vendor: 16,392 bytes, lines 1-582
1/*1790295444000*/ 2/*! jQuery UI - v1.12.1 - 2019-01-14 3* http://jqueryui.com 4* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js 5* Copyright jQuery Foundation and other contributors; Licensed MIT */ 6 7(function (factory) { 8 if (typeof define === "function" && define.amd) { 9 10 // AMD. Register as an anonymous module. 11 define(["jquery"], factory); 12 } else { 13 14 // Browser globals 15 factory(jQuery); 16 } 17}(function ($) { 18 19 $.ui = $.ui || {}; 20 21 var version = $.ui.version = "1.12.1"; 22 23 24 /*! 25 * jQuery UI Widget 1.12.1 26 * http://jqueryui.com 27 * 28 * Copyright jQuery Foundation and other contributors 29 * Released under the MIT license. 30 * http://jquery.org/license 31 */ 32 33 //>>label: Widget 34 //>>group: Core 35 //>>description: Provides a factory for creating stateful widgets with a common API. 36 //>>docs: http://api.jqueryui.com/jQuery.widget/ 37 //>>demos: http://jqueryui.com/widget/ 38 39 40 41 var widgetUuid = 0; 42 var widgetSlice = Array.prototype.slice; 43 44 $.cleanData = (function (orig) { 45 return function (elems) { 46 var events, elem, i; 47 for (i = 0; (elem = elems[i]) != null; i++) { 48 try { 49 50 // Only trigger remove when necessary to save time 51 events = $._data(elem, "events"); 52 if (events && events.remove) { 53 $(elem).triggerHandler("remove"); 54 } 55 56 // Http://bugs.jquery.com/ticket/8235 57 } catch (e) { } 58 } 59 orig(elems); 60 }; 61 })($.cleanData); 62 63 $.widget = function (name, base, prototype) { 64 var existingConstructor, constructor, basePrototype; 65 66 // ProxiedPrototype allows the provided prototype to remain unmodified 67 // so that it can be used as a mixin for multiple widgets (#8876) 68 var proxiedPrototype = {}; 69 70 var namespace = name.split(".")[0]; 71 name = name.split(".")[1]; 72 var fullName = namespace + "-" + name; 73 74 if (!prototype) { 75 prototype = base; 76 base = $.Widget; 77 } 78 79 if ($.isArray(prototype)) { 80 prototype = $.extend.apply(null, [{}].concat(prototype)); 81 } 82 83 // Create selector for plugin 84 $.expr[":"][fullName.toLowerCase()] = function (elem) { 85 return !!$.data(elem, fullName); 86 }; 87 88 $[namespace] = $[namespace] || {}; 89 existingConstructor = $[namespace][name]; 90 constructor = $[namespace][name] = function (options, element) { 91 92 // Allow instantiation without "new" keyword 93 if (!this._createWidget) { 94 return new constructor(options, element); 95 } 96 97 // Allow instantiation without initializing for simple inheritance 98 // must use "new" keyword (the code above always passes args) 99 if (arguments.length) { 100 this._createWidget(options, element); 101 } 102 }; 103 104 // Extend with the existing constructor to carry over any static properties 105 $.extend(constructor, existingConstructor, { 106 version: prototype.version, 107 108 // Copy the object used to create the prototype in case we need to 109 // redefine the widget later 110 _proto: $.extend({}, prototype), 111 112 // Track widgets that inherit from this widget in case this widget is 113 // redefined after a widget inherits from it 114 _childConstructors: [] 115 }); 116 117 basePrototype = new base(); 118 119 // We need to make the options hash a property directly on the new instance 120 // otherwise we'll modify the options hash on the prototype that we're 121 // inheriting from 122 basePrototype.options = $.widget.extend({}, basePrototype.options); 123 $.each(prototype, function (prop, value) { 124 if (!$.isFunction(value)) { 125 proxiedPrototype[prop] = value; 126 return; 127 } 128 proxiedPrototype[prop] = (function () { 129 function _super() { 130 return base.prototype[prop].apply(this, arguments); 131 } 132 133 function _superApply(args) { 134 return base.prototype[prop].apply(this, args); 135 } 136 137 return function () { 138 var __super = this._super; 139 var __superApply = this._superApply; 140 var returnValue; 141 142 this._super = _super; 143 this._superApply = _superApply; 144 145 returnValue = value.apply(this, arguments); 146 147 this._super = __super; 148 this._superApply = __superApply; 149 150 return returnValue; 151 }; 152 })(); 153 }); 154 constructor.prototype = $.widget.extend(basePrototype, { 155 156 // TODO: remove support for widgetEventPrefix 157 // always use the name + a colon as the prefix, e.g., draggable:start 158 // don't prefix for widgets that aren't DOM-based 159 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 160 }, proxiedPrototype, { 161 constructor: constructor, 162 namespace: namespace, 163 widgetName: name, 164 widgetFullName: fullName 165 }); 166 167 // If this widget is being redefined then we need to find all widgets that 168 // are inheriting from it and redefine all of them so that they inherit from 169 // the new version of this widget. We're essentially trying to replace one 170 // level in the prototype chain. 171 if (existingConstructor) { 172 $.each(existingConstructor._childConstructors, function (i, child) { 173 var childPrototype = child.prototype; 174 175 // Redefine the child widget using the same prototype that was 176 // originally used, but inherit from the new version of the base 177 $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, 178 child._proto); 179 }); 180 181 // Remove the list of existing child constructors from the old constructor 182 // so the old child constructors can be garbage collected 183 delete existingConstructor._childConstructors; 184 } else { 185 base._childConstructors.push(constructor); 186 } 187 188 $.widget.bridge(name, constructor); 189 190 return constructor; 191 }; 192 193 $.widget.extend = function (target) { 194 var input = widgetSlice.call(arguments, 1); 195 var inputIndex = 0; 196 var inputLength = input.length; 197 var key; 198 var value; 199 200 for (; inputIndex < inputLength; inputIndex++) { 201 for (key in input[inputIndex]) { 202 value = input[inputIndex][key]; 203 if (input[inputIndex].hasOwnProperty(key) && value !== undefined) { 204 205 // Clone objects 206 if ($.isPlainObject(value)) { 207 target[key] = $.isPlainObject(target[key]) ? 208 $.widget.extend({}, target[key], value) : 209 210 // Don't extend strings, arrays, etc. with objects 211 $.widget.extend({}, value); 212 213 // Copy everything else by reference 214 } else { 215 target[key] = value; 216 } 217 } 218 } 219 } 220 return target; 221 }; 222 223 $.widget.bridge = function (name, object) { 224 var fullName = object.prototype.widgetFullName || name; 225 $.fn[name] = function (options) { 226 var isMethodCall = typeof options === "string"; 227 var args = widgetSlice.call(arguments, 1); 228 var returnValue = this; 229 230 if (isMethodCall) { 231 232 // If this is an empty collection, we need to have the instance method 233 // return undefined instead of the jQuery instance 234 if (!this.length && options === "instance") { 235 returnValue = undefined; 236 } else { 237 this.each(function () { 238 var methodValue; 239 var instance = $.data(this, fullName); 240 241 if (options === "instance") { 242 returnValue = instance; 243 return false; 244 } 245 246 if (!instance) { 247 return $.error("cannot call methods on " + name + 248 " prior to initialization; " + 249 "attempted to call method '" + options + "'"); 250 } 251 252 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 253 return $.error("no such method '" + options + "' for " + name + 254 " widget instance"); 255 } 256 257 methodValue = instance[options].apply(instance, args); 258 259 if (methodValue !== instance && methodValue !== undefined) { 260 returnValue = methodValue && methodValue.jquery ? 261 returnValue.pushStack(methodValue.get()) : 262 methodValue; 263 return false; 264 } 265 }); 266 } 267 } else { 268 269 // Allow multiple hashes to be passed on init 270 if (args.length) { 271 options = $.widget.extend.apply(null, [options].concat(args)); 272 } 273 274 this.each(function () { 275 var instance = $.data(this, fullName); 276 if (instance) { 277 instance.option(options || {}); 278 if (instance._init) { 279 instance._init(); 280 } 281 } else { 282 $.data(this, fullName, new object(options, this)); 283 } 284 }); 285 } 286 287 return returnValue; 288 }; 289 }; 290 291 $.Widget = function ( /* options, element */) { }; 292 $.Widget._childConstructors = []; 293 294 $.Widget.prototype = { 295 widgetName: "widget", 296 widgetEventPrefix: "", 297 defaultElement: "<div>", 298 299 options: { 300 classes: {}, 301 disabled: false, 302 303 // Callbacks 304 create: null 305 }, 306 307 _createWidget: function (options, element) { 308 element = $(element || this.defaultElement || this)[0]; 309 this.element = $(element); 310 this.uuid = widgetUuid++; 311 this.eventNamespace = "." + this.widgetName + this.uuid; 312 313 this.bindings = $(); 314 this.hoverable = $(); 315 this.focusable = $(); 316 this.classesElementLookup = {}; 317 318 if (element !== this) { 319 $.data(element, this.widgetFullName, this); 320 this._on(true, this.element, { 321 remove: function (event) { 322 if (event.target === element) { 323 this.destroy(); 324 } 325 } 326 }); 327 this.document = $(element.style ? 328 329 // Element within the document 330 element.ownerDocument : 331 332 // Element is window or document 333 element.document || element); 334 this.window = $(this.document[0].defaultView || this.document[0].parentWindow); 335 } 336 337 this.options = $.widget.extend({}, 338 this.options, 339 this._getCreateOptions(), 340 options); 341 342 this._create(); 343 344 if (this.options.disabled) { 345 this._setOptionDisabled(this.options.disabled); 346 } 347 348 this._trigger("create", null, this._getCreateEventData()); 349 this._init(); 350 }, 351 352 _getCreateOptions: function () { 353 return {}; 354 }, 355 356 _getCreateEventData: $.noop, 357 358 _create: $.noop, 359 360 _init: $.noop, 361 362 destroy: function () { 363 var that = this; 364 365 this._destroy(); 366 $.each(this.classesElementLookup, function (key, value) { 367 that._removeClass(value, key); 368 }); 369 370 // We can probably remove the unbind calls in 2.0 371 // all event bindings should go through this._on() 372 this.element 373 .off(this.eventNamespace) 374 .removeData(this.widgetFullName); 375 this.widget() 376 .off(this.eventNamespace) 377 .removeAttr("aria-disabled"); 378 379 // Clean up events and states 380 this.bindings.off(this.eventNamespace); 381 }, 382 383 _destroy: $.noop, 384 385 widget: function () { 386 return this.element; 387 }, 388 389 option: function (key, value) { 390 var options = key; 391 var parts; 392 var curOption; 393 var i; 394 395 if (arguments.length === 0) { 396 397 // Don't return a reference to the internal hash 398 return $.widget.extend({}, this.options); 399 } 400 401 if (typeof key === "string") { 402 403 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 404 options = {}; 405 parts = key.split("."); 406 key = parts.shift(); 407 if (parts.length) { 408 curOption = options[key] = $.widget.extend({}, this.options[key]); 409 for (i = 0; i < parts.length - 1; i++) { 410 curOption[parts[i]] = curOption[parts[i]] || {}; 411 curOption = curOption[parts[i]]; 412 } 413 key = parts.pop(); 414 if (arguments.length === 1) { 415 return curOption[key] === undefined ? null : curOption[key]; 416 } 417 curOption[key] = value; 418 } else { 419 if (arguments.length === 1) { 420 return this.options[key] === undefined ? null : this.options[key]; 421 } 422 options[key] = value; 423 } 424 } 425 426 this._setOptions(options); 427 428 return this; 429 }, 430 431 _setOptions: function (options) { 432 var key; 433 434 for (key in options) { 435 this._setOption(key, options[key]); 436 } 437 438 return this; 439 }, 440 441 _setOption: function (key, value) { 442 if (key === "classes") { 443 this._setOptionClasses(value); 444 } 445 446 this.options[key] = value; 447 448 if (key === "disabled") { 449 this._setOptionDisabled(value); 450 } 451 452 return this; 453 }, 454 455 _setOptionClasses: function (value) { 456 var classKey, elements, currentElements; 457 458 for (classKey in value) { 459 currentElements = this.classesElementLookup[classKey]; 460 if (value[classKey] === this.options.classes[classKey] || 461 !currentElements || 462 !currentElements.length) { 463 continue; 464 } 465 466 // We are doing this to create a new jQuery object because the _removeClass() call 467 // on the next line is going to destroy the reference to the current elements being 468 // tracked. We need to save a copy of this collection so that we can add the new classes 469 // below. 470 elements = $(currentElements.get()); 471 this._removeClass(currentElements, classKey); 472 473 // We don't use _addClass() here, because that uses this.options.classes 474 // for generating the string of classes. We want to use the value passed in from 475 // _setOption(), this is the new value of the classes option which was passed to 476 // _setOption(). We pass this value directly to _classes(). 477 elements.addClass(this._classes({ 478 element: elements, 479 keys: classKey, 480 classes: value, 481 add: true 482 })); 483 } 484 }, 485 486 _setOptionDisabled: function (value) { 487 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value); 488 489 // If the widget is becoming disabled, then nothing is interactive 490 if (value) { 491 this._removeClass(this.hoverable, null, "ui-state-hover"); 492 this._removeClass(this.focusable, null, "ui-state-focus"); 493 } 494 }, 495 496 enable: function () { 497 return this._setOptions({ disabled: false }); 498 }, 499 500 disable: function () { 501 return this._setOptions({ disabled: true }); 502 }, 503 504 _classes: function (options) { 505 var full = []; 506 var that = this; 507 508 options = $.extend({ 509 element: this.element, 510 classes: this.options.classes || {} 511 }, options); 512 513 function processClassString(classes, checkOption) { 514 var current, i; 515 for (i = 0; i < classes.length; i++) { 516 current = that.classesElementLookup[classes[i]] || $(); 517 if (options.add) { 518 current = $($.unique(current.get().concat(options.element.get()))); 519 } else { 520 current = $(current.not(options.element).get()); 521 } 522 that.classesElementLookup[classes[i]] = current; 523 full.push(classes[i]); 524 if (checkOption && options.classes[classes[i]]) { 525 full.push(options.classes[classes[i]]); 526 } 527 } 528 } 529 530 this._on(options.element, { 531 "remove": "_untrackClassesElement" 532 }); 533 534 if (options.keys) { 535 processClassString(options.keys.match(/\S+/g) || [], true); 536 } 537 if (options.extra) { 538 processClassString(options.extra.match(/\S+/g) || []); 539 } 540 541 return full.join(" "); 542 }, 543 544 _untrackClassesElement: function (event) { 545 var that = this; 546 $.each(that.classesElementLookup, function (key, value) { 547 if ($.inArray(event.target, value) !== -1) { 548 that.classesElementLookup[key] = $(value.not(event.target).get()); 549 } 550 }); 551 }, 552 553 _removeClass: function (element, keys, extra) { 554 return this._toggleClass(element, keys, extra, false); 555 }, 556 557 _addClass: function (element, keys, extra) { 558 return this._toggleClass(element, keys, extra, true); 559 }, 560 561 _toggleClass: function (element, keys, extra, add) { 562 add = (typeof add === "boolean") ? add : extra; 563 var shift = (typeof element === "string" || element === null), 564 options = { 565 extra: shift ? keys : extra, 566 keys: shift ? element : keys, 567 element: shift ? this.element : element, 568 add: add 569 }; 570 options.element.toggleClass(this._classes(options), add); 571 return this; 572 }, 573 574 _on: function (suppressDisabledCheck, element, handlers) { 575 var delegateElement; 576 var instance = this; 577 578 // No suppressDisabledCheck flag, shuffle arguments 579 if (typeof suppressDisabledCheck !== "boolean") { 580 handlers = element; 581 element = suppressDisabledCheck; 582 suppressDisabledCheck = false;
vendor: 9,836 bytes, lines 583-933
583 } 584 585 // No element argument, shuffle and use this.element 586 if (!handlers) { 587 handlers = element; 588 element = this.element; 589 delegateElement = this.widget(); 590 } else { 591 element = delegateElement = $(element); 592 this.bindings = this.bindings.add(element); 593 } 594 595 $.each(handlers, function (event, handler) { 596 function handlerProxy() { 597 598 // Allow widgets to customize the disabled handling 599 // - disabled as an array instead of boolean 600 // - disabled class as method for disabling individual parts 601 if (!suppressDisabledCheck && 602 (instance.options.disabled === true || 603 $(this).hasClass("ui-state-disabled"))) { 604 return; 605 } 606 return (typeof handler === "string" ? instance[handler] : handler) 607 .apply(instance, arguments); 608 } 609 610 // Copy the guid so direct unbinding works 611 if (typeof handler !== "string") { 612 handlerProxy.guid = handler.guid = 613 handler.guid || handlerProxy.guid || $.guid++; 614 } 615 616 var match = event.match(/^([\w:-]*)\s*(.*)$/); 617 var eventName = match[1] + instance.eventNamespace; 618 var selector = match[2]; 619 620 if (selector) { 621 delegateElement.on(eventName, selector, handlerProxy); 622 } else { 623 element.on(eventName, handlerProxy); 624 } 625 }); 626 }, 627 628 _off: function (element, eventName) { 629 eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + 630 this.eventNamespace; 631 element.off(eventName).off(eventName); 632 633 // Clear the stack to avoid memory leaks (#10056) 634 this.bindings = $(this.bindings.not(element).get()); 635 this.focusable = $(this.focusable.not(element).get()); 636 this.hoverable = $(this.hoverable.not(element).get()); 637 }, 638 639 _delay: function (handler, delay) { 640 function handlerProxy() { 641 return (typeof handler === "string" ? instance[handler] : handler) 642 .apply(instance, arguments); 643 } 644 var instance = this; 645 return setTimeout(handlerProxy, delay || 0); 646 }, 647 648 _hoverable: function (element) { 649 this.hoverable = this.hoverable.add(element); 650 this._on(element, { 651 mouseenter: function (event) { 652 this._addClass($(event.currentTarget), null, "ui-state-hover"); 653 }, 654 mouseleave: function (event) { 655 this._removeClass($(event.currentTarget), null, "ui-state-hover"); 656 } 657 }); 658 }, 659 660 _focusable: function (element) { 661 this.focusable = this.focusable.add(element); 662 this._on(element, { 663 focusin: function (event) { 664 this._addClass($(event.currentTarget), null, "ui-state-focus"); 665 }, 666 focusout: function (event) { 667 this._removeClass($(event.currentTarget), null, "ui-state-focus"); 668 } 669 }); 670 }, 671 672 _trigger: function (type, event, data) { 673 var prop, orig; 674 var callback = this.options[type]; 675 676 data = data || {}; 677 event = $.Event(event); 678 event.type = (type === this.widgetEventPrefix ? 679 type : 680 this.widgetEventPrefix + type).toLowerCase(); 681 682 // The original event may come from any element 683 // so we need to reset the target on the new event 684 event.target = this.element[0]; 685 686 // Copy original event properties over to the new event 687 orig = event.originalEvent; 688 if (orig) { 689 for (prop in orig) { 690 if (!(prop in event)) { 691 event[prop] = orig[prop]; 692 } 693 } 694 } 695 696 this.element.trigger(event, data); 697 return !($.isFunction(callback) && 698 callback.apply(this.element[0], [event].concat(data)) === false || 699 event.isDefaultPrevented()); 700 } 701 }; 702 703 $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) { 704 $.Widget.prototype["_" + method] = function (element, options, callback) { 705 if (typeof options === "string") { 706 options = { effect: options }; 707 } 708 709 var hasOptions; 710 var effectName = !options ? 711 method : 712 options === true || typeof options === "number" ? 713 defaultEffect : 714 options.effect || defaultEffect; 715 716 options = options || {}; 717 if (typeof options === "number") { 718 options = { duration: options }; 719 } 720 721 hasOptions = !$.isEmptyObject(options); 722 options.complete = callback; 723 724 if (options.delay) { 725 element.delay(options.delay); 726 } 727 728 if (hasOptions && $.effects && $.effects.effect[effectName]) { 729 element[method](options); 730 } else if (effectName !== method && element[effectName]) { 731 element[effectName](options.duration, options.easing, callback); 732 } else { 733 element.queue(function (next) { 734 $(this)[method](); 735 if (callback) { 736 callback.call(element[0]); 737 } 738 next(); 739 }); 740 } 741 }; 742 }); 743 744 var widget = $.widget; 745 746 747 /*! 748 * jQuery UI Position 1.12.1 749 * http://jqueryui.com 750 * 751 * Copyright jQuery Foundation and other contributors 752 * Released under the MIT license. 753 * http://jquery.org/license 754 * 755 * http://api.jqueryui.com/position/ 756 */ 757 758 //>>label: Position 759 //>>group: Core 760 //>>description: Positions elements relative to other elements. 761 //>>docs: http://api.jqueryui.com/position/ 762 //>>demos: http://jqueryui.com/position/ 763 764 765 (function () { 766 var cachedScrollbarWidth, 767 max = Math.max, 768 abs = Math.abs, 769 rhorizontal = /left|center|right/, 770 rvertical = /top|center|bottom/, 771 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 772 rposition = /^\w+/, 773 rpercent = /%$/, 774 _position = $.fn.position; 775 776 function getOffsets(offsets, width, height) { 777 return [ 778 parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1), 779 parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1) 780 ]; 781 } 782 783 function parseCss(element, property) { 784 return parseInt($.css(element, property), 10) || 0; 785 } 786 787 function getDimensions(elem) { 788 var raw = elem[0]; 789 if (raw.nodeType === 9) { 790 return { 791 width: elem.width(), 792 height: elem.height(), 793 offset: { top: 0, left: 0 } 794 }; 795 } 796 if ($.isWindow(raw)) { 797 return { 798 width: elem.width(), 799 height: elem.height(), 800 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 801 }; 802 } 803 if (raw.preventDefault) { 804 return { 805 width: 0, 806 height: 0, 807 offset: { top: raw.pageY, left: raw.pageX } 808 }; 809 } 810 return { 811 width: elem.outerWidth(), 812 height: elem.outerHeight(), 813 offset: elem.offset() 814 }; 815 } 816 817 $.position = { 818 scrollbarWidth: function () { 819 if (cachedScrollbarWidth !== undefined) { 820 return cachedScrollbarWidth; 821 } 822 var w1, w2, 823 div = $("<div " + 824 "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" + 825 "<div style='height:100px;width:auto;'></div></div>"), 826 innerDiv = div.children()[0]; 827 828 $("body").append(div); 829 w1 = innerDiv.offsetWidth; 830 div.css("overflow", "scroll"); 831 832 w2 = innerDiv.offsetWidth; 833 834 if (w1 === w2) { 835 w2 = div[0].clientWidth; 836 } 837 838 div.remove(); 839 840 return (cachedScrollbarWidth = w1 - w2); 841 }, 842 getScrollInfo: function (within) { 843 var overflowX = within.isWindow || within.isDocument ? "" : 844 within.element.css("overflow-x"), 845 overflowY = within.isWindow || within.isDocument ? "" : 846 within.element.css("overflow-y"), 847 hasOverflowX = overflowX === "scroll" || 848 (overflowX === "auto" && within.width < within.element[0].scrollWidth), 849 hasOverflowY = overflowY === "scroll" || 850 (overflowY === "auto" && within.height < within.element[0].scrollHeight); 851 return { 852 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 853 height: hasOverflowX ? $.position.scrollbarWidth() : 0 854 }; 855 }, 856 getWithinInfo: function (element) { 857 var withinElement = $(element || window), 858 isWindow = $.isWindow(withinElement[0]), 859 isDocument = !!withinElement[0] && withinElement[0].nodeType === 9, 860 hasOffset = !isWindow && !isDocument; 861 return { 862 element: withinElement, 863 isWindow: isWindow, 864 isDocument: isDocument, 865 offset: hasOffset ? $(element).offset() : { left: 0, top: 0 }, 866 scrollLeft: withinElement.scrollLeft(), 867 scrollTop: withinElement.scrollTop(), 868 width: withinElement.outerWidth(), 869 height: withinElement.outerHeight() 870 }; 871 } 872 }; 873 874 $.fn.position = function (options) { 875 if (!options || !options.of) { 876 return _position.apply(this, arguments); 877 } 878 879 // Make a copy, we don't want to modify arguments 880 options = $.extend({}, options); 881 882 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 883 target = $(options.of), 884 within = $.position.getWithinInfo(options.within), 885 scrollInfo = $.position.getScrollInfo(within), 886 collision = (options.collision || "flip").split(" "), 887 offsets = {}; 888 889 dimensions = getDimensions(target); 890 if (target[0].preventDefault) { 891 892 // Force left top to allow flipping 893 options.at = "left top"; 894 } 895 targetWidth = dimensions.width; 896 targetHeight = dimensions.height; 897 targetOffset = dimensions.offset; 898 899 // Clone to reuse original targetOffset later 900 basePosition = $.extend({}, targetOffset); 901 902 // Force my and at to have valid horizontal and vertical positions 903 // if a value is missing or invalid, it will be converted to center 904 $.each(["my", "at"], function () { 905 var pos = (options[this] || "").split(" "), 906 horizontalOffset, 907 verticalOffset; 908 909 if (pos.length === 1) { 910 pos = rhorizontal.test(pos[0]) ? 911 pos.concat(["center"]) : 912 rvertical.test(pos[0]) ? 913 ["center"].concat(pos) : 914 ["center", "center"]; 915 } 916 pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center"; 917 pos[1] = rvertical.test(pos[1]) ? pos[1] : "center"; 918 919 // Calculate offsets 920 horizontalOffset = roffset.exec(pos[0]); 921 verticalOffset = roffset.exec(pos[1]); 922 offsets[this] = [ 923 horizontalOffset ? horizontalOffset[0] : 0, 924 verticalOffset ? verticalOffset[0] : 0 925 ]; 926 927 // Reduce to just the positions without the offsets 928 options[this] = [ 929 rposition.exec(pos[0])[0], 930 rposition.exec(pos[1])[0] 931 ]; 932 }); 933
vendor: 15,599 bytes, lines 934-1464
934 // Normalize collision option 935 if (collision.length === 1) { 936 collision[1] = collision[0]; 937 } 938 939 if (options.at[0] === "right") { 940 basePosition.left += targetWidth; 941 } else if (options.at[0] === "center") { 942 basePosition.left += targetWidth / 2; 943 } 944 945 if (options.at[1] === "bottom") { 946 basePosition.top += targetHeight; 947 } else if (options.at[1] === "center") { 948 basePosition.top += targetHeight / 2; 949 } 950 951 atOffset = getOffsets(offsets.at, targetWidth, targetHeight); 952 basePosition.left += atOffset[0]; 953 basePosition.top += atOffset[1]; 954 955 return this.each(function () { 956 var collisionPosition, using, 957 elem = $(this), 958 elemWidth = elem.outerWidth(), 959 elemHeight = elem.outerHeight(), 960 marginLeft = parseCss(this, "marginLeft"), 961 marginTop = parseCss(this, "marginTop"), 962 collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") + 963 scrollInfo.width, 964 collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") + 965 scrollInfo.height, 966 position = $.extend({}, basePosition), 967 myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight()); 968 969 if (options.my[0] === "right") { 970 position.left -= elemWidth; 971 } else if (options.my[0] === "center") { 972 position.left -= elemWidth / 2; 973 } 974 975 if (options.my[1] === "bottom") { 976 position.top -= elemHeight; 977 } else if (options.my[1] === "center") { 978 position.top -= elemHeight / 2; 979 } 980 981 position.left += myOffset[0]; 982 position.top += myOffset[1]; 983 984 collisionPosition = { 985 marginLeft: marginLeft, 986 marginTop: marginTop 987 }; 988 989 $.each(["left", "top"], function (i, dir) { 990 if ($.ui.position[collision[i]]) { 991 $.ui.position[collision[i]][dir](position, { 992 targetWidth: targetWidth, 993 targetHeight: targetHeight, 994 elemWidth: elemWidth, 995 elemHeight: elemHeight, 996 collisionPosition: collisionPosition, 997 collisionWidth: collisionWidth, 998 collisionHeight: collisionHeight, 999 offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]], 1000 my: options.my, 1001 at: options.at, 1002 within: within, 1003 elem: elem 1004 }); 1005 } 1006 }); 1007 1008 if (options.using) { 1009 1010 // Adds feedback as second argument to using callback, if present 1011 using = function (props) { 1012 var left = targetOffset.left - position.left, 1013 right = left + targetWidth - elemWidth, 1014 top = targetOffset.top - position.top, 1015 bottom = top + targetHeight - elemHeight, 1016 feedback = { 1017 target: { 1018 element: target, 1019 left: targetOffset.left, 1020 top: targetOffset.top, 1021 width: targetWidth, 1022 height: targetHeight 1023 }, 1024 element: { 1025 element: elem, 1026 left: position.left, 1027 top: position.top, 1028 width: elemWidth, 1029 height: elemHeight 1030 }, 1031 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1032 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1033 }; 1034 if (targetWidth < elemWidth && abs(left + right) < targetWidth) { 1035 feedback.horizontal = "center"; 1036 } 1037 if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) { 1038 feedback.vertical = "middle"; 1039 } 1040 if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) { 1041 feedback.important = "horizontal"; 1042 } else { 1043 feedback.important = "vertical"; 1044 } 1045 options.using.call(this, props, feedback); 1046 }; 1047 } 1048 1049 elem.offset($.extend(position, { using: using })); 1050 }); 1051 }; 1052 1053 $.ui.position = { 1054 fit: { 1055 left: function (position, data) { 1056 var within = data.within, 1057 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1058 outerWidth = within.width, 1059 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1060 overLeft = withinOffset - collisionPosLeft, 1061 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1062 newOverRight; 1063 1064 // Element is wider than within 1065 if (data.collisionWidth > outerWidth) { 1066 1067 // Element is initially over the left side of within 1068 if (overLeft > 0 && overRight <= 0) { 1069 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1070 withinOffset; 1071 position.left += overLeft - newOverRight; 1072 1073 // Element is initially over right side of within 1074 } else if (overRight > 0 && overLeft <= 0) { 1075 position.left = withinOffset; 1076 1077 // Element is initially over both left and right sides of within 1078 } else { 1079 if (overLeft > overRight) { 1080 position.left = withinOffset + outerWidth - data.collisionWidth; 1081 } else { 1082 position.left = withinOffset; 1083 } 1084 } 1085 1086 // Too far left -> align with left edge 1087 } else if (overLeft > 0) { 1088 position.left += overLeft; 1089 1090 // Too far right -> align with right edge 1091 } else if (overRight > 0) { 1092 position.left -= overRight; 1093 1094 // Adjust based on position and margin 1095 } else { 1096 position.left = max(position.left - collisionPosLeft, position.left); 1097 } 1098 }, 1099 top: function (position, data) { 1100 var within = data.within, 1101 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1102 outerHeight = data.within.height, 1103 collisionPosTop = position.top - data.collisionPosition.marginTop, 1104 overTop = withinOffset - collisionPosTop, 1105 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1106 newOverBottom; 1107 1108 // Element is taller than within 1109 if (data.collisionHeight > outerHeight) { 1110 1111 // Element is initially over the top of within 1112 if (overTop > 0 && overBottom <= 0) { 1113 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1114 withinOffset; 1115 position.top += overTop - newOverBottom; 1116 1117 // Element is initially over bottom of within 1118 } else if (overBottom > 0 && overTop <= 0) { 1119 position.top = withinOffset; 1120 1121 // Element is initially over both top and bottom of within 1122 } else { 1123 if (overTop > overBottom) { 1124 position.top = withinOffset + outerHeight - data.collisionHeight; 1125 } else { 1126 position.top = withinOffset; 1127 } 1128 } 1129 1130 // Too far up -> align with top 1131 } else if (overTop > 0) { 1132 position.top += overTop; 1133 1134 // Too far down -> align with bottom edge 1135 } else if (overBottom > 0) { 1136 position.top -= overBottom; 1137 1138 // Adjust based on position and margin 1139 } else { 1140 position.top = max(position.top - collisionPosTop, position.top); 1141 } 1142 } 1143 }, 1144 flip: { 1145 left: function (position, data) { 1146 var within = data.within, 1147 withinOffset = within.offset.left + within.scrollLeft, 1148 outerWidth = within.width, 1149 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1150 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1151 overLeft = collisionPosLeft - offsetLeft, 1152 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1153 myOffset = data.my[0] === "left" ? 1154 -data.elemWidth : 1155 data.my[0] === "right" ? 1156 data.elemWidth : 1157 0, 1158 atOffset = data.at[0] === "left" ? 1159 data.targetWidth : 1160 data.at[0] === "right" ? 1161 -data.targetWidth : 1162 0, 1163 offset = -2 * data.offset[0], 1164 newOverRight, 1165 newOverLeft; 1166 1167 if (overLeft < 0) { 1168 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1169 outerWidth - withinOffset; 1170 if (newOverRight < 0 || newOverRight < abs(overLeft)) { 1171 position.left += myOffset + atOffset + offset; 1172 } 1173 } else if (overRight > 0) { 1174 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1175 atOffset + offset - offsetLeft; 1176 if (newOverLeft > 0 || abs(newOverLeft) < overRight) { 1177 position.left += myOffset + atOffset + offset; 1178 } 1179 } 1180 }, 1181 top: function (position, data) { 1182 var within = data.within, 1183 withinOffset = within.offset.top + within.scrollTop, 1184 outerHeight = within.height, 1185 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1186 collisionPosTop = position.top - data.collisionPosition.marginTop, 1187 overTop = collisionPosTop - offsetTop, 1188 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1189 top = data.my[1] === "top", 1190 myOffset = top ? 1191 -data.elemHeight : 1192 data.my[1] === "bottom" ? 1193 data.elemHeight : 1194 0, 1195 atOffset = data.at[1] === "top" ? 1196 data.targetHeight : 1197 data.at[1] === "bottom" ? 1198 -data.targetHeight : 1199 0, 1200 offset = -2 * data.offset[1], 1201 newOverTop, 1202 newOverBottom; 1203 if (overTop < 0) { 1204 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1205 outerHeight - withinOffset; 1206 if (newOverBottom < 0 || newOverBottom < abs(overTop)) { 1207 position.top += myOffset + atOffset + offset; 1208 } 1209 } else if (overBottom > 0) { 1210 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1211 offset - offsetTop; 1212 if (newOverTop > 0 || abs(newOverTop) < overBottom) { 1213 position.top += myOffset + atOffset + offset; 1214 } 1215 } 1216 } 1217 }, 1218 flipfit: { 1219 left: function () { 1220 $.ui.position.flip.left.apply(this, arguments); 1221 $.ui.position.fit.left.apply(this, arguments); 1222 }, 1223 top: function () { 1224 $.ui.position.flip.top.apply(this, arguments); 1225 $.ui.position.fit.top.apply(this, arguments); 1226 } 1227 } 1228 }; 1229 1230 })(); 1231 1232 var position = $.ui.position; 1233 1234 1235 /*! 1236 * jQuery UI :data 1.12.1 1237 * http://jqueryui.com 1238 * 1239 * Copyright jQuery Foundation and other contributors 1240 * Released under the MIT license. 1241 * http://jquery.org/license 1242 */ 1243 1244 //>>label: :data Selector 1245 //>>group: Core 1246 //>>description: Selects elements which have data stored under the specified key. 1247 //>>docs: http://api.jqueryui.com/data-selector/ 1248 1249 1250 var data = $.extend($.expr[":"], { 1251 data: $.expr.createPseudo ? 1252 $.expr.createPseudo(function (dataName) { 1253 return function (elem) { 1254 return !!$.data(elem, dataName); 1255 }; 1256 }) : 1257 1258 // Support: jQuery <1.8 1259 function (elem, i, match) { 1260 return !!$.data(elem, match[3]); 1261 } 1262 }); 1263 1264 /*! 1265 * jQuery UI Disable Selection 1.12.1 1266 * http://jqueryui.com 1267 * 1268 * Copyright jQuery Foundation and other contributors 1269 * Released under the MIT license. 1270 * http://jquery.org/license 1271 */ 1272 1273 //>>label: disableSelection 1274 //>>group: Core 1275 //>>description: Disable selection of text content within the set of matched elements. 1276 //>>docs: http://api.jqueryui.com/disableSelection/ 1277 1278 // This file is deprecated 1279 1280 1281 var disableSelection = $.fn.extend({ 1282 disableSelection: (function () { 1283 var eventType = "onselectstart" in document.createElement("div") ? 1284 "selectstart" : 1285 "mousedown"; 1286 1287 return function () { 1288 return this.on(eventType + ".ui-disableSelection", function (event) { 1289 event.preventDefault(); 1290 }); 1291 }; 1292 })(), 1293 1294 enableSelection: function () { 1295 return this.off(".ui-disableSelection"); 1296 } 1297 }); 1298 1299 1300 /*! 1301 * jQuery UI Focusable 1.12.1 1302 * http://jqueryui.com 1303 * 1304 * Copyright jQuery Foundation and other contributors 1305 * Released under the MIT license. 1306 * http://jquery.org/license 1307 */ 1308 1309 //>>label: :focusable Selector 1310 //>>group: Core 1311 //>>description: Selects elements which can be focused. 1312 //>>docs: http://api.jqueryui.com/focusable-selector/ 1313 1314 1315 1316 // Selectors 1317 $.ui.focusable = function (element, hasTabindex) { 1318 var map, mapName, img, focusableIfVisible, fieldset, 1319 nodeName = element.nodeName.toLowerCase(); 1320 1321 if ("area" === nodeName) { 1322 map = element.parentNode; 1323 mapName = map.name; 1324 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 1325 return false; 1326 } 1327 img = $("img[usemap='#" + mapName + "']"); 1328 return img.length > 0 && img.is(":visible"); 1329 } 1330 1331 if (/^(input|select|textarea|button|object)$/.test(nodeName)) { 1332 focusableIfVisible = !element.disabled; 1333 1334 if (focusableIfVisible) { 1335 1336 // Form controls within a disabled fieldset are disabled. 1337 // However, controls within the fieldset's legend do not get disabled. 1338 // Since controls generally aren't placed inside legends, we skip 1339 // this portion of the check. 1340 fieldset = $(element).closest("fieldset")[0]; 1341 if (fieldset) { 1342 focusableIfVisible = !fieldset.disabled; 1343 } 1344 } 1345 } else if ("a" === nodeName) { 1346 focusableIfVisible = element.href || hasTabindex; 1347 } else { 1348 focusableIfVisible = hasTabindex; 1349 } 1350 1351 return focusableIfVisible && $(element).is(":visible") && visible($(element)); 1352 }; 1353 1354 // Support: IE 8 only 1355 // IE 8 doesn't resolve inherit to visible/hidden for computed values 1356 function visible(element) { 1357 var visibility = element.css("visibility"); 1358 while (visibility === "inherit") { 1359 element = element.parent(); 1360 visibility = element.css("visibility"); 1361 } 1362 return visibility !== "hidden"; 1363 } 1364 1365 $.extend($.expr[":"], { 1366 focusable: function (element) { 1367 return $.ui.focusable(element, $.attr(element, "tabindex") != null); 1368 } 1369 }); 1370 1371 var focusable = $.ui.focusable; 1372 1373 1374 1375 1376 // Support: IE8 Only 1377 // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 1378 // with a string, so we need to find the proper form. 1379 var form = $.fn.form = function () { 1380 return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form); 1381 }; 1382 1383 1384 /*! 1385 * jQuery UI Form Reset Mixin 1.12.1 1386 * http://jqueryui.com 1387 * 1388 * Copyright jQuery Foundation and other contributors 1389 * Released under the MIT license. 1390 * http://jquery.org/license 1391 */ 1392 1393 //>>label: Form Reset Mixin 1394 //>>group: Core 1395 //>>description: Refresh input widgets when their form is reset 1396 //>>docs: http://api.jqueryui.com/form-reset-mixin/ 1397 1398 1399 1400 var formResetMixin = $.ui.formResetMixin = { 1401 _formResetHandler: function () { 1402 var form = $(this); 1403 1404 // Wait for the form reset to actually happen before refreshing 1405 setTimeout(function () { 1406 var instances = form.data("ui-form-reset-instances"); 1407 $.each(instances, function () { 1408 this.refresh(); 1409 }); 1410 }); 1411 }, 1412 1413 _bindFormResetHandler: function () { 1414 this.form = this.element.form(); 1415 if (!this.form.length) { 1416 return; 1417 } 1418 1419 var instances = this.form.data("ui-form-reset-instances") || []; 1420 if (!instances.length) { 1421 1422 // We don't use _on() here because we use a single event handler per form 1423 this.form.on("reset.ui-form-reset", this._formResetHandler); 1424 } 1425 instances.push(this); 1426 this.form.data("ui-form-reset-instances", instances); 1427 }, 1428 1429 _unbindFormResetHandler: function () { 1430 if (!this.form.length) { 1431 return; 1432 } 1433 1434 var instances = this.form.data("ui-form-reset-instances"); 1435 instances.splice($.inArray(this, instances), 1); 1436 if (instances.length) { 1437 this.form.data("ui-form-reset-instances", instances); 1438 } else { 1439 this.form 1440 .removeData("ui-form-reset-instances") 1441 .off("reset.ui-form-reset"); 1442 } 1443 } 1444 }; 1445 1446 1447 /*! 1448 * jQuery UI Support for jQuery core 1.7.x 1.12.1 1449 * http://jqueryui.com 1450 * 1451 * Copyright jQuery Foundation and other contributors 1452 * Released under the MIT license. 1453 * http://jquery.org/license 1454 * 1455 */ 1456 1457 //>>label: jQuery 1.7 Support 1458 //>>group: Core 1459 //>>description: Support version 1.7.x of jQuery core 1460 1461 1462 1463 // Support: jQuery 1.7 only 1464 // Not a great way to check versions, but since we only support
vendor: 4,893 bytes, lines 1464-1647
14641.7+ and only 1465 // need to detect <1.8, this is a simple check that should suffice. Checking 1466 // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0 1467 // and we'll never reach 1.70.0 (if we do, we certainly won't be supporting 1468 // 1.7 anymore). See #11197 for why we're not using feature detection. 1469 if ($.fn.jquery.substring(0, 3) === "1.7") { 1470 1471 // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight() 1472 // Unlike jQuery Core 1.8+, these only support numeric values to set the 1473 // dimensions in pixels 1474 $.each(["Width", "Height"], function (i, name) { 1475 var side = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"], 1476 type = name.toLowerCase(), 1477 orig = { 1478 innerWidth: $.fn.innerWidth, 1479 innerHeight: $.fn.innerHeight, 1480 outerWidth: $.fn.outerWidth, 1481 outerHeight: $.fn.outerHeight 1482 }; 1483 1484 function reduce(elem, size, border, margin) { 1485 $.each(side, function () { 1486 size -= parseFloat($.css(elem, "padding" + this)) || 0; 1487 if (border) { 1488 size -= parseFloat($.css(elem, "border" + this + "Width")) || 0; 1489 } 1490 if (margin) { 1491 size -= parseFloat($.css(elem, "margin" + this)) || 0; 1492 } 1493 }); 1494 return size; 1495 } 1496 1497 $.fn["inner" + name] = function (size) { 1498 if (size === undefined) { 1499 return orig["inner" + name].call(this); 1500 } 1501 1502 return this.each(function () { 1503 $(this).css(type, reduce(this, size) + "px"); 1504 }); 1505 }; 1506 1507 $.fn["outer" + name] = function (size, margin) { 1508 if (typeof size !== "number") { 1509 return orig["outer" + name].call(this, size); 1510 } 1511 1512 return this.each(function () { 1513 $(this).css(type, reduce(this, size, true, margin) + "px"); 1514 }); 1515 }; 1516 }); 1517 1518 $.fn.addBack = function (selector) { 1519 return this.add(selector == null ? 1520 this.prevObject : this.prevObject.filter(selector) 1521 ); 1522 }; 1523 } 1524 1525 ; 1526 /*! 1527 * jQuery UI Keycode 1.12.1 1528 * http://jqueryui.com 1529 * 1530 * Copyright jQuery Foundation and other contributors 1531 * Released under the MIT license. 1532 * http://jquery.org/license 1533 */ 1534 1535 //>>label: Keycode 1536 //>>group: Core 1537 //>>description: Provide keycodes as keynames 1538 //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 1539 1540 1541 var keycode = $.ui.keyCode = { 1542 BACKSPACE: 8, 1543 COMMA: 188, 1544 DELETE: 46, 1545 DOWN: 40, 1546 END: 35, 1547 ENTER: 13, 1548 ESCAPE: 27, 1549 HOME: 36, 1550 LEFT: 37, 1551 PAGE_DOWN: 34, 1552 PAGE_UP: 33, 1553 PERIOD: 190, 1554 RIGHT: 39, 1555 SPACE: 32, 1556 TAB: 9, 1557 UP: 38 1558 }; 1559 1560 1561 1562 1563 // Internal use only 1564 var escapeSelector = $.ui.escapeSelector = (function () { 1565 var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g; 1566 return function (selector) { 1567 return selector.replace(selectorEscape, "\\$1"); 1568 }; 1569 })(); 1570 1571 1572 /*! 1573 * jQuery UI Labels 1.12.1 1574 * http://jqueryui.com 1575 * 1576 * Copyright jQuery Foundation and other contributors 1577 * Released under the MIT license. 1578 * http://jquery.org/license 1579 */ 1580 1581 //>>label: labels 1582 //>>group: Core 1583 //>>description: Find all the labels associated with a given input 1584 //>>docs: http://api.jqueryui.com/labels/ 1585 1586 1587 1588 var labels = $.fn.labels = function () { 1589 var ancestor, selector, id, labels, ancestors; 1590 1591 // Check control.labels first 1592 if (this[0].labels && this[0].labels.length) { 1593 return this.pushStack(this[0].labels); 1594 } 1595 1596 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 1597 // Above browsers do not support control.labels. Everything below is to support them 1598 // as well as document fragments. control.labels does not work on document fragments 1599 labels = this.eq(0).parents("label"); 1600 1601 // Look for the label based on the id 1602 id = this.attr("id"); 1603 if (id) { 1604 1605 // We don't search against the document in case the element 1606 // is disconnected from the DOM 1607 ancestor = this.eq(0).parents().last(); 1608 1609 // Get a full set of top level ancestors 1610 ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings()); 1611 1612 // Create a selector for the label based on the id 1613 selector = "label[for='" + $.ui.escapeSelector(id) + "']"; 1614 1615 labels = labels.add(ancestors.find(selector).addBack(selector)); 1616 1617 } 1618 1619 // Return whatever we have found for labels 1620 return this.pushStack(labels); 1621 }; 1622 1623 1624 /*! 1625 * jQuery UI Scroll Parent 1.12.1 1626 * http://jqueryui.com 1627 * 1628 * Copyright jQuery Foundation and other contributors 1629 * Released under the MIT license. 1630 * http://jquery.org/license 1631 */ 1632 1633 //>>label: scrollParent 1634 //>>group: Core 1635 //>>description: Get the closest ancestor element that is scrollable. 1636 //>>docs: http://api.jqueryui.com/scrollParent/ 1637 1638 1639 1640 var scrollParent = $.fn.scrollParent = function (includeHidden) { 1641 var position = this.css("position"), 1642 excludeStaticParent = position === "absolute", 1643 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 1644 scrollParent = this.parents().filter(function () { 1645 var parent = $(this); 1646 if (excludeStaticParent && parent.css("position") === "static") { 1647 return false;
vendor: 5,213 bytes, lines 1648-1852
1648 } 1649 return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + 1650 parent.css("overflow-x")); 1651 }).eq(0); 1652 1653 return position === "fixed" || !scrollParent.length ? 1654 $(this[0].ownerDocument || document) : 1655 scrollParent; 1656 }; 1657 1658 1659 /*! 1660 * jQuery UI Tabbable 1.12.1 1661 * http://jqueryui.com 1662 * 1663 * Copyright jQuery Foundation and other contributors 1664 * Released under the MIT license. 1665 * http://jquery.org/license 1666 */ 1667 1668 //>>label: :tabbable Selector 1669 //>>group: Core 1670 //>>description: Selects elements which can be tabbed to. 1671 //>>docs: http://api.jqueryui.com/tabbable-selector/ 1672 1673 1674 1675 var tabbable = $.extend($.expr[":"], { 1676 tabbable: function (element) { 1677 var tabIndex = $.attr(element, "tabindex"), 1678 hasTabindex = tabIndex != null; 1679 return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex); 1680 } 1681 }); 1682 1683 1684 /*! 1685 * jQuery UI Unique ID 1.12.1 1686 * http://jqueryui.com 1687 * 1688 * Copyright jQuery Foundation and other contributors 1689 * Released under the MIT license. 1690 * http://jquery.org/license 1691 */ 1692 1693 //>>label: uniqueId 1694 //>>group: Core 1695 //>>description: Functions to generate and remove uniqueId's 1696 //>>docs: http://api.jqueryui.com/uniqueId/ 1697 1698 1699 1700 var uniqueId = $.fn.extend({ 1701 uniqueId: (function () { 1702 var uuid = 0; 1703 1704 return function () { 1705 return this.each(function () { 1706 if (!this.id) { 1707 this.id = "ui-id-" + (++uuid); 1708 } 1709 }); 1710 }; 1711 })(), 1712 1713 removeUniqueId: function () { 1714 return this.each(function () { 1715 if (/^ui-id-\d+$/.test(this.id)) { 1716 $(this).removeAttr("id"); 1717 } 1718 }); 1719 } 1720 }); 1721 1722 1723 1724 1725 // This file is deprecated 1726 var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); 1727 1728 /*! 1729 * jQuery UI Mouse 1.12.1 1730 * http://jqueryui.com 1731 * 1732 * Copyright jQuery Foundation and other contributors 1733 * Released under the MIT license. 1734 * http://jquery.org/license 1735 */ 1736 1737 //>>label: Mouse 1738 //>>group: Widgets 1739 //>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 1740 //>>docs: http://api.jqueryui.com/mouse/ 1741 1742 1743 1744 var mouseHandled = false; 1745 $(document).on("mouseup", function () { 1746 mouseHandled = false; 1747 }); 1748 1749 var widgetsMouse = $.widget("ui.mouse", { 1750 version: "1.12.1", 1751 options: { 1752 cancel: "input, textarea, button, select, option", 1753 distance: 1, 1754 delay: 0 1755 }, 1756 _mouseInit: function () { 1757 var that = this; 1758 1759 this.element 1760 .on("mousedown." + this.widgetName, function (event) { 1761 return that._mouseDown(event); 1762 }) 1763 .on("click." + this.widgetName, function (event) { 1764 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 1765 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 1766 event.stopImmediatePropagation(); 1767 return false; 1768 } 1769 }); 1770 1771 this.started = false; 1772 }, 1773 1774 // TODO: make sure destroying one instance of mouse doesn't mess with 1775 // other instances of mouse 1776 _mouseDestroy: function () { 1777 this.element.off("." + this.widgetName); 1778 if (this._mouseMoveDelegate) { 1779 this.document 1780 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 1781 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 1782 } 1783 }, 1784 1785 _mouseDown: function (event) { 1786 1787 // don't let more than one widget handle mouseStart 1788 if (mouseHandled) { 1789 return; 1790 } 1791 1792 this._mouseMoved = false; 1793 1794 // We may have missed mouseup (out of window) 1795 (this._mouseStarted && this._mouseUp(event)); 1796 1797 this._mouseDownEvent = event; 1798 1799 var that = this, 1800 btnIsLeft = (event.which === 1), 1801 1802 // event.target.nodeName works around a bug in IE 8 with 1803 // disabled inputs (#7620) 1804 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? 1805 $(event.target).closest(this.options.cancel).length : false); 1806 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 1807 return true; 1808 } 1809 1810 this.mouseDelayMet = !this.options.delay; 1811 if (!this.mouseDelayMet) { 1812 this._mouseDelayTimer = setTimeout(function () { 1813 that.mouseDelayMet = true; 1814 }, this.options.delay); 1815 } 1816 1817 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 1818 this._mouseStarted = (this._mouseStart(event) !== false); 1819 if (!this._mouseStarted) { 1820 event.preventDefault(); 1821 return true; 1822 } 1823 } 1824 1825 // Click event may never have fired (Gecko & Opera) 1826 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 1827 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 1828 } 1829 1830 // These delegates are required to keep context 1831 this._mouseMoveDelegate = function (event) { 1832 return that._mouseMove(event); 1833 }; 1834 this._mouseUpDelegate = function (event) { 1835 return that._mouseUp(event); 1836 }; 1837 1838 this.document 1839 .on("mousemove." + this.widgetName, this._mouseMoveDelegate) 1840 .on("mouseup." + this.widgetName, this._mouseUpDelegate); 1841 1842 event.preventDefault(); 1843 1844 mouseHandled = true; 1845 return true; 1846 }, 1847 1848 _mouseMove: function (event) { 1849 1850 // Only check for mouseups outside the document if you've moved inside the document 1851 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 1852 // fire a mousemove event if content is placed under the cursor. See #7778
vendor: 15,556 bytes, lines 1853-2442
1853 // Support: IE <9 1854 if (this._mouseMoved) { 1855 1856 // IE mouseup check - mouseup happened when mouse was out of window 1857 if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && 1858 !event.button) { 1859 return this._mouseUp(event); 1860 1861 // Iframe mouseup check - mouseup occurred in another document 1862 } else if (!event.which) { 1863 1864 // Support: Safari <=8 - 9 1865 // Safari sets which to 0 if you press any of the following keys 1866 // during a drag (#14461) 1867 if (event.originalEvent.altKey || event.originalEvent.ctrlKey || 1868 event.originalEvent.metaKey || event.originalEvent.shiftKey) { 1869 this.ignoreMissingWhich = true; 1870 } else if (!this.ignoreMissingWhich) { 1871 return this._mouseUp(event); 1872 } 1873 } 1874 } 1875 1876 if (event.which || event.button) { 1877 this._mouseMoved = true; 1878 } 1879 1880 if (this._mouseStarted) { 1881 this._mouseDrag(event); 1882 return event.preventDefault(); 1883 } 1884 1885 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 1886 this._mouseStarted = 1887 (this._mouseStart(this._mouseDownEvent, event) !== false); 1888 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 1889 } 1890 1891 return !this._mouseStarted; 1892 }, 1893 1894 _mouseUp: function (event) { 1895 this.document 1896 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 1897 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 1898 1899 if (this._mouseStarted) { 1900 this._mouseStarted = false; 1901 1902 if (event.target === this._mouseDownEvent.target) { 1903 $.data(event.target, this.widgetName + ".preventClickEvent", true); 1904 } 1905 1906 this._mouseStop(event); 1907 } 1908 1909 if (this._mouseDelayTimer) { 1910 clearTimeout(this._mouseDelayTimer); 1911 delete this._mouseDelayTimer; 1912 } 1913 1914 this.ignoreMissingWhich = false; 1915 mouseHandled = false; 1916 event.preventDefault(); 1917 }, 1918 1919 _mouseDistanceMet: function (event) { 1920 return (Math.max( 1921 Math.abs(this._mouseDownEvent.pageX - event.pageX), 1922 Math.abs(this._mouseDownEvent.pageY - event.pageY) 1923 ) >= this.options.distance 1924 ); 1925 }, 1926 1927 _mouseDelayMet: function ( /* event */) { 1928 return this.mouseDelayMet; 1929 }, 1930 1931 // These are placeholder methods, to be overriden by extending plugin 1932 _mouseStart: function ( /* event */) { }, 1933 _mouseDrag: function ( /* event */) { }, 1934 _mouseStop: function ( /* event */) { }, 1935 _mouseCapture: function ( /* event */) { return true; } 1936 }); 1937 1938 1939 1940 1941 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 1942 var plugin = $.ui.plugin = { 1943 add: function (module, option, set) { 1944 var i, 1945 proto = $.ui[module].prototype; 1946 for (i in set) { 1947 proto.plugins[i] = proto.plugins[i] || []; 1948 proto.plugins[i].push([option, set[i]]); 1949 } 1950 }, 1951 call: function (instance, name, args, allowDisconnected) { 1952 var i, 1953 set = instance.plugins[name]; 1954 1955 if (!set) { 1956 return; 1957 } 1958 1959 if (!allowDisconnected && (!instance.element[0].parentNode || 1960 instance.element[0].parentNode.nodeType === 11)) { 1961 return; 1962 } 1963 1964 for (i = 0; i < set.length; i++) { 1965 if (instance.options[set[i][0]]) { 1966 set[i][1].apply(instance.element, args); 1967 } 1968 } 1969 } 1970 }; 1971 1972 1973 1974 var safeActiveElement = $.ui.safeActiveElement = function (document) { 1975 var activeElement; 1976 1977 // Support: IE 9 only 1978 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 1979 try { 1980 activeElement = document.activeElement; 1981 } catch (error) { 1982 activeElement = document.body; 1983 } 1984 1985 // Support: IE 9 - 11 only 1986 // IE may return null instead of an element 1987 // Interestingly, this only seems to occur when NOT in an iframe 1988 if (!activeElement) { 1989 activeElement = document.body; 1990 } 1991 1992 // Support: IE 11 only 1993 // IE11 returns a seemingly empty object in some cases when accessing 1994 // document.activeElement from an <iframe> 1995 if (!activeElement.nodeName) { 1996 activeElement = document.body; 1997 } 1998 1999 return activeElement; 2000 }; 2001 2002 2003 2004 var safeBlur = $.ui.safeBlur = function (element) { 2005 2006 // Support: IE9 - 10 only 2007 // If the <body> is blurred, IE will switch windows, see #9420 2008 if (element && element.nodeName.toLowerCase() !== "body") { 2009 $(element).trigger("blur"); 2010 } 2011 }; 2012 2013 2014 /*! 2015 * jQuery UI Draggable 1.12.1 2016 * http://jqueryui.com 2017 * 2018 * Copyright jQuery Foundation and other contributors 2019 * Released under the MIT license. 2020 * http://jquery.org/license 2021 */ 2022 2023 //>>label: Draggable 2024 //>>group: Interactions 2025 //>>description: Enables dragging functionality for any element. 2026 //>>docs: http://api.jqueryui.com/draggable/ 2027 //>>demos: http://jqueryui.com/draggable/ 2028 //>>css.structure: ../../themes/base/draggable.css 2029 2030 2031 2032 $.widget("ui.draggable", $.ui.mouse, { 2033 version: "1.12.1", 2034 widgetEventPrefix: "drag", 2035 options: { 2036 addClasses: true, 2037 appendTo: "parent", 2038 axis: false, 2039 connectToSortable: false, 2040 containment: false, 2041 cursor: "auto", 2042 cursorAt: false, 2043 grid: false, 2044 handle: false, 2045 helper: "original", 2046 iframeFix: false, 2047 opacity: false, 2048 refreshPositions: false, 2049 revert: false, 2050 revertDuration: 500, 2051 scope: "default", 2052 scroll: true, 2053 scrollSensitivity: 20, 2054 scrollSpeed: 20, 2055 snap: false, 2056 snapMode: "both", 2057 snapTolerance: 20, 2058 stack: false, 2059 zIndex: false, 2060 2061 // Callbacks 2062 drag: null, 2063 start: null, 2064 stop: null 2065 }, 2066 _create: function () { 2067 2068 if (this.options.helper === "original") { 2069 this._setPositionRelative(); 2070 } 2071 if (this.options.addClasses) { 2072 this._addClass("ui-draggable"); 2073 } 2074 this._setHandleClassName(); 2075 2076 this._mouseInit(); 2077 }, 2078 2079 _setOption: function (key, value) { 2080 this._super(key, value); 2081 if (key === "handle") { 2082 this._removeHandleClassName(); 2083 this._setHandleClassName(); 2084 } 2085 }, 2086 2087 _destroy: function () { 2088 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 2089 this.destroyOnClear = true; 2090 return; 2091 } 2092 this._removeHandleClassName(); 2093 this._mouseDestroy(); 2094 }, 2095 2096 _mouseCapture: function (event) { 2097 var o = this.options; 2098 2099 // Among others, prevent a drag on a resizable-handle 2100 if (this.helper || o.disabled || 2101 $(event.target).closest(".ui-resizable-handle").length > 0) { 2102 return false; 2103 } 2104 2105 //Quit if we're not on a valid handle 2106 this.handle = this._getHandle(event); 2107 if (!this.handle) { 2108 return false; 2109 } 2110 2111 this._blurActiveElement(event); 2112 2113 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 2114 2115 return true; 2116 2117 }, 2118 2119 _blockFrames: function (selector) { 2120 this.iframeBlocks = this.document.find(selector).map(function () { 2121 var iframe = $(this); 2122 2123 return $("<div>") 2124 .css("position", "absolute") 2125 .appendTo(iframe.parent()) 2126 .outerWidth(iframe.outerWidth()) 2127 .outerHeight(iframe.outerHeight()) 2128 .offset(iframe.offset())[0]; 2129 }); 2130 }, 2131 2132 _unblockFrames: function () { 2133 if (this.iframeBlocks) { 2134 this.iframeBlocks.remove(); 2135 delete this.iframeBlocks; 2136 } 2137 }, 2138 2139 _blurActiveElement: function (event) { 2140 var activeElement = $.ui.safeActiveElement(this.document[0]), 2141 target = $(event.target); 2142 2143 // Don't blur if the event occurred on an element that is within 2144 // the currently focused element 2145 // See #10527, #12472 2146 if (target.closest(activeElement).length) { 2147 return; 2148 } 2149 2150 // Blur any element that currently has focus, see #4261 2151 $.ui.safeBlur(activeElement); 2152 }, 2153 2154 _mouseStart: function (event) { 2155 2156 var o = this.options; 2157 2158 //Create and append the visible helper 2159 this.helper = this._createHelper(event); 2160 2161 this._addClass(this.helper, "ui-draggable-dragging"); 2162 2163 //Cache the helper size 2164 this._cacheHelperProportions(); 2165 2166 //If ddmanager is used for droppables, set the global draggable 2167 if ($.ui.ddmanager) { 2168 $.ui.ddmanager.current = this; 2169 } 2170 2171 /* 2172 * - Position generation - 2173 * This block generates everything position related - it's the core of draggables. 2174 */ 2175 2176 //Cache the margins of the original element 2177 this._cacheMargins(); 2178 2179 //Store the helper's css position 2180 this.cssPosition = this.helper.css("position"); 2181 this.scrollParent = this.helper.scrollParent(true); 2182 this.offsetParent = this.helper.offsetParent(); 2183 this.hasFixedAncestor = this.helper.parents().filter(function () { 2184 return $(this).css("position") === "fixed"; 2185 }).length > 0; 2186 2187 //The element's absolute position on the page minus margins 2188 this.positionAbs = this.element.offset(); 2189 this._refreshOffsets(event); 2190 2191 //Generate the original position 2192 this.originalPosition = this.position = this._generatePosition(event, false); 2193 this.originalPageX = event.pageX; 2194 this.originalPageY = event.pageY; 2195 2196 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 2197 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 2198 2199 //Set a containment if given in the options 2200 this._setContainment(); 2201 2202 //Trigger event + callbacks 2203 if (this._trigger("start", event) === false) { 2204 this._clear(); 2205 return false; 2206 } 2207 2208 //Recache the helper size 2209 this._cacheHelperProportions(); 2210 2211 //Prepare the droppable offsets 2212 if ($.ui.ddmanager && !o.dropBehaviour) { 2213 $.ui.ddmanager.prepareOffsets(this, event); 2214 } 2215 2216 // Execute the drag once - this causes the helper not to be visible before getting its 2217 // correct position 2218 this._mouseDrag(event, true); 2219 2220 // If the ddmanager is used for droppables, inform the manager that dragging has started 2221 // (see #5003) 2222 if ($.ui.ddmanager) { 2223 $.ui.ddmanager.dragStart(this, event); 2224 } 2225 2226 return true; 2227 }, 2228 2229 _refreshOffsets: function (event) { 2230 this.offset = { 2231 top: this.positionAbs.top - this.margins.top, 2232 left: this.positionAbs.left - this.margins.left, 2233 scroll: false, 2234 parent: this._getParentOffset(), 2235 relative: this._getRelativeOffset() 2236 }; 2237 2238 this.offset.click = { 2239 left: event.pageX - this.offset.left, 2240 top: event.pageY - this.offset.top 2241 }; 2242 }, 2243 2244 _mouseDrag: function (event, noPropagation) { 2245 2246 // reset any necessary cached properties (see #5009) 2247 if (this.hasFixedAncestor) { 2248 this.offset.parent = this._getParentOffset(); 2249 } 2250 2251 //Compute the helpers position 2252 this.position = this._generatePosition(event, true); 2253 this.positionAbs = this._convertPositionTo("absolute"); 2254 2255 //Call plugins and callbacks and use the resulting position if something is returned 2256 if (!noPropagation) { 2257 var ui = this._uiHash(); 2258 if (this._trigger("drag", event, ui) === false) { 2259 this._mouseUp(new $.Event("mouseup", event)); 2260 return false; 2261 } 2262 this.position = ui.position; 2263 } 2264 2265 this.helper[0].style.left = this.position.left + "px"; 2266 this.helper[0].style.top = this.position.top + "px"; 2267 2268 if ($.ui.ddmanager) { 2269 $.ui.ddmanager.drag(this, event); 2270 } 2271 2272 return false; 2273 }, 2274 2275 _mouseStop: function (event) { 2276 2277 //If we are using droppables, inform the manager about the drop 2278 var that = this, 2279 dropped = false; 2280 if ($.ui.ddmanager && !this.options.dropBehaviour) { 2281 dropped = $.ui.ddmanager.drop(this, event); 2282 } 2283 2284 //if a drop comes from outside (a sortable) 2285 if (this.dropped) { 2286 dropped = this.dropped; 2287 this.dropped = false; 2288 } 2289 2290 if ((this.options.revert === "invalid" && !dropped) || 2291 (this.options.revert === "valid" && dropped) || 2292 this.options.revert === true || ($.isFunction(this.options.revert) && 2293 this.options.revert.call(this.element, dropped)) 2294 ) { 2295 $(this.helper).animate( 2296 this.originalPosition, 2297 parseInt(this.options.revertDuration, 10), 2298 function () { 2299 if (that._trigger("stop", event) !== false) { 2300 that._clear(); 2301 } 2302 } 2303 ); 2304 } else { 2305 if (this._trigger("stop", event) !== false) { 2306 this._clear(); 2307 } 2308 } 2309 2310 return false; 2311 }, 2312 2313 _mouseUp: function (event) { 2314 this._unblockFrames(); 2315 2316 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 2317 // (see #5003) 2318 if ($.ui.ddmanager) { 2319 $.ui.ddmanager.dragStop(this, event); 2320 } 2321 2322 // Only need to focus if the event occurred on the draggable itself, see #10527 2323 if (this.handleElement.is(event.target)) { 2324 2325 // The interaction is over; whether or not the click resulted in a drag, 2326 // focus the element 2327 this.element.trigger("focus"); 2328 } 2329 2330 return $.ui.mouse.prototype._mouseUp.call(this, event); 2331 }, 2332 2333 cancel: function () { 2334 2335 if (this.helper.is(".ui-draggable-dragging")) { 2336 this._mouseUp(new $.Event("mouseup", { target: this.element[0] })); 2337 } else { 2338 this._clear(); 2339 } 2340 2341 return this; 2342 2343 }, 2344 2345 _getHandle: function (event) { 2346 return this.options.handle ? 2347 !!$(event.target).closest(this.element.find(this.options.handle)).length : 2348 true; 2349 }, 2350 2351 _setHandleClassName: function () { 2352 this.handleElement = this.options.handle ? 2353 this.element.find(this.options.handle) : this.element; 2354 this._addClass(this.handleElement, "ui-draggable-handle"); 2355 }, 2356 2357 _removeHandleClassName: function () { 2358 this._removeClass(this.handleElement, "ui-draggable-handle"); 2359 }, 2360 2361 _createHelper: function (event) { 2362 2363 var o = this.options, 2364 helperIsFunction = $.isFunction(o.helper), 2365 helper = helperIsFunction ? 2366 $(o.helper.apply(this.element[0], [event])) : 2367 (o.helper === "clone" ? 2368 this.element.clone().removeAttr("id") : 2369 this.element); 2370 2371 if (!helper.parents("body").length) { 2372 helper.appendTo((o.appendTo === "parent" ? 2373 this.element[0].parentNode : 2374 o.appendTo)); 2375 } 2376 2377 // Http://bugs.jqueryui.com/ticket/9446 2378 // a helper function can return the original element 2379 // which wouldn't have been set to relative in _create 2380 if (helperIsFunction && helper[0] === this.element[0]) { 2381 this._setPositionRelative(); 2382 } 2383 2384 if (helper[0] !== this.element[0] && 2385 !(/(fixed|absolute)/).test(helper.css("position"))) { 2386 helper.css("position", "absolute"); 2387 } 2388 2389 return helper; 2390 2391 }, 2392 2393 _setPositionRelative: function () { 2394 if (!(/^(?:r|a|f)/).test(this.element.css("position"))) { 2395 this.element[0].style.position = "relative"; 2396 } 2397 }, 2398 2399 _adjustOffsetFromHelper: function (obj) { 2400 if (typeof obj === "string") { 2401 obj = obj.split(" "); 2402 } 2403 if ($.isArray(obj)) { 2404 obj = { left: +obj[0], top: +obj[1] || 0 }; 2405 } 2406 if ("left" in obj) { 2407 this.offset.click.left = obj.left + this.margins.left; 2408 } 2409 if ("right" in obj) { 2410 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 2411 } 2412 if ("top" in obj) { 2413 this.offset.click.top = obj.top + this.margins.top; 2414 } 2415 if ("bottom" in obj) { 2416 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 2417 } 2418 }, 2419 2420 _isRootNode: function (element) { 2421 return (/(html|body)/i).test(element.tagName) || element === this.document[0]; 2422 }, 2423 2424 _getParentOffset: function () { 2425 2426 //Get the offsetParent and cache its position 2427 var po = this.offsetParent.offset(), 2428 document = this.document[0]; 2429 2430 // This is a special case where we need to modify a offset calculated on start, since the 2431 // following happened: 2432 // 1. The position of the helper is absolute, so it's position is calculated based on the 2433 // next positioned parent 2434 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 2435 // the document, which means that the scroll is included in the initial calculation of the 2436 // offset of the parent, and never recalculated upon drag 2437 if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && 2438 $.contains(this.scrollParent[0], this.offsetParent[0])) { 2439 po.left += this.scrollParent.scrollLeft(); 2440 po.top += this.scrollParent.scrollTop(); 2441 } 2442
vendor: 19,450 bytes, lines 2443-3078
2443 if (this._isRootNode(this.offsetParent[0])) { 2444 po = { top: 0, left: 0 }; 2445 } 2446 2447 return { 2448 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 2449 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 2450 }; 2451 2452 }, 2453 2454 _getRelativeOffset: function () { 2455 if (this.cssPosition !== "relative") { 2456 return { top: 0, left: 0 }; 2457 } 2458 2459 var p = this.element.position(), 2460 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 2461 2462 return { 2463 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 2464 (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 2465 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 2466 (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) 2467 }; 2468 2469 }, 2470 2471 _cacheMargins: function () { 2472 this.margins = { 2473 left: (parseInt(this.element.css("marginLeft"), 10) || 0), 2474 top: (parseInt(this.element.css("marginTop"), 10) || 0), 2475 right: (parseInt(this.element.css("marginRight"), 10) || 0), 2476 bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) 2477 }; 2478 }, 2479 2480 _cacheHelperProportions: function () { 2481 this.helperProportions = { 2482 width: this.helper.outerWidth(), 2483 height: this.helper.outerHeight() 2484 }; 2485 }, 2486 2487 _setContainment: function () { 2488 2489 var isUserScrollable, c, ce, 2490 o = this.options, 2491 document = this.document[0]; 2492 2493 this.relativeContainer = null; 2494 2495 if (!o.containment) { 2496 this.containment = null; 2497 return; 2498 } 2499 2500 if (o.containment === "window") { 2501 this.containment = [ 2502 $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 2503 $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 2504 $(window).scrollLeft() + $(window).width() - 2505 this.helperProportions.width - this.margins.left, 2506 $(window).scrollTop() + 2507 ($(window).height() || document.body.parentNode.scrollHeight) - 2508 this.helperProportions.height - this.margins.top 2509 ]; 2510 return; 2511 } 2512 2513 if (o.containment === "document") { 2514 this.containment = [ 2515 0, 2516 0, 2517 $(document).width() - this.helperProportions.width - this.margins.left, 2518 ($(document).height() || document.body.parentNode.scrollHeight) - 2519 this.helperProportions.height - this.margins.top 2520 ]; 2521 return; 2522 } 2523 2524 if (o.containment.constructor === Array) { 2525 this.containment = o.containment; 2526 return; 2527 } 2528 2529 if (o.containment === "parent") { 2530 o.containment = this.helper[0].parentNode; 2531 } 2532 2533 c = $(o.containment); 2534 ce = c[0]; 2535 2536 if (!ce) { 2537 return; 2538 } 2539 2540 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 2541 2542 this.containment = [ 2543 (parseInt(c.css("borderLeftWidth"), 10) || 0) + 2544 (parseInt(c.css("paddingLeft"), 10) || 0), 2545 (parseInt(c.css("borderTopWidth"), 10) || 0) + 2546 (parseInt(c.css("paddingTop"), 10) || 0), 2547 (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 2548 (parseInt(c.css("borderRightWidth"), 10) || 0) - 2549 (parseInt(c.css("paddingRight"), 10) || 0) - 2550 this.helperProportions.width - 2551 this.margins.left - 2552 this.margins.right, 2553 (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 2554 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 2555 (parseInt(c.css("paddingBottom"), 10) || 0) - 2556 this.helperProportions.height - 2557 this.margins.top - 2558 this.margins.bottom 2559 ]; 2560 this.relativeContainer = c; 2561 }, 2562 2563 _convertPositionTo: function (d, pos) { 2564 2565 if (!pos) { 2566 pos = this.position; 2567 } 2568 2569 var mod = d === "absolute" ? 1 : -1, 2570 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 2571 2572 return { 2573 top: ( 2574 2575 // The absolute mouse position 2576 pos.top + 2577 2578 // Only for relative positioned nodes: Relative offset from element to offset parent 2579 this.offset.relative.top * mod + 2580 2581 // The offsetParent's offset without borders (offset + border) 2582 this.offset.parent.top * mod - 2583 ((this.cssPosition === "fixed" ? 2584 -this.offset.scroll.top : 2585 (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod) 2586 ), 2587 left: ( 2588 2589 // The absolute mouse position 2590 pos.left + 2591 2592 // Only for relative positioned nodes: Relative offset from element to offset parent 2593 this.offset.relative.left * mod + 2594 2595 // The offsetParent's offset without borders (offset + border) 2596 this.offset.parent.left * mod - 2597 ((this.cssPosition === "fixed" ? 2598 -this.offset.scroll.left : 2599 (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod) 2600 ) 2601 }; 2602 2603 }, 2604 2605 _generatePosition: function (event, constrainPosition) { 2606 2607 var containment, co, top, left, 2608 o = this.options, 2609 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 2610 pageX = event.pageX, 2611 pageY = event.pageY; 2612 2613 // Cache the scroll 2614 if (!scrollIsRootNode || !this.offset.scroll) { 2615 this.offset.scroll = { 2616 top: this.scrollParent.scrollTop(), 2617 left: this.scrollParent.scrollLeft() 2618 }; 2619 } 2620 2621 /* 2622 * - Position constraining - 2623 * Constrain the position to a mix of grid, containment. 2624 */ 2625 2626 // If we are not dragging yet, we won't check for options 2627 if (constrainPosition) { 2628 if (this.containment) { 2629 if (this.relativeContainer) { 2630 co = this.relativeContainer.offset(); 2631 containment = [ 2632 this.containment[0] + co.left, 2633 this.containment[1] + co.top, 2634 this.containment[2] + co.left, 2635 this.containment[3] + co.top 2636 ]; 2637 } else { 2638 containment = this.containment; 2639 } 2640 2641 if (event.pageX - this.offset.click.left < containment[0]) { 2642 pageX = containment[0] + this.offset.click.left; 2643 } 2644 if (event.pageY - this.offset.click.top < containment[1]) { 2645 pageY = containment[1] + this.offset.click.top; 2646 } 2647 if (event.pageX - this.offset.click.left > containment[2]) { 2648 pageX = containment[2] + this.offset.click.left; 2649 } 2650 if (event.pageY - this.offset.click.top > containment[3]) { 2651 pageY = containment[3] + this.offset.click.top; 2652 } 2653 } 2654 2655 if (o.grid) { 2656 2657 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 2658 // argument errors in IE (see ticket #6950) 2659 top = o.grid[1] ? this.originalPageY + Math.round((pageY - 2660 this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 2661 pageY = containment ? ((top - this.offset.click.top >= containment[1] || 2662 top - this.offset.click.top > containment[3]) ? 2663 top : 2664 ((top - this.offset.click.top >= containment[1]) ? 2665 top - o.grid[1] : top + o.grid[1])) : top; 2666 2667 left = o.grid[0] ? this.originalPageX + 2668 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : 2669 this.originalPageX; 2670 pageX = containment ? ((left - this.offset.click.left >= containment[0] || 2671 left - this.offset.click.left > containment[2]) ? 2672 left : 2673 ((left - this.offset.click.left >= containment[0]) ? 2674 left - o.grid[0] : left + o.grid[0])) : left; 2675 } 2676 2677 if (o.axis === "y") { 2678 pageX = this.originalPageX; 2679 } 2680 2681 if (o.axis === "x") { 2682 pageY = this.originalPageY; 2683 } 2684 } 2685 2686 return { 2687 top: ( 2688 2689 // The absolute mouse position 2690 pageY - 2691 2692 // Click offset (relative to the element) 2693 this.offset.click.top - 2694 2695 // Only for relative positioned nodes: Relative offset from element to offset parent 2696 this.offset.relative.top - 2697 2698 // The offsetParent's offset without borders (offset + border) 2699 this.offset.parent.top + 2700 (this.cssPosition === "fixed" ? 2701 -this.offset.scroll.top : 2702 (scrollIsRootNode ? 0 : this.offset.scroll.top)) 2703 ), 2704 left: ( 2705 2706 // The absolute mouse position 2707 pageX - 2708 2709 // Click offset (relative to the element) 2710 this.offset.click.left - 2711 2712 // Only for relative positioned nodes: Relative offset from element to offset parent 2713 this.offset.relative.left - 2714 2715 // The offsetParent's offset without borders (offset + border) 2716 this.offset.parent.left + 2717 (this.cssPosition === "fixed" ? 2718 -this.offset.scroll.left : 2719 (scrollIsRootNode ? 0 : this.offset.scroll.left)) 2720 ) 2721 }; 2722 2723 }, 2724 2725 _clear: function () { 2726 this._removeClass(this.helper, "ui-draggable-dragging"); 2727 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 2728 this.helper.remove(); 2729 } 2730 this.helper = null; 2731 this.cancelHelperRemoval = false; 2732 if (this.destroyOnClear) { 2733 this.destroy(); 2734 } 2735 }, 2736 2737 // From now on bulk stuff - mainly helpers 2738 2739 _trigger: function (type, event, ui) { 2740 ui = ui || this._uiHash(); 2741 $.ui.plugin.call(this, type, [event, ui, this], true); 2742 2743 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 2744 if (/^(drag|start|stop)/.test(type)) { 2745 this.positionAbs = this._convertPositionTo("absolute"); 2746 ui.offset = this.positionAbs; 2747 } 2748 return $.Widget.prototype._trigger.call(this, type, event, ui); 2749 }, 2750 2751 plugins: {}, 2752 2753 _uiHash: function () { 2754 return { 2755 helper: this.helper, 2756 position: this.position, 2757 originalPosition: this.originalPosition, 2758 offset: this.positionAbs 2759 }; 2760 } 2761 2762 }); 2763 2764 $.ui.plugin.add("draggable", "connectToSortable", { 2765 start: function (event, ui, draggable) { 2766 var uiSortable = $.extend({}, ui, { 2767 item: draggable.element 2768 }); 2769 2770 draggable.sortables = []; 2771 $(draggable.options.connectToSortable).each(function () { 2772 var sortable = $(this).sortable("instance"); 2773 2774 if (sortable && !sortable.options.disabled) { 2775 draggable.sortables.push(sortable); 2776 2777 // RefreshPositions is called at drag start to refresh the containerCache 2778 // which is used in drag. This ensures it's initialized and synchronized 2779 // with any changes that might have happened on the page since initialization. 2780 sortable.refreshPositions(); 2781 sortable._trigger("activate", event, uiSortable); 2782 } 2783 }); 2784 }, 2785 stop: function (event, ui, draggable) { 2786 var uiSortable = $.extend({}, ui, { 2787 item: draggable.element 2788 }); 2789 2790 draggable.cancelHelperRemoval = false; 2791 2792 $.each(draggable.sortables, function () { 2793 var sortable = this; 2794 2795 if (sortable.isOver) { 2796 sortable.isOver = 0; 2797 2798 // Allow this sortable to handle removing the helper 2799 draggable.cancelHelperRemoval = true; 2800 sortable.cancelHelperRemoval = false; 2801 2802 // Use _storedCSS To restore properties in the sortable, 2803 // as this also handles revert (#9675) since the draggable 2804 // may have modified them in unexpected ways (#8809) 2805 sortable._storedCSS = { 2806 position: sortable.placeholder.css("position"), 2807 top: sortable.placeholder.css("top"), 2808 left: sortable.placeholder.css("left") 2809 }; 2810 2811 sortable._mouseStop(event); 2812 2813 // Once drag has ended, the sortable should return to using 2814 // its original helper, not the shared helper from draggable 2815 sortable.options.helper = sortable.options._helper; 2816 } else { 2817 2818 // Prevent this Sortable from removing the helper. 2819 // However, don't set the draggable to remove the helper 2820 // either as another connected Sortable may yet handle the removal. 2821 sortable.cancelHelperRemoval = true; 2822 2823 sortable._trigger("deactivate", event, uiSortable); 2824 } 2825 }); 2826 }, 2827 drag: function (event, ui, draggable) { 2828 $.each(draggable.sortables, function () { 2829 var innermostIntersecting = false, 2830 sortable = this; 2831 2832 // Copy over variables that sortable's _intersectsWith uses 2833 sortable.positionAbs = draggable.positionAbs; 2834 sortable.helperProportions = draggable.helperProportions; 2835 sortable.offset.click = draggable.offset.click; 2836 2837 if (sortable._intersectsWith(sortable.containerCache)) { 2838 innermostIntersecting = true; 2839 2840 $.each(draggable.sortables, function () { 2841 2842 // Copy over variables that sortable's _intersectsWith uses 2843 this.positionAbs = draggable.positionAbs; 2844 this.helperProportions = draggable.helperProportions; 2845 this.offset.click = draggable.offset.click; 2846 2847 if (this !== sortable && 2848 this._intersectsWith(this.containerCache) && 2849 $.contains(sortable.element[0], this.element[0])) { 2850 innermostIntersecting = false; 2851 } 2852 2853 return innermostIntersecting; 2854 }); 2855 } 2856 2857 if (innermostIntersecting) { 2858 2859 // If it intersects, we use a little isOver variable and set it once, 2860 // so that the move-in stuff gets fired only once. 2861 if (!sortable.isOver) { 2862 sortable.isOver = 1; 2863 2864 // Store draggable's parent in case we need to reappend to it later. 2865 draggable._parent = ui.helper.parent(); 2866 2867 sortable.currentItem = ui.helper 2868 .appendTo(sortable.element) 2869 .data("ui-sortable-item", true); 2870 2871 // Store helper option to later restore it 2872 sortable.options._helper = sortable.options.helper; 2873 2874 sortable.options.helper = function () { 2875 return ui.helper[0]; 2876 }; 2877 2878 // Fire the start events of the sortable with our passed browser event, 2879 // and our own helper (so it doesn't create a new one) 2880 event.target = sortable.currentItem[0]; 2881 sortable._mouseCapture(event, true); 2882 sortable._mouseStart(event, true, true); 2883 2884 // Because the browser event is way off the new appended portlet, 2885 // modify necessary variables to reflect the changes 2886 sortable.offset.click.top = draggable.offset.click.top; 2887 sortable.offset.click.left = draggable.offset.click.left; 2888 sortable.offset.parent.left -= draggable.offset.parent.left - 2889 sortable.offset.parent.left; 2890 sortable.offset.parent.top -= draggable.offset.parent.top - 2891 sortable.offset.parent.top; 2892 2893 draggable._trigger("toSortable", event); 2894 2895 // Inform draggable that the helper is in a valid drop zone, 2896 // used solely in the revert option to handle "valid/invalid". 2897 draggable.dropped = sortable.element; 2898 2899 // Need to refreshPositions of all sortables in the case that 2900 // adding to one sortable changes the location of the other sortables (#9675) 2901 $.each(draggable.sortables, function () { 2902 this.refreshPositions(); 2903 }); 2904 2905 // Hack so receive/update callbacks work (mostly) 2906 draggable.currentItem = draggable.element; 2907 sortable.fromOutside = draggable; 2908 } 2909 2910 if (sortable.currentItem) { 2911 sortable._mouseDrag(event); 2912 2913 // Copy the sortable's position because the draggable's can potentially reflect 2914 // a relative position, while sortable is always absolute, which the dragged 2915 // element has now become. (#8809) 2916 ui.position = sortable.position; 2917 } 2918 } else { 2919 2920 // If it doesn't intersect with the sortable, and it intersected before, 2921 // we fake the drag stop of the sortable, but make sure it doesn't remove 2922 // the helper by using cancelHelperRemoval. 2923 if (sortable.isOver) { 2924 2925 sortable.isOver = 0; 2926 sortable.cancelHelperRemoval = true; 2927 2928 // Calling sortable's mouseStop would trigger a revert, 2929 // so revert must be temporarily false until after mouseStop is called. 2930 sortable.options._revert = sortable.options.revert; 2931 sortable.options.revert = false; 2932 2933 sortable._trigger("out", event, sortable._uiHash(sortable)); 2934 sortable._mouseStop(event, true); 2935 2936 // Restore sortable behaviors that were modfied 2937 // when the draggable entered the sortable area (#9481) 2938 sortable.options.revert = sortable.options._revert; 2939 sortable.options.helper = sortable.options._helper; 2940 2941 if (sortable.placeholder) { 2942 sortable.placeholder.remove(); 2943 } 2944 2945 // Restore and recalculate the draggable's offset considering the sortable 2946 // may have modified them in unexpected ways. (#8809, #10669) 2947 ui.helper.appendTo(draggable._parent); 2948 draggable._refreshOffsets(event); 2949 ui.position = draggable._generatePosition(event, true); 2950 2951 draggable._trigger("fromSortable", event); 2952 2953 // Inform draggable that the helper is no longer in a valid drop zone 2954 draggable.dropped = false; 2955 2956 // Need to refreshPositions of all sortables just in case removing 2957 // from one sortable changes the location of other sortables (#9675) 2958 $.each(draggable.sortables, function () { 2959 this.refreshPositions(); 2960 }); 2961 } 2962 } 2963 }); 2964 } 2965 }); 2966 2967 $.ui.plugin.add("draggable", "cursor", { 2968 start: function (event, ui, instance) { 2969 var t = $("body"), 2970 o = instance.options; 2971 2972 if (t.css("cursor")) { 2973 o._cursor = t.css("cursor"); 2974 } 2975 t.css("cursor", o.cursor); 2976 }, 2977 stop: function (event, ui, instance) { 2978 var o = instance.options; 2979 if (o._cursor) { 2980 $("body").css("cursor", o._cursor); 2981 } 2982 } 2983 }); 2984 2985 $.ui.plugin.add("draggable", "opacity", { 2986 start: function (event, ui, instance) { 2987 var t = $(ui.helper), 2988 o = instance.options; 2989 if (t.css("opacity")) { 2990 o._opacity = t.css("opacity"); 2991 } 2992 t.css("opacity", o.opacity); 2993 }, 2994 stop: function (event, ui, instance) { 2995 var o = instance.options; 2996 if (o._opacity) { 2997 $(ui.helper).css("opacity", o._opacity); 2998 } 2999 } 3000 }); 3001 3002 $.ui.plugin.add("draggable", "scroll", { 3003 start: function (event, ui, i) { 3004 if (!i.scrollParentNotHidden) { 3005 i.scrollParentNotHidden = i.helper.scrollParent(false); 3006 } 3007 3008 if (i.scrollParentNotHidden[0] !== i.document[0] && 3009 i.scrollParentNotHidden[0].tagName !== "HTML") { 3010 i.overflowOffset = i.scrollParentNotHidden.offset(); 3011 } 3012 }, 3013 drag: function (event, ui, i) { 3014 3015 var o = i.options, 3016 scrolled = false, 3017 scrollParent = i.scrollParentNotHidden[0], 3018 document = i.document[0]; 3019 3020 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 3021 if (!o.axis || o.axis !== "x") { 3022 if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < 3023 o.scrollSensitivity) { 3024 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 3025 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 3026 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 3027 } 3028 } 3029 3030 if (!o.axis || o.axis !== "y") { 3031 if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < 3032 o.scrollSensitivity) { 3033 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 3034 } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 3035 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 3036 } 3037 } 3038 3039 } else { 3040 3041 if (!o.axis || o.axis !== "x") { 3042 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 3043 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 3044 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < 3045 o.scrollSensitivity) { 3046 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 3047 } 3048 } 3049 3050 if (!o.axis || o.axis !== "y") { 3051 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 3052 scrolled = $(document).scrollLeft( 3053 $(document).scrollLeft() - o.scrollSpeed 3054 ); 3055 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < 3056 o.scrollSensitivity) { 3057 scrolled = $(document).scrollLeft( 3058 $(document).scrollLeft() + o.scrollSpeed 3059 ); 3060 } 3061 } 3062 3063 } 3064 3065 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 3066 $.ui.ddmanager.prepareOffsets(i, event); 3067 } 3068 3069 } 3070 }); 3071 3072 $.ui.plugin.add("draggable", "snap", { 3073 start: function (event, ui, i) { 3074 3075 var o = i.options; 3076 3077 i.snapElements = []; 3078
vendor: 4,700 bytes, lines 3079-3266
3079 $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap) 3080 .each(function () { 3081 var $t = $(this), 3082 $o = $t.offset(); 3083 if (this !== i.element[0]) { 3084 i.snapElements.push({ 3085 item: this, 3086 width: $t.outerWidth(), height: $t.outerHeight(), 3087 top: $o.top, left: $o.left 3088 }); 3089 } 3090 }); 3091 3092 }, 3093 drag: function (event, ui, inst) { 3094 3095 var ts, bs, ls, rs, l, r, t, b, i, first, 3096 o = inst.options, 3097 d = o.snapTolerance, 3098 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 3099 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 3100 3101 for (i = inst.snapElements.length - 1; i >= 0; i--) { 3102 3103 l = inst.snapElements[i].left - inst.margins.left; 3104 r = l + inst.snapElements[i].width; 3105 t = inst.snapElements[i].top - inst.margins.top; 3106 b = t + inst.snapElements[i].height; 3107 3108 if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 3109 !$.contains(inst.snapElements[i].item.ownerDocument, 3110 inst.snapElements[i].item)) { 3111 if (inst.snapElements[i].snapping) { 3112 (inst.options.snap.release && 3113 inst.options.snap.release.call( 3114 inst.element, 3115 event, 3116 $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }) 3117 )); 3118 } 3119 inst.snapElements[i].snapping = false; 3120 continue; 3121 } 3122 3123 if (o.snapMode !== "inner") { 3124 ts = Math.abs(t - y2) <= d; 3125 bs = Math.abs(b - y1) <= d; 3126 ls = Math.abs(l - x2) <= d; 3127 rs = Math.abs(r - x1) <= d; 3128 if (ts) { 3129 ui.position.top = inst._convertPositionTo("relative", { 3130 top: t - inst.helperProportions.height, 3131 left: 0 3132 }).top; 3133 } 3134 if (bs) { 3135 ui.position.top = inst._convertPositionTo("relative", { 3136 top: b, 3137 left: 0 3138 }).top; 3139 } 3140 if (ls) { 3141 ui.position.left = inst._convertPositionTo("relative", { 3142 top: 0, 3143 left: l - inst.helperProportions.width 3144 }).left; 3145 } 3146 if (rs) { 3147 ui.position.left = inst._convertPositionTo("relative", { 3148 top: 0, 3149 left: r 3150 }).left; 3151 } 3152 } 3153 3154 first = (ts || bs || ls || rs); 3155 3156 if (o.snapMode !== "outer") { 3157 ts = Math.abs(t - y1) <= d; 3158 bs = Math.abs(b - y2) <= d; 3159 ls = Math.abs(l - x1) <= d; 3160 rs = Math.abs(r - x2) <= d; 3161 if (ts) { 3162 ui.position.top = inst._convertPositionTo("relative", { 3163 top: t, 3164 left: 0 3165 }).top; 3166 } 3167 if (bs) { 3168 ui.position.top = inst._convertPositionTo("relative", { 3169 top: b - inst.helperProportions.height, 3170 left: 0 3171 }).top; 3172 } 3173 if (ls) { 3174 ui.position.left = inst._convertPositionTo("relative", { 3175 top: 0, 3176 left: l 3177 }).left; 3178 } 3179 if (rs) { 3180 ui.position.left = inst._convertPositionTo("relative", { 3181 top: 0, 3182 left: r - inst.helperProportions.width 3183 }).left; 3184 } 3185 } 3186 3187 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 3188 (inst.options.snap.snap && 3189 inst.options.snap.snap.call( 3190 inst.element, 3191 event, 3192 $.extend(inst._uiHash(), { 3193 snapItem: inst.snapElements[i].item 3194 }))); 3195 } 3196 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 3197 3198 } 3199 3200 } 3201 }); 3202 3203 $.ui.plugin.add("draggable", "stack", { 3204 start: function (event, ui, instance) { 3205 var min, 3206 o = instance.options, 3207 group = $.makeArray($(o.stack)).sort(function (a, b) { 3208 return (parseInt($(a).css("zIndex"), 10) || 0) - 3209 (parseInt($(b).css("zIndex"), 10) || 0); 3210 }); 3211 3212 if (!group.length) { return; } 3213 3214 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 3215 $(group).each(function (i) { 3216 $(this).css("zIndex", min + i); 3217 }); 3218 this.css("zIndex", (min + group.length)); 3219 } 3220 }); 3221 3222 $.ui.plugin.add("draggable", "zIndex", { 3223 start: function (event, ui, instance) { 3224 var t = $(ui.helper), 3225 o = instance.options; 3226 3227 if (t.css("zIndex")) { 3228 o._zIndex = t.css("zIndex"); 3229 } 3230 t.css("zIndex", o.zIndex); 3231 }, 3232 stop: function (event, ui, instance) { 3233 var o = instance.options; 3234 3235 if (o._zIndex) { 3236 $(ui.helper).css("zIndex", o._zIndex); 3237 } 3238 } 3239 }); 3240 3241 var widgetsDraggable = $.ui.draggable; 3242 3243 3244 /*! 3245 * jQuery UI Droppable 1.12.1 3246 * http://jqueryui.com 3247 * 3248 * Copyright jQuery Foundation and other contributors 3249 * Released under the MIT license. 3250 * http://jquery.org/license 3251 */ 3252 3253 //>>label: Droppable 3254 //>>group: Interactions 3255 //>>description: Enables drop targets for draggable elements. 3256 //>>docs: http://api.jqueryui.com/droppable/ 3257 //>>demos: http://jqueryui.com/droppable/ 3258 3259 3260 3261 $.widget("ui.droppable", { 3262 version: "1.12.1", 3263 widgetEventPrefix: "drop", 3264 options: { 3265 accept: "*", 3266 addClasses: true,
vendor: 18,805 bytes, lines 3267-4007
3267 greedy: false, 3268 scope: "default", 3269 tolerance: "intersect", 3270 3271 // Callbacks 3272 activate: null, 3273 deactivate: null, 3274 drop: null, 3275 out: null, 3276 over: null 3277 }, 3278 _create: function () { 3279 3280 var proportions, 3281 o = this.options, 3282 accept = o.accept; 3283 3284 this.isover = false; 3285 this.isout = true; 3286 3287 this.accept = $.isFunction(accept) ? accept : function (d) { 3288 return d.is(accept); 3289 }; 3290 3291 this.proportions = function ( /* valueToWrite */) { 3292 if (arguments.length) { 3293 3294 // Store the droppable's proportions 3295 proportions = arguments[0]; 3296 } else { 3297 3298 // Retrieve or derive the droppable's proportions 3299 return proportions ? 3300 proportions : 3301 proportions = { 3302 width: this.element[0].offsetWidth, 3303 height: this.element[0].offsetHeight 3304 }; 3305 } 3306 }; 3307 3308 this._addToManager(o.scope); 3309 3310 o.addClasses && this._addClass("ui-droppable"); 3311 3312 }, 3313 3314 _addToManager: function (scope) { 3315 3316 // Add the reference and positions to the manager 3317 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 3318 $.ui.ddmanager.droppables[scope].push(this); 3319 }, 3320 3321 _splice: function (drop) { 3322 var i = 0; 3323 for (; i < drop.length; i++) { 3324 if (drop[i] === this) { 3325 drop.splice(i, 1); 3326 } 3327 } 3328 }, 3329 3330 _destroy: function () { 3331 var drop = $.ui.ddmanager.droppables[this.options.scope]; 3332 3333 this._splice(drop); 3334 }, 3335 3336 _setOption: function (key, value) { 3337 3338 if (key === "accept") { 3339 this.accept = $.isFunction(value) ? value : function (d) { 3340 return d.is(value); 3341 }; 3342 } else if (key === "scope") { 3343 var drop = $.ui.ddmanager.droppables[this.options.scope]; 3344 3345 this._splice(drop); 3346 this._addToManager(value); 3347 } 3348 3349 this._super(key, value); 3350 }, 3351 3352 _activate: function (event) { 3353 var draggable = $.ui.ddmanager.current; 3354 3355 this._addActiveClass(); 3356 if (draggable) { 3357 this._trigger("activate", event, this.ui(draggable)); 3358 } 3359 }, 3360 3361 _deactivate: function (event) { 3362 var draggable = $.ui.ddmanager.current; 3363 3364 this._removeActiveClass(); 3365 if (draggable) { 3366 this._trigger("deactivate", event, this.ui(draggable)); 3367 } 3368 }, 3369 3370 _over: function (event) { 3371 3372 var draggable = $.ui.ddmanager.current; 3373 3374 // Bail if draggable and droppable are same element 3375 if (!draggable || (draggable.currentItem || 3376 draggable.element)[0] === this.element[0]) { 3377 return; 3378 } 3379 3380 if (this.accept.call(this.element[0], (draggable.currentItem || 3381 draggable.element))) { 3382 this._addHoverClass(); 3383 this._trigger("over", event, this.ui(draggable)); 3384 } 3385 3386 }, 3387 3388 _out: function (event) { 3389 3390 var draggable = $.ui.ddmanager.current; 3391 3392 // Bail if draggable and droppable are same element 3393 if (!draggable || (draggable.currentItem || 3394 draggable.element)[0] === this.element[0]) { 3395 return; 3396 } 3397 3398 if (this.accept.call(this.element[0], (draggable.currentItem || 3399 draggable.element))) { 3400 this._removeHoverClass(); 3401 this._trigger("out", event, this.ui(draggable)); 3402 } 3403 3404 }, 3405 3406 _drop: function (event, custom) { 3407 3408 var draggable = custom || $.ui.ddmanager.current, 3409 childrenIntersection = false; 3410 3411 // Bail if draggable and droppable are same element 3412 if (!draggable || (draggable.currentItem || 3413 draggable.element)[0] === this.element[0]) { 3414 return false; 3415 } 3416 3417 this.element 3418 .find(":data(ui-droppable)") 3419 .not(".ui-draggable-dragging") 3420 .each(function () { 3421 var inst = $(this).droppable("instance"); 3422 if ( 3423 inst.options.greedy && 3424 !inst.options.disabled && 3425 inst.options.scope === draggable.options.scope && 3426 inst.accept.call( 3427 inst.element[0], (draggable.currentItem || draggable.element) 3428 ) && 3429 intersect( 3430 draggable, 3431 $.extend(inst, { offset: inst.element.offset() }), 3432 inst.options.tolerance, event 3433 ) 3434 ) { 3435 childrenIntersection = true; 3436 return false; 3437 } 3438 }); 3439 if (childrenIntersection) { 3440 return false; 3441 } 3442 3443 if (this.accept.call(this.element[0], 3444 (draggable.currentItem || draggable.element))) { 3445 this._removeActiveClass(); 3446 this._removeHoverClass(); 3447 3448 this._trigger("drop", event, this.ui(draggable)); 3449 return this.element; 3450 } 3451 3452 return false; 3453 3454 }, 3455 3456 ui: function (c) { 3457 return { 3458 draggable: (c.currentItem || c.element), 3459 helper: c.helper, 3460 position: c.position, 3461 offset: c.positionAbs 3462 }; 3463 }, 3464 3465 // Extension points just to make backcompat sane and avoid duplicating logic 3466 // TODO: Remove in 1.13 along with call to it below 3467 _addHoverClass: function () { 3468 this._addClass("ui-droppable-hover"); 3469 }, 3470 3471 _removeHoverClass: function () { 3472 this._removeClass("ui-droppable-hover"); 3473 }, 3474 3475 _addActiveClass: function () { 3476 this._addClass("ui-droppable-active"); 3477 }, 3478 3479 _removeActiveClass: function () { 3480 this._removeClass("ui-droppable-active"); 3481 } 3482 }); 3483 3484 var intersect = $.ui.intersect = (function () { 3485 function isOverAxis(x, reference, size) { 3486 return (x >= reference) && (x < (reference + size)); 3487 } 3488 3489 return function (draggable, droppable, toleranceMode, event) { 3490 3491 if (!droppable.offset) { 3492 return false; 3493 } 3494 3495 var x1 = (draggable.positionAbs || 3496 draggable.position.absolute).left + draggable.margins.left, 3497 y1 = (draggable.positionAbs || 3498 draggable.position.absolute).top + draggable.margins.top, 3499 x2 = x1 + draggable.helperProportions.width, 3500 y2 = y1 + draggable.helperProportions.height, 3501 l = droppable.offset.left, 3502 t = droppable.offset.top, 3503 r = l + droppable.proportions().width, 3504 b = t + droppable.proportions().height; 3505 3506 switch (toleranceMode) { 3507 case "fit": 3508 return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 3509 case "intersect": 3510 return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 3511 x2 - (draggable.helperProportions.width / 2) < r && // Left Half 3512 t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 3513 y2 - (draggable.helperProportions.height / 2) < b); // Top Half 3514 case "pointer": 3515 return isOverAxis(event.pageY, t, droppable.proportions().height) && 3516 isOverAxis(event.pageX, l, droppable.proportions().width); 3517 case "touch": 3518 return ( 3519 (y1 >= t && y1 <= b) || // Top edge touching 3520 (y2 >= t && y2 <= b) || // Bottom edge touching 3521 (y1 < t && y2 > b) // Surrounded vertically 3522 ) && ( 3523 (x1 >= l && x1 <= r) || // Left edge touching 3524 (x2 >= l && x2 <= r) || // Right edge touching 3525 (x1 < l && x2 > r) // Surrounded horizontally 3526 ); 3527 default: 3528 return false; 3529 } 3530 }; 3531 })(); 3532 3533 /* 3534 This manager tracks offsets of draggables and droppables 3535 */ 3536 $.ui.ddmanager = { 3537 current: null, 3538 droppables: { "default": [] }, 3539 prepareOffsets: function (t, event) { 3540 3541 var i, j, 3542 m = $.ui.ddmanager.droppables[t.options.scope] || [], 3543 type = event ? event.type : null, // workaround for #2317 3544 list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 3545 3546 droppablesLoop: for (i = 0; i < m.length; i++) { 3547 3548 // No disabled and non-accepted 3549 if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], 3550 (t.currentItem || t.element)))) { 3551 continue; 3552 } 3553 3554 // Filter out elements in the current dragged item 3555 for (j = 0; j < list.length; j++) { 3556 if (list[j] === m[i].element[0]) { 3557 m[i].proportions().height = 0; 3558 continue droppablesLoop; 3559 } 3560 } 3561 3562 m[i].visible = m[i].element.css("display") !== "none"; 3563 if (!m[i].visible) { 3564 continue; 3565 } 3566 3567 // Activate the droppable if used directly from draggables 3568 if (type === "mousedown") { 3569 m[i]._activate.call(m[i], event); 3570 } 3571 3572 m[i].offset = m[i].element.offset(); 3573 m[i].proportions({ 3574 width: m[i].element[0].offsetWidth, 3575 height: m[i].element[0].offsetHeight 3576 }); 3577 3578 } 3579 3580 }, 3581 drop: function (draggable, event) { 3582 3583 var dropped = false; 3584 3585 // Create a copy of the droppables in case the list changes during the drop (#9116) 3586 $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () { 3587 3588 if (!this.options) { 3589 return; 3590 } 3591 if (!this.options.disabled && this.visible && 3592 intersect(draggable, this, this.options.tolerance, event)) { 3593 dropped = this._drop.call(this, event) || dropped; 3594 } 3595 3596 if (!this.options.disabled && this.visible && this.accept.call(this.element[0], 3597 (draggable.currentItem || draggable.element))) { 3598 this.isout = true; 3599 this.isover = false; 3600 this._deactivate.call(this, event); 3601 } 3602 3603 }); 3604 return dropped; 3605 3606 }, 3607 dragStart: function (draggable, event) { 3608 3609 // Listen for scrolling so that if the dragging causes scrolling the position of the 3610 // droppables can be recalculated (see #5003) 3611 draggable.element.parentsUntil("body").on("scroll.droppable", function () { 3612 if (!draggable.options.refreshPositions) { 3613 $.ui.ddmanager.prepareOffsets(draggable, event); 3614 } 3615 }); 3616 }, 3617 drag: function (draggable, event) { 3618 3619 // If you have a highly dynamic page, you might try this option. It renders positions 3620 // every time you move the mouse. 3621 if (draggable.options.refreshPositions) { 3622 $.ui.ddmanager.prepareOffsets(draggable, event); 3623 } 3624 3625 // Run through all droppables and check their positions based on specific tolerance options 3626 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () { 3627 3628 if (this.options.disabled || this.greedyChild || !this.visible) { 3629 return; 3630 } 3631 3632 var parentInstance, scope, parent, 3633 intersects = intersect(draggable, this, this.options.tolerance, event), 3634 c = !intersects && this.isover ? 3635 "isout" : 3636 (intersects && !this.isover ? "isover" : null); 3637 if (!c) { 3638 return; 3639 } 3640 3641 if (this.options.greedy) { 3642 3643 // find droppable parents with same scope 3644 scope = this.options.scope; 3645 parent = this.element.parents(":data(ui-droppable)").filter(function () { 3646 return $(this).droppable("instance").options.scope === scope; 3647 }); 3648 3649 if (parent.length) { 3650 parentInstance = $(parent[0]).droppable("instance"); 3651 parentInstance.greedyChild = (c === "isover"); 3652 } 3653 } 3654 3655 // We just moved into a greedy child 3656 if (parentInstance && c === "isover") { 3657 parentInstance.isover = false; 3658 parentInstance.isout = true; 3659 parentInstance._out.call(parentInstance, event); 3660 } 3661 3662 this[c] = true; 3663 this[c === "isout" ? "isover" : "isout"] = false; 3664 this[c === "isover" ? "_over" : "_out"].call(this, event); 3665 3666 // We just moved out of a greedy child 3667 if (parentInstance && c === "isout") { 3668 parentInstance.isout = false; 3669 parentInstance.isover = true; 3670 parentInstance._over.call(parentInstance, event); 3671 } 3672 }); 3673 3674 }, 3675 dragStop: function (draggable, event) { 3676 draggable.element.parentsUntil("body").off("scroll.droppable"); 3677 3678 // Call prepareOffsets one final time since IE does not fire return scroll events when 3679 // overflow was caused by drag (see #5003) 3680 if (!draggable.options.refreshPositions) { 3681 $.ui.ddmanager.prepareOffsets(draggable, event); 3682 } 3683 } 3684 }; 3685 3686 // DEPRECATED 3687 // TODO: switch return back to widget declaration at top of file when this is removed 3688 if ($.uiBackCompat !== false) { 3689 3690 // Backcompat for activeClass and hoverClass options 3691 $.widget("ui.droppable", $.ui.droppable, { 3692 options: { 3693 hoverClass: false, 3694 activeClass: false 3695 }, 3696 _addActiveClass: function () { 3697 this._super(); 3698 if (this.options.activeClass) { 3699 this.element.addClass(this.options.activeClass); 3700 } 3701 }, 3702 _removeActiveClass: function () { 3703 this._super(); 3704 if (this.options.activeClass) { 3705 this.element.removeClass(this.options.activeClass); 3706 } 3707 }, 3708 _addHoverClass: function () { 3709 this._super(); 3710 if (this.options.hoverClass) { 3711 this.element.addClass(this.options.hoverClass); 3712 } 3713 }, 3714 _removeHoverClass: function () { 3715 this._super(); 3716 if (this.options.hoverClass) { 3717 this.element.removeClass(this.options.hoverClass); 3718 } 3719 } 3720 }); 3721 } 3722 3723 var widgetsDroppable = $.ui.droppable; 3724 3725 3726 /*! 3727 * jQuery UI Resizable 1.12.1 3728 * http://jqueryui.com 3729 * 3730 * Copyright jQuery Foundation and other contributors 3731 * Released under the MIT license. 3732 * http://jquery.org/license 3733 */ 3734 3735 //>>label: Resizable 3736 //>>group: Interactions 3737 //>>description: Enables resize functionality for any element. 3738 //>>docs: http://api.jqueryui.com/resizable/ 3739 //>>demos: http://jqueryui.com/resizable/ 3740 //>>css.structure: ../../themes/base/core.css 3741 //>>css.structure: ../../themes/base/resizable.css 3742 //>>css.theme: ../../themes/base/theme.css 3743 3744 3745 3746 $.widget("ui.resizable", $.ui.mouse, { 3747 version: "1.12.1", 3748 widgetEventPrefix: "resize", 3749 options: { 3750 alsoResize: false, 3751 animate: false, 3752 animateDuration: "slow", 3753 animateEasing: "swing", 3754 aspectRatio: false, 3755 autoHide: false, 3756 classes: { 3757 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 3758 }, 3759 containment: false, 3760 ghost: false, 3761 grid: false, 3762 handles: "e,s,se", 3763 helper: false, 3764 maxHeight: null, 3765 maxWidth: null, 3766 minHeight: 10, 3767 minWidth: 10, 3768 3769 // See #7960 3770 zIndex: 90, 3771 3772 // Callbacks 3773 resize: null, 3774 start: null, 3775 stop: null 3776 }, 3777 3778 _num: function (value) { 3779 return parseFloat(value) || 0; 3780 }, 3781 3782 _isNumber: function (value) { 3783 return !isNaN(parseFloat(value)); 3784 }, 3785 3786 _hasScroll: function (el, a) { 3787 3788 if ($(el).css("overflow") === "hidden") { 3789 return false; 3790 } 3791 3792 var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop", 3793 has = false; 3794 3795 if (el[scroll] > 0) { 3796 return true; 3797 } 3798 3799 // TODO: determine which cases actually cause this to happen 3800 // if the element doesn't have the scroll set, see if it's possible to 3801 // set the scroll 3802 el[scroll] = 1; 3803 has = (el[scroll] > 0); 3804 el[scroll] = 0; 3805 return has; 3806 }, 3807 3808 _create: function () { 3809 3810 var margins, 3811 o = this.options, 3812 that = this; 3813 this._addClass("ui-resizable"); 3814 3815 $.extend(this, { 3816 _aspectRatio: !!(o.aspectRatio), 3817 aspectRatio: o.aspectRatio, 3818 originalElement: this.element, 3819 _proportionallyResizeElements: [], 3820 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 3821 }); 3822 3823 // Wrap the element if it cannot hold child nodes 3824 if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) { 3825 3826 this.element.wrap( 3827 $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ 3828 position: this.element.css("position"), 3829 width: this.element.outerWidth(), 3830 height: this.element.outerHeight(), 3831 top: this.element.css("top"), 3832 left: this.element.css("left") 3833 }) 3834 ); 3835 3836 this.element = this.element.parent().data( 3837 "ui-resizable", this.element.resizable("instance") 3838 ); 3839 3840 this.elementIsWrapper = true; 3841 3842 margins = { 3843 marginTop: this.originalElement.css("marginTop"), 3844 marginRight: this.originalElement.css("marginRight"), 3845 marginBottom: this.originalElement.css("marginBottom"), 3846 marginLeft: this.originalElement.css("marginLeft") 3847 }; 3848 3849 this.element.css(margins); 3850 this.originalElement.css("margin", 0); 3851 3852 // support: Safari 3853 // Prevent Safari textarea resize 3854 this.originalResizeStyle = this.originalElement.css("resize"); 3855 this.originalElement.css("resize", "none"); 3856 3857 this._proportionallyResizeElements.push(this.originalElement.css({ 3858 position: "static", 3859 zoom: 1, 3860 display: "block" 3861 })); 3862 3863 // Support: IE9 3864 // avoid IE jump (hard set the margin) 3865 this.originalElement.css(margins); 3866 3867 this._proportionallyResize(); 3868 } 3869 3870 this._setupHandles(); 3871 3872 if (o.autoHide) { 3873 $(this.element) 3874 .on("mouseenter", function () { 3875 if (o.disabled) { 3876 return; 3877 } 3878 that._removeClass("ui-resizable-autohide"); 3879 that._handles.show(); 3880 }) 3881 .on("mouseleave", function () { 3882 if (o.disabled) { 3883 return; 3884 } 3885 if (!that.resizing) { 3886 that._addClass("ui-resizable-autohide"); 3887 that._handles.hide(); 3888 } 3889 }); 3890 } 3891 3892 this._mouseInit(); 3893 }, 3894 3895 _destroy: function () { 3896 3897 this._mouseDestroy(); 3898 3899 var wrapper, 3900 _destroy = function (exp) { 3901 $(exp) 3902 .removeData("resizable") 3903 .removeData("ui-resizable") 3904 .off(".resizable") 3905 .find(".ui-resizable-handle") 3906 .remove(); 3907 }; 3908 3909 // TODO: Unwrap at same DOM position 3910 if (this.elementIsWrapper) { 3911 _destroy(this.element); 3912 wrapper = this.element; 3913 this.originalElement.css({ 3914 position: wrapper.css("position"), 3915 width: wrapper.outerWidth(), 3916 height: wrapper.outerHeight(), 3917 top: wrapper.css("top"), 3918 left: wrapper.css("left") 3919 }).insertAfter(wrapper); 3920 wrapper.remove(); 3921 } 3922 3923 this.originalElement.css("resize", this.originalResizeStyle); 3924 _destroy(this.originalElement); 3925 3926 return this; 3927 }, 3928 3929 _setOption: function (key, value) { 3930 this._super(key, value); 3931 3932 switch (key) { 3933 case "handles": 3934 this._removeHandles(); 3935 this._setupHandles(); 3936 break; 3937 default: 3938 break; 3939 } 3940 }, 3941 3942 _setupHandles: function () { 3943 var o = this.options, handle, i, n, hname, axis, that = this; 3944 this.handles = o.handles || 3945 (!$(".ui-resizable-handle", this.element).length ? 3946 "e,s,se" : { 3947 n: ".ui-resizable-n", 3948 e: ".ui-resizable-e", 3949 s: ".ui-resizable-s", 3950 w: ".ui-resizable-w", 3951 se: ".ui-resizable-se", 3952 sw: ".ui-resizable-sw", 3953 ne: ".ui-resizable-ne", 3954 nw: ".ui-resizable-nw" 3955 }); 3956 3957 this._handles = $(); 3958 if (this.handles.constructor === String) { 3959 3960 if (this.handles === "all") { 3961 this.handles = "n,e,s,w,se,sw,ne,nw"; 3962 } 3963 3964 n = this.handles.split(","); 3965 this.handles = {}; 3966 3967 for (i = 0; i < n.length; i++) { 3968 3969 handle = $.trim(n[i]); 3970 hname = "ui-resizable-" + handle; 3971 axis = $("<div>"); 3972 this._addClass(axis, "ui-resizable-handle " + hname); 3973 3974 axis.css({ zIndex: o.zIndex }); 3975 3976 this.handles[handle] = ".ui-resizable-" + handle; 3977 this.element.append(axis); 3978 } 3979 3980 } 3981 3982 this._renderAxis = function (target) { 3983 3984 var i, axis, padPos, padWrapper; 3985 3986 target = target || this.element; 3987 3988 for (i in this.handles) { 3989 3990 if (this.handles[i].constructor === String) { 3991 this.handles[i] = this.element.children(this.handles[i]).first().show(); 3992 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 3993 this.handles[i] = $(this.handles[i]); 3994 this._on(this.handles[i], { "mousedown": that._mouseDown }); 3995 } 3996 3997 if (this.elementIsWrapper && 3998 this.originalElement[0] 3999 .nodeName 4000 .match(/^(textarea|input|select|button)$/i)) { 4001 axis = $(this.handles[i], this.element); 4002 4003 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? 4004 axis.outerHeight() : 4005 axis.outerWidth(); 4006 4007 padPos = ["padding",
vendor: 4,471 bytes, lines 4008-4188
4008 /ne|nw|n/.test(i) ? "Top" : 4009 /se|sw|s/.test(i) ? "Bottom" : 4010 /^e$/.test(i) ? "Right" : "Left"].join(""); 4011 4012 target.css(padPos, padWrapper); 4013 4014 this._proportionallyResize(); 4015 } 4016 4017 this._handles = this._handles.add(this.handles[i]); 4018 } 4019 }; 4020 4021 // TODO: make renderAxis a prototype function 4022 this._renderAxis(this.element); 4023 4024 this._handles = this._handles.add(this.element.find(".ui-resizable-handle")); 4025 this._handles.disableSelection(); 4026 4027 this._handles.on("mouseover", function () { 4028 if (!that.resizing) { 4029 if (this.className) { 4030 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 4031 } 4032 that.axis = axis && axis[1] ? axis[1] : "se"; 4033 } 4034 }); 4035 4036 if (o.autoHide) { 4037 this._handles.hide(); 4038 this._addClass("ui-resizable-autohide"); 4039 } 4040 }, 4041 4042 _removeHandles: function () { 4043 this._handles.remove(); 4044 }, 4045 4046 _mouseCapture: function (event) { 4047 var i, handle, 4048 capture = false; 4049 4050 for (i in this.handles) { 4051 handle = $(this.handles[i])[0]; 4052 if (handle === event.target || $.contains(handle, event.target)) { 4053 capture = true; 4054 } 4055 } 4056 4057 return !this.options.disabled && capture; 4058 }, 4059 4060 _mouseStart: function (event) { 4061 4062 var curleft, curtop, cursor, 4063 o = this.options, 4064 el = this.element; 4065 4066 this.resizing = true; 4067 4068 this._renderProxy(); 4069 4070 curleft = this._num(this.helper.css("left")); 4071 curtop = this._num(this.helper.css("top")); 4072 4073 if (o.containment) { 4074 curleft += $(o.containment).scrollLeft() || 0; 4075 curtop += $(o.containment).scrollTop() || 0; 4076 } 4077 4078 this.offset = this.helper.offset(); 4079 this.position = { left: curleft, top: curtop }; 4080 4081 this.size = this._helper ? { 4082 width: this.helper.width(), 4083 height: this.helper.height() 4084 } : { 4085 width: el.width(), 4086 height: el.height() 4087 }; 4088 4089 this.originalSize = this._helper ? { 4090 width: el.outerWidth(), 4091 height: el.outerHeight() 4092 } : { 4093 width: el.width(), 4094 height: el.height() 4095 }; 4096 4097 this.sizeDiff = { 4098 width: el.outerWidth() - el.width(), 4099 height: el.outerHeight() - el.height() 4100 }; 4101 4102 this.originalPosition = { left: curleft, top: curtop }; 4103 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 4104 4105 this.aspectRatio = (typeof o.aspectRatio === "number") ? 4106 o.aspectRatio : 4107 ((this.originalSize.width / this.originalSize.height) || 1); 4108 4109 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 4110 $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); 4111 4112 this._addClass("ui-resizable-resizing"); 4113 this._propagate("start", event); 4114 return true; 4115 }, 4116 4117 _mouseDrag: function (event) { 4118 4119 var data, props, 4120 smp = this.originalMousePosition, 4121 a = this.axis, 4122 dx = (event.pageX - smp.left) || 0, 4123 dy = (event.pageY - smp.top) || 0, 4124 trigger = this._change[a]; 4125 4126 this._updatePrevProperties(); 4127 4128 if (!trigger) { 4129 return false; 4130 } 4131 4132 data = trigger.apply(this, [event, dx, dy]); 4133 4134 this._updateVirtualBoundaries(event.shiftKey); 4135 if (this._aspectRatio || event.shiftKey) { 4136 data = this._updateRatio(data, event); 4137 } 4138 4139 data = this._respectSize(data, event); 4140 4141 this._updateCache(data); 4142 4143 this._propagate("resize", event); 4144 4145 props = this._applyChanges(); 4146 4147 if (!this._helper && this._proportionallyResizeElements.length) { 4148 this._proportionallyResize(); 4149 } 4150 4151 if (!$.isEmptyObject(props)) { 4152 this._updatePrevProperties(); 4153 this._trigger("resize", event, this.ui()); 4154 this._applyChanges(); 4155 } 4156 4157 return false; 4158 }, 4159 4160 _mouseStop: function (event) { 4161 4162 this.resizing = false; 4163 var pr, ista, soffseth, soffsetw, s, left, top, 4164 o = this.options, that = this; 4165 4166 if (this._helper) { 4167 4168 pr = this._proportionallyResizeElements; 4169 ista = pr.length && (/textarea/i).test(pr[0].nodeName); 4170 soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 4171 soffsetw = ista ? 0 : that.sizeDiff.width; 4172 4173 s = { 4174 width: (that.helper.width() - soffsetw), 4175 height: (that.helper.height() - soffseth) 4176 }; 4177 left = (parseFloat(that.element.css("left")) + 4178 (that.position.left - that.originalPosition.left)) || null; 4179 top = (parseFloat(that.element.css("top")) + 4180 (that.position.top - that.originalPosition.top)) || null; 4181 4182 if (!o.animate) { 4183 this.element.css($.extend(s, { top: top, left: left })); 4184 } 4185 4186 that.helper.height(that.size.height); 4187 that.helper.width(that.size.width); 4188
vendor: 9,572 bytes, lines 4189-4566
4189 if (this._helper && !o.animate) { 4190 this._proportionallyResize(); 4191 } 4192 } 4193 4194 $("body").css("cursor", "auto"); 4195 4196 this._removeClass("ui-resizable-resizing"); 4197 4198 this._propagate("stop", event); 4199 4200 if (this._helper) { 4201 this.helper.remove(); 4202 } 4203 4204 return false; 4205 4206 }, 4207 4208 _updatePrevProperties: function () { 4209 this.prevPosition = { 4210 top: this.position.top, 4211 left: this.position.left 4212 }; 4213 this.prevSize = { 4214 width: this.size.width, 4215 height: this.size.height 4216 }; 4217 }, 4218 4219 _applyChanges: function () { 4220 var props = {}; 4221 4222 if (this.position.top !== this.prevPosition.top) { 4223 props.top = this.position.top + "px"; 4224 } 4225 if (this.position.left !== this.prevPosition.left) { 4226 props.left = this.position.left + "px"; 4227 } 4228 if (this.size.width !== this.prevSize.width) { 4229 props.width = this.size.width + "px"; 4230 } 4231 if (this.size.height !== this.prevSize.height) { 4232 props.height = this.size.height + "px"; 4233 } 4234 4235 this.helper.css(props); 4236 4237 return props; 4238 }, 4239 4240 _updateVirtualBoundaries: function (forceAspectRatio) { 4241 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 4242 o = this.options; 4243 4244 b = { 4245 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 4246 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 4247 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 4248 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity 4249 }; 4250 4251 if (this._aspectRatio || forceAspectRatio) { 4252 pMinWidth = b.minHeight * this.aspectRatio; 4253 pMinHeight = b.minWidth / this.aspectRatio; 4254 pMaxWidth = b.maxHeight * this.aspectRatio; 4255 pMaxHeight = b.maxWidth / this.aspectRatio; 4256 4257 if (pMinWidth > b.minWidth) { 4258 b.minWidth = pMinWidth; 4259 } 4260 if (pMinHeight > b.minHeight) { 4261 b.minHeight = pMinHeight; 4262 } 4263 if (pMaxWidth < b.maxWidth) { 4264 b.maxWidth = pMaxWidth; 4265 } 4266 if (pMaxHeight < b.maxHeight) { 4267 b.maxHeight = pMaxHeight; 4268 } 4269 } 4270 this._vBoundaries = b; 4271 }, 4272 4273 _updateCache: function (data) { 4274 this.offset = this.helper.offset(); 4275 if (this._isNumber(data.left)) { 4276 this.position.left = data.left; 4277 } 4278 if (this._isNumber(data.top)) { 4279 this.position.top = data.top; 4280 } 4281 if (this._isNumber(data.height)) { 4282 this.size.height = data.height; 4283 } 4284 if (this._isNumber(data.width)) { 4285 this.size.width = data.width; 4286 } 4287 }, 4288 4289 _updateRatio: function (data) { 4290 4291 var cpos = this.position, 4292 csize = this.size, 4293 a = this.axis; 4294 4295 if (this._isNumber(data.height)) { 4296 data.width = (data.height * this.aspectRatio); 4297 } else if (this._isNumber(data.width)) { 4298 data.height = (data.width / this.aspectRatio); 4299 } 4300 4301 if (a === "sw") { 4302 data.left = cpos.left + (csize.width - data.width); 4303 data.top = null; 4304 } 4305 if (a === "nw") { 4306 data.top = cpos.top + (csize.height - data.height); 4307 data.left = cpos.left + (csize.width - data.width); 4308 } 4309 4310 return data; 4311 }, 4312 4313 _respectSize: function (data) { 4314 4315 var o = this._vBoundaries, 4316 a = this.axis, 4317 ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), 4318 ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 4319 isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), 4320 isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), 4321 dw = this.originalPosition.left + this.originalSize.width, 4322 dh = this.originalPosition.top + this.originalSize.height, 4323 cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 4324 if (isminw) { 4325 data.width = o.minWidth; 4326 } 4327 if (isminh) { 4328 data.height = o.minHeight; 4329 } 4330 if (ismaxw) { 4331 data.width = o.maxWidth; 4332 } 4333 if (ismaxh) { 4334 data.height = o.maxHeight; 4335 } 4336 4337 if (isminw && cw) { 4338 data.left = dw - o.minWidth; 4339 } 4340 if (ismaxw && cw) { 4341 data.left = dw - o.maxWidth; 4342 } 4343 if (isminh && ch) { 4344 data.top = dh - o.minHeight; 4345 } 4346 if (ismaxh && ch) { 4347 data.top = dh - o.maxHeight; 4348 } 4349 4350 // Fixing jump error on top/left - bug #2330 4351 if (!data.width && !data.height && !data.left && data.top) { 4352 data.top = null; 4353 } else if (!data.width && !data.height && !data.top && data.left) { 4354 data.left = null; 4355 } 4356 4357 return data; 4358 }, 4359 4360 _getPaddingPlusBorderDimensions: function (element) { 4361 var i = 0, 4362 widths = [], 4363 borders = [ 4364 element.css("borderTopWidth"), 4365 element.css("borderRightWidth"), 4366 element.css("borderBottomWidth"), 4367 element.css("borderLeftWidth") 4368 ], 4369 paddings = [ 4370 element.css("paddingTop"), 4371 element.css("paddingRight"), 4372 element.css("paddingBottom"), 4373 element.css("paddingLeft") 4374 ]; 4375 4376 for (; i < 4; i++) { 4377 widths[i] = (parseFloat(borders[i]) || 0); 4378 widths[i] += (parseFloat(paddings[i]) || 0); 4379 } 4380 4381 return { 4382 height: widths[0] + widths[2], 4383 width: widths[1] + widths[3] 4384 }; 4385 }, 4386 4387 _proportionallyResize: function () { 4388 4389 if (!this._proportionallyResizeElements.length) { 4390 return; 4391 } 4392 4393 var prel, 4394 i = 0, 4395 element = this.helper || this.element; 4396 4397 for (; i < this._proportionallyResizeElements.length; i++) { 4398 4399 prel = this._proportionallyResizeElements[i]; 4400 4401 // TODO: Seems like a bug to cache this.outerDimensions 4402 // considering that we are in a loop. 4403 if (!this.outerDimensions) { 4404 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 4405 } 4406 4407 prel.css({ 4408 height: (element.height() - this.outerDimensions.height) || 0, 4409 width: (element.width() - this.outerDimensions.width) || 0 4410 }); 4411 4412 } 4413 4414 }, 4415 4416 _renderProxy: function () { 4417 4418 var el = this.element, o = this.options; 4419 this.elementOffset = el.offset(); 4420 4421 if (this._helper) { 4422 4423 this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); 4424 4425 this._addClass(this.helper, this._helper); 4426 this.helper.css({ 4427 width: this.element.outerWidth(), 4428 height: this.element.outerHeight(), 4429 position: "absolute", 4430 left: this.elementOffset.left + "px", 4431 top: this.elementOffset.top + "px", 4432 zIndex: ++o.zIndex //TODO: Don't modify option 4433 }); 4434 4435 this.helper 4436 .appendTo("body") 4437 .disableSelection(); 4438 4439 } else { 4440 this.helper = this.element; 4441 } 4442 4443 }, 4444 4445 _change: { 4446 e: function (event, dx) { 4447 return { width: this.originalSize.width + dx }; 4448 }, 4449 w: function (event, dx) { 4450 var cs = this.originalSize, sp = this.originalPosition; 4451 return { left: sp.left + dx, width: cs.width - dx }; 4452 }, 4453 n: function (event, dx, dy) { 4454 var cs = this.originalSize, sp = this.originalPosition; 4455 return { top: sp.top + dy, height: cs.height - dy }; 4456 }, 4457 s: function (event, dx, dy) { 4458 return { height: this.originalSize.height + dy }; 4459 }, 4460 se: function (event, dx, dy) { 4461 return $.extend(this._change.s.apply(this, arguments), 4462 this._change.e.apply(this, [event, dx, dy])); 4463 }, 4464 sw: function (event, dx, dy) { 4465 return $.extend(this._change.s.apply(this, arguments), 4466 this._change.w.apply(this, [event, dx, dy])); 4467 }, 4468 ne: function (event, dx, dy) { 4469 return $.extend(this._change.n.apply(this, arguments), 4470 this._change.e.apply(this, [event, dx, dy])); 4471 }, 4472 nw: function (event, dx, dy) { 4473 return $.extend(this._change.n.apply(this, arguments), 4474 this._change.w.apply(this, [event, dx, dy])); 4475 } 4476 }, 4477 4478 _propagate: function (n, event) { 4479 $.ui.plugin.call(this, n, [event, this.ui()]); 4480 (n !== "resize" && this._trigger(n, event, this.ui())); 4481 }, 4482 4483 plugins: {}, 4484 4485 ui: function () { 4486 return { 4487 originalElement: this.originalElement, 4488 element: this.element, 4489 helper: this.helper, 4490 position: this.position, 4491 size: this.size, 4492 originalSize: this.originalSize, 4493 originalPosition: this.originalPosition 4494 }; 4495 } 4496 4497 }); 4498 4499 /* 4500 * Resizable Extensions 4501 */ 4502 4503 $.ui.plugin.add("resizable", "animate", { 4504 4505 stop: function (event) { 4506 var that = $(this).resizable("instance"), 4507 o = that.options, 4508 pr = that._proportionallyResizeElements, 4509 ista = pr.length && (/textarea/i).test(pr[0].nodeName), 4510 soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 4511 soffsetw = ista ? 0 : that.sizeDiff.width, 4512 style = { 4513 width: (that.size.width - soffsetw), 4514 height: (that.size.height - soffseth) 4515 }, 4516 left = (parseFloat(that.element.css("left")) + 4517 (that.position.left - that.originalPosition.left)) || null, 4518 top = (parseFloat(that.element.css("top")) + 4519 (that.position.top - that.originalPosition.top)) || null; 4520 4521 that.element.animate( 4522 $.extend(style, top && left ? { top: top, left: left } : {}), { 4523 duration: o.animateDuration, 4524 easing: o.animateEasing, 4525 step: function () { 4526 4527 var data = { 4528 width: parseFloat(that.element.css("width")), 4529 height: parseFloat(that.element.css("height")), 4530 top: parseFloat(that.element.css("top")), 4531 left: parseFloat(that.element.css("left")) 4532 }; 4533 4534 if (pr && pr.length) { 4535 $(pr[0]).css({ width: data.width, height: data.height }); 4536 } 4537 4538 // Propagating resize, and updating values for each animation step 4539 that._updateCache(data); 4540 that._propagate("resize", event); 4541 4542 } 4543 } 4544 ); 4545 } 4546 4547 }); 4548 4549 $.ui.plugin.add("resizable", "containment", { 4550 4551 start: function () { 4552 var element, p, co, ch, cw, width, height, 4553 that = $(this).resizable("instance"), 4554 o = that.options, 4555 el = that.element, 4556 oc = o.containment, 4557 ce = (oc instanceof $) ? 4558 oc.get(0) : 4559 (/parent/.test(oc)) ? el.parent().get(0) : oc; 4560 4561 if (!ce) { 4562 return; 4563 } 4564 4565 that.containerElement = $(ce); 4566
vendor: 4,199 bytes, lines 4567-4721
4567 if (/document/.test(oc) || oc === document) { 4568 that.containerOffset = { 4569 left: 0, 4570 top: 0 4571 }; 4572 that.containerPosition = { 4573 left: 0, 4574 top: 0 4575 }; 4576 4577 that.parentData = { 4578 element: $(document), 4579 left: 0, 4580 top: 0, 4581 width: $(document).width(), 4582 height: $(document).height() || document.body.parentNode.scrollHeight 4583 }; 4584 } else { 4585 element = $(ce); 4586 p = []; 4587 $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) { 4588 p[i] = that._num(element.css("padding" + name)); 4589 }); 4590 4591 that.containerOffset = element.offset(); 4592 that.containerPosition = element.position(); 4593 that.containerSize = { 4594 height: (element.innerHeight() - p[3]), 4595 width: (element.innerWidth() - p[1]) 4596 }; 4597 4598 co = that.containerOffset; 4599 ch = that.containerSize.height; 4600 cw = that.containerSize.width; 4601 width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw); 4602 height = (that._hasScroll(ce) ? ce.scrollHeight : ch); 4603 4604 that.parentData = { 4605 element: ce, 4606 left: co.left, 4607 top: co.top, 4608 width: width, 4609 height: height 4610 }; 4611 } 4612 }, 4613 4614 resize: function (event) { 4615 var woset, hoset, isParent, isOffsetRelative, 4616 that = $(this).resizable("instance"), 4617 o = that.options, 4618 co = that.containerOffset, 4619 cp = that.position, 4620 pRatio = that._aspectRatio || event.shiftKey, 4621 cop = { 4622 top: 0, 4623 left: 0 4624 }, 4625 ce = that.containerElement, 4626 continueResize = true; 4627 4628 if (ce[0] !== document && (/static/).test(ce.css("position"))) { 4629 cop = co; 4630 } 4631 4632 if (cp.left < (that._helper ? co.left : 0)) { 4633 that.size.width = that.size.width + 4634 (that._helper ? 4635 (that.position.left - co.left) : 4636 (that.position.left - cop.left)); 4637 4638 if (pRatio) { 4639 that.size.height = that.size.width / that.aspectRatio; 4640 continueResize = false; 4641 } 4642 that.position.left = o.helper ? co.left : 0; 4643 } 4644 4645 if (cp.top < (that._helper ? co.top : 0)) { 4646 that.size.height = that.size.height + 4647 (that._helper ? 4648 (that.position.top - co.top) : 4649 that.position.top); 4650 4651 if (pRatio) { 4652 that.size.width = that.size.height * that.aspectRatio; 4653 continueResize = false; 4654 } 4655 that.position.top = that._helper ? co.top : 0; 4656 } 4657 4658 isParent = that.containerElement.get(0) === that.element.parent().get(0); 4659 isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); 4660 4661 if (isParent && isOffsetRelative) { 4662 that.offset.left = that.parentData.left + that.position.left; 4663 that.offset.top = that.parentData.top + that.position.top; 4664 } else { 4665 that.offset.left = that.element.offset().left; 4666 that.offset.top = that.element.offset().top; 4667 } 4668 4669 woset = Math.abs(that.sizeDiff.width + 4670 (that._helper ? 4671 that.offset.left - cop.left : 4672 (that.offset.left - co.left))); 4673 4674 hoset = Math.abs(that.sizeDiff.height + 4675 (that._helper ? 4676 that.offset.top - cop.top : 4677 (that.offset.top - co.top))); 4678 4679 if (woset + that.size.width >= that.parentData.width) { 4680 that.size.width = that.parentData.width - woset; 4681 if (pRatio) { 4682 that.size.height = that.size.width / that.aspectRatio; 4683 continueResize = false; 4684 } 4685 } 4686 4687 if (hoset + that.size.height >= that.parentData.height) { 4688 that.size.height = that.parentData.height - hoset; 4689 if (pRatio) { 4690 that.size.width = that.size.height * that.aspectRatio; 4691 continueResize = false; 4692 } 4693 } 4694 4695 if (!continueResize) { 4696 that.position.left = that.prevPosition.left; 4697 that.position.top = that.prevPosition.top; 4698 that.size.width = that.prevSize.width; 4699 that.size.height = that.prevSize.height; 4700 } 4701 }, 4702 4703 stop: function () { 4704 var that = $(this).resizable("instance"), 4705 o = that.options, 4706 co = that.containerOffset, 4707 cop = that.containerPosition, 4708 ce = that.containerElement, 4709 helper = $(that.helper), 4710 ho = helper.offset(), 4711 w = helper.outerWidth() - that.sizeDiff.width, 4712 h = helper.outerHeight() - that.sizeDiff.height; 4713 4714 if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { 4715 $(this).css({ 4716 left: ho.left - cop.left - co.left, 4717 width: w, 4718 height: h 4719 }); 4720 } 4721
vendor: 5,540 bytes, lines 4722-4950
4722 if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { 4723 $(this).css({ 4724 left: ho.left - cop.left - co.left, 4725 width: w, 4726 height: h 4727 }); 4728 } 4729 } 4730 }); 4731 4732 $.ui.plugin.add("resizable", "alsoResize", { 4733 4734 start: function () { 4735 var that = $(this).resizable("instance"), 4736 o = that.options; 4737 4738 $(o.alsoResize).each(function () { 4739 var el = $(this); 4740 el.data("ui-resizable-alsoresize", { 4741 width: parseFloat(el.width()), height: parseFloat(el.height()), 4742 left: parseFloat(el.css("left")), top: parseFloat(el.css("top")) 4743 }); 4744 }); 4745 }, 4746 4747 resize: function (event, ui) { 4748 var that = $(this).resizable("instance"), 4749 o = that.options, 4750 os = that.originalSize, 4751 op = that.originalPosition, 4752 delta = { 4753 height: (that.size.height - os.height) || 0, 4754 width: (that.size.width - os.width) || 0, 4755 top: (that.position.top - op.top) || 0, 4756 left: (that.position.left - op.left) || 0 4757 }; 4758 4759 $(o.alsoResize).each(function () { 4760 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, 4761 css = el.parents(ui.originalElement[0]).length ? 4762 ["width", "height"] : 4763 ["width", "height", "top", "left"]; 4764 4765 $.each(css, function (i, prop) { 4766 var sum = (start[prop] || 0) + (delta[prop] || 0); 4767 if (sum && sum >= 0) { 4768 style[prop] = sum || null; 4769 } 4770 }); 4771 4772 el.css(style); 4773 }); 4774 }, 4775 4776 stop: function () { 4777 $(this).removeData("ui-resizable-alsoresize"); 4778 } 4779 }); 4780 4781 $.ui.plugin.add("resizable", "ghost", { 4782 4783 start: function () { 4784 4785 var that = $(this).resizable("instance"), cs = that.size; 4786 4787 that.ghost = that.originalElement.clone(); 4788 that.ghost.css({ 4789 opacity: 0.25, 4790 display: "block", 4791 position: "relative", 4792 height: cs.height, 4793 width: cs.width, 4794 margin: 0, 4795 left: 0, 4796 top: 0 4797 }); 4798 4799 that._addClass(that.ghost, "ui-resizable-ghost"); 4800 4801 // DEPRECATED 4802 // TODO: remove after 1.12 4803 if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { 4804 4805 // Ghost option 4806 that.ghost.addClass(this.options.ghost); 4807 } 4808 4809 that.ghost.appendTo(that.helper); 4810 4811 }, 4812 4813 resize: function () { 4814 var that = $(this).resizable("instance"); 4815 if (that.ghost) { 4816 that.ghost.css({ 4817 position: "relative", 4818 height: that.size.height, 4819 width: that.size.width 4820 }); 4821 } 4822 }, 4823 4824 stop: function () { 4825 var that = $(this).resizable("instance"); 4826 if (that.ghost && that.helper) { 4827 that.helper.get(0).removeChild(that.ghost.get(0)); 4828 } 4829 } 4830 4831 }); 4832 4833 $.ui.plugin.add("resizable", "grid", { 4834 4835 resize: function () { 4836 var outerDimensions, 4837 that = $(this).resizable("instance"), 4838 o = that.options, 4839 cs = that.size, 4840 os = that.originalSize, 4841 op = that.originalPosition, 4842 a = that.axis, 4843 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, 4844 gridX = (grid[0] || 1), 4845 gridY = (grid[1] || 1), 4846 ox = Math.round((cs.width - os.width) / gridX) * gridX, 4847 oy = Math.round((cs.height - os.height) / gridY) * gridY, 4848 newWidth = os.width + ox, 4849 newHeight = os.height + oy, 4850 isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), 4851 isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), 4852 isMinWidth = o.minWidth && (o.minWidth > newWidth), 4853 isMinHeight = o.minHeight && (o.minHeight > newHeight); 4854 4855 o.grid = grid; 4856 4857 if (isMinWidth) { 4858 newWidth += gridX; 4859 } 4860 if (isMinHeight) { 4861 newHeight += gridY; 4862 } 4863 if (isMaxWidth) { 4864 newWidth -= gridX; 4865 } 4866 if (isMaxHeight) { 4867 newHeight -= gridY; 4868 } 4869 4870 if (/^(se|s|e)$/.test(a)) { 4871 that.size.width = newWidth; 4872 that.size.height = newHeight; 4873 } else if (/^(ne)$/.test(a)) { 4874 that.size.width = newWidth; 4875 that.size.height = newHeight; 4876 that.position.top = op.top - oy; 4877 } else if (/^(sw)$/.test(a)) { 4878 that.size.width = newWidth; 4879 that.size.height = newHeight; 4880 that.position.left = op.left - ox; 4881 } else { 4882 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 4883 outerDimensions = that._getPaddingPlusBorderDimensions(this); 4884 } 4885 4886 if (newHeight - gridY > 0) { 4887 that.size.height = newHeight; 4888 that.position.top = op.top - oy; 4889 } else { 4890 newHeight = gridY - outerDimensions.height; 4891 that.size.height = newHeight; 4892 that.position.top = op.top + os.height - newHeight; 4893 } 4894 if (newWidth - gridX > 0) { 4895 that.size.width = newWidth; 4896 that.position.left = op.left - ox; 4897 } else { 4898 newWidth = gridX - outerDimensions.width; 4899 that.size.width = newWidth; 4900 that.position.left = op.left + os.width - newWidth; 4901 } 4902 } 4903 } 4904 4905 }); 4906 4907 var widgetsResizable = $.ui.resizable; 4908 4909 4910 /*! 4911 * jQuery UI Selectable 1.12.1 4912 * http://jqueryui.com 4913 * 4914 * Copyright jQuery Foundation and other contributors 4915 * Released under the MIT license. 4916 * http://jquery.org/license 4917 */ 4918 4919 //>>label: Selectable 4920 //>>group: Interactions 4921 //>>description: Allows groups of elements to be selected with the mouse. 4922 //>>docs: http://api.jqueryui.com/selectable/ 4923 //>>demos: http://jqueryui.com/selectable/ 4924 //>>css.structure: ../../themes/base/selectable.css 4925 4926 4927 4928 var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, { 4929 version: "1.12.1", 4930 options: { 4931 appendTo: "body", 4932 autoRefresh: true, 4933 distance: 0, 4934 filter: "*", 4935 tolerance: "touch", 4936 4937 // Callbacks 4938 selected: null, 4939 selecting: null, 4940 start: null, 4941 stop: null, 4942 unselected: null, 4943 unselecting: null 4944 }, 4945 _create: function () { 4946 var that = this; 4947 4948 this._addClass("ui-selectable"); 4949 4950 this.dragged = false;
vendor: 9,678 bytes, lines 4951-5332
4951 4952 // Cache selectee children based on filter 4953 this.refresh = function () { 4954 that.elementPos = $(that.element[0]).offset(); 4955 that.selectees = $(that.options.filter, that.element[0]); 4956 that._addClass(that.selectees, "ui-selectee"); 4957 that.selectees.each(function () { 4958 var $this = $(this), 4959 selecteeOffset = $this.offset(), 4960 pos = { 4961 left: selecteeOffset.left - that.elementPos.left, 4962 top: selecteeOffset.top - that.elementPos.top 4963 }; 4964 $.data(this, "selectable-item", { 4965 element: this, 4966 $element: $this, 4967 left: pos.left, 4968 top: pos.top, 4969 right: pos.left + $this.outerWidth(), 4970 bottom: pos.top + $this.outerHeight(), 4971 startselected: false, 4972 selected: $this.hasClass("ui-selected"), 4973 selecting: $this.hasClass("ui-selecting"), 4974 unselecting: $this.hasClass("ui-unselecting") 4975 }); 4976 }); 4977 }; 4978 this.refresh(); 4979 4980 this._mouseInit(); 4981 4982 this.helper = $("<div>"); 4983 this._addClass(this.helper, "ui-selectable-helper"); 4984 }, 4985 4986 _destroy: function () { 4987 this.selectees.removeData("selectable-item"); 4988 this._mouseDestroy(); 4989 }, 4990 4991 _mouseStart: function (event) { 4992 var that = this, 4993 options = this.options; 4994 4995 this.opos = [event.pageX, event.pageY]; 4996 this.elementPos = $(this.element[0]).offset(); 4997 4998 if (this.options.disabled) { 4999 return; 5000 } 5001 5002 this.selectees = $(options.filter, this.element[0]); 5003 5004 this._trigger("start", event); 5005 5006 $(options.appendTo).append(this.helper); 5007 5008 // position helper (lasso) 5009 this.helper.css({ 5010 "left": event.pageX, 5011 "top": event.pageY, 5012 "width": 0, 5013 "height": 0 5014 }); 5015 5016 if (options.autoRefresh) { 5017 this.refresh(); 5018 } 5019 5020 this.selectees.filter(".ui-selected").each(function () { 5021 var selectee = $.data(this, "selectable-item"); 5022 selectee.startselected = true; 5023 if (!event.metaKey && !event.ctrlKey) { 5024 that._removeClass(selectee.$element, "ui-selected"); 5025 selectee.selected = false; 5026 that._addClass(selectee.$element, "ui-unselecting"); 5027 selectee.unselecting = true; 5028 5029 // selectable UNSELECTING callback 5030 that._trigger("unselecting", event, { 5031 unselecting: selectee.element 5032 }); 5033 } 5034 }); 5035 5036 $(event.target).parents().addBack().each(function () { 5037 var doSelect, 5038 selectee = $.data(this, "selectable-item"); 5039 if (selectee) { 5040 doSelect = (!event.metaKey && !event.ctrlKey) || 5041 !selectee.$element.hasClass("ui-selected"); 5042 that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected") 5043 ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting"); 5044 selectee.unselecting = !doSelect; 5045 selectee.selecting = doSelect; 5046 selectee.selected = doSelect; 5047 5048 // selectable (UN)SELECTING callback 5049 if (doSelect) { 5050 that._trigger("selecting", event, { 5051 selecting: selectee.element 5052 }); 5053 } else { 5054 that._trigger("unselecting", event, { 5055 unselecting: selectee.element 5056 }); 5057 } 5058 return false; 5059 } 5060 }); 5061 5062 }, 5063 5064 _mouseDrag: function (event) { 5065 5066 this.dragged = true; 5067 5068 if (this.options.disabled) { 5069 return; 5070 } 5071 5072 var tmp, 5073 that = this, 5074 options = this.options, 5075 x1 = this.opos[0], 5076 y1 = this.opos[1], 5077 x2 = event.pageX, 5078 y2 = event.pageY; 5079 5080 if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } 5081 if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } 5082 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 5083 5084 this.selectees.each(function () { 5085 var selectee = $.data(this, "selectable-item"), 5086 hit = false, 5087 offset = {}; 5088 5089 //prevent helper from being selected if appendTo: selectable 5090 if (!selectee || selectee.element === that.element[0]) { 5091 return; 5092 } 5093 5094 offset.left = selectee.left + that.elementPos.left; 5095 offset.right = selectee.right + that.elementPos.left; 5096 offset.top = selectee.top + that.elementPos.top; 5097 offset.bottom = selectee.bottom + that.elementPos.top; 5098 5099 if (options.tolerance === "touch") { 5100 hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 || 5101 offset.bottom < y1)); 5102 } else if (options.tolerance === "fit") { 5103 hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 && 5104 offset.bottom < y2); 5105 } 5106 5107 if (hit) { 5108 5109 // SELECT 5110 if (selectee.selected) { 5111 that._removeClass(selectee.$element, "ui-selected"); 5112 selectee.selected = false; 5113 } 5114 if (selectee.unselecting) { 5115 that._removeClass(selectee.$element, "ui-unselecting"); 5116 selectee.unselecting = false; 5117 } 5118 if (!selectee.selecting) { 5119 that._addClass(selectee.$element, "ui-selecting"); 5120 selectee.selecting = true; 5121 5122 // selectable SELECTING callback 5123 that._trigger("selecting", event, { 5124 selecting: selectee.element 5125 }); 5126 } 5127 } else { 5128 5129 // UNSELECT 5130 if (selectee.selecting) { 5131 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 5132 that._removeClass(selectee.$element, "ui-selecting"); 5133 selectee.selecting = false; 5134 that._addClass(selectee.$element, "ui-selected"); 5135 selectee.selected = true; 5136 } else { 5137 that._removeClass(selectee.$element, "ui-selecting"); 5138 selectee.selecting = false; 5139 if (selectee.startselected) { 5140 that._addClass(selectee.$element, "ui-unselecting"); 5141 selectee.unselecting = true; 5142 } 5143 5144 // selectable UNSELECTING callback 5145 that._trigger("unselecting", event, { 5146 unselecting: selectee.element 5147 }); 5148 } 5149 } 5150 if (selectee.selected) { 5151 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 5152 that._removeClass(selectee.$element, "ui-selected"); 5153 selectee.selected = false; 5154 5155 that._addClass(selectee.$element, "ui-unselecting"); 5156 selectee.unselecting = true; 5157 5158 // selectable UNSELECTING callback 5159 that._trigger("unselecting", event, { 5160 unselecting: selectee.element 5161 }); 5162 } 5163 } 5164 } 5165 }); 5166 5167 return false; 5168 }, 5169 5170 _mouseStop: function (event) { 5171 var that = this; 5172 5173 this.dragged = false; 5174 5175 $(".ui-unselecting", this.element[0]).each(function () { 5176 var selectee = $.data(this, "selectable-item"); 5177 that._removeClass(selectee.$element, "ui-unselecting"); 5178 selectee.unselecting = false; 5179 selectee.startselected = false; 5180 that._trigger("unselected", event, { 5181 unselected: selectee.element 5182 }); 5183 }); 5184 $(".ui-selecting", this.element[0]).each(function () { 5185 var selectee = $.data(this, "selectable-item"); 5186 that._removeClass(selectee.$element, "ui-selecting") 5187 ._addClass(selectee.$element, "ui-selected"); 5188 selectee.selecting = false; 5189 selectee.selected = true; 5190 selectee.startselected = true; 5191 that._trigger("selected", event, { 5192 selected: selectee.element 5193 }); 5194 }); 5195 this._trigger("stop", event); 5196 5197 this.helper.remove(); 5198 5199 return false; 5200 } 5201 5202 }); 5203 5204 5205 /*! 5206 * jQuery UI Sortable 1.12.1 5207 * http://jqueryui.com 5208 * 5209 * Copyright jQuery Foundation and other contributors 5210 * Released under the MIT license. 5211 * http://jquery.org/license 5212 */ 5213 5214 //>>label: Sortable 5215 //>>group: Interactions 5216 //>>description: Enables items in a list to be sorted using the mouse. 5217 //>>docs: http://api.jqueryui.com/sortable/ 5218 //>>demos: http://jqueryui.com/sortable/ 5219 //>>css.structure: ../../themes/base/sortable.css 5220 5221 5222 5223 var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, { 5224 version: "1.12.1", 5225 widgetEventPrefix: "sort", 5226 ready: false, 5227 options: { 5228 appendTo: "parent", 5229 axis: false, 5230 connectWith: false, 5231 containment: false, 5232 cursor: "auto", 5233 cursorAt: false, 5234 dropOnEmpty: true, 5235 forcePlaceholderSize: false, 5236 forceHelperSize: false, 5237 grid: false, 5238 handle: false, 5239 helper: "original", 5240 items: "> *", 5241 opacity: false, 5242 placeholder: false, 5243 revert: false, 5244 scroll: true, 5245 scrollSensitivity: 20, 5246 scrollSpeed: 20, 5247 scope: "default", 5248 tolerance: "intersect", 5249 zIndex: 1000, 5250 5251 // Callbacks 5252 activate: null, 5253 beforeStop: null, 5254 change: null, 5255 deactivate: null, 5256 out: null, 5257 over: null, 5258 receive: null, 5259 remove: null, 5260 sort: null, 5261 start: null, 5262 stop: null, 5263 update: null 5264 }, 5265 5266 _isOverAxis: function (x, reference, size) { 5267 return (x >= reference) && (x < (reference + size)); 5268 }, 5269 5270 _isFloating: function (item) { 5271 return (/left|right/).test(item.css("float")) || 5272 (/inline|table-cell/).test(item.css("display")); 5273 }, 5274 5275 _create: function () { 5276 this.containerCache = {}; 5277 this._addClass("ui-sortable"); 5278 5279 //Get the items 5280 this.refresh(); 5281 5282 //Let's determine the parent's offset 5283 this.offset = this.element.offset(); 5284 5285 //Initialize mouse events for interaction 5286 this._mouseInit(); 5287 5288 this._setHandleClassName(); 5289 5290 //We're ready to go 5291 this.ready = true; 5292 5293 }, 5294 5295 _setOption: function (key, value) { 5296 this._super(key, value); 5297 5298 if (key === "handle") { 5299 this._setHandleClassName(); 5300 } 5301 }, 5302 5303 _setHandleClassName: function () { 5304 var that = this; 5305 this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle"); 5306 $.each(this.items, function () { 5307 that._addClass( 5308 this.instance.options.handle ? 5309 this.item.find(this.instance.options.handle) : 5310 this.item, 5311 "ui-sortable-handle" 5312 ); 5313 }); 5314 }, 5315 5316 _destroy: function () { 5317 this._mouseDestroy(); 5318 5319 for (var i = this.items.length - 1; i >= 0; i--) { 5320 this.items[i].item.removeData(this.widgetName + "-item"); 5321 } 5322 5323 return this; 5324 }, 5325 5326 _mouseCapture: function (event, overrideHandle) { 5327 var currentItem = null, 5328 validHandle = false, 5329 that = this; 5330 5331 if (this.reverting) { 5332 return false;
vendor: 5,213 bytes, lines 5333-5522
5333 } 5334 5335 if (this.options.disabled || this.options.type === "static") { 5336 return false; 5337 } 5338 5339 //We have to refresh the items data once first 5340 this._refreshItems(event); 5341 5342 //Find out if the clicked node (or one of its parents) is a actual item in this.items 5343 $(event.target).parents().each(function () { 5344 if ($.data(this, that.widgetName + "-item") === that) { 5345 currentItem = $(this); 5346 return false; 5347 } 5348 }); 5349 if ($.data(event.target, that.widgetName + "-item") === that) { 5350 currentItem = $(event.target); 5351 } 5352 5353 if (!currentItem) { 5354 return false; 5355 } 5356 if (this.options.handle && !overrideHandle) { 5357 $(this.options.handle, currentItem).find("*").addBack().each(function () { 5358 if (this === event.target) { 5359 validHandle = true; 5360 } 5361 }); 5362 if (!validHandle) { 5363 return false; 5364 } 5365 } 5366 5367 this.currentItem = currentItem; 5368 this._removeCurrentsFromItems(); 5369 return true; 5370 5371 }, 5372 5373 _mouseStart: function (event, overrideHandle, noActivation) { 5374 5375 var i, body, 5376 o = this.options; 5377 5378 this.currentContainer = this; 5379 5380 //We only need to call refreshPositions, because the refreshItems call has been moved to 5381 // mouseCapture 5382 this.refreshPositions(); 5383 5384 //Create and append the visible helper 5385 this.helper = this._createHelper(event); 5386 5387 //Cache the helper size 5388 this._cacheHelperProportions(); 5389 5390 /* 5391 * - Position generation - 5392 * This block generates everything position related - it's the core of draggables. 5393 */ 5394 5395 //Cache the margins of the original element 5396 this._cacheMargins(); 5397 5398 //Get the next scrolling parent 5399 this.scrollParent = this.helper.scrollParent(); 5400 5401 //The element's absolute position on the page minus margins 5402 this.offset = this.currentItem.offset(); 5403 this.offset = { 5404 top: this.offset.top - this.margins.top, 5405 left: this.offset.left - this.margins.left 5406 }; 5407 5408 $.extend(this.offset, { 5409 click: { //Where the click happened, relative to the element 5410 left: event.pageX - this.offset.left, 5411 top: event.pageY - this.offset.top 5412 }, 5413 parent: this._getParentOffset(), 5414 5415 // This is a relative to absolute position minus the actual position calculation - 5416 // only used for relative positioned helper 5417 relative: this._getRelativeOffset() 5418 }); 5419 5420 // Only after we got the offset, we can change the helper's position to absolute 5421 // TODO: Still need to figure out a way to make relative sorting possible 5422 this.helper.css("position", "absolute"); 5423 this.cssPosition = this.helper.css("position"); 5424 5425 //Generate the original position 5426 this.originalPosition = this._generatePosition(event); 5427 this.originalPageX = event.pageX; 5428 this.originalPageY = event.pageY; 5429 5430 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 5431 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 5432 5433 //Cache the former DOM position 5434 this.domPosition = { 5435 prev: this.currentItem.prev()[0], 5436 parent: this.currentItem.parent()[0] 5437 }; 5438 5439 // If the helper is not the original, hide the original so it's not playing any role during 5440 // the drag, won't cause anything bad this way 5441 if (this.helper[0] !== this.currentItem[0]) { 5442 this.currentItem.hide(); 5443 } 5444 5445 //Create the placeholder 5446 this._createPlaceholder(); 5447 5448 //Set a containment if given in the options 5449 if (o.containment) { 5450 this._setContainment(); 5451 } 5452 5453 if (o.cursor && o.cursor !== "auto") { // cursor option 5454 body = this.document.find("body"); 5455 5456 // Support: IE 5457 this.storedCursor = body.css("cursor"); 5458 body.css("cursor", o.cursor); 5459 5460 this.storedStylesheet = 5461 $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body); 5462 } 5463 5464 if (o.opacity) { // opacity option 5465 if (this.helper.css("opacity")) { 5466 this._storedOpacity = this.helper.css("opacity"); 5467 } 5468 this.helper.css("opacity", o.opacity); 5469 } 5470 5471 if (o.zIndex) { // zIndex option 5472 if (this.helper.css("zIndex")) { 5473 this._storedZIndex = this.helper.css("zIndex"); 5474 } 5475 this.helper.css("zIndex", o.zIndex); 5476 } 5477 5478 //Prepare scrolling 5479 if (this.scrollParent[0] !== this.document[0] && 5480 this.scrollParent[0].tagName !== "HTML") { 5481 this.overflowOffset = this.scrollParent.offset(); 5482 } 5483 5484 //Call callbacks 5485 this._trigger("start", event, this._uiHash()); 5486 5487 //Recache the helper size 5488 if (!this._preserveHelperProportions) { 5489 this._cacheHelperProportions(); 5490 } 5491 5492 //Post "activate" events to possible containers 5493 if (!noActivation) { 5494 for (i = this.containers.length - 1; i >= 0; i--) { 5495 this.containers[i]._trigger("activate", event, this._uiHash(this)); 5496 } 5497 } 5498 5499 //Prepare possible droppables 5500 if ($.ui.ddmanager) { 5501 $.ui.ddmanager.current = this; 5502 } 5503 5504 if ($.ui.ddmanager && !o.dropBehaviour) { 5505 $.ui.ddmanager.prepareOffsets(this, event); 5506 } 5507 5508 this.dragging = true; 5509 5510 this._addClass(this.helper, "ui-sortable-helper"); 5511 5512 // Execute the drag once - this causes the helper not to be visiblebefore getting its 5513 // correct position 5514 this._mouseDrag(event); 5515 return true; 5516 5517 }, 5518 5519 _mouseDrag: function (event) { 5520 var i, item, itemElement, intersection, 5521 o = this.options, 5522 scrolled = false;
vendor: 4,338 bytes, lines 5523-5652
5523 5524 //Compute the helpers position 5525 this.position = this._generatePosition(event); 5526 this.positionAbs = this._convertPositionTo("absolute"); 5527 5528 if (!this.lastPositionAbs) { 5529 this.lastPositionAbs = this.positionAbs; 5530 } 5531 5532 //Do scrolling 5533 if (this.options.scroll) { 5534 if (this.scrollParent[0] !== this.document[0] && 5535 this.scrollParent[0].tagName !== "HTML") { 5536 5537 if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - 5538 event.pageY < o.scrollSensitivity) { 5539 this.scrollParent[0].scrollTop = 5540 scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 5541 } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 5542 this.scrollParent[0].scrollTop = 5543 scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 5544 } 5545 5546 if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - 5547 event.pageX < o.scrollSensitivity) { 5548 this.scrollParent[0].scrollLeft = scrolled = 5549 this.scrollParent[0].scrollLeft + o.scrollSpeed; 5550 } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 5551 this.scrollParent[0].scrollLeft = scrolled = 5552 this.scrollParent[0].scrollLeft - o.scrollSpeed; 5553 } 5554 5555 } else { 5556 5557 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 5558 scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); 5559 } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < 5560 o.scrollSensitivity) { 5561 scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); 5562 } 5563 5564 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 5565 scrolled = this.document.scrollLeft( 5566 this.document.scrollLeft() - o.scrollSpeed 5567 ); 5568 } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < 5569 o.scrollSensitivity) { 5570 scrolled = this.document.scrollLeft( 5571 this.document.scrollLeft() + o.scrollSpeed 5572 ); 5573 } 5574 5575 } 5576 5577 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 5578 $.ui.ddmanager.prepareOffsets(this, event); 5579 } 5580 } 5581 5582 //Regenerate the absolute position used for position checks 5583 this.positionAbs = this._convertPositionTo("absolute"); 5584 5585 //Set the helper position 5586 if (!this.options.axis || this.options.axis !== "y") { 5587 this.helper[0].style.left = this.position.left + "px"; 5588 } 5589 if (!this.options.axis || this.options.axis !== "x") { 5590 this.helper[0].style.top = this.position.top + "px"; 5591 } 5592 5593 //Rearrange 5594 for (i = this.items.length - 1; i >= 0; i--) { 5595 5596 //Cache variables and intersection, continue if no intersection 5597 item = this.items[i]; 5598 itemElement = item.item[0]; 5599 intersection = this._intersectsWithPointer(item); 5600 if (!intersection) { 5601 continue; 5602 } 5603 5604 // Only put the placeholder inside the current Container, skip all 5605 // items from other containers. This works because when moving 5606 // an item from one container to another the 5607 // currentContainer is switched before the placeholder is moved. 5608 // 5609 // Without this, moving items in "sub-sortables" can cause 5610 // the placeholder to jitter between the outer and inner container. 5611 if (item.instance !== this.currentContainer) { 5612 continue; 5613 } 5614 5615 // Cannot intersect with itself 5616 // no useless actions that have been done before 5617 // no action if the item moved is the parent of the item checked 5618 if (itemElement !== this.currentItem[0] && 5619 this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && 5620 !$.contains(this.placeholder[0], itemElement) && 5621 (this.options.type === "semi-dynamic" ? 5622 !$.contains(this.element[0], itemElement) : 5623 true 5624 ) 5625 ) { 5626 5627 this.direction = intersection === 1 ? "down" : "up"; 5628 5629 if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { 5630 this._rearrange(event, item); 5631 } else { 5632 break; 5633 } 5634 5635 this._trigger("change", event, this._uiHash()); 5636 break; 5637 } 5638 } 5639 5640 //Post events to containers 5641 this._contactContainers(event); 5642 5643 //Interconnect with droppables 5644 if ($.ui.ddmanager) { 5645 $.ui.ddmanager.drag(this, event); 5646 } 5647 5648 //Call callbacks 5649 this._trigger("sort", event, this._uiHash()); 5650 5651 this.lastPositionAbs = this.positionAbs; 5652 return false;
vendor: 5,033 bytes, lines 5653-5842
5653 5654 }, 5655 5656 _mouseStop: function (event, noPropagation) { 5657 5658 if (!event) { 5659 return; 5660 } 5661 5662 //If we are using droppables, inform the manager about the drop 5663 if ($.ui.ddmanager && !this.options.dropBehaviour) { 5664 $.ui.ddmanager.drop(this, event); 5665 } 5666 5667 if (this.options.revert) { 5668 var that = this, 5669 cur = this.placeholder.offset(), 5670 axis = this.options.axis, 5671 animation = {}; 5672 5673 if (!axis || axis === "x") { 5674 animation.left = cur.left - this.offset.parent.left - this.margins.left + 5675 (this.offsetParent[0] === this.document[0].body ? 5676 0 : 5677 this.offsetParent[0].scrollLeft 5678 ); 5679 } 5680 if (!axis || axis === "y") { 5681 animation.top = cur.top - this.offset.parent.top - this.margins.top + 5682 (this.offsetParent[0] === this.document[0].body ? 5683 0 : 5684 this.offsetParent[0].scrollTop 5685 ); 5686 } 5687 this.reverting = true; 5688 $(this.helper).animate( 5689 animation, 5690 parseInt(this.options.revert, 10) || 500, 5691 function () { 5692 that._clear(event); 5693 } 5694 ); 5695 } else { 5696 this._clear(event, noPropagation); 5697 } 5698 5699 return false; 5700 5701 }, 5702 5703 cancel: function () { 5704 5705 if (this.dragging) { 5706 5707 this._mouseUp(new $.Event("mouseup", { target: null })); 5708 5709 if (this.options.helper === "original") { 5710 this.currentItem.css(this._storedCSS); 5711 this._removeClass(this.currentItem, "ui-sortable-helper"); 5712 } else { 5713 this.currentItem.show(); 5714 } 5715 5716 //Post deactivating events to containers 5717 for (var i = this.containers.length - 1; i >= 0; i--) { 5718 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 5719 if (this.containers[i].containerCache.over) { 5720 this.containers[i]._trigger("out", null, this._uiHash(this)); 5721 this.containers[i].containerCache.over = 0; 5722 } 5723 } 5724 5725 } 5726 5727 if (this.placeholder) { 5728 5729 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 5730 // it unbinds ALL events from the original node! 5731 if (this.placeholder[0].parentNode) { 5732 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 5733 } 5734 if (this.options.helper !== "original" && this.helper && 5735 this.helper[0].parentNode) { 5736 this.helper.remove(); 5737 } 5738 5739 $.extend(this, { 5740 helper: null, 5741 dragging: false, 5742 reverting: false, 5743 _noFinalSort: null 5744 }); 5745 5746 if (this.domPosition.prev) { 5747 $(this.domPosition.prev).after(this.currentItem); 5748 } else { 5749 $(this.domPosition.parent).prepend(this.currentItem); 5750 } 5751 } 5752 5753 return this; 5754 5755 }, 5756 5757 serialize: function (o) { 5758 5759 var items = this._getItemsAsjQuery(o && o.connected), 5760 str = []; 5761 o = o || {}; 5762 5763 $(items).each(function () { 5764 var res = ($(o.item || this).attr(o.attribute || "id") || "") 5765 .match(o.expression || (/(.+)[\-=_](.+)/)); 5766 if (res) { 5767 str.push( 5768 (o.key || res[1] + "[]") + 5769 "=" + (o.key && o.expression ? res[1] : res[2])); 5770 } 5771 }); 5772 5773 if (!str.length && o.key) { 5774 str.push(o.key + "="); 5775 } 5776 5777 return str.join("&"); 5778 5779 }, 5780 5781 toArray: function (o) { 5782 5783 var items = this._getItemsAsjQuery(o && o.connected), 5784 ret = []; 5785 5786 o = o || {}; 5787 5788 items.each(function () { 5789 ret.push($(o.item || this).attr(o.attribute || "id") || ""); 5790 }); 5791 return ret; 5792 5793 }, 5794 5795 /* Be careful with the following core functions */ 5796 _intersectsWith: function (item) { 5797 5798 var x1 = this.positionAbs.left, 5799 x2 = x1 + this.helperProportions.width, 5800 y1 = this.positionAbs.top, 5801 y2 = y1 + this.helperProportions.height, 5802 l = item.left, 5803 r = l + item.width, 5804 t = item.top, 5805 b = t + item.height, 5806 dyClick = this.offset.click.top, 5807 dxClick = this.offset.click.left, 5808 isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && 5809 (y1 + dyClick) < b), 5810 isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && 5811 (x1 + dxClick) < r), 5812 isOverElement = isOverElementHeight && isOverElementWidth; 5813 5814 if (this.options.tolerance === "pointer" || 5815 this.options.forcePointerForContainers || 5816 (this.options.tolerance !== "pointer" && 5817 this.helperProportions[this.floating ? "width" : "height"] > 5818 item[this.floating ? "width" : "height"]) 5819 ) { 5820 return isOverElement; 5821 } else { 5822 5823 return (l < x1 + (this.helperProportions.width / 2) && // Right Half 5824 x2 - (this.helperProportions.width / 2) < r && // Left Half 5825 t < y1 + (this.helperProportions.height / 2) && // Bottom Half 5826 y2 - (this.helperProportions.height / 2) < b); // Top Half 5827 5828 } 5829 }, 5830 5831 _intersectsWithPointer: function (item) { 5832 var verticalDirection, horizontalDirection, 5833 isOverElementHeight = (this.options.axis === "x") || 5834 this._isOverAxis( 5835 this.positionAbs.top + this.offset.click.top, item.top, item.height), 5836 isOverElementWidth = (this.options.axis === "y") || 5837 this._isOverAxis( 5838 this.positionAbs.left + this.offset.click.left, item.left, item.width), 5839 isOverElement = isOverElementHeight && isOverElementWidth; 5840 5841 if (!isOverElement) { 5842 return false;
vendor: 7,919 bytes, lines 5843-6105
5843 } 5844 5845 verticalDirection = this._getDragVerticalDirection(); 5846 horizontalDirection = this._getDragHorizontalDirection(); 5847 5848 return this.floating ? 5849 ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1) 5850 : (verticalDirection && (verticalDirection === "down" ? 2 : 1)); 5851 5852 }, 5853 5854 _intersectsWithSides: function (item) { 5855 5856 var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + 5857 this.offset.click.top, item.top + (item.height / 2), item.height), 5858 isOverRightHalf = this._isOverAxis(this.positionAbs.left + 5859 this.offset.click.left, item.left + (item.width / 2), item.width), 5860 verticalDirection = this._getDragVerticalDirection(), 5861 horizontalDirection = this._getDragHorizontalDirection(); 5862 5863 if (this.floating && horizontalDirection) { 5864 return ((horizontalDirection === "right" && isOverRightHalf) || 5865 (horizontalDirection === "left" && !isOverRightHalf)); 5866 } else { 5867 return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || 5868 (verticalDirection === "up" && !isOverBottomHalf)); 5869 } 5870 5871 }, 5872 5873 _getDragVerticalDirection: function () { 5874 var delta = this.positionAbs.top - this.lastPositionAbs.top; 5875 return delta !== 0 && (delta > 0 ? "down" : "up"); 5876 }, 5877 5878 _getDragHorizontalDirection: function () { 5879 var delta = this.positionAbs.left - this.lastPositionAbs.left; 5880 return delta !== 0 && (delta > 0 ? "right" : "left"); 5881 }, 5882 5883 refresh: function (event) { 5884 this._refreshItems(event); 5885 this._setHandleClassName(); 5886 this.refreshPositions(); 5887 return this; 5888 }, 5889 5890 _connectWith: function () { 5891 var options = this.options; 5892 return options.connectWith.constructor === String ? 5893 [options.connectWith] : 5894 options.connectWith; 5895 }, 5896 5897 _getItemsAsjQuery: function (connected) { 5898 5899 var i, j, cur, inst, 5900 items = [], 5901 queries = [], 5902 connectWith = this._connectWith(); 5903 5904 if (connectWith && connected) { 5905 for (i = connectWith.length - 1; i >= 0; i--) { 5906 cur = $(connectWith[i], this.document[0]); 5907 for (j = cur.length - 1; j >= 0; j--) { 5908 inst = $.data(cur[j], this.widgetFullName); 5909 if (inst && inst !== this && !inst.options.disabled) { 5910 queries.push([$.isFunction(inst.options.items) ? 5911 inst.options.items.call(inst.element) : 5912 $(inst.options.items, inst.element) 5913 .not(".ui-sortable-helper") 5914 .not(".ui-sortable-placeholder"), inst]); 5915 } 5916 } 5917 } 5918 } 5919 5920 queries.push([$.isFunction(this.options.items) ? 5921 this.options.items 5922 .call(this.element, null, { options: this.options, item: this.currentItem }) : 5923 $(this.options.items, this.element) 5924 .not(".ui-sortable-helper") 5925 .not(".ui-sortable-placeholder"), this]); 5926 5927 function addItems() { 5928 items.push(this); 5929 } 5930 for (i = queries.length - 1; i >= 0; i--) { 5931 queries[i][0].each(addItems); 5932 } 5933 5934 return $(items); 5935 5936 }, 5937 5938 _removeCurrentsFromItems: function () { 5939 5940 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 5941 5942 this.items = $.grep(this.items, function (item) { 5943 for (var j = 0; j < list.length; j++) { 5944 if (list[j] === item.item[0]) { 5945 return false; 5946 } 5947 } 5948 return true; 5949 }); 5950 5951 }, 5952 5953 _refreshItems: function (event) { 5954 5955 this.items = []; 5956 this.containers = [this]; 5957 5958 var i, j, cur, inst, targetData, _queries, item, queriesLength, 5959 items = this.items, 5960 queries = [[$.isFunction(this.options.items) ? 5961 this.options.items.call(this.element[0], event, { item: this.currentItem }) : 5962 $(this.options.items, this.element), this]], 5963 connectWith = this._connectWith(); 5964 5965 //Shouldn't be run the first time through due to massive slow-down 5966 if (connectWith && this.ready) { 5967 for (i = connectWith.length - 1; i >= 0; i--) { 5968 cur = $(connectWith[i], this.document[0]); 5969 for (j = cur.length - 1; j >= 0; j--) { 5970 inst = $.data(cur[j], this.widgetFullName); 5971 if (inst && inst !== this && !inst.options.disabled) { 5972 queries.push([$.isFunction(inst.options.items) ? 5973 inst.options.items 5974 .call(inst.element[0], event, { item: this.currentItem }) : 5975 $(inst.options.items, inst.element), inst]); 5976 this.containers.push(inst); 5977 } 5978 } 5979 } 5980 } 5981 5982 for (i = queries.length - 1; i >= 0; i--) { 5983 targetData = queries[i][1]; 5984 _queries = queries[i][0]; 5985 5986 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 5987 item = $(_queries[j]); 5988 5989 // Data for target checking (mouse manager) 5990 item.data(this.widgetName + "-item", targetData); 5991 5992 items.push({ 5993 item: item, 5994 instance: targetData, 5995 width: 0, height: 0, 5996 left: 0, top: 0 5997 }); 5998 } 5999 } 6000 6001 }, 6002 6003 refreshPositions: function (fast) { 6004 6005 // Determine whether items are being displayed horizontally 6006 this.floating = this.items.length ? 6007 this.options.axis === "x" || this._isFloating(this.items[0].item) : 6008 false; 6009 6010 //This has to be redone because due to the item being moved out/into the offsetParent, 6011 // the offsetParent's position will change 6012 if (this.offsetParent && this.helper) { 6013 this.offset.parent = this._getParentOffset(); 6014 } 6015 6016 var i, item, t, p; 6017 6018 for (i = this.items.length - 1; i >= 0; i--) { 6019 item = this.items[i]; 6020 6021 //We ignore calculating positions of all connected containers when we're not over them 6022 if (item.instance !== this.currentContainer && this.currentContainer && 6023 item.item[0] !== this.currentItem[0]) { 6024 continue; 6025 } 6026 6027 t = this.options.toleranceElement ? 6028 $(this.options.toleranceElement, item.item) : 6029 item.item; 6030 6031 if (!fast) { 6032 item.width = t.outerWidth(); 6033 item.height = t.outerHeight(); 6034 } 6035 6036 p = t.offset(); 6037 item.left = p.left; 6038 item.top = p.top; 6039 } 6040 6041 if (this.options.custom && this.options.custom.refreshContainers) { 6042 this.options.custom.refreshContainers.call(this); 6043 } else { 6044 for (i = this.containers.length - 1; i >= 0; i--) { 6045 p = this.containers[i].element.offset(); 6046 this.containers[i].containerCache.left = p.left; 6047 this.containers[i].containerCache.top = p.top; 6048 this.containers[i].containerCache.width = 6049 this.containers[i].element.outerWidth(); 6050 this.containers[i].containerCache.height = 6051 this.containers[i].element.outerHeight(); 6052 } 6053 } 6054 6055 return this; 6056 }, 6057 6058 _createPlaceholder: function (that) { 6059 that = that || this; 6060 var className, 6061 o = that.options; 6062 6063 if (!o.placeholder || o.placeholder.constructor === String) { 6064 className = o.placeholder; 6065 o.placeholder = { 6066 element: function () { 6067 6068 var nodeName = that.currentItem[0].nodeName.toLowerCase(), 6069 element = $("<" + nodeName + ">", that.document[0]); 6070 6071 that._addClass(element, "ui-sortable-placeholder", 6072 className || that.currentItem[0].className) 6073 ._removeClass(element, "ui-sortable-helper"); 6074 6075 if (nodeName === "tbody") { 6076 that._createTrPlaceholder( 6077 that.currentItem.find("tr").eq(0), 6078 $("<tr>", that.document[0]).appendTo(element) 6079 ); 6080 } else if (nodeName === "tr") { 6081 that._createTrPlaceholder(that.currentItem, element); 6082 } else if (nodeName === "img") { 6083 element.attr("src", that.currentItem.attr("src")); 6084 } 6085 6086 if (!className) { 6087 element.css("visibility", "hidden"); 6088 } 6089 6090 return element; 6091 }, 6092 update: function (container, p) { 6093 6094 // 1. If a className is set as 'placeholder option, we don't force sizes - 6095 // the class is responsible for that 6096 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 6097 // class name is specified 6098 if (className && !o.forcePlaceholderSize) { 6099 return; 6100 } 6101 6102 //If the element doesn't have a actual height by itself (without styles coming 6103 // from a stylesheet), it receives the inline height from the dragged item 6104 if (!p.height()) { 6105 p.height(
vendor: 5,650 bytes, lines 6106-6287
6106 that.currentItem.innerHeight() - 6107 parseInt(that.currentItem.css("paddingTop") || 0, 10) - 6108 parseInt(that.currentItem.css("paddingBottom") || 0, 10)); 6109 } 6110 if (!p.width()) { 6111 p.width( 6112 that.currentItem.innerWidth() - 6113 parseInt(that.currentItem.css("paddingLeft") || 0, 10) - 6114 parseInt(that.currentItem.css("paddingRight") || 0, 10)); 6115 } 6116 } 6117 }; 6118 } 6119 6120 //Create the placeholder 6121 that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); 6122 6123 //Append it after the actual current item 6124 that.currentItem.after(that.placeholder); 6125 6126 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 6127 o.placeholder.update(that, that.placeholder); 6128 6129 }, 6130 6131 _createTrPlaceholder: function (sourceTr, targetTr) { 6132 var that = this; 6133 6134 sourceTr.children().each(function () { 6135 $("<td> </td>", that.document[0]) 6136 .attr("colspan", $(this).attr("colspan") || 1) 6137 .appendTo(targetTr); 6138 }); 6139 }, 6140 6141 _contactContainers: function (event) { 6142 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 6143 floating, axis, 6144 innermostContainer = null, 6145 innermostIndex = null; 6146 6147 // Get innermost container that intersects with item 6148 for (i = this.containers.length - 1; i >= 0; i--) { 6149 6150 // Never consider a container that's located within the item itself 6151 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 6152 continue; 6153 } 6154 6155 if (this._intersectsWith(this.containers[i].containerCache)) { 6156 6157 // If we've already found a container and it's more "inner" than this, then continue 6158 if (innermostContainer && 6159 $.contains( 6160 this.containers[i].element[0], 6161 innermostContainer.element[0])) { 6162 continue; 6163 } 6164 6165 innermostContainer = this.containers[i]; 6166 innermostIndex = i; 6167 6168 } else { 6169 6170 // container doesn't intersect. trigger "out" event if necessary 6171 if (this.containers[i].containerCache.over) { 6172 this.containers[i]._trigger("out", event, this._uiHash(this)); 6173 this.containers[i].containerCache.over = 0; 6174 } 6175 } 6176 6177 } 6178 6179 // If no intersecting containers found, return 6180 if (!innermostContainer) { 6181 return; 6182 } 6183 6184 // Move the item into the container if it's not there already 6185 if (this.containers.length === 1) { 6186 if (!this.containers[innermostIndex].containerCache.over) { 6187 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 6188 this.containers[innermostIndex].containerCache.over = 1; 6189 } 6190 } else { 6191 6192 // When entering a new container, we will find the item with the least distance and 6193 // append our item near it 6194 dist = 10000; 6195 itemWithLeastDistance = null; 6196 floating = innermostContainer.floating || this._isFloating(this.currentItem); 6197 posProperty = floating ? "left" : "top"; 6198 sizeProperty = floating ? "width" : "height"; 6199 axis = floating ? "pageX" : "pageY"; 6200 6201 for (j = this.items.length - 1; j >= 0; j--) { 6202 if (!$.contains( 6203 this.containers[innermostIndex].element[0], this.items[j].item[0]) 6204 ) { 6205 continue; 6206 } 6207 if (this.items[j].item[0] === this.currentItem[0]) { 6208 continue; 6209 } 6210 6211 cur = this.items[j].item.offset()[posProperty]; 6212 nearBottom = false; 6213 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 6214 nearBottom = true; 6215 } 6216 6217 if (Math.abs(event[axis] - cur) < dist) { 6218 dist = Math.abs(event[axis] - cur); 6219 itemWithLeastDistance = this.items[j]; 6220 this.direction = nearBottom ? "up" : "down"; 6221 } 6222 } 6223 6224 //Check if dropOnEmpty is enabled 6225 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 6226 return; 6227 } 6228 6229 if (this.currentContainer === this.containers[innermostIndex]) { 6230 if (!this.currentContainer.containerCache.over) { 6231 this.containers[innermostIndex]._trigger("over", event, this._uiHash()); 6232 this.currentContainer.containerCache.over = 1; 6233 } 6234 return; 6235 } 6236 6237 itemWithLeastDistance ? 6238 this._rearrange(event, itemWithLeastDistance, null, true) : 6239 this._rearrange(event, null, this.containers[innermostIndex].element, true); 6240 this._trigger("change", event, this._uiHash()); 6241 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 6242 this.currentContainer = this.containers[innermostIndex]; 6243 6244 //Update the placeholder 6245 this.options.placeholder.update(this.currentContainer, this.placeholder); 6246 6247 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 6248 this.containers[innermostIndex].containerCache.over = 1; 6249 } 6250 6251 }, 6252 6253 _createHelper: function (event) { 6254 6255 var o = this.options, 6256 helper = $.isFunction(o.helper) ? 6257 $(o.helper.apply(this.element[0], [event, this.currentItem])) : 6258 (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 6259 6260 //Add the helper to the DOM if that didn't happen already 6261 if (!helper.parents("body").length) { 6262 $(o.appendTo !== "parent" ? 6263 o.appendTo : 6264 this.currentItem[0].parentNode)[0].appendChild(helper[0]); 6265 } 6266 6267 if (helper[0] === this.currentItem[0]) { 6268 this._storedCSS = { 6269 width: this.currentItem[0].style.width, 6270 height: this.currentItem[0].style.height, 6271 position: this.currentItem.css("position"), 6272 top: this.currentItem.css("top"), 6273 left: this.currentItem.css("left") 6274 }; 6275 } 6276 6277 if (!helper[0].style.width || o.forceHelperSize) { 6278 helper.width(this.currentItem.width()); 6279 } 6280 if (!helper[0].style.height || o.forceHelperSize) { 6281 helper.height(this.currentItem.height()); 6282 } 6283 6284 return helper; 6285 6286 }, 6287
vendor: 5,832 bytes, lines 6288-6456
6288 _adjustOffsetFromHelper: function (obj) { 6289 if (typeof obj === "string") { 6290 obj = obj.split(" "); 6291 } 6292 if ($.isArray(obj)) { 6293 obj = { left: +obj[0], top: +obj[1] || 0 }; 6294 } 6295 if ("left" in obj) { 6296 this.offset.click.left = obj.left + this.margins.left; 6297 } 6298 if ("right" in obj) { 6299 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 6300 } 6301 if ("top" in obj) { 6302 this.offset.click.top = obj.top + this.margins.top; 6303 } 6304 if ("bottom" in obj) { 6305 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 6306 } 6307 }, 6308 6309 _getParentOffset: function () { 6310 6311 //Get the offsetParent and cache its position 6312 this.offsetParent = this.helper.offsetParent(); 6313 var po = this.offsetParent.offset(); 6314 6315 // This is a special case where we need to modify a offset calculated on start, since the 6316 // following happened: 6317 // 1. The position of the helper is absolute, so it's position is calculated based on the 6318 // next positioned parent 6319 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 6320 // the document, which means that the scroll is included in the initial calculation of the 6321 // offset of the parent, and never recalculated upon drag 6322 if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && 6323 $.contains(this.scrollParent[0], this.offsetParent[0])) { 6324 po.left += this.scrollParent.scrollLeft(); 6325 po.top += this.scrollParent.scrollTop(); 6326 } 6327 6328 // This needs to be actually done for all browsers, since pageX/pageY includes this 6329 // information with an ugly IE fix 6330 if (this.offsetParent[0] === this.document[0].body || 6331 (this.offsetParent[0].tagName && 6332 this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 6333 po = { top: 0, left: 0 }; 6334 } 6335 6336 return { 6337 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 6338 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 6339 }; 6340 6341 }, 6342 6343 _getRelativeOffset: function () { 6344 6345 if (this.cssPosition === "relative") { 6346 var p = this.currentItem.position(); 6347 return { 6348 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 6349 this.scrollParent.scrollTop(), 6350 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 6351 this.scrollParent.scrollLeft() 6352 }; 6353 } else { 6354 return { top: 0, left: 0 }; 6355 } 6356 6357 }, 6358 6359 _cacheMargins: function () { 6360 this.margins = { 6361 left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), 6362 top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) 6363 }; 6364 }, 6365 6366 _cacheHelperProportions: function () { 6367 this.helperProportions = { 6368 width: this.helper.outerWidth(), 6369 height: this.helper.outerHeight() 6370 }; 6371 }, 6372 6373 _setContainment: function () { 6374 6375 var ce, co, over, 6376 o = this.options; 6377 if (o.containment === "parent") { 6378 o.containment = this.helper[0].parentNode; 6379 } 6380 if (o.containment === "document" || o.containment === "window") { 6381 this.containment = [ 6382 0 - this.offset.relative.left - this.offset.parent.left, 6383 0 - this.offset.relative.top - this.offset.parent.top, 6384 o.containment === "document" ? 6385 this.document.width() : 6386 this.window.width() - this.helperProportions.width - this.margins.left, 6387 (o.containment === "document" ? 6388 (this.document.height() || document.body.parentNode.scrollHeight) : 6389 this.window.height() || this.document[0].body.parentNode.scrollHeight 6390 ) - this.helperProportions.height - this.margins.top 6391 ]; 6392 } 6393 6394 if (!(/^(document|window|parent)$/).test(o.containment)) { 6395 ce = $(o.containment)[0]; 6396 co = $(o.containment).offset(); 6397 over = ($(ce).css("overflow") !== "hidden"); 6398 6399 this.containment = [ 6400 co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + 6401 (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, 6402 co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + 6403 (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, 6404 co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 6405 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - 6406 (parseInt($(ce).css("paddingRight"), 10) || 0) - 6407 this.helperProportions.width - this.margins.left, 6408 co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 6409 (parseInt($(ce).css("borderTopWidth"), 10) || 0) - 6410 (parseInt($(ce).css("paddingBottom"), 10) || 0) - 6411 this.helperProportions.height - this.margins.top 6412 ]; 6413 } 6414 6415 }, 6416 6417 _convertPositionTo: function (d, pos) { 6418 6419 if (!pos) { 6420 pos = this.position; 6421 } 6422 var mod = d === "absolute" ? 1 : -1, 6423 scroll = this.cssPosition === "absolute" && 6424 !(this.scrollParent[0] !== this.document[0] && 6425 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 6426 this.offsetParent : 6427 this.scrollParent, 6428 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 6429 6430 return { 6431 top: ( 6432 6433 // The absolute mouse position 6434 pos.top + 6435 6436 // Only for relative positioned nodes: Relative offset from element to offset parent 6437 this.offset.relative.top * mod + 6438 6439 // The offsetParent's offset without borders (offset + border) 6440 this.offset.parent.top * mod - 6441 ((this.cssPosition === "fixed" ? 6442 -this.scrollParent.scrollTop() : 6443 (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod) 6444 ), 6445 left: ( 6446 6447 // The absolute mouse position 6448 pos.left + 6449 6450 // Only for relative positioned nodes: Relative offset from element to offset parent 6451 this.offset.relative.left * mod + 6452 6453 // The offsetParent's offset without borders (offset + border) 6454 this.offset.parent.left * mod - 6455 ((this.cssPosition === "fixed" ? 6456 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 4,423 bytes, lines 6457-6588
6457 scroll.scrollLeft()) * mod) 6458 ) 6459 }; 6460 6461 }, 6462 6463 _generatePosition: function (event) { 6464 6465 var top, left, 6466 o = this.options, 6467 pageX = event.pageX, 6468 pageY = event.pageY, 6469 scroll = this.cssPosition === "absolute" && 6470 !(this.scrollParent[0] !== this.document[0] && 6471 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 6472 this.offsetParent : 6473 this.scrollParent, 6474 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 6475 6476 // This is another very weird special case that only happens for relative elements: 6477 // 1. If the css position is relative 6478 // 2. and the scroll parent is the document or similar to the offset parent 6479 // we have to refresh the relative offset during the scroll so there are no jumps 6480 if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && 6481 this.scrollParent[0] !== this.offsetParent[0])) { 6482 this.offset.relative = this._getRelativeOffset(); 6483 } 6484 6485 /* 6486 * - Position constraining - 6487 * Constrain the position to a mix of grid, containment. 6488 */ 6489 6490 if (this.originalPosition) { //If we are not dragging yet, we won't check for options 6491 6492 if (this.containment) { 6493 if (event.pageX - this.offset.click.left < this.containment[0]) { 6494 pageX = this.containment[0] + this.offset.click.left; 6495 } 6496 if (event.pageY - this.offset.click.top < this.containment[1]) { 6497 pageY = this.containment[1] + this.offset.click.top; 6498 } 6499 if (event.pageX - this.offset.click.left > this.containment[2]) { 6500 pageX = this.containment[2] + this.offset.click.left; 6501 } 6502 if (event.pageY - this.offset.click.top > this.containment[3]) { 6503 pageY = this.containment[3] + this.offset.click.top; 6504 } 6505 } 6506 6507 if (o.grid) { 6508 top = this.originalPageY + Math.round((pageY - this.originalPageY) / 6509 o.grid[1]) * o.grid[1]; 6510 pageY = this.containment ? 6511 ((top - this.offset.click.top >= this.containment[1] && 6512 top - this.offset.click.top <= this.containment[3]) ? 6513 top : 6514 ((top - this.offset.click.top >= this.containment[1]) ? 6515 top - o.grid[1] : top + o.grid[1])) : 6516 top; 6517 6518 left = this.originalPageX + Math.round((pageX - this.originalPageX) / 6519 o.grid[0]) * o.grid[0]; 6520 pageX = this.containment ? 6521 ((left - this.offset.click.left >= this.containment[0] && 6522 left - this.offset.click.left <= this.containment[2]) ? 6523 left : 6524 ((left - this.offset.click.left >= this.containment[0]) ? 6525 left - o.grid[0] : left + o.grid[0])) : 6526 left; 6527 } 6528 6529 } 6530 6531 return { 6532 top: ( 6533 6534 // The absolute mouse position 6535 pageY - 6536 6537 // Click offset (relative to the element) 6538 this.offset.click.top - 6539 6540 // Only for relative positioned nodes: Relative offset from element to offset parent 6541 this.offset.relative.top - 6542 6543 // The offsetParent's offset without borders (offset + border) 6544 this.offset.parent.top + 6545 ((this.cssPosition === "fixed" ? 6546 -this.scrollParent.scrollTop() : 6547 (scrollIsRootNode ? 0 : scroll.scrollTop()))) 6548 ), 6549 left: ( 6550 6551 // The absolute mouse position 6552 pageX - 6553 6554 // Click offset (relative to the element) 6555 this.offset.click.left - 6556 6557 // Only for relative positioned nodes: Relative offset from element to offset parent 6558 this.offset.relative.left - 6559 6560 // The offsetParent's offset without borders (offset + border) 6561 this.offset.parent.left + 6562 ((this.cssPosition === "fixed" ? 6563 -this.scrollParent.scrollLeft() : 6564 scrollIsRootNode ? 0 : scroll.scrollLeft())) 6565 ) 6566 }; 6567 6568 }, 6569 6570 _rearrange: function (event, i, a, hardRefresh) { 6571 6572 a ? a[0].appendChild(this.placeholder[0]) : 6573 i.item[0].parentNode.insertBefore(this.placeholder[0], 6574 (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 6575 6576 //Various things done here to improve the performance: 6577 // 1. we create a setTimeout, that calls refreshPositions 6578 // 2. on the instance, we have a counter variable, that get's higher after every append 6579 // 3. on the local scope, we copy the counter variable, and check in the timeout, 6580 // if it's still the same 6581 // 4. this lets only the last addition to the timeout stack through 6582 this.counter = this.counter ? ++this.counter : 1; 6583 var counter = this.counter; 6584 6585 this._delay(function () { 6586 if (counter === this.counter) { 6587 6588 //Precompute after each DOM insertion, NOT on mousemove
vendor: 3,845 bytes, lines 6589-6714
6589 this.refreshPositions(!hardRefresh); 6590 } 6591 }); 6592 6593 }, 6594 6595 _clear: function (event, noPropagation) { 6596 6597 this.reverting = false; 6598 6599 // We delay all events that have to be triggered to after the point where the placeholder 6600 // has been removed and everything else normalized again 6601 var i, 6602 delayedTriggers = []; 6603 6604 // We first have to update the dom position of the actual currentItem 6605 // Note: don't do it if the current item is already removed (by a user), or it gets 6606 // reappended (see #4088) 6607 if (!this._noFinalSort && this.currentItem.parent().length) { 6608 this.placeholder.before(this.currentItem); 6609 } 6610 this._noFinalSort = null; 6611 6612 if (this.helper[0] === this.currentItem[0]) { 6613 for (i in this._storedCSS) { 6614 if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 6615 this._storedCSS[i] = ""; 6616 } 6617 } 6618 this.currentItem.css(this._storedCSS); 6619 this._removeClass(this.currentItem, "ui-sortable-helper"); 6620 } else { 6621 this.currentItem.show(); 6622 } 6623 6624 if (this.fromOutside && !noPropagation) { 6625 delayedTriggers.push(function (event) { 6626 this._trigger("receive", event, this._uiHash(this.fromOutside)); 6627 }); 6628 } 6629 if ((this.fromOutside || 6630 this.domPosition.prev !== 6631 this.currentItem.prev().not(".ui-sortable-helper")[0] || 6632 this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 6633 6634 // Trigger update callback if the DOM position has changed 6635 delayedTriggers.push(function (event) { 6636 this._trigger("update", event, this._uiHash()); 6637 }); 6638 } 6639 6640 // Check if the items Container has Changed and trigger appropriate 6641 // events. 6642 if (this !== this.currentContainer) { 6643 if (!noPropagation) { 6644 delayedTriggers.push(function (event) { 6645 this._trigger("remove", event, this._uiHash()); 6646 }); 6647 delayedTriggers.push((function (c) { 6648 return function (event) { 6649 c._trigger("receive", event, this._uiHash(this)); 6650 }; 6651 }).call(this, this.currentContainer)); 6652 delayedTriggers.push((function (c) { 6653 return function (event) { 6654 c._trigger("update", event, this._uiHash(this)); 6655 }; 6656 }).call(this, this.currentContainer)); 6657 } 6658 } 6659 6660 //Post events to containers 6661 function delayEvent(type, instance, container) { 6662 return function (event) { 6663 container._trigger(type, event, instance._uiHash(instance)); 6664 }; 6665 } 6666 for (i = this.containers.length - 1; i >= 0; i--) { 6667 if (!noPropagation) { 6668 delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])); 6669 } 6670 if (this.containers[i].containerCache.over) { 6671 delayedTriggers.push(delayEvent("out", this, this.containers[i])); 6672 this.containers[i].containerCache.over = 0; 6673 } 6674 } 6675 6676 //Do what was originally in plugins 6677 if (this.storedCursor) { 6678 this.document.find("body").css("cursor", this.storedCursor); 6679 this.storedStylesheet.remove(); 6680 } 6681 if (this._storedOpacity) { 6682 this.helper.css("opacity", this._storedOpacity); 6683 } 6684 if (this._storedZIndex) { 6685 this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 6686 } 6687 6688 this.dragging = false; 6689 6690 if (!noPropagation) { 6691 this._trigger("beforeStop", event, this._uiHash()); 6692 } 6693 6694 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 6695 // it unbinds ALL events from the original node! 6696 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 6697 6698 if (!this.cancelHelperRemoval) { 6699 if (this.helper[0] !== this.currentItem[0]) { 6700 this.helper.remove(); 6701 } 6702 this.helper = null; 6703 } 6704 6705 if (!noPropagation) { 6706 for (i = 0; i < delayedTriggers.length; i++) { 6707 6708 // Trigger all delayed events 6709 delayedTriggers[i].call(this, event); 6710 } 6711 this._trigger("stop", event, this._uiHash()); 6712 } 6713 6714 this.fromOutside = false;
vendor: 22,016 bytes, lines 6715-7556
6715 return !this.cancelHelperRemoval; 6716 6717 }, 6718 6719 _trigger: function () { 6720 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 6721 this.cancel(); 6722 } 6723 }, 6724 6725 _uiHash: function (_inst) { 6726 var inst = _inst || this; 6727 return { 6728 helper: inst.helper, 6729 placeholder: inst.placeholder || $([]), 6730 position: inst.position, 6731 originalPosition: inst.originalPosition, 6732 offset: inst.positionAbs, 6733 item: inst.currentItem, 6734 sender: _inst ? _inst.element : null 6735 }; 6736 } 6737 6738 }); 6739 6740 6741 /*! 6742 * jQuery UI Accordion 1.12.1 6743 * http://jqueryui.com 6744 * 6745 * Copyright jQuery Foundation and other contributors 6746 * Released under the MIT license. 6747 * http://jquery.org/license 6748 */ 6749 6750 //>>label: Accordion 6751 //>>group: Widgets 6752 // jscs:disable maximumLineLength 6753 //>>description: Displays collapsible content panels for presenting information in a limited amount of space. 6754 // jscs:enable maximumLineLength 6755 //>>docs: http://api.jqueryui.com/accordion/ 6756 //>>demos: http://jqueryui.com/accordion/ 6757 //>>css.structure: ../../themes/base/core.css 6758 //>>css.structure: ../../themes/base/accordion.css 6759 //>>css.theme: ../../themes/base/theme.css 6760 6761 6762 6763 var widgetsAccordion = $.widget("ui.accordion", { 6764 version: "1.12.1", 6765 options: { 6766 active: 0, 6767 animate: {}, 6768 classes: { 6769 "ui-accordion-header": "ui-corner-top", 6770 "ui-accordion-header-collapsed": "ui-corner-all", 6771 "ui-accordion-content": "ui-corner-bottom" 6772 }, 6773 collapsible: false, 6774 event: "click", 6775 header: "> li > :first-child, > :not(li):even", 6776 heightStyle: "auto", 6777 icons: { 6778 activeHeader: "ui-icon-triangle-1-s", 6779 header: "ui-icon-triangle-1-e" 6780 }, 6781 6782 // Callbacks 6783 activate: null, 6784 beforeActivate: null 6785 }, 6786 6787 hideProps: { 6788 borderTopWidth: "hide", 6789 borderBottomWidth: "hide", 6790 paddingTop: "hide", 6791 paddingBottom: "hide", 6792 height: "hide" 6793 }, 6794 6795 showProps: { 6796 borderTopWidth: "show", 6797 borderBottomWidth: "show", 6798 paddingTop: "show", 6799 paddingBottom: "show", 6800 height: "show" 6801 }, 6802 6803 _create: function () { 6804 var options = this.options; 6805 6806 this.prevShow = this.prevHide = $(); 6807 this._addClass("ui-accordion", "ui-widget ui-helper-reset"); 6808 this.element.attr("role", "tablist"); 6809 6810 // Don't allow collapsible: false and active: false / null 6811 if (!options.collapsible && (options.active === false || options.active == null)) { 6812 options.active = 0; 6813 } 6814 6815 this._processPanels(); 6816 6817 // handle negative values 6818 if (options.active < 0) { 6819 options.active += this.headers.length; 6820 } 6821 this._refresh(); 6822 }, 6823 6824 _getCreateEventData: function () { 6825 return { 6826 header: this.active, 6827 panel: !this.active.length ? $() : this.active.next() 6828 }; 6829 }, 6830 6831 _createIcons: function () { 6832 var icon, children, 6833 icons = this.options.icons; 6834 6835 if (icons) { 6836 icon = $("<span>"); 6837 this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header); 6838 icon.prependTo(this.headers); 6839 children = this.active.children(".ui-accordion-header-icon"); 6840 this._removeClass(children, icons.header) 6841 ._addClass(children, null, icons.activeHeader) 6842 ._addClass(this.headers, "ui-accordion-icons"); 6843 } 6844 }, 6845 6846 _destroyIcons: function () { 6847 this._removeClass(this.headers, "ui-accordion-icons"); 6848 this.headers.children(".ui-accordion-header-icon").remove(); 6849 }, 6850 6851 _destroy: function () { 6852 var contents; 6853 6854 // Clean up main element 6855 this.element.removeAttr("role"); 6856 6857 // Clean up headers 6858 this.headers 6859 .removeAttr("role aria-expanded aria-selected aria-controls tabIndex") 6860 .removeUniqueId(); 6861 6862 this._destroyIcons(); 6863 6864 // Clean up content panels 6865 contents = this.headers.next() 6866 .css("display", "") 6867 .removeAttr("role aria-hidden aria-labelledby") 6868 .removeUniqueId(); 6869 6870 if (this.options.heightStyle !== "content") { 6871 contents.css("height", ""); 6872 } 6873 }, 6874 6875 _setOption: function (key, value) { 6876 if (key === "active") { 6877 6878 // _activate() will handle invalid values and update this.options 6879 this._activate(value); 6880 return; 6881 } 6882 6883 if (key === "event") { 6884 if (this.options.event) { 6885 this._off(this.headers, this.options.event); 6886 } 6887 this._setupEvents(value); 6888 } 6889 6890 this._super(key, value); 6891 6892 // Setting collapsible: false while collapsed; open first panel 6893 if (key === "collapsible" && !value && this.options.active === false) { 6894 this._activate(0); 6895 } 6896 6897 if (key === "icons") { 6898 this._destroyIcons(); 6899 if (value) { 6900 this._createIcons(); 6901 } 6902 } 6903 }, 6904 6905 _setOptionDisabled: function (value) { 6906 this._super(value); 6907 6908 this.element.attr("aria-disabled", value); 6909 6910 // Support: IE8 Only 6911 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 6912 // so we need to add the disabled class to the headers and panels 6913 this._toggleClass(null, "ui-state-disabled", !!value); 6914 this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled", 6915 !!value); 6916 }, 6917 6918 _keydown: function (event) { 6919 if (event.altKey || event.ctrlKey) { 6920 return; 6921 } 6922 6923 var keyCode = $.ui.keyCode, 6924 length = this.headers.length, 6925 currentIndex = this.headers.index(event.target), 6926 toFocus = false; 6927 6928 switch (event.keyCode) { 6929 case keyCode.RIGHT: 6930 case keyCode.DOWN: 6931 toFocus = this.headers[(currentIndex + 1) % length]; 6932 break; 6933 case keyCode.LEFT: 6934 case keyCode.UP: 6935 toFocus = this.headers[(currentIndex - 1 + length) % length]; 6936 break; 6937 case keyCode.SPACE: 6938 case keyCode.ENTER: 6939 this._eventHandler(event); 6940 break; 6941 case keyCode.HOME: 6942 toFocus = this.headers[0]; 6943 break; 6944 case keyCode.END: 6945 toFocus = this.headers[length - 1]; 6946 break; 6947 } 6948 6949 if (toFocus) { 6950 $(event.target).attr("tabIndex", -1); 6951 $(toFocus).attr("tabIndex", 0); 6952 $(toFocus).trigger("focus"); 6953 event.preventDefault(); 6954 } 6955 }, 6956 6957 _panelKeyDown: function (event) { 6958 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 6959 $(event.currentTarget).prev().trigger("focus"); 6960 } 6961 }, 6962 6963 refresh: function () { 6964 var options = this.options; 6965 this._processPanels(); 6966 6967 // Was collapsed or no panel 6968 if ((options.active === false && options.collapsible === true) || 6969 !this.headers.length) { 6970 options.active = false; 6971 this.active = $(); 6972 6973 // active false only when collapsible is true 6974 } else if (options.active === false) { 6975 this._activate(0); 6976 6977 // was active, but active panel is gone 6978 } else if (this.active.length && !$.contains(this.element[0], this.active[0])) { 6979 6980 // all remaining panel are disabled 6981 if (this.headers.length === this.headers.find(".ui-state-disabled").length) { 6982 options.active = false; 6983 this.active = $(); 6984 6985 // activate previous panel 6986 } else { 6987 this._activate(Math.max(0, options.active - 1)); 6988 } 6989 6990 // was active, active panel still exists 6991 } else { 6992 6993 // make sure active index is correct 6994 options.active = this.headers.index(this.active); 6995 } 6996 6997 this._destroyIcons(); 6998 6999 this._refresh(); 7000 }, 7001 7002 _processPanels: function () { 7003 var prevHeaders = this.headers, 7004 prevPanels = this.panels; 7005 7006 this.headers = this.element.find(this.options.header); 7007 this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed", 7008 "ui-state-default"); 7009 7010 this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide(); 7011 this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content"); 7012 7013 // Avoid memory leaks (#10056) 7014 if (prevPanels) { 7015 this._off(prevHeaders.not(this.headers)); 7016 this._off(prevPanels.not(this.panels)); 7017 } 7018 }, 7019 7020 _refresh: function () { 7021 var maxHeight, 7022 options = this.options, 7023 heightStyle = options.heightStyle, 7024 parent = this.element.parent(); 7025 7026 this.active = this._findActive(options.active); 7027 this._addClass(this.active, "ui-accordion-header-active", "ui-state-active") 7028 ._removeClass(this.active, "ui-accordion-header-collapsed"); 7029 this._addClass(this.active.next(), "ui-accordion-content-active"); 7030 this.active.next().show(); 7031 7032 this.headers 7033 .attr("role", "tab") 7034 .each(function () { 7035 var header = $(this), 7036 headerId = header.uniqueId().attr("id"), 7037 panel = header.next(), 7038 panelId = panel.uniqueId().attr("id"); 7039 header.attr("aria-controls", panelId); 7040 panel.attr("aria-labelledby", headerId); 7041 }) 7042 .next() 7043 .attr("role", "tabpanel"); 7044 7045 this.headers 7046 .not(this.active) 7047 .attr({ 7048 "aria-selected": "false", 7049 "aria-expanded": "false", 7050 tabIndex: -1 7051 }) 7052 .next() 7053 .attr({ 7054 "aria-hidden": "true" 7055 }) 7056 .hide(); 7057 7058 // Make sure at least one header is in the tab order 7059 if (!this.active.length) { 7060 this.headers.eq(0).attr("tabIndex", 0); 7061 } else { 7062 this.active.attr({ 7063 "aria-selected": "true", 7064 "aria-expanded": "true", 7065 tabIndex: 0 7066 }) 7067 .next() 7068 .attr({ 7069 "aria-hidden": "false" 7070 }); 7071 } 7072 7073 this._createIcons(); 7074 7075 this._setupEvents(options.event); 7076 7077 if (heightStyle === "fill") { 7078 maxHeight = parent.height(); 7079 this.element.siblings(":visible").each(function () { 7080 var elem = $(this), 7081 position = elem.css("position"); 7082 7083 if (position === "absolute" || position === "fixed") { 7084 return; 7085 } 7086 maxHeight -= elem.outerHeight(true); 7087 }); 7088 7089 this.headers.each(function () { 7090 maxHeight -= $(this).outerHeight(true); 7091 }); 7092 7093 this.headers.next() 7094 .each(function () { 7095 $(this).height(Math.max(0, maxHeight - 7096 $(this).innerHeight() + $(this).height())); 7097 }) 7098 .css("overflow", "auto"); 7099 } else if (heightStyle === "auto") { 7100 maxHeight = 0; 7101 this.headers.next() 7102 .each(function () { 7103 var isVisible = $(this).is(":visible"); 7104 if (!isVisible) { 7105 $(this).show(); 7106 } 7107 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 7108 if (!isVisible) { 7109 $(this).hide(); 7110 } 7111 }) 7112 .height(maxHeight); 7113 } 7114 }, 7115 7116 _activate: function (index) { 7117 var active = this._findActive(index)[0]; 7118 7119 // Trying to activate the already active panel 7120 if (active === this.active[0]) { 7121 return; 7122 } 7123 7124 // Trying to collapse, simulate a click on the currently active header 7125 active = active || this.active[0]; 7126 7127 this._eventHandler({ 7128 target: active, 7129 currentTarget: active, 7130 preventDefault: $.noop 7131 }); 7132 }, 7133 7134 _findActive: function (selector) { 7135 return typeof selector === "number" ? this.headers.eq(selector) : $(); 7136 }, 7137 7138 _setupEvents: function (event) { 7139 var events = { 7140 keydown: "_keydown" 7141 }; 7142 if (event) { 7143 $.each(event.split(" "), function (index, eventName) { 7144 events[eventName] = "_eventHandler"; 7145 }); 7146 } 7147 7148 this._off(this.headers.add(this.headers.next())); 7149 this._on(this.headers, events); 7150 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 7151 this._hoverable(this.headers); 7152 this._focusable(this.headers); 7153 }, 7154 7155 _eventHandler: function (event) { 7156 var activeChildren, clickedChildren, 7157 options = this.options, 7158 active = this.active, 7159 clicked = $(event.currentTarget), 7160 clickedIsActive = clicked[0] === active[0], 7161 collapsing = clickedIsActive && options.collapsible, 7162 toShow = collapsing ? $() : clicked.next(), 7163 toHide = active.next(), 7164 eventData = { 7165 oldHeader: active, 7166 oldPanel: toHide, 7167 newHeader: collapsing ? $() : clicked, 7168 newPanel: toShow 7169 }; 7170 7171 event.preventDefault(); 7172 7173 if ( 7174 7175 // click on active header, but not collapsible 7176 (clickedIsActive && !options.collapsible) || 7177 7178 // allow canceling activation 7179 (this._trigger("beforeActivate", event, eventData) === false)) { 7180 return; 7181 } 7182 7183 options.active = collapsing ? false : this.headers.index(clicked); 7184 7185 // When the call to ._toggle() comes after the class changes 7186 // it causes a very odd bug in IE 8 (see #6720) 7187 this.active = clickedIsActive ? $() : clicked; 7188 this._toggle(eventData); 7189 7190 // Switch classes 7191 // corner classes on the previously active header stay after the animation 7192 this._removeClass(active, "ui-accordion-header-active", "ui-state-active"); 7193 if (options.icons) { 7194 activeChildren = active.children(".ui-accordion-header-icon"); 7195 this._removeClass(activeChildren, null, options.icons.activeHeader) 7196 ._addClass(activeChildren, null, options.icons.header); 7197 } 7198 7199 if (!clickedIsActive) { 7200 this._removeClass(clicked, "ui-accordion-header-collapsed") 7201 ._addClass(clicked, "ui-accordion-header-active", "ui-state-active"); 7202 if (options.icons) { 7203 clickedChildren = clicked.children(".ui-accordion-header-icon"); 7204 this._removeClass(clickedChildren, null, options.icons.header) 7205 ._addClass(clickedChildren, null, options.icons.activeHeader); 7206 } 7207 7208 this._addClass(clicked.next(), "ui-accordion-content-active"); 7209 } 7210 }, 7211 7212 _toggle: function (data) { 7213 var toShow = data.newPanel, 7214 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 7215 7216 // Handle activating a panel during the animation for another activation 7217 this.prevShow.add(this.prevHide).stop(true, true); 7218 this.prevShow = toShow; 7219 this.prevHide = toHide; 7220 7221 if (this.options.animate) { 7222 this._animate(toShow, toHide, data); 7223 } else { 7224 toHide.hide(); 7225 toShow.show(); 7226 this._toggleComplete(data); 7227 } 7228 7229 toHide.attr({ 7230 "aria-hidden": "true" 7231 }); 7232 toHide.prev().attr({ 7233 "aria-selected": "false", 7234 "aria-expanded": "false" 7235 }); 7236 7237 // if we're switching panels, remove the old header from the tab order 7238 // if we're opening from collapsed state, remove the previous header from the tab order 7239 // if we're collapsing, then keep the collapsing header in the tab order 7240 if (toShow.length && toHide.length) { 7241 toHide.prev().attr({ 7242 "tabIndex": -1, 7243 "aria-expanded": "false" 7244 }); 7245 } else if (toShow.length) { 7246 this.headers.filter(function () { 7247 return parseInt($(this).attr("tabIndex"), 10) === 0; 7248 }) 7249 .attr("tabIndex", -1); 7250 } 7251 7252 toShow 7253 .attr("aria-hidden", "false") 7254 .prev() 7255 .attr({ 7256 "aria-selected": "true", 7257 "aria-expanded": "true", 7258 tabIndex: 0 7259 }); 7260 }, 7261 7262 _animate: function (toShow, toHide, data) { 7263 var total, easing, duration, 7264 that = this, 7265 adjust = 0, 7266 boxSizing = toShow.css("box-sizing"), 7267 down = toShow.length && 7268 (!toHide.length || (toShow.index() < toHide.index())), 7269 animate = this.options.animate || {}, 7270 options = down && animate.down || animate, 7271 complete = function () { 7272 that._toggleComplete(data); 7273 }; 7274 7275 if (typeof options === "number") { 7276 duration = options; 7277 } 7278 if (typeof options === "string") { 7279 easing = options; 7280 } 7281 7282 // fall back from options to animation in case of partial down settings 7283 easing = easing || options.easing || animate.easing; 7284 duration = duration || options.duration || animate.duration; 7285 7286 if (!toHide.length) { 7287 return toShow.animate(this.showProps, duration, easing, complete); 7288 } 7289 if (!toShow.length) { 7290 return toHide.animate(this.hideProps, duration, easing, complete); 7291 } 7292 7293 total = toShow.show().outerHeight(); 7294 toHide.animate(this.hideProps, { 7295 duration: duration, 7296 easing: easing, 7297 step: function (now, fx) { 7298 fx.now = Math.round(now); 7299 } 7300 }); 7301 toShow 7302 .hide() 7303 .animate(this.showProps, { 7304 duration: duration, 7305 easing: easing, 7306 complete: complete, 7307 step: function (now, fx) { 7308 fx.now = Math.round(now); 7309 if (fx.prop !== "height") { 7310 if (boxSizing === "content-box") { 7311 adjust += fx.now; 7312 } 7313 } else if (that.options.heightStyle !== "content") { 7314 fx.now = Math.round(total - toHide.outerHeight() - adjust); 7315 adjust = 0; 7316 } 7317 } 7318 }); 7319 }, 7320 7321 _toggleComplete: function (data) { 7322 var toHide = data.oldPanel, 7323 prev = toHide.prev(); 7324 7325 this._removeClass(toHide, "ui-accordion-content-active"); 7326 this._removeClass(prev, "ui-accordion-header-active") 7327 ._addClass(prev, "ui-accordion-header-collapsed"); 7328 7329 // Work around for rendering bug in IE (#5421) 7330 if (toHide.length) { 7331 toHide.parent()[0].className = toHide.parent()[0].className; 7332 } 7333 this._trigger("activate", null, data); 7334 } 7335 }); 7336 7337 7338 /*! 7339 * jQuery UI Menu 1.12.1 7340 * http://jqueryui.com 7341 * 7342 * Copyright jQuery Foundation and other contributors 7343 * Released under the MIT license. 7344 * http://jquery.org/license 7345 */ 7346 7347 //>>label: Menu 7348 //>>group: Widgets 7349 //>>description: Creates nestable menus. 7350 //>>docs: http://api.jqueryui.com/menu/ 7351 //>>demos: http://jqueryui.com/menu/ 7352 //>>css.structure: ../../themes/base/core.css 7353 //>>css.structure: ../../themes/base/menu.css 7354 //>>css.theme: ../../themes/base/theme.css 7355 7356 7357 7358 var widgetsMenu = $.widget("ui.menu", { 7359 version: "1.12.1", 7360 defaultElement: "<ul>", 7361 delay: 300, 7362 options: { 7363 icons: { 7364 submenu: "ui-icon-caret-1-e" 7365 }, 7366 items: "> *", 7367 menus: "ul", 7368 position: { 7369 my: "left top", 7370 at: "right top" 7371 }, 7372 role: "menu", 7373 7374 // Callbacks 7375 blur: null, 7376 focus: null, 7377 select: null 7378 }, 7379 7380 _create: function () { 7381 this.activeMenu = this.element; 7382 7383 // Flag used to prevent firing of the click handler 7384 // as the event bubbles up through nested menus 7385 this.mouseHandled = false; 7386 this.element 7387 .uniqueId() 7388 .attr({ 7389 role: this.options.role, 7390 tabIndex: 0 7391 }); 7392 7393 this._addClass("ui-menu", "ui-widget ui-widget-content"); 7394 this._on({ 7395 7396 // Prevent focus from sticking to links inside menu after clicking 7397 // them (focus should always stay on UL during navigation). 7398 "mousedown .ui-menu-item": function (event) { 7399 event.preventDefault(); 7400 }, 7401 "click .ui-menu-item": function (event) { 7402 var target = $(event.target); 7403 var active = $($.ui.safeActiveElement(this.document[0])); 7404 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 7405 this.select(event); 7406 7407 // Only set the mouseHandled flag if the event will bubble, see #9469. 7408 if (!event.isPropagationStopped()) { 7409 this.mouseHandled = true; 7410 } 7411 7412 // Open submenu on click 7413 if (target.has(".ui-menu").length) { 7414 this.expand(event); 7415 } else if (!this.element.is(":focus") && 7416 active.closest(".ui-menu").length) { 7417 7418 // Redirect focus to the menu 7419 this.element.trigger("focus", [true]); 7420 7421 // If the active item is on the top level, let it stay active. 7422 // Otherwise, blur the active item since it is no longer visible. 7423 if (this.active && this.active.parents(".ui-menu").length === 1) { 7424 clearTimeout(this.timer); 7425 } 7426 } 7427 } 7428 }, 7429 "mouseenter .ui-menu-item": function (event) { 7430 7431 // Ignore mouse events while typeahead is active, see #10458. 7432 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 7433 // is over an item in the menu 7434 if (this.previousFilter) { 7435 return; 7436 } 7437 7438 var actualTarget = $(event.target).closest(".ui-menu-item"), 7439 target = $(event.currentTarget); 7440 7441 // Ignore bubbled events on parent items, see #11641 7442 if (actualTarget[0] !== target[0]) { 7443 return; 7444 } 7445 7446 // Remove ui-state-active class from siblings of the newly focused menu item 7447 // to avoid a jump caused by adjacent elements both having a class with a border 7448 this._removeClass(target.siblings().children(".ui-state-active"), 7449 null, "ui-state-active"); 7450 this.focus(event, target); 7451 }, 7452 mouseleave: "collapseAll", 7453 "mouseleave .ui-menu": "collapseAll", 7454 focus: function (event, keepActiveItem) { 7455 7456 // If there's already an active item, keep it active 7457 // If not, activate the first item 7458 var item = this.active || this.element.find(this.options.items).eq(0); 7459 7460 if (!keepActiveItem) { 7461 this.focus(event, item); 7462 } 7463 }, 7464 blur: function (event) { 7465 this._delay(function () { 7466 var notContained = !$.contains( 7467 this.element[0], 7468 $.ui.safeActiveElement(this.document[0]) 7469 ); 7470 if (notContained) { 7471 this.collapseAll(event); 7472 } 7473 }); 7474 }, 7475 keydown: "_keydown" 7476 }); 7477 7478 this.refresh(); 7479 7480 // Clicks outside of a menu collapse any open menus 7481 this._on(this.document, { 7482 click: function (event) { 7483 if (this._closeOnDocumentClick(event)) { 7484 this.collapseAll(event); 7485 } 7486 7487 // Reset the mouseHandled flag 7488 this.mouseHandled = false; 7489 } 7490 }); 7491 }, 7492 7493 _destroy: function () { 7494 var items = this.element.find(".ui-menu-item") 7495 .removeAttr("role aria-disabled"), 7496 submenus = items.children(".ui-menu-item-wrapper") 7497 .removeUniqueId() 7498 .removeAttr("tabIndex role aria-haspopup"); 7499 7500 // Destroy (sub)menus 7501 this.element 7502 .removeAttr("aria-activedescendant") 7503 .find(".ui-menu").addBack() 7504 .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " + 7505 "tabIndex") 7506 .removeUniqueId() 7507 .show(); 7508 7509 submenus.children().each(function () { 7510 var elem = $(this); 7511 if (elem.data("ui-menu-submenu-caret")) { 7512 elem.remove(); 7513 } 7514 }); 7515 }, 7516 7517 _keydown: function (event) { 7518 var match, prev, character, skip, 7519 preventDefault = true; 7520 7521 switch (event.keyCode) { 7522 case $.ui.keyCode.PAGE_UP: 7523 this.previousPage(event); 7524 break; 7525 case $.ui.keyCode.PAGE_DOWN: 7526 this.nextPage(event); 7527 break; 7528 case $.ui.keyCode.HOME: 7529 this._move("first", "first", event); 7530 break; 7531 case $.ui.keyCode.END: 7532 this._move("last", "last", event); 7533 break; 7534 case $.ui.keyCode.UP: 7535 this.previous(event); 7536 break; 7537 case $.ui.keyCode.DOWN: 7538 this.next(event); 7539 break; 7540 case $.ui.keyCode.LEFT: 7541 this.collapse(event); 7542 break; 7543 case $.ui.keyCode.RIGHT: 7544 if (this.active && !this.active.is(".ui-state-disabled")) { 7545 this.expand(event); 7546 } 7547 break; 7548 case $.ui.keyCode.ENTER: 7549 case $.ui.keyCode.SPACE: 7550 this._activate(event); 7551 break; 7552 case $.ui.keyCode.ESCAPE: 7553 this.collapse(event); 7554 break; 7555 default: 7556 preventDefault = false;
vendor: 6,926 bytes, lines 7557-7805
7557 prev = this.previousFilter || ""; 7558 skip = false; 7559 7560 // Support number pad values 7561 character = event.keyCode >= 96 && event.keyCode <= 105 ? 7562 (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode); 7563 7564 clearTimeout(this.filterTimer); 7565 7566 if (character === prev) { 7567 skip = true; 7568 } else { 7569 character = prev + character; 7570 } 7571 7572 match = this._filterMenuItems(character); 7573 match = skip && match.index(this.active.next()) !== -1 ? 7574 this.active.nextAll(".ui-menu-item") : 7575 match; 7576 7577 // If no matches on the current filter, reset to the last character pressed 7578 // to move down the menu to the first item that starts with that character 7579 if (!match.length) { 7580 character = String.fromCharCode(event.keyCode); 7581 match = this._filterMenuItems(character); 7582 } 7583 7584 if (match.length) { 7585 this.focus(event, match); 7586 this.previousFilter = character; 7587 this.filterTimer = this._delay(function () { 7588 delete this.previousFilter; 7589 }, 1000); 7590 } else { 7591 delete this.previousFilter; 7592 } 7593 } 7594 7595 if (preventDefault) { 7596 event.preventDefault(); 7597 } 7598 }, 7599 7600 _activate: function (event) { 7601 if (this.active && !this.active.is(".ui-state-disabled")) { 7602 if (this.active.children("[aria-haspopup='true']").length) { 7603 this.expand(event); 7604 } else { 7605 this.select(event); 7606 } 7607 } 7608 }, 7609 7610 refresh: function () { 7611 var menus, items, newSubmenus, newItems, newWrappers, 7612 that = this, 7613 icon = this.options.icons.submenu, 7614 submenus = this.element.find(this.options.menus); 7615 7616 this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length); 7617 7618 // Initialize nested menus 7619 newSubmenus = submenus.filter(":not(.ui-menu)") 7620 .hide() 7621 .attr({ 7622 role: this.options.role, 7623 "aria-hidden": "true", 7624 "aria-expanded": "false" 7625 }) 7626 .each(function () { 7627 var menu = $(this), 7628 item = menu.prev(), 7629 submenuCaret = $("<span>").data("ui-menu-submenu-caret", true); 7630 7631 that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon); 7632 item 7633 .attr("aria-haspopup", "true") 7634 .prepend(submenuCaret); 7635 menu.attr("aria-labelledby", item.attr("id")); 7636 }); 7637 7638 this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front"); 7639 7640 menus = submenus.add(this.element); 7641 items = menus.find(this.options.items); 7642 7643 // Initialize menu-items containing spaces and/or dashes only as dividers 7644 items.not(".ui-menu-item").each(function () { 7645 var item = $(this); 7646 if (that._isDivider(item)) { 7647 that._addClass(item, "ui-menu-divider", "ui-widget-content"); 7648 } 7649 }); 7650 7651 // Don't refresh list items that are already adapted 7652 newItems = items.not(".ui-menu-item, .ui-menu-divider"); 7653 newWrappers = newItems.children() 7654 .not(".ui-menu") 7655 .uniqueId() 7656 .attr({ 7657 tabIndex: -1, 7658 role: this._itemRole() 7659 }); 7660 this._addClass(newItems, "ui-menu-item") 7661 ._addClass(newWrappers, "ui-menu-item-wrapper"); 7662 7663 // Add aria-disabled attribute to any disabled menu item 7664 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 7665 7666 // If the active item has been removed, blur the menu 7667 if (this.active && !$.contains(this.element[0], this.active[0])) { 7668 this.blur(); 7669 } 7670 }, 7671 7672 _itemRole: function () { 7673 return { 7674 menu: "menuitem", 7675 listbox: "option" 7676 }[this.options.role]; 7677 }, 7678 7679 _setOption: function (key, value) { 7680 if (key === "icons") { 7681 var icons = this.element.find(".ui-menu-icon"); 7682 this._removeClass(icons, null, this.options.icons.submenu) 7683 ._addClass(icons, null, value.submenu); 7684 } 7685 this._super(key, value); 7686 }, 7687 7688 _setOptionDisabled: function (value) { 7689 this._super(value); 7690 7691 this.element.attr("aria-disabled", String(value)); 7692 this._toggleClass(null, "ui-state-disabled", !!value); 7693 }, 7694 7695 focus: function (event, item) { 7696 var nested, focused, activeParent; 7697 this.blur(event, event && event.type === "focus"); 7698 7699 this._scrollIntoView(item); 7700 7701 this.active = item.first(); 7702 7703 focused = this.active.children(".ui-menu-item-wrapper"); 7704 this._addClass(focused, null, "ui-state-active"); 7705 7706 // Only update aria-activedescendant if there's a role 7707 // otherwise we assume focus is managed elsewhere 7708 if (this.options.role) { 7709 this.element.attr("aria-activedescendant", focused.attr("id")); 7710 } 7711 7712 // Highlight active parent menu item, if any 7713 activeParent = this.active 7714 .parent() 7715 .closest(".ui-menu-item") 7716 .children(".ui-menu-item-wrapper"); 7717 this._addClass(activeParent, null, "ui-state-active"); 7718 7719 if (event && event.type === "keydown") { 7720 this._close(); 7721 } else { 7722 this.timer = this._delay(function () { 7723 this._close(); 7724 }, this.delay); 7725 } 7726 7727 nested = item.children(".ui-menu"); 7728 if (nested.length && event && (/^mouse/.test(event.type))) { 7729 this._startOpening(nested); 7730 } 7731 this.activeMenu = item.parent(); 7732 7733 this._trigger("focus", event, { item: item }); 7734 }, 7735 7736 _scrollIntoView: function (item) { 7737 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 7738 if (this._hasScroll()) { 7739 borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 7740 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 7741 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 7742 scroll = this.activeMenu.scrollTop(); 7743 elementHeight = this.activeMenu.height(); 7744 itemHeight = item.outerHeight(); 7745 7746 if (offset < 0) { 7747 this.activeMenu.scrollTop(scroll + offset); 7748 } else if (offset + itemHeight > elementHeight) { 7749 this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight); 7750 } 7751 } 7752 }, 7753 7754 blur: function (event, fromFocus) { 7755 if (!fromFocus) { 7756 clearTimeout(this.timer); 7757 } 7758 7759 if (!this.active) { 7760 return; 7761 } 7762 7763 this._removeClass(this.active.children(".ui-menu-item-wrapper"), 7764 null, "ui-state-active"); 7765 7766 this._trigger("blur", event, { item: this.active }); 7767 this.active = null; 7768 }, 7769 7770 _startOpening: function (submenu) { 7771 clearTimeout(this.timer); 7772 7773 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 7774 // shift in the submenu position when mousing over the caret icon 7775 if (submenu.attr("aria-hidden") !== "true") { 7776 return; 7777 } 7778 7779 this.timer = this._delay(function () { 7780 this._close(); 7781 this._open(submenu); 7782 }, this.delay); 7783 }, 7784 7785 _open: function (submenu) { 7786 var position = $.extend({ 7787 of: this.active 7788 }, this.options.position); 7789 7790 clearTimeout(this.timer); 7791 this.element.find(".ui-menu").not(submenu.parents(".ui-menu")) 7792 .hide() 7793 .attr("aria-hidden", "true"); 7794 7795 submenu 7796 .show() 7797 .removeAttr("aria-hidden") 7798 .attr("aria-expanded", "true") 7799 .position(position); 7800 }, 7801 7802 collapseAll: function (event, all) { 7803 clearTimeout(this.timer); 7804 this.timer = this._delay(function () { 7805
vendor: 36,542 bytes, lines 7806-9155
7806 // If we were passed an event, look for the submenu that contains the event 7807 var currentMenu = all ? this.element : 7808 $(event && event.target).closest(this.element.find(".ui-menu")); 7809 7810 // If we found no valid submenu ancestor, use the main menu to close all 7811 // sub menus anyway 7812 if (!currentMenu.length) { 7813 currentMenu = this.element; 7814 } 7815 7816 this._close(currentMenu); 7817 7818 this.blur(event); 7819 7820 // Work around active item staying active after menu is blurred 7821 this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active"); 7822 7823 this.activeMenu = currentMenu; 7824 }, this.delay); 7825 }, 7826 7827 // With no arguments, closes the currently active menu - if nothing is active 7828 // it closes all menus. If passed an argument, it will search for menus BELOW 7829 _close: function (startMenu) { 7830 if (!startMenu) { 7831 startMenu = this.active ? this.active.parent() : this.element; 7832 } 7833 7834 startMenu.find(".ui-menu") 7835 .hide() 7836 .attr("aria-hidden", "true") 7837 .attr("aria-expanded", "false"); 7838 }, 7839 7840 _closeOnDocumentClick: function (event) { 7841 return !$(event.target).closest(".ui-menu").length; 7842 }, 7843 7844 _isDivider: function (item) { 7845 7846 // Match hyphen, em dash, en dash 7847 return !/[^\-\u2014\u2013\s]/.test(item.text()); 7848 }, 7849 7850 collapse: function (event) { 7851 var newItem = this.active && 7852 this.active.parent().closest(".ui-menu-item", this.element); 7853 if (newItem && newItem.length) { 7854 this._close(); 7855 this.focus(event, newItem); 7856 } 7857 }, 7858 7859 expand: function (event) { 7860 var newItem = this.active && 7861 this.active 7862 .children(".ui-menu ") 7863 .find(this.options.items) 7864 .first(); 7865 7866 if (newItem && newItem.length) { 7867 this._open(newItem.parent()); 7868 7869 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 7870 this._delay(function () { 7871 this.focus(event, newItem); 7872 }); 7873 } 7874 }, 7875 7876 next: function (event) { 7877 this._move("next", "first", event); 7878 }, 7879 7880 previous: function (event) { 7881 this._move("prev", "last", event); 7882 }, 7883 7884 isFirstItem: function () { 7885 return this.active && !this.active.prevAll(".ui-menu-item").length; 7886 }, 7887 7888 isLastItem: function () { 7889 return this.active && !this.active.nextAll(".ui-menu-item").length; 7890 }, 7891 7892 _move: function (direction, filter, event) { 7893 var next; 7894 if (this.active) { 7895 if (direction === "first" || direction === "last") { 7896 next = this.active 7897 [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item") 7898 .eq(-1); 7899 } else { 7900 next = this.active 7901 [direction + "All"](".ui-menu-item") 7902 .eq(0); 7903 } 7904 } 7905 if (!next || !next.length || !this.active) { 7906 next = this.activeMenu.find(this.options.items)[filter](); 7907 } 7908 7909 this.focus(event, next); 7910 }, 7911 7912 nextPage: function (event) { 7913 var item, base, height; 7914 7915 if (!this.active) { 7916 this.next(event); 7917 return; 7918 } 7919 if (this.isLastItem()) { 7920 return; 7921 } 7922 if (this._hasScroll()) { 7923 base = this.active.offset().top; 7924 height = this.element.height(); 7925 this.active.nextAll(".ui-menu-item").each(function () { 7926 item = $(this); 7927 return item.offset().top - base - height < 0; 7928 }); 7929 7930 this.focus(event, item); 7931 } else { 7932 this.focus(event, this.activeMenu.find(this.options.items) 7933 [!this.active ? "first" : "last"]()); 7934 } 7935 }, 7936 7937 previousPage: function (event) { 7938 var item, base, height; 7939 if (!this.active) { 7940 this.next(event); 7941 return; 7942 } 7943 if (this.isFirstItem()) { 7944 return; 7945 } 7946 if (this._hasScroll()) { 7947 base = this.active.offset().top; 7948 height = this.element.height(); 7949 this.active.prevAll(".ui-menu-item").each(function () { 7950 item = $(this); 7951 return item.offset().top - base + height > 0; 7952 }); 7953 7954 this.focus(event, item); 7955 } else { 7956 this.focus(event, this.activeMenu.find(this.options.items).first()); 7957 } 7958 }, 7959 7960 _hasScroll: function () { 7961 return this.element.outerHeight() < this.element.prop("scrollHeight"); 7962 }, 7963 7964 select: function (event) { 7965 7966 // TODO: It should never be possible to not have an active item at this 7967 // point, but the tests don't trigger mouseenter before click. 7968 this.active = this.active || $(event.target).closest(".ui-menu-item"); 7969 var ui = { item: this.active }; 7970 if (!this.active.has(".ui-menu").length) { 7971 this.collapseAll(event, true); 7972 } 7973 this._trigger("select", event, ui); 7974 }, 7975 7976 _filterMenuItems: function (character) { 7977 var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), 7978 regex = new RegExp("^" + escapedCharacter, "i"); 7979 7980 return this.activeMenu 7981 .find(this.options.items) 7982 7983 // Only match on items, not dividers or other content (#10571) 7984 .filter(".ui-menu-item") 7985 .filter(function () { 7986 return regex.test( 7987 $.trim($(this).children(".ui-menu-item-wrapper").text())); 7988 }); 7989 } 7990 }); 7991 7992 7993 /*! 7994 * jQuery UI Autocomplete 1.12.1 7995 * http://jqueryui.com 7996 * 7997 * Copyright jQuery Foundation and other contributors 7998 * Released under the MIT license. 7999 * http://jquery.org/license 8000 */ 8001 8002 //>>label: Autocomplete 8003 //>>group: Widgets 8004 //>>description: Lists suggested words as the user is typing. 8005 //>>docs: http://api.jqueryui.com/autocomplete/ 8006 //>>demos: http://jqueryui.com/autocomplete/ 8007 //>>css.structure: ../../themes/base/core.css 8008 //>>css.structure: ../../themes/base/autocomplete.css 8009 //>>css.theme: ../../themes/base/theme.css 8010 8011 8012 8013 $.widget("ui.autocomplete", { 8014 version: "1.12.1", 8015 defaultElement: "<input>", 8016 options: { 8017 appendTo: null, 8018 autoFocus: false, 8019 delay: 300, 8020 minLength: 1, 8021 position: { 8022 my: "left top", 8023 at: "left bottom", 8024 collision: "none" 8025 }, 8026 source: null, 8027 8028 // Callbacks 8029 change: null, 8030 close: null, 8031 focus: null, 8032 open: null, 8033 response: null, 8034 search: null, 8035 select: null 8036 }, 8037 8038 requestIndex: 0, 8039 pending: 0, 8040 8041 _create: function () { 8042 8043 // Some browsers only repeat keydown events, not keypress events, 8044 // so we use the suppressKeyPress flag to determine if we've already 8045 // handled the keydown event. #7269 8046 // Unfortunately the code for & in keypress is the same as the up arrow, 8047 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 8048 // events when we know the keydown event was used to modify the 8049 // search term. #7799 8050 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 8051 nodeName = this.element[0].nodeName.toLowerCase(), 8052 isTextarea = nodeName === "textarea", 8053 isInput = nodeName === "input"; 8054 8055 // Textareas are always multi-line 8056 // Inputs are always single-line, even if inside a contentEditable element 8057 // IE also treats inputs as contentEditable 8058 // All other element types are determined by whether or not they're contentEditable 8059 this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element); 8060 8061 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 8062 this.isNewMenu = true; 8063 8064 this._addClass("ui-autocomplete-input"); 8065 this.element.attr("autocomplete", "off"); 8066 8067 this._on(this.element, { 8068 keydown: function (event) { 8069 if (this.element.prop("readOnly")) { 8070 suppressKeyPress = true; 8071 suppressInput = true; 8072 suppressKeyPressRepeat = true; 8073 return; 8074 } 8075 8076 suppressKeyPress = false; 8077 suppressInput = false; 8078 suppressKeyPressRepeat = false; 8079 var keyCode = $.ui.keyCode; 8080 switch (event.keyCode) { 8081 case keyCode.PAGE_UP: 8082 suppressKeyPress = true; 8083 this._move("previousPage", event); 8084 break; 8085 case keyCode.PAGE_DOWN: 8086 suppressKeyPress = true; 8087 this._move("nextPage", event); 8088 break; 8089 case keyCode.UP: 8090 suppressKeyPress = true; 8091 this._keyEvent("previous", event); 8092 break; 8093 case keyCode.DOWN: 8094 suppressKeyPress = true; 8095 this._keyEvent("next", event); 8096 break; 8097 case keyCode.ENTER: 8098 8099 // when menu is open and has focus 8100 if (this.menu.active) { 8101 8102 // #6055 - Opera still allows the keypress to occur 8103 // which causes forms to submit 8104 suppressKeyPress = true; 8105 event.preventDefault(); 8106 this.menu.select(event); 8107 } 8108 break; 8109 case keyCode.TAB: 8110 if (this.menu.active) { 8111 this.menu.select(event); 8112 } 8113 break; 8114 case keyCode.ESCAPE: 8115 if (this.menu.element.is(":visible")) { 8116 if (!this.isMultiLine) { 8117 this._value(this.term); 8118 } 8119 this.close(event); 8120 8121 // Different browsers have different default behavior for escape 8122 // Single press can mean undo or clear 8123 // Double press in IE means clear the whole form 8124 event.preventDefault(); 8125 } 8126 break; 8127 default: 8128 suppressKeyPressRepeat = true; 8129 8130 // search timeout should be triggered before the input value is changed 8131 this._searchTimeout(event); 8132 break; 8133 } 8134 }, 8135 keypress: function (event) { 8136 if (suppressKeyPress) { 8137 suppressKeyPress = false; 8138 if (!this.isMultiLine || this.menu.element.is(":visible")) { 8139 event.preventDefault(); 8140 } 8141 return; 8142 } 8143 if (suppressKeyPressRepeat) { 8144 return; 8145 } 8146 8147 // Replicate some key handlers to allow them to repeat in Firefox and Opera 8148 var keyCode = $.ui.keyCode; 8149 switch (event.keyCode) { 8150 case keyCode.PAGE_UP: 8151 this._move("previousPage", event); 8152 break; 8153 case keyCode.PAGE_DOWN: 8154 this._move("nextPage", event); 8155 break; 8156 case keyCode.UP: 8157 this._keyEvent("previous", event); 8158 break; 8159 case keyCode.DOWN: 8160 this._keyEvent("next", event); 8161 break; 8162 } 8163 }, 8164 input: function (event) { 8165 if (suppressInput) { 8166 suppressInput = false; 8167 event.preventDefault(); 8168 return; 8169 } 8170 this._searchTimeout(event); 8171 }, 8172 focus: function () { 8173 this.selectedItem = null; 8174 this.previous = this._value(); 8175 }, 8176 blur: function (event) { 8177 if (this.cancelBlur) { 8178 delete this.cancelBlur; 8179 return; 8180 } 8181 8182 clearTimeout(this.searching); 8183 this.close(event); 8184 this._change(event); 8185 } 8186 }); 8187 8188 this._initSource(); 8189 this.menu = $("<ul>") 8190 .appendTo(this._appendTo()) 8191 .menu({ 8192 8193 // disable ARIA support, the live region takes care of that 8194 role: null 8195 }) 8196 .hide() 8197 .menu("instance"); 8198 8199 this._addClass(this.menu.element, "ui-autocomplete", "ui-front"); 8200 this._on(this.menu.element, { 8201 mousedown: function (event) { 8202 8203 // prevent moving focus out of the text field 8204 event.preventDefault(); 8205 8206 // IE doesn't prevent moving focus even with event.preventDefault() 8207 // so we set a flag to know when we should ignore the blur event 8208 this.cancelBlur = true; 8209 this._delay(function () { 8210 delete this.cancelBlur; 8211 8212 // Support: IE 8 only 8213 // Right clicking a menu item or selecting text from the menu items will 8214 // result in focus moving out of the input. However, we've already received 8215 // and ignored the blur event because of the cancelBlur flag set above. So 8216 // we restore focus to ensure that the menu closes properly based on the user's 8217 // next actions. 8218 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 8219 this.element.trigger("focus"); 8220 } 8221 }); 8222 }, 8223 menufocus: function (event, ui) { 8224 var label, item; 8225 8226 // support: Firefox 8227 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 8228 if (this.isNewMenu) { 8229 this.isNewMenu = false; 8230 if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) { 8231 this.menu.blur(); 8232 8233 this.document.one("mousemove", function () { 8234 $(event.target).trigger(event.originalEvent); 8235 }); 8236 8237 return; 8238 } 8239 } 8240 8241 item = ui.item.data("ui-autocomplete-item"); 8242 if (false !== this._trigger("focus", event, { item: item })) { 8243 8244 // use value to match what will end up in the input, if it was a key event 8245 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 8246 this._value(item.value); 8247 } 8248 } 8249 8250 // Announce the value in the liveRegion 8251 label = ui.item.attr("aria-label") || item.value; 8252 if (label && $.trim(label).length) { 8253 this.liveRegion.children().hide(); 8254 $("<div>").text(label).appendTo(this.liveRegion); 8255 } 8256 }, 8257 menuselect: function (event, ui) { 8258 var item = ui.item.data("ui-autocomplete-item"), 8259 previous = this.previous; 8260 8261 // Only trigger when focus was lost (click on menu) 8262 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 8263 this.element.trigger("focus"); 8264 this.previous = previous; 8265 8266 // #6109 - IE triggers two focus events and the second 8267 // is asynchronous, so we need to reset the previous 8268 // term synchronously and asynchronously :-( 8269 this._delay(function () { 8270 this.previous = previous; 8271 this.selectedItem = item; 8272 }); 8273 } 8274 8275 if (false !== this._trigger("select", event, { item: item })) { 8276 this._value(item.value); 8277 } 8278 8279 // reset the term after the select event 8280 // this allows custom select handling to work properly 8281 this.term = this._value(); 8282 8283 this.close(event); 8284 this.selectedItem = item; 8285 } 8286 }); 8287 8288 this.liveRegion = $("<div>", { 8289 role: "status", 8290 "aria-live": "assertive", 8291 "aria-relevant": "additions" 8292 }) 8293 .appendTo(this.document[0].body); 8294 8295 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 8296 8297 // Turning off autocomplete prevents the browser from remembering the 8298 // value when navigating through history, so we re-enable autocomplete 8299 // if the page is unloaded before the widget is destroyed. #7790 8300 this._on(this.window, { 8301 beforeunload: function () { 8302 this.element.removeAttr("autocomplete"); 8303 } 8304 }); 8305 }, 8306 8307 _destroy: function () { 8308 clearTimeout(this.searching); 8309 this.element.removeAttr("autocomplete"); 8310 this.menu.element.remove(); 8311 this.liveRegion.remove(); 8312 }, 8313 8314 _setOption: function (key, value) { 8315 this._super(key, value); 8316 if (key === "source") { 8317 this._initSource(); 8318 } 8319 if (key === "appendTo") { 8320 this.menu.element.appendTo(this._appendTo()); 8321 } 8322 if (key === "disabled" && value && this.xhr) { 8323 this.xhr.abort(); 8324 } 8325 }, 8326 8327 _isEventTargetInWidget: function (event) { 8328 var menuElement = this.menu.element[0]; 8329 8330 return event.target === this.element[0] || 8331 event.target === menuElement || 8332 $.contains(menuElement, event.target); 8333 }, 8334 8335 _closeOnClickOutside: function (event) { 8336 if (!this._isEventTargetInWidget(event)) { 8337 this.close(); 8338 } 8339 }, 8340 8341 _appendTo: function () { 8342 var element = this.options.appendTo; 8343 8344 if (element) { 8345 element = element.jquery || element.nodeType ? 8346 $(element) : 8347 this.document.find(element).eq(0); 8348 } 8349 8350 if (!element || !element[0]) { 8351 element = this.element.closest(".ui-front, dialog"); 8352 } 8353 8354 if (!element.length) { 8355 element = this.document[0].body; 8356 } 8357 8358 return element; 8359 }, 8360 8361 _initSource: function () { 8362 var array, url, 8363 that = this; 8364 if ($.isArray(this.options.source)) { 8365 array = this.options.source; 8366 this.source = function (request, response) { 8367 response($.ui.autocomplete.filter(array, request.term)); 8368 }; 8369 } else if (typeof this.options.source === "string") { 8370 url = this.options.source; 8371 this.source = function (request, response) { 8372 if (that.xhr) { 8373 that.xhr.abort(); 8374 } 8375 that.xhr = $.ajax({ 8376 url: url, 8377 data: request, 8378 dataType: "json", 8379 success: function (data) { 8380 response(data); 8381 }, 8382 error: function () { 8383 response([]); 8384 } 8385 }); 8386 }; 8387 } else { 8388 this.source = this.options.source; 8389 } 8390 }, 8391 8392 _searchTimeout: function (event) { 8393 clearTimeout(this.searching); 8394 this.searching = this._delay(function () { 8395 8396 // Search if the value has changed, or if the user retypes the same value (see #7434) 8397 var equalValues = this.term === this._value(), 8398 menuVisible = this.menu.element.is(":visible"), 8399 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 8400 8401 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 8402 this.selectedItem = null; 8403 this.search(null, event); 8404 } 8405 }, this.options.delay); 8406 }, 8407 8408 search: function (value, event) { 8409 value = value != null ? value : this._value(); 8410 8411 // Always save the actual value, not the one passed as an argument 8412 this.term = this._value(); 8413 8414 if (value.length < this.options.minLength) { 8415 return this.close(event); 8416 } 8417 8418 if (this._trigger("search", event) === false) { 8419 return; 8420 } 8421 8422 return this._search(value); 8423 }, 8424 8425 _search: function (value) { 8426 this.pending++; 8427 this._addClass("ui-autocomplete-loading"); 8428 this.cancelSearch = false; 8429 8430 this.source({ term: value }, this._response()); 8431 }, 8432 8433 _response: function () { 8434 var index = ++this.requestIndex; 8435 8436 return $.proxy(function (content) { 8437 if (index === this.requestIndex) { 8438 this.__response(content); 8439 } 8440 8441 this.pending--; 8442 if (!this.pending) { 8443 this._removeClass("ui-autocomplete-loading"); 8444 } 8445 }, this); 8446 }, 8447 8448 __response: function (content) { 8449 if (content) { 8450 content = this._normalize(content); 8451 } 8452 this._trigger("response", null, { content: content }); 8453 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 8454 this._suggest(content); 8455 this._trigger("open"); 8456 } else { 8457 8458 // use ._close() instead of .close() so we don't cancel future searches 8459 this._close(); 8460 } 8461 }, 8462 8463 close: function (event) { 8464 this.cancelSearch = true; 8465 this._close(event); 8466 }, 8467 8468 _close: function (event) { 8469 8470 // Remove the handler that closes the menu on outside clicks 8471 this._off(this.document, "mousedown"); 8472 8473 if (this.menu.element.is(":visible")) { 8474 this.menu.element.hide(); 8475 this.menu.blur(); 8476 this.isNewMenu = true; 8477 this._trigger("close", event); 8478 } 8479 }, 8480 8481 _change: function (event) { 8482 if (this.previous !== this._value()) { 8483 this._trigger("change", event, { item: this.selectedItem }); 8484 } 8485 }, 8486 8487 _normalize: function (items) { 8488 8489 // assume all items have the right format when the first item is complete 8490 if (items.length && items[0].label && items[0].value) { 8491 return items; 8492 } 8493 return $.map(items, function (item) { 8494 if (typeof item === "string") { 8495 return { 8496 label: item, 8497 value: item 8498 }; 8499 } 8500 return $.extend({}, item, { 8501 label: item.label || item.value, 8502 value: item.value || item.label 8503 }); 8504 }); 8505 }, 8506 8507 _suggest: function (items) { 8508 var ul = this.menu.element.empty(); 8509 this._renderMenu(ul, items); 8510 this.isNewMenu = true; 8511 this.menu.refresh(); 8512 8513 // Size and position menu 8514 ul.show(); 8515 this._resizeMenu(); 8516 ul.position($.extend({ 8517 of: this.element 8518 }, this.options.position)); 8519 8520 if (this.options.autoFocus) { 8521 this.menu.next(); 8522 } 8523 8524 // Listen for interactions outside of the widget (#6642) 8525 this._on(this.document, { 8526 mousedown: "_closeOnClickOutside" 8527 }); 8528 }, 8529 8530 _resizeMenu: function () { 8531 var ul = this.menu.element; 8532 ul.outerWidth(Math.max( 8533 8534 // Firefox wraps long text (possibly a rounding bug) 8535 // so we add 1px to avoid the wrapping (#7513) 8536 ul.width("").outerWidth() + 1, 8537 this.element.outerWidth() 8538 )); 8539 }, 8540 8541 _renderMenu: function (ul, items) { 8542 var that = this; 8543 $.each(items, function (index, item) { 8544 that._renderItemData(ul, item); 8545 }); 8546 }, 8547 8548 _renderItemData: function (ul, item) { 8549 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 8550 }, 8551 8552 _renderItem: function (ul, item) { 8553 return $("<li>") 8554 .append($("<div>").text(item.label)) 8555 .appendTo(ul); 8556 }, 8557 8558 _move: function (direction, event) { 8559 if (!this.menu.element.is(":visible")) { 8560 this.search(null, event); 8561 return; 8562 } 8563 if (this.menu.isFirstItem() && /^previous/.test(direction) || 8564 this.menu.isLastItem() && /^next/.test(direction)) { 8565 8566 if (!this.isMultiLine) { 8567 this._value(this.term); 8568 } 8569 8570 this.menu.blur(); 8571 return; 8572 } 8573 this.menu[direction](event); 8574 }, 8575 8576 widget: function () { 8577 return this.menu.element; 8578 }, 8579 8580 _value: function () { 8581 return this.valueMethod.apply(this.element, arguments); 8582 }, 8583 8584 _keyEvent: function (keyEvent, event) { 8585 if (!this.isMultiLine || this.menu.element.is(":visible")) { 8586 this._move(keyEvent, event); 8587 8588 // Prevents moving cursor to beginning/end of the text field in some browsers 8589 event.preventDefault(); 8590 } 8591 }, 8592 8593 // Support: Chrome <=50 8594 // We should be able to just use this.element.prop( "isContentEditable" ) 8595 // but hidden elements always report false in Chrome. 8596 // https://code.google.com/p/chromium/issues/detail?id=313082 8597 _isContentEditable: function (element) { 8598 if (!element.length) { 8599 return false; 8600 } 8601 8602 var editable = element.prop("contentEditable"); 8603 8604 if (editable === "inherit") { 8605 return this._isContentEditable(element.parent()); 8606 } 8607 8608 return editable === "true"; 8609 } 8610 }); 8611 8612 $.extend($.ui.autocomplete, { 8613 escapeRegex: function (value) { 8614 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 8615 }, 8616 filter: function (array, term) { 8617 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 8618 return $.grep(array, function (value) { 8619 return matcher.test(value.label || value.value || value); 8620 }); 8621 } 8622 }); 8623 8624 // Live region extension, adding a `messages` option 8625 // NOTE: This is an experimental API. We are still investigating 8626 // a full solution for string manipulation and internationalization. 8627 $.widget("ui.autocomplete", $.ui.autocomplete, { 8628 options: { 8629 messages: { 8630 noResults: "No search results.", 8631 results: function (amount) { 8632 return amount + (amount > 1 ? " results are" : " result is") + 8633 " available, use up and down arrow keys to navigate."; 8634 } 8635 } 8636 }, 8637 8638 __response: function (content) { 8639 var message; 8640 this._superApply(arguments); 8641 if (this.options.disabled || this.cancelSearch) { 8642 return; 8643 } 8644 if (content && content.length) { 8645 message = this.options.messages.results(content.length); 8646 } else { 8647 message = this.options.messages.noResults; 8648 } 8649 this.liveRegion.children().hide(); 8650 $("<div>").text(message).appendTo(this.liveRegion); 8651 } 8652 }); 8653 8654 var widgetsAutocomplete = $.ui.autocomplete; 8655 8656 8657 /*! 8658 * jQuery UI Controlgroup 1.12.1 8659 * http://jqueryui.com 8660 * 8661 * Copyright jQuery Foundation and other contributors 8662 * Released under the MIT license. 8663 * http://jquery.org/license 8664 */ 8665 8666 //>>label: Controlgroup 8667 //>>group: Widgets 8668 //>>description: Visually groups form control widgets 8669 //>>docs: http://api.jqueryui.com/controlgroup/ 8670 //>>demos: http://jqueryui.com/controlgroup/ 8671 //>>css.structure: ../../themes/base/core.css 8672 //>>css.structure: ../../themes/base/controlgroup.css 8673 //>>css.theme: ../../themes/base/theme.css 8674 8675 8676 var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 8677 8678 var widgetsControlgroup = $.widget("ui.controlgroup", { 8679 version: "1.12.1", 8680 defaultElement: "<div>", 8681 options: { 8682 direction: "horizontal", 8683 disabled: null, 8684 onlyVisible: true, 8685 items: { 8686 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 8687 "controlgroupLabel": ".ui-controlgroup-label", 8688 "checkboxradio": "input[type='checkbox'], input[type='radio']", 8689 "selectmenu": "select", 8690 "spinner": ".ui-spinner-input" 8691 } 8692 }, 8693 8694 _create: function () { 8695 this._enhance(); 8696 }, 8697 8698 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 8699 _enhance: function () { 8700 this.element.attr("role", "toolbar"); 8701 this.refresh(); 8702 }, 8703 8704 _destroy: function () { 8705 this._callChildMethod("destroy"); 8706 this.childWidgets.removeData("ui-controlgroup-data"); 8707 this.element.removeAttr("role"); 8708 if (this.options.items.controlgroupLabel) { 8709 this.element 8710 .find(this.options.items.controlgroupLabel) 8711 .find(".ui-controlgroup-label-contents") 8712 .contents().unwrap(); 8713 } 8714 }, 8715 8716 _initWidgets: function () { 8717 var that = this, 8718 childWidgets = []; 8719 8720 // First we iterate over each of the items options 8721 $.each(this.options.items, function (widget, selector) { 8722 var labels; 8723 var options = {}; 8724 8725 // Make sure the widget has a selector set 8726 if (!selector) { 8727 return; 8728 } 8729 8730 if (widget === "controlgroupLabel") { 8731 labels = that.element.find(selector); 8732 labels.each(function () { 8733 var element = $(this); 8734 8735 if (element.children(".ui-controlgroup-label-contents").length) { 8736 return; 8737 } 8738 element.contents() 8739 .wrapAll("<span class='ui-controlgroup-label-contents'></span>"); 8740 }); 8741 that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default"); 8742 childWidgets = childWidgets.concat(labels.get()); 8743 return; 8744 } 8745 8746 // Make sure the widget actually exists 8747 if (!$.fn[widget]) { 8748 return; 8749 } 8750 8751 // We assume everything is in the middle to start because we can't determine 8752 // first / last elements until all enhancments are done. 8753 if (that["_" + widget + "Options"]) { 8754 options = that["_" + widget + "Options"]("middle"); 8755 } else { 8756 options = { classes: {} }; 8757 } 8758 8759 // Find instances of this widget inside controlgroup and init them 8760 that.element 8761 .find(selector) 8762 .each(function () { 8763 var element = $(this); 8764 var instance = element[widget]("instance"); 8765 8766 // We need to clone the default options for this type of widget to avoid 8767 // polluting the variable options which has a wider scope than a single widget. 8768 var instanceOptions = $.widget.extend({}, options); 8769 8770 // If the button is the child of a spinner ignore it 8771 // TODO: Find a more generic solution 8772 if (widget === "button" && element.parent(".ui-spinner").length) { 8773 return; 8774 } 8775 8776 // Create the widget if it doesn't exist 8777 if (!instance) { 8778 instance = element[widget]()[widget]("instance"); 8779 } 8780 if (instance) { 8781 instanceOptions.classes = 8782 that._resolveClassesValues(instanceOptions.classes, instance); 8783 } 8784 element[widget](instanceOptions); 8785 8786 // Store an instance of the controlgroup to be able to reference 8787 // from the outermost element for changing options and refresh 8788 var widgetElement = element[widget]("widget"); 8789 $.data(widgetElement[0], "ui-controlgroup-data", 8790 instance ? instance : element[widget]("instance")); 8791 8792 childWidgets.push(widgetElement[0]); 8793 }); 8794 }); 8795 8796 this.childWidgets = $($.unique(childWidgets)); 8797 this._addClass(this.childWidgets, "ui-controlgroup-item"); 8798 }, 8799 8800 _callChildMethod: function (method) { 8801 this.childWidgets.each(function () { 8802 var element = $(this), 8803 data = element.data("ui-controlgroup-data"); 8804 if (data && data[method]) { 8805 data[method](); 8806 } 8807 }); 8808 }, 8809 8810 _updateCornerClass: function (element, position) { 8811 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 8812 var add = this._buildSimpleOptions(position, "label").classes.label; 8813 8814 this._removeClass(element, null, remove); 8815 this._addClass(element, null, add); 8816 }, 8817 8818 _buildSimpleOptions: function (position, key) { 8819 var direction = this.options.direction === "vertical"; 8820 var result = { 8821 classes: {} 8822 }; 8823 result.classes[key] = { 8824 "middle": "", 8825 "first": "ui-corner-" + (direction ? "top" : "left"), 8826 "last": "ui-corner-" + (direction ? "bottom" : "right"), 8827 "only": "ui-corner-all" 8828 }[position]; 8829 8830 return result; 8831 }, 8832 8833 _spinnerOptions: function (position) { 8834 var options = this._buildSimpleOptions(position, "ui-spinner"); 8835 8836 options.classes["ui-spinner-up"] = ""; 8837 options.classes["ui-spinner-down"] = ""; 8838 8839 return options; 8840 }, 8841 8842 _buttonOptions: function (position) { 8843 return this._buildSimpleOptions(position, "ui-button"); 8844 }, 8845 8846 _checkboxradioOptions: function (position) { 8847 return this._buildSimpleOptions(position, "ui-checkboxradio-label"); 8848 }, 8849 8850 _selectmenuOptions: function (position) { 8851 var direction = this.options.direction === "vertical"; 8852 return { 8853 width: direction ? "auto" : false, 8854 classes: { 8855 middle: { 8856 "ui-selectmenu-button-open": "", 8857 "ui-selectmenu-button-closed": "" 8858 }, 8859 first: { 8860 "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"), 8861 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left") 8862 }, 8863 last: { 8864 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 8865 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right") 8866 }, 8867 only: { 8868 "ui-selectmenu-button-open": "ui-corner-top", 8869 "ui-selectmenu-button-closed": "ui-corner-all" 8870 } 8871 8872 }[position] 8873 }; 8874 }, 8875 8876 _resolveClassesValues: function (classes, instance) { 8877 var result = {}; 8878 $.each(classes, function (key) { 8879 var current = instance.options.classes[key] || ""; 8880 current = $.trim(current.replace(controlgroupCornerRegex, "")); 8881 result[key] = (current + " " + classes[key]).replace(/\s+/g, " "); 8882 }); 8883 return result; 8884 }, 8885 8886 _setOption: function (key, value) { 8887 if (key === "direction") { 8888 this._removeClass("ui-controlgroup-" + this.options.direction); 8889 } 8890 8891 this._super(key, value); 8892 if (key === "disabled") { 8893 this._callChildMethod(value ? "disable" : "enable"); 8894 return; 8895 } 8896 8897 this.refresh(); 8898 }, 8899 8900 refresh: function () { 8901 var children, 8902 that = this; 8903 8904 this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction); 8905 8906 if (this.options.direction === "horizontal") { 8907 this._addClass(null, "ui-helper-clearfix"); 8908 } 8909 this._initWidgets(); 8910 8911 children = this.childWidgets; 8912 8913 // We filter here because we need to track all childWidgets not just the visible ones 8914 if (this.options.onlyVisible) { 8915 children = children.filter(":visible"); 8916 } 8917 8918 if (children.length) { 8919 8920 // We do this last because we need to make sure all enhancment is done 8921 // before determining first and last 8922 $.each(["first", "last"], function (index, value) { 8923 var instance = children[value]().data("ui-controlgroup-data"); 8924 8925 if (instance && that["_" + instance.widgetName + "Options"]) { 8926 var options = that["_" + instance.widgetName + "Options"]( 8927 children.length === 1 ? "only" : value 8928 ); 8929 options.classes = that._resolveClassesValues(options.classes, instance); 8930 instance.element[instance.widgetName](options); 8931 } else { 8932 that._updateCornerClass(children[value](), value); 8933 } 8934 }); 8935 8936 // Finally call the refresh method on each of the child widgets. 8937 this._callChildMethod("refresh"); 8938 } 8939 } 8940 }); 8941 8942 /*! 8943 * jQuery UI Checkboxradio 1.12.1 8944 * http://jqueryui.com 8945 * 8946 * Copyright jQuery Foundation and other contributors 8947 * Released under the MIT license. 8948 * http://jquery.org/license 8949 */ 8950 8951 //>>label: Checkboxradio 8952 //>>group: Widgets 8953 //>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 8954 //>>docs: http://api.jqueryui.com/checkboxradio/ 8955 //>>demos: http://jqueryui.com/checkboxradio/ 8956 //>>css.structure: ../../themes/base/core.css 8957 //>>css.structure: ../../themes/base/button.css 8958 //>>css.structure: ../../themes/base/checkboxradio.css 8959 //>>css.theme: ../../themes/base/theme.css 8960 8961 8962 8963 $.widget("ui.checkboxradio", [$.ui.formResetMixin, { 8964 version: "1.12.1", 8965 options: { 8966 disabled: null, 8967 label: null, 8968 icon: true, 8969 classes: { 8970 "ui-checkboxradio-label": "ui-corner-all", 8971 "ui-checkboxradio-icon": "ui-corner-all" 8972 } 8973 }, 8974 8975 _getCreateOptions: function () { 8976 var disabled, labels; 8977 var that = this; 8978 var options = this._super() || {}; 8979 8980 // We read the type here, because it makes more sense to throw a element type error first, 8981 // rather then the error for lack of a label. Often if its the wrong type, it 8982 // won't have a label (e.g. calling on a div, btn, etc) 8983 this._readType(); 8984 8985 labels = this.element.labels(); 8986 8987 // If there are multiple labels, use the last one 8988 this.label = $(labels[labels.length - 1]); 8989 if (!this.label.length) { 8990 $.error("No label found for checkboxradio widget"); 8991 } 8992 8993 this.originalLabel = ""; 8994 8995 // We need to get the label text but this may also need to make sure it does not contain the 8996 // input itself. 8997 this.label.contents().not(this.element[0]).each(function () { 8998 8999 // The label contents could be text, html, or a mix. We concat each element to get a 9000 // string representation of the label, without the input as part of it. 9001 that.originalLabel += this.nodeType === 3 ? $(this).text() : this.outerHTML; 9002 }); 9003 9004 // Set the label option if we found label text 9005 if (this.originalLabel) { 9006 options.label = this.originalLabel; 9007 } 9008 9009 disabled = this.element[0].disabled; 9010 if (disabled != null) { 9011 options.disabled = disabled; 9012 } 9013 return options; 9014 }, 9015 9016 _create: function () { 9017 var checked = this.element[0].checked; 9018 9019 this._bindFormResetHandler(); 9020 9021 if (this.options.disabled == null) { 9022 this.options.disabled = this.element[0].disabled; 9023 } 9024 9025 this._setOption("disabled", this.options.disabled); 9026 this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible"); 9027 this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget"); 9028 9029 if (this.type === "radio") { 9030 this._addClass(this.label, "ui-checkboxradio-radio-label"); 9031 } 9032 9033 if (this.options.label && this.options.label !== this.originalLabel) { 9034 this._updateLabel(); 9035 } else if (this.originalLabel) { 9036 this.options.label = this.originalLabel; 9037 } 9038 9039 this._enhance(); 9040 9041 if (checked) { 9042 this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active"); 9043 if (this.icon) { 9044 this._addClass(this.icon, null, "ui-state-hover"); 9045 } 9046 } 9047 9048 this._on({ 9049 change: "_toggleClasses", 9050 focus: function () { 9051 this._addClass(this.label, null, "ui-state-focus ui-visual-focus"); 9052 }, 9053 blur: function () { 9054 this._removeClass(this.label, null, "ui-state-focus ui-visual-focus"); 9055 } 9056 }); 9057 }, 9058 9059 _readType: function () { 9060 var nodeName = this.element[0].nodeName.toLowerCase(); 9061 this.type = this.element[0].type; 9062 if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) { 9063 $.error("Can't create checkboxradio on element.nodeName=" + nodeName + 9064 " and element.type=" + this.type); 9065 } 9066 }, 9067 9068 // Support jQuery Mobile enhanced option 9069 _enhance: function () { 9070 this._updateIcon(this.element[0].checked); 9071 }, 9072 9073 widget: function () { 9074 return this.label; 9075 }, 9076 9077 _getRadioGroup: function () { 9078 var group; 9079 var name = this.element[0].name; 9080 var nameSelector = "input[name='" + $.ui.escapeSelector(name) + "']"; 9081 9082 if (!name) { 9083 return $([]); 9084 } 9085 9086 if (this.form.length) { 9087 group = $(this.form[0].elements).filter(nameSelector); 9088 } else { 9089 9090 // Not inside a form, check all inputs that also are not inside a form 9091 group = $(nameSelector).filter(function () { 9092 return $(this).form().length === 0; 9093 }); 9094 } 9095 9096 return group.not(this.element); 9097 }, 9098 9099 _toggleClasses: function () { 9100 var checked = this.element[0].checked; 9101 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 9102 9103 if (this.options.icon && this.type === "checkbox") { 9104 this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked) 9105 ._toggleClass(this.icon, null, "ui-icon-blank", !checked); 9106 } 9107 9108 if (this.type === "radio") { 9109 this._getRadioGroup() 9110 .each(function () { 9111 var instance = $(this).checkboxradio("instance"); 9112 9113 if (instance) { 9114 instance._removeClass(instance.label, 9115 "ui-checkboxradio-checked", "ui-state-active"); 9116 } 9117 }); 9118 } 9119 }, 9120 9121 _destroy: function () { 9122 this._unbindFormResetHandler(); 9123 9124 if (this.icon) { 9125 this.icon.remove(); 9126 this.iconSpace.remove(); 9127 } 9128 }, 9129 9130 _setOption: function (key, value) { 9131 9132 // We don't allow the value to be set to nothing 9133 if (key === "label" && !value) { 9134 return; 9135 } 9136 9137 this._super(key, value); 9138 9139 if (key === "disabled") { 9140 this._toggleClass(this.label, null, "ui-state-disabled", value); 9141 this.element[0].disabled = value; 9142 9143 // Don't refresh when setting disabled 9144 return; 9145 } 9146 this.refresh(); 9147 }, 9148 9149 _updateIcon: function (checked) { 9150 var toAdd = "ui-icon ui-icon-background "; 9151 9152 if (this.options.icon) { 9153 if (!this.icon) { 9154 this.icon = $("<span>"); 9155 this.iconSpace = $("<span> </span>");
vendor: 5,572 bytes, lines 9156-9363
9156 this._addClass(this.iconSpace, "ui-checkboxradio-icon-space"); 9157 } 9158 9159 if (this.type === "checkbox") { 9160 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 9161 this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check"); 9162 } else { 9163 toAdd += "ui-icon-blank"; 9164 } 9165 this._addClass(this.icon, "ui-checkboxradio-icon", toAdd); 9166 if (!checked) { 9167 this._removeClass(this.icon, null, "ui-icon-check ui-state-checked"); 9168 } 9169 this.icon.prependTo(this.label).after(this.iconSpace); 9170 } else if (this.icon !== undefined) { 9171 this.icon.remove(); 9172 this.iconSpace.remove(); 9173 delete this.icon; 9174 } 9175 }, 9176 9177 _updateLabel: function () { 9178 9179 // Remove the contents of the label ( minus the icon, icon space, and input ) 9180 var contents = this.label.contents().not(this.element[0]); 9181 if (this.icon) { 9182 contents = contents.not(this.icon[0]); 9183 } 9184 if (this.iconSpace) { 9185 contents = contents.not(this.iconSpace[0]); 9186 } 9187 contents.remove(); 9188 9189 this.label.append(this.options.label); 9190 }, 9191 9192 refresh: function () { 9193 var checked = this.element[0].checked, 9194 isDisabled = this.element[0].disabled; 9195 9196 this._updateIcon(checked); 9197 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 9198 if (this.options.label !== null) { 9199 this._updateLabel(); 9200 } 9201 9202 if (isDisabled !== this.options.disabled) { 9203 this._setOptions({ "disabled": isDisabled }); 9204 } 9205 } 9206 9207 }]); 9208 9209 var widgetsCheckboxradio = $.ui.checkboxradio; 9210 9211 9212 /*! 9213 * jQuery UI Button 1.12.1 9214 * http://jqueryui.com 9215 * 9216 * Copyright jQuery Foundation and other contributors 9217 * Released under the MIT license. 9218 * http://jquery.org/license 9219 */ 9220 9221 //>>label: Button 9222 //>>group: Widgets 9223 //>>description: Enhances a form with themeable buttons. 9224 //>>docs: http://api.jqueryui.com/button/ 9225 //>>demos: http://jqueryui.com/button/ 9226 //>>css.structure: ../../themes/base/core.css 9227 //>>css.structure: ../../themes/base/button.css 9228 //>>css.theme: ../../themes/base/theme.css 9229 9230 9231 9232 $.widget("ui.button", { 9233 version: "1.12.1", 9234 defaultElement: "<button>", 9235 options: { 9236 classes: { 9237 "ui-button": "ui-corner-all" 9238 }, 9239 disabled: null, 9240 icon: null, 9241 iconPosition: "beginning", 9242 label: null, 9243 showLabel: true 9244 }, 9245 9246 _getCreateOptions: function () { 9247 var disabled, 9248 9249 // This is to support cases like in jQuery Mobile where the base widget does have 9250 // an implementation of _getCreateOptions 9251 options = this._super() || {}; 9252 9253 this.isInput = this.element.is("input"); 9254 9255 disabled = this.element[0].disabled; 9256 if (disabled != null) { 9257 options.disabled = disabled; 9258 } 9259 9260 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 9261 if (this.originalLabel) { 9262 options.label = this.originalLabel; 9263 } 9264 9265 return options; 9266 }, 9267 9268 _create: function () { 9269 if (!this.option.showLabel & !this.options.icon) { 9270 this.options.showLabel = true; 9271 } 9272 9273 // We have to check the option again here even though we did in _getCreateOptions, 9274 // because null may have been passed on init which would override what was set in 9275 // _getCreateOptions 9276 if (this.options.disabled == null) { 9277 this.options.disabled = this.element[0].disabled || false; 9278 } 9279 9280 this.hasTitle = !!this.element.attr("title"); 9281 9282 // Check to see if the label needs to be set or if its already correct 9283 if (this.options.label && this.options.label !== this.originalLabel) { 9284 if (this.isInput) { 9285 this.element.val(this.options.label); 9286 } else { 9287 this.element.html(this.options.label); 9288 } 9289 } 9290 this._addClass("ui-button", "ui-widget"); 9291 this._setOption("disabled", this.options.disabled); 9292 this._enhance(); 9293 9294 if (this.element.is("a")) { 9295 this._on({ 9296 "keyup": function (event) { 9297 if (event.keyCode === $.ui.keyCode.SPACE) { 9298 event.preventDefault(); 9299 9300 // Support: PhantomJS <= 1.9, IE 8 Only 9301 // If a native click is available use it so we actually cause navigation 9302 // otherwise just trigger a click event 9303 if (this.element[0].click) { 9304 this.element[0].click(); 9305 } else { 9306 this.element.trigger("click"); 9307 } 9308 } 9309 } 9310 }); 9311 } 9312 }, 9313 9314 _enhance: function () { 9315 if (!this.element.is("button")) { 9316 this.element.attr("role", "button"); 9317 } 9318 9319 if (this.options.icon) { 9320 this._updateIcon("icon", this.options.icon); 9321 this._updateTooltip(); 9322 } 9323 }, 9324 9325 _updateTooltip: function () { 9326 this.title = this.element.attr("title"); 9327 9328 if (!this.options.showLabel && !this.title) { 9329 this.element.attr("title", this.options.label); 9330 } 9331 }, 9332 9333 _updateIcon: function (option, value) { 9334 var icon = option !== "iconPosition", 9335 position = icon ? this.options.iconPosition : value, 9336 displayBlock = position === "top" || position === "bottom"; 9337 9338 // Create icon 9339 if (!this.icon) { 9340 this.icon = $("<span>"); 9341 9342 this._addClass(this.icon, "ui-button-icon", "ui-icon"); 9343 9344 if (!this.options.showLabel) { 9345 this._addClass("ui-button-icon-only"); 9346 } 9347 } else if (icon) { 9348 9349 // If we are updating the icon remove the old icon class 9350 this._removeClass(this.icon, null, this.options.icon); 9351 } 9352 9353 // If we are updating the icon add the new icon class 9354 if (icon) { 9355 this._addClass(this.icon, null, value); 9356 } 9357 9358 this._attachIcon(position); 9359 9360 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 9361 // the iconSpace if there is one. 9362 if (displayBlock) { 9363 this._addClass(this.icon, null, "ui-widget-icon-block");
vendor: 5,039 bytes, lines 9364-9558
9364 if (this.iconSpace) { 9365 this.iconSpace.remove(); 9366 } 9367 } else { 9368 9369 // Position is beginning or end so remove the ui-widget-icon-block class and add the 9370 // space if it does not exist 9371 if (!this.iconSpace) { 9372 this.iconSpace = $("<span> </span>"); 9373 this._addClass(this.iconSpace, "ui-button-icon-space"); 9374 } 9375 this._removeClass(this.icon, null, "ui-wiget-icon-block"); 9376 this._attachIconSpace(position); 9377 } 9378 }, 9379 9380 _destroy: function () { 9381 this.element.removeAttr("role"); 9382 9383 if (this.icon) { 9384 this.icon.remove(); 9385 } 9386 if (this.iconSpace) { 9387 this.iconSpace.remove(); 9388 } 9389 if (!this.hasTitle) { 9390 this.element.removeAttr("title"); 9391 } 9392 }, 9393 9394 _attachIconSpace: function (iconPosition) { 9395 this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace); 9396 }, 9397 9398 _attachIcon: function (iconPosition) { 9399 this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon); 9400 }, 9401 9402 _setOptions: function (options) { 9403 var newShowLabel = options.showLabel === undefined ? 9404 this.options.showLabel : 9405 options.showLabel, 9406 newIcon = options.icon === undefined ? this.options.icon : options.icon; 9407 9408 if (!newShowLabel && !newIcon) { 9409 options.showLabel = true; 9410 } 9411 this._super(options); 9412 }, 9413 9414 _setOption: function (key, value) { 9415 if (key === "icon") { 9416 if (value) { 9417 this._updateIcon(key, value); 9418 } else if (this.icon) { 9419 this.icon.remove(); 9420 if (this.iconSpace) { 9421 this.iconSpace.remove(); 9422 } 9423 } 9424 } 9425 9426 if (key === "iconPosition") { 9427 this._updateIcon(key, value); 9428 } 9429 9430 // Make sure we can't end up with a button that has neither text nor icon 9431 if (key === "showLabel") { 9432 this._toggleClass("ui-button-icon-only", null, !value); 9433 this._updateTooltip(); 9434 } 9435 9436 if (key === "label") { 9437 if (this.isInput) { 9438 this.element.val(value); 9439 } else { 9440 9441 // If there is an icon, append it, else nothing then append the value 9442 // this avoids removal of the icon when setting label text 9443 this.element.html(value); 9444 if (this.icon) { 9445 this._attachIcon(this.options.iconPosition); 9446 this._attachIconSpace(this.options.iconPosition); 9447 } 9448 } 9449 } 9450 9451 this._super(key, value); 9452 9453 if (key === "disabled") { 9454 this._toggleClass(null, "ui-state-disabled", value); 9455 this.element[0].disabled = value; 9456 if (value) { 9457 this.element.blur(); 9458 } 9459 } 9460 }, 9461 9462 refresh: function () { 9463 9464 // Make sure to only check disabled if its an element that supports this otherwise 9465 // check for the disabled class to determine state 9466 var isDisabled = this.element.is("input, button") ? 9467 this.element[0].disabled : this.element.hasClass("ui-button-disabled"); 9468 9469 if (isDisabled !== this.options.disabled) { 9470 this._setOptions({ disabled: isDisabled }); 9471 } 9472 9473 this._updateTooltip(); 9474 } 9475 }); 9476 9477 // DEPRECATED 9478 if ($.uiBackCompat !== false) { 9479 9480 // Text and Icons options 9481 $.widget("ui.button", $.ui.button, { 9482 options: { 9483 text: true, 9484 icons: { 9485 primary: null, 9486 secondary: null 9487 } 9488 }, 9489 9490 _create: function () { 9491 if (this.options.showLabel && !this.options.text) { 9492 this.options.showLabel = this.options.text; 9493 } 9494 if (!this.options.showLabel && this.options.text) { 9495 this.options.text = this.options.showLabel; 9496 } 9497 if (!this.options.icon && (this.options.icons.primary || 9498 this.options.icons.secondary)) { 9499 if (this.options.icons.primary) { 9500 this.options.icon = this.options.icons.primary; 9501 } else { 9502 this.options.icon = this.options.icons.secondary; 9503 this.options.iconPosition = "end"; 9504 } 9505 } else if (this.options.icon) { 9506 this.options.icons.primary = this.options.icon; 9507 } 9508 this._super(); 9509 }, 9510 9511 _setOption: function (key, value) { 9512 if (key === "text") { 9513 this._super("showLabel", value); 9514 return; 9515 } 9516 if (key === "showLabel") { 9517 this.options.text = value; 9518 } 9519 if (key === "icon") { 9520 this.options.icons.primary = value; 9521 } 9522 if (key === "icons") { 9523 if (value.primary) { 9524 this._super("icon", value.primary); 9525 this._super("iconPosition", "beginning"); 9526 } else if (value.secondary) { 9527 this._super("icon", value.secondary); 9528 this._super("iconPosition", "end"); 9529 } 9530 } 9531 this._superApply(arguments); 9532 } 9533 }); 9534 9535 $.fn.button = (function (orig) { 9536 return function () { 9537 if (!this.length || (this.length && this[0].tagName !== "INPUT") || 9538 (this.length && this[0].tagName === "INPUT" && ( 9539 this.attr("type") !== "checkbox" && this.attr("type") !== "radio" 9540 ))) { 9541 return orig.apply(this, arguments); 9542 } 9543 if (!$.ui.checkboxradio) { 9544 $.error("Checkboxradio widget missing"); 9545 } 9546 if (arguments.length === 0) { 9547 return this.checkboxradio({ 9548 "icon": false 9549 }); 9550 } 9551 return this.checkboxradio.apply(this, arguments); 9552 }; 9553 })($.fn.button); 9554 9555 $.fn.buttonset = function () { 9556 if (!$.ui.controlgroup) { 9557 $.error("Controlgroup widget missing"); 9558 }
vendor: 4,055 bytes, lines 9559-9654
9559 if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) { 9560 return this.controlgroup.apply(this, 9561 [arguments[0], "items.button", arguments[2]]); 9562 } 9563 if (arguments[0] === "option" && arguments[1] === "items") { 9564 return this.controlgroup.apply(this, [arguments[0], "items.button"]); 9565 } 9566 if (typeof arguments[0] === "object" && arguments[0].items) { 9567 arguments[0].items = { 9568 button: arguments[0].items 9569 }; 9570 } 9571 return this.controlgroup.apply(this, arguments); 9572 }; 9573 } 9574 9575 var widgetsButton = $.ui.button; 9576 9577 9578 // jscs:disable maximumLineLength 9579 /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ 9580 /*! 9581 * jQuery UI Datepicker 1.12.1 9582 * http://jqueryui.com 9583 * 9584 * Copyright jQuery Foundation and other contributors 9585 * Released under the MIT license. 9586 * http://jquery.org/license 9587 */ 9588 9589 //>>label: Datepicker 9590 //>>group: Widgets 9591 //>>description: Displays a calendar from an input or inline for selecting dates. 9592 //>>docs: http://api.jqueryui.com/datepicker/ 9593 //>>demos: http://jqueryui.com/datepicker/ 9594 //>>css.structure: ../../themes/base/core.css 9595 //>>css.structure: ../../themes/base/datepicker.css 9596 //>>css.theme: ../../themes/base/theme.css 9597 9598 9599 9600 $.extend($.ui, { datepicker: { version: "1.12.1" } }); 9601 9602 var datepicker_instActive; 9603 9604 function datepicker_getZindex(elem) { 9605 var position, value; 9606 while (elem.length && elem[0] !== document) { 9607 9608 // Ignore z-index if position is set to a value where z-index is ignored by the browser 9609 // This makes behavior of this function consistent across browsers 9610 // WebKit always returns auto if the element is positioned 9611 position = elem.css("position"); 9612 if (position === "absolute" || position === "relative" || position === "fixed") { 9613 9614 // IE returns 0 when zIndex is not specified 9615 // other browsers return a string 9616 // we ignore the case of nested elements with an explicit value of 0 9617 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 9618 value = parseInt(elem.css("zIndex"), 10); 9619 if (!isNaN(value) && value !== 0) { 9620 return value; 9621 } 9622 } 9623 elem = elem.parent(); 9624 } 9625 9626 return 0; 9627 } 9628 /* Date picker manager. 9629 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 9630 Settings for (groups of) date pickers are maintained in an instance object, 9631 allowing multiple different settings on the same page. */ 9632 9633 function Datepicker() { 9634 this._curInst = null; // The current instance in use 9635 this._keyEvent = false; // If the last event was a key event 9636 this._disabledInputs = []; // List of date picker inputs that have been disabled 9637 this._datepickerShowing = false; // True if the popup picker is showing , false if not 9638 this._inDialog = false; // True if showing within a "dialog", false if not 9639 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 9640 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 9641 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 9642 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 9643 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 9644 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 9645 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 9646 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 9647 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 9648 this.regional = []; // Available regional settings, indexed by language code 9649 this.regional[""] = { // Default regional settings 9650 closeText: "Done", // Display text for close link 9651 prevText: "Prev", // Display text for previous month link 9652 nextText: "Next", // Display text for next month link 9653 currentText: "Today", // Display text for current month link 9654 monthNames: ["January", "February", "March", "April", "May", "June",
vendor: 7,062 bytes, lines 9655-9780
9655 "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting 9656 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting 9657 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting 9658 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 9659 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 9660 weekHeader: "Wk", // Column header for week of the year 9661 dateFormat: "mm/dd/yy", // See format options on parseDate 9662 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 9663 isRTL: false, // True if right-to-left language, false if left-to-right 9664 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 9665 yearSuffix: "" // Additional text to append to the year in the month headers 9666 }; 9667 this._defaults = { // Global defaults for all the date picker instances 9668 showOn: "focus", // "focus" for popup on focus, 9669 // "button" for trigger button, or "both" for either 9670 showAnim: "fadeIn", // Name of jQuery animation for popup 9671 showOptions: {}, // Options for enhanced animations 9672 defaultDate: null, // Used when field is blank: actual date, 9673 // +/-number for offset from today, null for today 9674 appendText: "", // Display text following the input box, e.g. showing the format 9675 buttonText: "...", // Text for trigger button 9676 buttonImage: "", // URL for trigger button image 9677 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 9678 hideIfNoPrevNext: false, // True to hide next/previous month links 9679 // if not applicable, false to just disable them 9680 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 9681 gotoCurrent: false, // True if today link goes back to current selection instead 9682 changeMonth: false, // True if month can be selected directly, false if only prev/next 9683 changeYear: false, // True if year can be selected directly, false if only prev/next 9684 yearRange: "c-10:c+10", // Range of years to display in drop-down, 9685 // either relative to today's year (-nn:+nn), relative to currently displayed year 9686 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 9687 showOtherMonths: false, // True to show dates in other months, false to leave blank 9688 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 9689 showWeek: false, // True to show week of the year, false to not show it 9690 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 9691 // takes a Date and returns the number of the week for it 9692 shortYearCutoff: "+10", // Short year values < this are in the current century, 9693 // > this are in the previous century, 9694 // string value starting with "+" for current year + value 9695 minDate: null, // The earliest selectable date, or null for no limit 9696 maxDate: null, // The latest selectable date, or null for no limit 9697 duration: "fast", // Duration of display/closure 9698 beforeShowDay: null, // Function that takes a date and returns an array with 9699 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 9700 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 9701 beforeShow: null, // Function that takes an input field and 9702 // returns a set of custom settings for the date picker 9703 onSelect: null, // Define a callback function when a date is selected 9704 onChangeMonthYear: null, // Define a callback function when the month or year is changed 9705 onClose: null, // Define a callback function when the datepicker is closed 9706 numberOfMonths: 1, // Number of months to show at a time 9707 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 9708 stepMonths: 1, // Number of months to step back/forward 9709 stepBigMonths: 12, // Number of months to step back/forward for the big links 9710 altField: "", // Selector for an alternate field to store selected dates into 9711 altFormat: "", // The date format to use for the alternate field 9712 constrainInput: true, // The input is constrained by the current date format 9713 showButtonPanel: false, // True to show button panel, false to not show it 9714 autoSize: false, // True to size the input for the date format, false to leave as is 9715 disabled: false // The initial disabled state 9716 }; 9717 $.extend(this._defaults, this.regional[""]); 9718 this.regional.en = $.extend(true, {}, this.regional[""]); 9719 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 9720 this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); 9721 } 9722 9723 $.extend(Datepicker.prototype, { 9724 /* Class name added to elements to indicate already configured with a date picker. */ 9725 markerClassName: "hasDatepicker", 9726 9727 //Keep track of the maximum number of rows displayed (see #7043) 9728 maxRows: 4, 9729 9730 // TODO rename to "widget" when switching to widget factory 9731 _widgetDatepicker: function () { 9732 return this.dpDiv; 9733 }, 9734 9735 /* Override the default settings for all instances of the date picker. 9736 * @param settings object - the new settings to use as defaults (anonymous object) 9737 * @return the manager object 9738 */ 9739 setDefaults: function (settings) { 9740 datepicker_extendRemove(this._defaults, settings || {}); 9741 return this; 9742 }, 9743 9744 /* Attach the date picker to a jQuery selection. 9745 * @param target element - the target input field or division or span 9746 * @param settings object - the new settings to use for this date picker instance (anonymous) 9747 */ 9748 _attachDatepicker: function (target, settings) { 9749 var nodeName, inline, inst; 9750 nodeName = target.nodeName.toLowerCase(); 9751 inline = (nodeName === "div" || nodeName === "span"); 9752 if (!target.id) { 9753 this.uuid += 1; 9754 target.id = "dp" + this.uuid; 9755 } 9756 inst = this._newInst($(target), inline); 9757 inst.settings = $.extend({}, settings || {}); 9758 if (nodeName === "input") { 9759 this._connectDatepicker(target, inst); 9760 } else if (inline) { 9761 this._inlineDatepicker(target, inst); 9762 } 9763 }, 9764 9765 /* Create a new instance object. */ 9766 _newInst: function (target, inline) { 9767 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 9768 return { 9769 id: id, input: target, // associated target 9770 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 9771 drawMonth: 0, drawYear: 0, // month being drawn 9772 inline: inline, // is datepicker inline or not 9773 dpDiv: (!inline ? this.dpDiv : // presentation div 9774 datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))) 9775 }; 9776 }, 9777 9778 /* Attach the date picker to an input field. */ 9779 _connectDatepicker: function (target, inst) { 9780 var input = $(target);
vendor: 4,118 bytes, lines 9781-9897
9781 inst.append = $([]); 9782 inst.trigger = $([]); 9783 if (input.hasClass(this.markerClassName)) { 9784 return; 9785 } 9786 this._attachments(input, inst); 9787 input.addClass(this.markerClassName).on("keydown", this._doKeyDown). 9788 on("keypress", this._doKeyPress).on("keyup", this._doKeyUp); 9789 this._autoSize(inst); 9790 $.data(target, "datepicker", inst); 9791 9792 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 9793 if (inst.settings.disabled) { 9794 this._disableDatepicker(target); 9795 } 9796 }, 9797 9798 /* Make attachments based on settings. */ 9799 _attachments: function (input, inst) { 9800 var showOn, buttonText, buttonImage, 9801 appendText = this._get(inst, "appendText"), 9802 isRTL = this._get(inst, "isRTL"); 9803 9804 if (inst.append) { 9805 inst.append.remove(); 9806 } 9807 if (appendText) { 9808 inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); 9809 input[isRTL ? "before" : "after"](inst.append); 9810 } 9811 9812 input.off("focus", this._showDatepicker); 9813 9814 if (inst.trigger) { 9815 inst.trigger.remove(); 9816 } 9817 9818 showOn = this._get(inst, "showOn"); 9819 if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field 9820 input.on("focus", this._showDatepicker); 9821 } 9822 if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked 9823 buttonText = this._get(inst, "buttonText"); 9824 buttonImage = this._get(inst, "buttonImage"); 9825 inst.trigger = $(this._get(inst, "buttonImageOnly") ? 9826 $("<img/>").addClass(this._triggerClass). 9827 attr({ src: buttonImage, alt: buttonText, title: buttonText }) : 9828 $("<button type='button'></button>").addClass(this._triggerClass). 9829 html(!buttonImage ? buttonText : $("<img/>").attr( 9830 { src: buttonImage, alt: buttonText, title: buttonText }))); 9831 input[isRTL ? "before" : "after"](inst.trigger); 9832 inst.trigger.on("click", function () { 9833 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { 9834 $.datepicker._hideDatepicker(); 9835 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { 9836 $.datepicker._hideDatepicker(); 9837 $.datepicker._showDatepicker(input[0]); 9838 } else { 9839 $.datepicker._showDatepicker(input[0]); 9840 } 9841 return false; 9842 }); 9843 } 9844 }, 9845 9846 /* Apply the maximum length for the date format. */ 9847 _autoSize: function (inst) { 9848 if (this._get(inst, "autoSize") && !inst.inline) { 9849 var findMax, max, maxI, i, 9850 date = new Date(2009, 12 - 1, 20), // Ensure double digits 9851 dateFormat = this._get(inst, "dateFormat"); 9852 9853 if (dateFormat.match(/[DM]/)) { 9854 findMax = function (names) { 9855 max = 0; 9856 maxI = 0; 9857 for (i = 0; i < names.length; i++) { 9858 if (names[i].length > max) { 9859 max = names[i].length; 9860 maxI = i; 9861 } 9862 } 9863 return maxI; 9864 }; 9865 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 9866 "monthNames" : "monthNamesShort")))); 9867 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 9868 "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); 9869 } 9870 inst.input.attr("size", this._formatDate(inst, date).length); 9871 } 9872 }, 9873 9874 /* Attach an inline date picker to a div. */ 9875 _inlineDatepicker: function (target, inst) { 9876 var divSpan = $(target); 9877 if (divSpan.hasClass(this.markerClassName)) { 9878 return; 9879 } 9880 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 9881 $.data(target, "datepicker", inst); 9882 this._setDate(inst, this._getDefaultDate(inst), true); 9883 this._updateDatepicker(inst); 9884 this._updateAlternate(inst); 9885 9886 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 9887 if (inst.settings.disabled) { 9888 this._disableDatepicker(target); 9889 } 9890 9891 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 9892 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 9893 inst.dpDiv.css("display", "block"); 9894 }, 9895 9896 /* Pop-up the date picker in a "dialog" box. 9897 * @param input element - ignored
vendor: 2,629 bytes, lines 9898-9962
9898 * @param date string or Date - the initial date to display 9899 * @param onSelect function - the function to call when a date is selected 9900 * @param settings object - update the dialog date picker instance's settings (anonymous object) 9901 * @param pos int[2] - coordinates for the dialog's position within the screen or 9902 * event - with x/y coordinates or 9903 * leave empty for default (screen centre) 9904 * @return the manager object 9905 */ 9906 _dialogDatepicker: function (input, date, onSelect, settings, pos) { 9907 var id, browserWidth, browserHeight, scrollX, scrollY, 9908 inst = this._dialogInst; // internal instance 9909 9910 if (!inst) { 9911 this.uuid += 1; 9912 id = "dp" + this.uuid; 9913 this._dialogInput = $("<input type='text' id='" + id + 9914 "' style='position: absolute; top: -100px; width: 0px;'/>"); 9915 this._dialogInput.on("keydown", this._doKeyDown); 9916 $("body").append(this._dialogInput); 9917 inst = this._dialogInst = this._newInst(this._dialogInput, false); 9918 inst.settings = {}; 9919 $.data(this._dialogInput[0], "datepicker", inst); 9920 } 9921 datepicker_extendRemove(inst.settings, settings || {}); 9922 date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); 9923 this._dialogInput.val(date); 9924 9925 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 9926 if (!this._pos) { 9927 browserWidth = document.documentElement.clientWidth; 9928 browserHeight = document.documentElement.clientHeight; 9929 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 9930 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 9931 this._pos = // should use actual width/height below 9932 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 9933 } 9934 9935 // Move input on screen for focus, but hidden behind dialog 9936 this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); 9937 inst.settings.onSelect = onSelect; 9938 this._inDialog = true; 9939 this.dpDiv.addClass(this._dialogClass); 9940 this._showDatepicker(this._dialogInput[0]); 9941 if ($.blockUI) { 9942 $.blockUI(this.dpDiv); 9943 } 9944 $.data(this._dialogInput[0], "datepicker", inst); 9945 return this; 9946 }, 9947 9948 /* Detach a datepicker from its control. 9949 * @param target element - the target input field or division or span 9950 */ 9951 _destroyDatepicker: function (target) { 9952 var nodeName, 9953 $target = $(target), 9954 inst = $.data(target, "datepicker"); 9955 9956 if (!$target.hasClass(this.markerClassName)) { 9957 return; 9958 } 9959 9960 nodeName = target.nodeName.toLowerCase(); 9961 $.removeData(target, "datepicker"); 9962 if (nodeName === "input") {
vendor: 7,127 bytes, lines 9963-10175
9963 inst.append.remove(); 9964 inst.trigger.remove(); 9965 $target.removeClass(this.markerClassName). 9966 off("focus", this._showDatepicker). 9967 off("keydown", this._doKeyDown). 9968 off("keypress", this._doKeyPress). 9969 off("keyup", this._doKeyUp); 9970 } else if (nodeName === "div" || nodeName === "span") { 9971 $target.removeClass(this.markerClassName).empty(); 9972 } 9973 9974 if (datepicker_instActive === inst) { 9975 datepicker_instActive = null; 9976 } 9977 }, 9978 9979 /* Enable the date picker to a jQuery selection. 9980 * @param target element - the target input field or division or span 9981 */ 9982 _enableDatepicker: function (target) { 9983 var nodeName, inline, 9984 $target = $(target), 9985 inst = $.data(target, "datepicker"); 9986 9987 if (!$target.hasClass(this.markerClassName)) { 9988 return; 9989 } 9990 9991 nodeName = target.nodeName.toLowerCase(); 9992 if (nodeName === "input") { 9993 target.disabled = false; 9994 inst.trigger.filter("button"). 9995 each(function () { this.disabled = false; }).end(). 9996 filter("img").css({ opacity: "1.0", cursor: "" }); 9997 } else if (nodeName === "div" || nodeName === "span") { 9998 inline = $target.children("." + this._inlineClass); 9999 inline.children().removeClass("ui-state-disabled"); 10000 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 10001 prop("disabled", false); 10002 } 10003 this._disabledInputs = $.map(this._disabledInputs, 10004 function (value) { return (value === target ? null : value); }); // delete entry 10005 }, 10006 10007 /* Disable the date picker to a jQuery selection. 10008 * @param target element - the target input field or division or span 10009 */ 10010 _disableDatepicker: function (target) { 10011 var nodeName, inline, 10012 $target = $(target), 10013 inst = $.data(target, "datepicker"); 10014 10015 if (!$target.hasClass(this.markerClassName)) { 10016 return; 10017 } 10018 10019 nodeName = target.nodeName.toLowerCase(); 10020 if (nodeName === "input") { 10021 target.disabled = true; 10022 inst.trigger.filter("button"). 10023 each(function () { this.disabled = true; }).end(). 10024 filter("img").css({ opacity: "0.5", cursor: "default" }); 10025 } else if (nodeName === "div" || nodeName === "span") { 10026 inline = $target.children("." + this._inlineClass); 10027 inline.children().addClass("ui-state-disabled"); 10028 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 10029 prop("disabled", true); 10030 } 10031 this._disabledInputs = $.map(this._disabledInputs, 10032 function (value) { return (value === target ? null : value); }); // delete entry 10033 this._disabledInputs[this._disabledInputs.length] = target; 10034 }, 10035 10036 /* Is the first field in a jQuery collection disabled as a datepicker? 10037 * @param target element - the target input field or division or span 10038 * @return boolean - true if disabled, false if enabled 10039 */ 10040 _isDisabledDatepicker: function (target) { 10041 if (!target) { 10042 return false; 10043 } 10044 for (var i = 0; i < this._disabledInputs.length; i++) { 10045 if (this._disabledInputs[i] === target) { 10046 return true; 10047 } 10048 } 10049 return false; 10050 }, 10051 10052 /* Retrieve the instance data for the target control. 10053 * @param target element - the target input field or division or span 10054 * @return object - the associated instance data 10055 * @throws error if a jQuery problem getting data 10056 */ 10057 _getInst: function (target) { 10058 try { 10059 return $.data(target, "datepicker"); 10060 } 10061 catch (err) { 10062 throw "Missing instance data for this datepicker"; 10063 } 10064 }, 10065 10066 /* Update or retrieve the settings for a date picker attached to an input field or division. 10067 * @param target element - the target input field or division or span 10068 * @param name object - the new settings to update or 10069 * string - the name of the setting to change or retrieve, 10070 * when retrieving also "all" for all instance settings or 10071 * "defaults" for all global defaults 10072 * @param value any - the new value for the setting 10073 * (omit if above is an object or to retrieve a value) 10074 */ 10075 _optionDatepicker: function (target, name, value) { 10076 var settings, date, minDate, maxDate, 10077 inst = this._getInst(target); 10078 10079 if (arguments.length === 2 && typeof name === "string") { 10080 return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : 10081 (inst ? (name === "all" ? $.extend({}, inst.settings) : 10082 this._get(inst, name)) : null)); 10083 } 10084 10085 settings = name || {}; 10086 if (typeof name === "string") { 10087 settings = {}; 10088 settings[name] = value; 10089 } 10090 10091 if (inst) { 10092 if (this._curInst === inst) { 10093 this._hideDatepicker(); 10094 } 10095 10096 date = this._getDateDatepicker(target, true); 10097 minDate = this._getMinMaxDate(inst, "min"); 10098 maxDate = this._getMinMaxDate(inst, "max"); 10099 datepicker_extendRemove(inst.settings, settings); 10100 10101 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 10102 if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { 10103 inst.settings.minDate = this._formatDate(inst, minDate); 10104 } 10105 if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { 10106 inst.settings.maxDate = this._formatDate(inst, maxDate); 10107 } 10108 if ("disabled" in settings) { 10109 if (settings.disabled) { 10110 this._disableDatepicker(target); 10111 } else { 10112 this._enableDatepicker(target); 10113 } 10114 } 10115 this._attachments($(target), inst); 10116 this._autoSize(inst); 10117 this._setDate(inst, date); 10118 this._updateAlternate(inst); 10119 this._updateDatepicker(inst); 10120 } 10121 }, 10122 10123 // Change method deprecated 10124 _changeDatepicker: function (target, name, value) { 10125 this._optionDatepicker(target, name, value); 10126 }, 10127 10128 /* Redraw the date picker attached to an input field or division. 10129 * @param target element - the target input field or division or span 10130 */ 10131 _refreshDatepicker: function (target) { 10132 var inst = this._getInst(target); 10133 if (inst) { 10134 this._updateDatepicker(inst); 10135 } 10136 }, 10137 10138 /* Set the dates for a jQuery selection. 10139 * @param target element - the target input field or division or span 10140 * @param date Date - the new date 10141 */ 10142 _setDateDatepicker: function (target, date) { 10143 var inst = this._getInst(target); 10144 if (inst) { 10145 this._setDate(inst, date); 10146 this._updateDatepicker(inst); 10147 this._updateAlternate(inst); 10148 } 10149 }, 10150 10151 /* Get the date(s) for the first entry in a jQuery selection. 10152 * @param target element - the target input field or division or span 10153 * @param noDefault boolean - true if no default date is to be used 10154 * @return Date - the current date 10155 */ 10156 _getDateDatepicker: function (target, noDefault) { 10157 var inst = this._getInst(target); 10158 if (inst && !inst.inline) { 10159 this._setDateFromField(inst, noDefault); 10160 } 10161 return (inst ? this._getDate(inst) : null); 10162 }, 10163 10164 /* Handle keystrokes. */ 10165 _doKeyDown: function (event) { 10166 var onSelect, dateStr, sel, 10167 inst = $.datepicker._getInst(event.target), 10168 handled = true, 10169 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 10170 10171 inst._keyEvent = true; 10172 if ($.datepicker._datepickerShowing) { 10173 switch (event.keyCode) { 10174 case 9: $.datepicker._hideDatepicker(); 10175 handled = false;
vendor: 4,537 bytes, lines 10176-10303
10176 break; // hide on tab out 10177 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + 10178 $.datepicker._currentClass + ")", inst.dpDiv); 10179 if (sel[0]) { 10180 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 10181 } 10182 10183 onSelect = $.datepicker._get(inst, "onSelect"); 10184 if (onSelect) { 10185 dateStr = $.datepicker._formatDate(inst); 10186 10187 // Trigger custom callback 10188 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 10189 } else { 10190 $.datepicker._hideDatepicker(); 10191 } 10192 10193 return false; // don't submit the form 10194 case 27: $.datepicker._hideDatepicker(); 10195 break; // hide on escape 10196 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10197 -$.datepicker._get(inst, "stepBigMonths") : 10198 -$.datepicker._get(inst, "stepMonths")), "M"); 10199 break; // previous month/year on page up/+ ctrl 10200 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10201 +$.datepicker._get(inst, "stepBigMonths") : 10202 +$.datepicker._get(inst, "stepMonths")), "M"); 10203 break; // next month/year on page down/+ ctrl 10204 case 35: if (event.ctrlKey || event.metaKey) { 10205 $.datepicker._clearDate(event.target); 10206 } 10207 handled = event.ctrlKey || event.metaKey; 10208 break; // clear on ctrl or command +end 10209 case 36: if (event.ctrlKey || event.metaKey) { 10210 $.datepicker._gotoToday(event.target); 10211 } 10212 handled = event.ctrlKey || event.metaKey; 10213 break; // current on ctrl or command +home 10214 case 37: if (event.ctrlKey || event.metaKey) { 10215 $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); 10216 } 10217 handled = event.ctrlKey || event.metaKey; 10218 10219 // -1 day on ctrl or command +left 10220 if (event.originalEvent.altKey) { 10221 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10222 -$.datepicker._get(inst, "stepBigMonths") : 10223 -$.datepicker._get(inst, "stepMonths")), "M"); 10224 } 10225 10226 // next month/year on alt +left on Mac 10227 break; 10228 case 38: if (event.ctrlKey || event.metaKey) { 10229 $.datepicker._adjustDate(event.target, -7, "D"); 10230 } 10231 handled = event.ctrlKey || event.metaKey; 10232 break; // -1 week on ctrl or command +up 10233 case 39: if (event.ctrlKey || event.metaKey) { 10234 $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); 10235 } 10236 handled = event.ctrlKey || event.metaKey; 10237 10238 // +1 day on ctrl or command +right 10239 if (event.originalEvent.altKey) { 10240 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10241 +$.datepicker._get(inst, "stepBigMonths") : 10242 +$.datepicker._get(inst, "stepMonths")), "M"); 10243 } 10244 10245 // next month/year on alt +right 10246 break; 10247 case 40: if (event.ctrlKey || event.metaKey) { 10248 $.datepicker._adjustDate(event.target, +7, "D"); 10249 } 10250 handled = event.ctrlKey || event.metaKey; 10251 break; // +1 week on ctrl or command +down 10252 default: handled = false; 10253 } 10254 } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home 10255 $.datepicker._showDatepicker(this); 10256 } else { 10257 handled = false; 10258 } 10259 10260 if (handled) { 10261 event.preventDefault(); 10262 event.stopPropagation(); 10263 } 10264 }, 10265 10266 /* Filter entered characters - based on date format. */ 10267 _doKeyPress: function (event) { 10268 var chars, chr, 10269 inst = $.datepicker._getInst(event.target); 10270 10271 if ($.datepicker._get(inst, "constrainInput")) { 10272 chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); 10273 chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); 10274 return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); 10275 } 10276 }, 10277 10278 /* Synchronise manual entry and field/alternate field. */ 10279 _doKeyUp: function (event) { 10280 var date, 10281 inst = $.datepicker._getInst(event.target); 10282 10283 if (inst.input.val() !== inst.lastVal) { 10284 try { 10285 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 10286 (inst.input ? inst.input.val() : null), 10287 $.datepicker._getFormatConfig(inst)); 10288 10289 if (date) { // only if valid 10290 $.datepicker._setDateFromField(inst); 10291 $.datepicker._updateAlternate(inst); 10292 $.datepicker._updateDatepicker(inst); 10293 } 10294 } 10295 catch (err) { 10296 } 10297 } 10298 return true; 10299 }, 10300 10301 /* Pop-up the date picker for a given input field. 10302 * If false returned from beforeShow event handler do not show. 10303 * @param input element - the input field attached to the date picker or
vendor: 4,212 bytes, lines 10304-10427
10304 * event - if triggered by focus 10305 */ 10306 _showDatepicker: function (input) { 10307 input = input.target || input; 10308 if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger 10309 input = $("input", input.parentNode)[0]; 10310 } 10311 10312 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here 10313 return; 10314 } 10315 10316 var inst, beforeShow, beforeShowSettings, isFixed, 10317 offset, showAnim, duration; 10318 10319 inst = $.datepicker._getInst(input); 10320 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 10321 $.datepicker._curInst.dpDiv.stop(true, true); 10322 if (inst && $.datepicker._datepickerShowing) { 10323 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 10324 } 10325 } 10326 10327 beforeShow = $.datepicker._get(inst, "beforeShow"); 10328 beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 10329 if (beforeShowSettings === false) { 10330 return; 10331 } 10332 datepicker_extendRemove(inst.settings, beforeShowSettings); 10333 10334 inst.lastVal = null; 10335 $.datepicker._lastInput = input; 10336 $.datepicker._setDateFromField(inst); 10337 10338 if ($.datepicker._inDialog) { // hide cursor 10339 input.value = ""; 10340 } 10341 if (!$.datepicker._pos) { // position below input 10342 $.datepicker._pos = $.datepicker._findPos(input); 10343 $.datepicker._pos[1] += input.offsetHeight; // add the height 10344 } 10345 10346 isFixed = false; 10347 $(input).parents().each(function () { 10348 isFixed |= $(this).css("position") === "fixed"; 10349 return !isFixed; 10350 }); 10351 10352 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 10353 $.datepicker._pos = null; 10354 10355 //to avoid flashes on Firefox 10356 inst.dpDiv.empty(); 10357 10358 // determine sizing offscreen 10359 inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); 10360 $.datepicker._updateDatepicker(inst); 10361 10362 // fix width for dynamic number of date pickers 10363 // and adjust position before showing 10364 offset = $.datepicker._checkOffset(inst, offset, isFixed); 10365 inst.dpDiv.css({ 10366 position: ($.datepicker._inDialog && $.blockUI ? 10367 "static" : (isFixed ? "fixed" : "absolute")), display: "none", 10368 left: offset.left + "px", top: offset.top + "px" 10369 }); 10370 10371 if (!inst.inline) { 10372 showAnim = $.datepicker._get(inst, "showAnim"); 10373 duration = $.datepicker._get(inst, "duration"); 10374 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 10375 $.datepicker._datepickerShowing = true; 10376 10377 if ($.effects && $.effects.effect[showAnim]) { 10378 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); 10379 } else { 10380 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 10381 } 10382 10383 if ($.datepicker._shouldFocusInput(inst)) { 10384 inst.input.trigger("focus"); 10385 } 10386 10387 $.datepicker._curInst = inst; 10388 } 10389 }, 10390 10391 /* Generate the date picker content. */ 10392 _updateDatepicker: function (inst) { 10393 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 10394 datepicker_instActive = inst; // for delegate hover events 10395 inst.dpDiv.empty().append(this._generateHTML(inst)); 10396 this._attachHandlers(inst); 10397 10398 var origyearshtml, 10399 numMonths = this._getNumberOfMonths(inst), 10400 cols = numMonths[1], 10401 width = 17, 10402 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"); 10403 10404 if (activeCell.length > 0) { 10405 datepicker_handleMouseover.apply(activeCell.get(0)); 10406 } 10407 10408 inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); 10409 if (cols > 1) { 10410 inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); 10411 } 10412 inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + 10413 "Class"]("ui-datepicker-multi"); 10414 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + 10415 "Class"]("ui-datepicker-rtl"); 10416 10417 if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) { 10418 inst.input.trigger("focus"); 10419 } 10420 10421 // Deffered render of the years select (to avoid flashes on Firefox) 10422 if (inst.yearshtml) { 10423 origyearshtml = inst.yearshtml; 10424 setTimeout(function () { 10425 10426 //assure that inst.yearshtml didn't change. 10427 if (origyearshtml === inst.yearshtml && inst.yearshtml) {
vendor: 4,400 bytes, lines 10428-10550
10428 inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); 10429 } 10430 origyearshtml = inst.yearshtml = null; 10431 }, 0); 10432 } 10433 }, 10434 10435 // #6694 - don't focus the input if it's already focused 10436 // this breaks the change event in IE 10437 // Support: IE and jQuery <1.9 10438 _shouldFocusInput: function (inst) { 10439 return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus"); 10440 }, 10441 10442 /* Check positioning to remain on screen. */ 10443 _checkOffset: function (inst, offset, isFixed) { 10444 var dpWidth = inst.dpDiv.outerWidth(), 10445 dpHeight = inst.dpDiv.outerHeight(), 10446 inputWidth = inst.input ? inst.input.outerWidth() : 0, 10447 inputHeight = inst.input ? inst.input.outerHeight() : 0, 10448 viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), 10449 viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 10450 10451 offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); 10452 offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; 10453 offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 10454 10455 // Now check if datepicker is showing outside window viewport - move to a better place if so. 10456 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 10457 Math.abs(offset.left + dpWidth - viewWidth) : 0); 10458 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 10459 Math.abs(dpHeight + inputHeight) : 0); 10460 10461 return offset; 10462 }, 10463 10464 /* Find an object's position on the screen. */ 10465 _findPos: function (obj) { 10466 var position, 10467 inst = this._getInst(obj), 10468 isRTL = this._get(inst, "isRTL"); 10469 10470 while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { 10471 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 10472 } 10473 10474 position = $(obj).offset(); 10475 return [position.left, position.top]; 10476 }, 10477 10478 /* Hide the date picker from view. 10479 * @param input element - the input field attached to the date picker 10480 */ 10481 _hideDatepicker: function (input) { 10482 var showAnim, duration, postProcess, onClose, 10483 inst = this._curInst; 10484 10485 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 10486 return; 10487 } 10488 10489 if (this._datepickerShowing) { 10490 showAnim = this._get(inst, "showAnim"); 10491 duration = this._get(inst, "duration"); 10492 postProcess = function () { 10493 $.datepicker._tidyDialog(inst); 10494 }; 10495 10496 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 10497 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 10498 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); 10499 } else { 10500 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : 10501 (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); 10502 } 10503 10504 if (!showAnim) { 10505 postProcess(); 10506 } 10507 this._datepickerShowing = false; 10508 10509 onClose = this._get(inst, "onClose"); 10510 if (onClose) { 10511 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); 10512 } 10513 10514 this._lastInput = null; 10515 if (this._inDialog) { 10516 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); 10517 if ($.blockUI) { 10518 $.unblockUI(); 10519 $("body").append(this.dpDiv); 10520 } 10521 } 10522 this._inDialog = false; 10523 } 10524 }, 10525 10526 /* Tidy up after a dialog display. */ 10527 _tidyDialog: function (inst) { 10528 inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar"); 10529 }, 10530 10531 /* Close date picker if clicked elsewhere. */ 10532 _checkExternalClick: function (event) { 10533 if (!$.datepicker._curInst) { 10534 return; 10535 } 10536 10537 var $target = $(event.target), 10538 inst = $.datepicker._getInst($target[0]); 10539 10540 if ((($target[0].id !== $.datepicker._mainDivId && 10541 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 10542 !$target.hasClass($.datepicker.markerClassName) && 10543 !$target.closest("." + $.datepicker._triggerClass).length && 10544 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || 10545 ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) { 10546 $.datepicker._hideDatepicker(); 10547 } 10548 }, 10549 10550 /* Adjust one of the date sub-fields. */
vendor: 4,335 bytes, lines 10551-10690
10551 _adjustDate: function (id, offset, period) { 10552 var target = $(id), 10553 inst = this._getInst(target[0]); 10554 10555 if (this._isDisabledDatepicker(target[0])) { 10556 return; 10557 } 10558 this._adjustInstDate(inst, offset, period); 10559 this._updateDatepicker(inst); 10560 }, 10561 10562 /* Action for current link. */ 10563 _gotoToday: function (id) { 10564 var date, 10565 target = $(id), 10566 inst = this._getInst(target[0]); 10567 10568 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 10569 inst.selectedDay = inst.currentDay; 10570 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 10571 inst.drawYear = inst.selectedYear = inst.currentYear; 10572 } else { 10573 date = new Date(); 10574 inst.selectedDay = date.getDate(); 10575 inst.drawMonth = inst.selectedMonth = date.getMonth(); 10576 inst.drawYear = inst.selectedYear = date.getFullYear(); 10577 } 10578 this._notifyChange(inst); 10579 this._adjustDate(target); 10580 }, 10581 10582 /* Action for selecting a new month/year. */ 10583 _selectMonthYear: function (id, select, period) { 10584 var target = $(id), 10585 inst = this._getInst(target[0]); 10586 10587 inst["selected" + (period === "M" ? "Month" : "Year")] = 10588 inst["draw" + (period === "M" ? "Month" : "Year")] = 10589 parseInt(select.options[select.selectedIndex].value, 10); 10590 10591 this._notifyChange(inst); 10592 this._adjustDate(target); 10593 }, 10594 10595 /* Action for selecting a day. */ 10596 _selectDay: function (id, month, year, td) { 10597 var inst, 10598 target = $(id); 10599 10600 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 10601 return; 10602 } 10603 10604 inst = this._getInst(target[0]); 10605 inst.selectedDay = inst.currentDay = $("a", td).html(); 10606 inst.selectedMonth = inst.currentMonth = month; 10607 inst.selectedYear = inst.currentYear = year; 10608 this._selectDate(id, this._formatDate(inst, 10609 inst.currentDay, inst.currentMonth, inst.currentYear)); 10610 }, 10611 10612 /* Erase the input field and hide the date picker. */ 10613 _clearDate: function (id) { 10614 var target = $(id); 10615 this._selectDate(target, ""); 10616 }, 10617 10618 /* Update the input field with the selected date. */ 10619 _selectDate: function (id, dateStr) { 10620 var onSelect, 10621 target = $(id), 10622 inst = this._getInst(target[0]); 10623 10624 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 10625 if (inst.input) { 10626 inst.input.val(dateStr); 10627 } 10628 this._updateAlternate(inst); 10629 10630 onSelect = this._get(inst, "onSelect"); 10631 if (onSelect) { 10632 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 10633 } else if (inst.input) { 10634 inst.input.trigger("change"); // fire the change event 10635 } 10636 10637 if (inst.inline) { 10638 this._updateDatepicker(inst); 10639 } else { 10640 this._hideDatepicker(); 10641 this._lastInput = inst.input[0]; 10642 if (typeof (inst.input[0]) !== "object") { 10643 inst.input.trigger("focus"); // restore focus 10644 } 10645 this._lastInput = null; 10646 } 10647 }, 10648 10649 /* Update any alternate field to synchronise with the main field. */ 10650 _updateAlternate: function (inst) { 10651 var altFormat, date, dateStr, 10652 altField = this._get(inst, "altField"); 10653 10654 if (altField) { // update alternate field too 10655 altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 10656 date = this._getDate(inst); 10657 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 10658 $(altField).val(dateStr); 10659 } 10660 }, 10661 10662 /* Set as beforeShowDay function to prevent selection of weekends. 10663 * @param date Date - the date to customise 10664 * @return [boolean, string] - is this date selectable?, what is its CSS class? 10665 */ 10666 noWeekends: function (date) { 10667 var day = date.getDay(); 10668 return [(day > 0 && day < 6), ""]; 10669 }, 10670 10671 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 10672 * @param date Date - the date to get the week for 10673 * @return number - the number of the week within the year that contains this date 10674 */ 10675 iso8601Week: function (date) { 10676 var time, 10677 checkDate = new Date(date.getTime()); 10678 10679 // Find Thursday of this week starting on Monday 10680 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 10681 10682 time = checkDate.getTime(); 10683 checkDate.setMonth(0); // Compare with Jan 1 10684 checkDate.setDate(1); 10685 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 10686 }, 10687 10688 /* Parse a string value into a date object. 10689 * See formatDate below for the possible formats. 10690 *
vendor: 18,061 bytes, lines 10691-11243
10691 * @param format string - the expected format of the date 10692 * @param value string - the date in the above format 10693 * @param settings Object - attributes include: 10694 * shortYearCutoff number - the cutoff year for determining the century (optional) 10695 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10696 * dayNames string[7] - names of the days from Sunday (optional) 10697 * monthNamesShort string[12] - abbreviated names of the months (optional) 10698 * monthNames string[12] - names of the months (optional) 10699 * @return Date - the extracted date value or null if value is blank 10700 */ 10701 parseDate: function (format, value, settings) { 10702 if (format == null || value == null) { 10703 throw "Invalid arguments"; 10704 } 10705 10706 value = (typeof value === "object" ? value.toString() : value + ""); 10707 if (value === "") { 10708 return null; 10709 } 10710 10711 var iFormat, dim, extra, 10712 iValue = 0, 10713 shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, 10714 shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : 10715 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), 10716 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 10717 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 10718 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 10719 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 10720 year = -1, 10721 month = -1, 10722 day = -1, 10723 doy = -1, 10724 literal = false, 10725 date, 10726 10727 // Check whether a format character is doubled 10728 lookAhead = function (match) { 10729 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 10730 if (matches) { 10731 iFormat++; 10732 } 10733 return matches; 10734 }, 10735 10736 // Extract a number from the string value 10737 getNumber = function (match) { 10738 var isDoubled = lookAhead(match), 10739 size = (match === "@" ? 14 : (match === "!" ? 20 : 10740 (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), 10741 minSize = (match === "y" ? size : 1), 10742 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 10743 num = value.substring(iValue).match(digits); 10744 if (!num) { 10745 throw "Missing number at position " + iValue; 10746 } 10747 iValue += num[0].length; 10748 return parseInt(num[0], 10); 10749 }, 10750 10751 // Extract a name from the string value and convert to an index 10752 getName = function (match, shortNames, longNames) { 10753 var index = -1, 10754 names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 10755 return [[k, v]]; 10756 }).sort(function (a, b) { 10757 return -(a[1].length - b[1].length); 10758 }); 10759 10760 $.each(names, function (i, pair) { 10761 var name = pair[1]; 10762 if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { 10763 index = pair[0]; 10764 iValue += name.length; 10765 return false; 10766 } 10767 }); 10768 if (index !== -1) { 10769 return index + 1; 10770 } else { 10771 throw "Unknown name at position " + iValue; 10772 } 10773 }, 10774 10775 // Confirm that a literal character matches the string value 10776 checkLiteral = function () { 10777 if (value.charAt(iValue) !== format.charAt(iFormat)) { 10778 throw "Unexpected literal at position " + iValue; 10779 } 10780 iValue++; 10781 }; 10782 10783 for (iFormat = 0; iFormat < format.length; iFormat++) { 10784 if (literal) { 10785 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 10786 literal = false; 10787 } else { 10788 checkLiteral(); 10789 } 10790 } else { 10791 switch (format.charAt(iFormat)) { 10792 case "d": 10793 day = getNumber("d"); 10794 break; 10795 case "D": 10796 getName("D", dayNamesShort, dayNames); 10797 break; 10798 case "o": 10799 doy = getNumber("o"); 10800 break; 10801 case "m": 10802 month = getNumber("m"); 10803 break; 10804 case "M": 10805 month = getName("M", monthNamesShort, monthNames); 10806 break; 10807 case "y": 10808 year = getNumber("y"); 10809 break; 10810 case "@": 10811 date = new Date(getNumber("@")); 10812 year = date.getFullYear(); 10813 month = date.getMonth() + 1; 10814 day = date.getDate(); 10815 break; 10816 case "!": 10817 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 10818 year = date.getFullYear(); 10819 month = date.getMonth() + 1; 10820 day = date.getDate(); 10821 break; 10822 case "'": 10823 if (lookAhead("'")) { 10824 checkLiteral(); 10825 } else { 10826 literal = true; 10827 } 10828 break; 10829 default: 10830 checkLiteral(); 10831 } 10832 } 10833 } 10834 10835 if (iValue < value.length) { 10836 extra = value.substr(iValue); 10837 if (!/^\s+/.test(extra)) { 10838 throw "Extra/unparsed characters found in date: " + extra; 10839 } 10840 } 10841 10842 if (year === -1) { 10843 year = new Date().getFullYear(); 10844 } else if (year < 100) { 10845 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 10846 (year <= shortYearCutoff ? 0 : -100); 10847 } 10848 10849 if (doy > -1) { 10850 month = 1; 10851 day = doy; 10852 do { 10853 dim = this._getDaysInMonth(year, month - 1); 10854 if (day <= dim) { 10855 break; 10856 } 10857 month++; 10858 day -= dim; 10859 } while (true); 10860 } 10861 10862 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 10863 if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { 10864 throw "Invalid date"; // E.g. 31/02/00 10865 } 10866 return date; 10867 }, 10868 10869 /* Standard date formats. */ 10870 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 10871 COOKIE: "D, dd M yy", 10872 ISO_8601: "yy-mm-dd", 10873 RFC_822: "D, d M y", 10874 RFC_850: "DD, dd-M-y", 10875 RFC_1036: "D, d M y", 10876 RFC_1123: "D, d M yy", 10877 RFC_2822: "D, d M yy", 10878 RSS: "D, d M y", // RFC 822 10879 TICKS: "!", 10880 TIMESTAMP: "@", 10881 W3C: "yy-mm-dd", // ISO 8601 10882 10883 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 10884 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 10885 10886 /* Format a date object into a string value. 10887 * The format can be combinations of the following: 10888 * d - day of month (no leading zero) 10889 * dd - day of month (two digit) 10890 * o - day of year (no leading zeros) 10891 * oo - day of year (three digit) 10892 * D - day name short 10893 * DD - day name long 10894 * m - month of year (no leading zero) 10895 * mm - month of year (two digit) 10896 * M - month name short 10897 * MM - month name long 10898 * y - year (two digit) 10899 * yy - year (four digit) 10900 * @ - Unix timestamp (ms since 01/01/1970) 10901 * ! - Windows ticks (100ns since 01/01/0001) 10902 * "..." - literal text 10903 * '' - single quote 10904 * 10905 * @param format string - the desired format of the date 10906 * @param date Date - the date value to format 10907 * @param settings Object - attributes include: 10908 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10909 * dayNames string[7] - names of the days from Sunday (optional) 10910 * monthNamesShort string[12] - abbreviated names of the months (optional) 10911 * monthNames string[12] - names of the months (optional) 10912 * @return string - the date in the above format 10913 */ 10914 formatDate: function (format, date, settings) { 10915 if (!date) { 10916 return ""; 10917 } 10918 10919 var iFormat, 10920 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 10921 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 10922 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 10923 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 10924 10925 // Check whether a format character is doubled 10926 lookAhead = function (match) { 10927 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 10928 if (matches) { 10929 iFormat++; 10930 } 10931 return matches; 10932 }, 10933 10934 // Format a number, with leading zero if necessary 10935 formatNumber = function (match, value, len) { 10936 var num = "" + value; 10937 if (lookAhead(match)) { 10938 while (num.length < len) { 10939 num = "0" + num; 10940 } 10941 } 10942 return num; 10943 }, 10944 10945 // Format a name, short or long as requested 10946 formatName = function (match, value, shortNames, longNames) { 10947 return (lookAhead(match) ? longNames[value] : shortNames[value]); 10948 }, 10949 output = "", 10950 literal = false; 10951 10952 if (date) { 10953 for (iFormat = 0; iFormat < format.length; iFormat++) { 10954 if (literal) { 10955 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 10956 literal = false; 10957 } else { 10958 output += format.charAt(iFormat); 10959 } 10960 } else { 10961 switch (format.charAt(iFormat)) { 10962 case "d": 10963 output += formatNumber("d", date.getDate(), 2); 10964 break; 10965 case "D": 10966 output += formatName("D", date.getDay(), dayNamesShort, dayNames); 10967 break; 10968 case "o": 10969 output += formatNumber("o", 10970 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 10971 break; 10972 case "m": 10973 output += formatNumber("m", date.getMonth() + 1, 2); 10974 break; 10975 case "M": 10976 output += formatName("M", date.getMonth(), monthNamesShort, monthNames); 10977 break; 10978 case "y": 10979 output += (lookAhead("y") ? date.getFullYear() : 10980 (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100); 10981 break; 10982 case "@": 10983 output += date.getTime(); 10984 break; 10985 case "!": 10986 output += date.getTime() * 10000 + this._ticksTo1970; 10987 break; 10988 case "'": 10989 if (lookAhead("'")) { 10990 output += "'"; 10991 } else { 10992 literal = true; 10993 } 10994 break; 10995 default: 10996 output += format.charAt(iFormat); 10997 } 10998 } 10999 } 11000 } 11001 return output; 11002 }, 11003 11004 /* Extract all possible characters from the date format. */ 11005 _possibleChars: function (format) { 11006 var iFormat, 11007 chars = "", 11008 literal = false, 11009 11010 // Check whether a format character is doubled 11011 lookAhead = function (match) { 11012 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 11013 if (matches) { 11014 iFormat++; 11015 } 11016 return matches; 11017 }; 11018 11019 for (iFormat = 0; iFormat < format.length; iFormat++) { 11020 if (literal) { 11021 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 11022 literal = false; 11023 } else { 11024 chars += format.charAt(iFormat); 11025 } 11026 } else { 11027 switch (format.charAt(iFormat)) { 11028 case "d": case "m": case "y": case "@": 11029 chars += "0123456789"; 11030 break; 11031 case "D": case "M": 11032 return null; // Accept anything 11033 case "'": 11034 if (lookAhead("'")) { 11035 chars += "'"; 11036 } else { 11037 literal = true; 11038 } 11039 break; 11040 default: 11041 chars += format.charAt(iFormat); 11042 } 11043 } 11044 } 11045 return chars; 11046 }, 11047 11048 /* Get a setting value, defaulting if necessary. */ 11049 _get: function (inst, name) { 11050 return inst.settings[name] !== undefined ? 11051 inst.settings[name] : this._defaults[name]; 11052 }, 11053 11054 /* Parse existing date and initialise date picker. */ 11055 _setDateFromField: function (inst, noDefault) { 11056 if (inst.input.val() === inst.lastVal) { 11057 return; 11058 } 11059 11060 var dateFormat = this._get(inst, "dateFormat"), 11061 dates = inst.lastVal = inst.input ? inst.input.val() : null, 11062 defaultDate = this._getDefaultDate(inst), 11063 date = defaultDate, 11064 settings = this._getFormatConfig(inst); 11065 11066 try { 11067 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 11068 } catch (event) { 11069 dates = (noDefault ? "" : dates); 11070 } 11071 inst.selectedDay = date.getDate(); 11072 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11073 inst.drawYear = inst.selectedYear = date.getFullYear(); 11074 inst.currentDay = (dates ? date.getDate() : 0); 11075 inst.currentMonth = (dates ? date.getMonth() : 0); 11076 inst.currentYear = (dates ? date.getFullYear() : 0); 11077 this._adjustInstDate(inst); 11078 }, 11079 11080 /* Retrieve the default date shown on opening. */ 11081 _getDefaultDate: function (inst) { 11082 return this._restrictMinMax(inst, 11083 this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); 11084 }, 11085 11086 /* A date may be specified as an exact value or a relative one. */ 11087 _determineDate: function (inst, date, defaultDate) { 11088 var offsetNumeric = function (offset) { 11089 var date = new Date(); 11090 date.setDate(date.getDate() + offset); 11091 return date; 11092 }, 11093 offsetString = function (offset) { 11094 try { 11095 return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 11096 offset, $.datepicker._getFormatConfig(inst)); 11097 } 11098 catch (e) { 11099 11100 // Ignore 11101 } 11102 11103 var date = (offset.toLowerCase().match(/^c/) ? 11104 $.datepicker._getDate(inst) : null) || new Date(), 11105 year = date.getFullYear(), 11106 month = date.getMonth(), 11107 day = date.getDate(), 11108 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 11109 matches = pattern.exec(offset); 11110 11111 while (matches) { 11112 switch (matches[2] || "d") { 11113 case "d": case "D": 11114 day += parseInt(matches[1], 10); break; 11115 case "w": case "W": 11116 day += parseInt(matches[1], 10) * 7; break; 11117 case "m": case "M": 11118 month += parseInt(matches[1], 10); 11119 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 11120 break; 11121 case "y": case "Y": 11122 year += parseInt(matches[1], 10); 11123 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 11124 break; 11125 } 11126 matches = pattern.exec(offset); 11127 } 11128 return new Date(year, month, day); 11129 }, 11130 newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : 11131 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 11132 11133 newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); 11134 if (newDate) { 11135 newDate.setHours(0); 11136 newDate.setMinutes(0); 11137 newDate.setSeconds(0); 11138 newDate.setMilliseconds(0); 11139 } 11140 return this._daylightSavingAdjust(newDate); 11141 }, 11142 11143 /* Handle switch to/from daylight saving. 11144 * Hours may be non-zero on daylight saving cut-over: 11145 * > 12 when midnight changeover, but then cannot generate 11146 * midnight datetime, so jump to 1AM, otherwise reset. 11147 * @param date (Date) the date to check 11148 * @return (Date) the corrected date 11149 */ 11150 _daylightSavingAdjust: function (date) { 11151 if (!date) { 11152 return null; 11153 } 11154 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 11155 return date; 11156 }, 11157 11158 /* Set the date(s) directly. */ 11159 _setDate: function (inst, date, noChange) { 11160 var clear = !date, 11161 origMonth = inst.selectedMonth, 11162 origYear = inst.selectedYear, 11163 newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 11164 11165 inst.selectedDay = inst.currentDay = newDate.getDate(); 11166 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 11167 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 11168 if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { 11169 this._notifyChange(inst); 11170 } 11171 this._adjustInstDate(inst); 11172 if (inst.input) { 11173 inst.input.val(clear ? "" : this._formatDate(inst)); 11174 } 11175 }, 11176 11177 /* Retrieve the date(s) directly. */ 11178 _getDate: function (inst) { 11179 var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : 11180 this._daylightSavingAdjust(new Date( 11181 inst.currentYear, inst.currentMonth, inst.currentDay))); 11182 return startDate; 11183 }, 11184 11185 /* Attach the onxxx handlers. These are declared statically so 11186 * they work with static code transformers like Caja. 11187 */ 11188 _attachHandlers: function (inst) { 11189 var stepMonths = this._get(inst, "stepMonths"), 11190 id = "#" + inst.id.replace(/\\\\/g, "\\"); 11191 inst.dpDiv.find("[data-handler]").map(function () { 11192 var handler = { 11193 prev: function () { 11194 $.datepicker._adjustDate(id, -stepMonths, "M"); 11195 }, 11196 next: function () { 11197 $.datepicker._adjustDate(id, +stepMonths, "M"); 11198 }, 11199 hide: function () { 11200 $.datepicker._hideDatepicker(); 11201 }, 11202 today: function () { 11203 $.datepicker._gotoToday(id); 11204 }, 11205 selectDay: function () { 11206 $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); 11207 return false; 11208 }, 11209 selectMonth: function () { 11210 $.datepicker._selectMonthYear(id, this, "M"); 11211 return false; 11212 }, 11213 selectYear: function () { 11214 $.datepicker._selectMonthYear(id, this, "Y"); 11215 return false; 11216 } 11217 }; 11218 $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); 11219 }); 11220 }, 11221 11222 /* Generate the HTML for the current state of the date picker. */ 11223 _generateHTML: function (inst) { 11224 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 11225 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 11226 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 11227 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 11228 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 11229 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 11230 tempDate = new Date(), 11231 today = this._daylightSavingAdjust( 11232 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time 11233 isRTL = this._get(inst, "isRTL"), 11234 showButtonPanel = this._get(inst, "showButtonPanel"), 11235 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 11236 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 11237 numMonths = this._getNumberOfMonths(inst), 11238 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 11239 stepMonths = this._get(inst, "stepMonths"), 11240 isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), 11241 currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 11242 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), 11243 minDate = this._getMinMaxDate(inst, "min"),
vendor: 4,136 bytes, lines 11244-11324
11244 maxDate = this._getMinMaxDate(inst, "max"), 11245 drawMonth = inst.drawMonth - showCurrentAtPos, 11246 drawYear = inst.drawYear; 11247 11248 if (drawMonth < 0) { 11249 drawMonth += 12; 11250 drawYear--; 11251 } 11252 if (maxDate) { 11253 maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 11254 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 11255 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 11256 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 11257 drawMonth--; 11258 if (drawMonth < 0) { 11259 drawMonth = 11; 11260 drawYear--; 11261 } 11262 } 11263 } 11264 inst.drawMonth = drawMonth; 11265 inst.drawYear = drawYear; 11266 11267 prevText = this._get(inst, "prevText"); 11268 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 11269 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 11270 this._getFormatConfig(inst))); 11271 11272 prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? 11273 "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + 11274 " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" : 11275 (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>")); 11276 11277 nextText = this._get(inst, "nextText"); 11278 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 11279 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 11280 this._getFormatConfig(inst))); 11281 11282 next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? 11283 "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + 11284 " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" : 11285 (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>")); 11286 11287 currentText = this._get(inst, "currentText"); 11288 gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); 11289 currentText = (!navigationAsDateFormat ? currentText : 11290 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 11291 11292 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'>" + 11293 this._get(inst, "closeText") + "</button>" : ""); 11294 11295 buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") + 11296 (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'" + 11297 ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; 11298 11299 firstDay = parseInt(this._get(inst, "firstDay"), 10); 11300 firstDay = (isNaN(firstDay) ? 0 : firstDay); 11301 11302 showWeek = this._get(inst, "showWeek"); 11303 dayNames = this._get(inst, "dayNames"); 11304 dayNamesMin = this._get(inst, "dayNamesMin"); 11305 monthNames = this._get(inst, "monthNames"); 11306 monthNamesShort = this._get(inst, "monthNamesShort"); 11307 beforeShowDay = this._get(inst, "beforeShowDay"); 11308 showOtherMonths = this._get(inst, "showOtherMonths"); 11309 selectOtherMonths = this._get(inst, "selectOtherMonths"); 11310 defaultDate = this._getDefaultDate(inst); 11311 html = ""; 11312 11313 for (row = 0; row < numMonths[0]; row++) { 11314 group = ""; 11315 this.maxRows = 4; 11316 for (col = 0; col < numMonths[1]; col++) { 11317 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 11318 cornerClass = " ui-corner-all"; 11319 calender = ""; 11320 if (isMultiMonth) { 11321 calender += "<div class='ui-datepicker-group"; 11322 if (numMonths[1] > 1) { 11323 switch (col) { 11324 case 0: calender += " ui-datepicker-group-first";
vendor: 5,165 bytes, lines 11325-11403
11325 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; 11326 case numMonths[1] - 1: calender += " ui-datepicker-group-last"; 11327 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; 11328 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 11329 } 11330 } 11331 calender += "'>"; 11332 } 11333 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 11334 (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + 11335 (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + 11336 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 11337 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 11338 "</div><table class='ui-datepicker-calendar'><thead>" + 11339 "<tr>"; 11340 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); 11341 for (dow = 0; dow < 7; dow++) { // days of the week 11342 day = (dow + firstDay) % 7; 11343 thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + 11344 "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; 11345 } 11346 calender += thead + "</tr></thead><tbody>"; 11347 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 11348 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { 11349 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 11350 } 11351 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 11352 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 11353 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 11354 this.maxRows = numRows; 11355 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 11356 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows 11357 calender += "<tr>"; 11358 tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 11359 this._get(inst, "calculateWeek")(printDate) + "</td>"); 11360 for (dow = 0; dow < 7; dow++) { // create date picker days 11361 daySettings = (beforeShowDay ? 11362 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); 11363 otherMonth = (printDate.getMonth() !== drawMonth); 11364 unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 11365 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 11366 tbody += "<td class='" + 11367 ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends 11368 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 11369 ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key 11370 (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? 11371 11372 // or defaultDate is current printedDate and defaultDate is selectedDate 11373 " " + this._dayOverClass : "") + // highlight selected day 11374 (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days 11375 (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates 11376 (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day 11377 (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) 11378 ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title 11379 (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions 11380 (otherMonth && !showOtherMonths ? " " : // display for other months 11381 (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 11382 (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + 11383 (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day 11384 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 11385 "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date 11386 printDate.setDate(printDate.getDate() + 1); 11387 printDate = this._daylightSavingAdjust(printDate); 11388 } 11389 calender += tbody + "</tr>"; 11390 } 11391 drawMonth++; 11392 if (drawMonth > 11) { 11393 drawMonth = 0; 11394 drawYear++; 11395 } 11396 calender += "</tbody></table>" + (isMultiMonth ? "</div>" + 11397 ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); 11398 group += calender; 11399 } 11400 html += group; 11401 } 11402 html += buttonPanel; 11403 inst._keyEvent = false;
vendor: 5,575 bytes, lines 11404-11548
11404 return html; 11405 }, 11406 11407 /* Generate the month and year header. */ 11408 _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, 11409 secondary, monthNames, monthNamesShort) { 11410 11411 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 11412 changeMonth = this._get(inst, "changeMonth"), 11413 changeYear = this._get(inst, "changeYear"), 11414 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 11415 html = "<div class='ui-datepicker-title'>", 11416 monthHtml = ""; 11417 11418 // Month selection 11419 if (secondary || !changeMonth) { 11420 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; 11421 } else { 11422 inMinYear = (minDate && minDate.getFullYear() === drawYear); 11423 inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); 11424 monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; 11425 for (month = 0; month < 12; month++) { 11426 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { 11427 monthHtml += "<option value='" + month + "'" + 11428 (month === drawMonth ? " selected='selected'" : "") + 11429 ">" + monthNamesShort[month] + "</option>"; 11430 } 11431 } 11432 monthHtml += "</select>"; 11433 } 11434 11435 if (!showMonthAfterYear) { 11436 html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); 11437 } 11438 11439 // Year selection 11440 if (!inst.yearshtml) { 11441 inst.yearshtml = ""; 11442 if (secondary || !changeYear) { 11443 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 11444 } else { 11445 11446 // determine range of years to display 11447 years = this._get(inst, "yearRange").split(":"); 11448 thisYear = new Date().getFullYear(); 11449 determineYear = function (value) { 11450 var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : 11451 (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : 11452 parseInt(value, 10))); 11453 return (isNaN(year) ? thisYear : year); 11454 }; 11455 year = determineYear(years[0]); 11456 endYear = Math.max(year, determineYear(years[1] || "")); 11457 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 11458 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 11459 inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; 11460 for (; year <= endYear; year++) { 11461 inst.yearshtml += "<option value='" + year + "'" + 11462 (year === drawYear ? " selected='selected'" : "") + 11463 ">" + year + "</option>"; 11464 } 11465 inst.yearshtml += "</select>"; 11466 11467 html += inst.yearshtml; 11468 inst.yearshtml = null; 11469 } 11470 } 11471 11472 html += this._get(inst, "yearSuffix"); 11473 if (showMonthAfterYear) { 11474 html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; 11475 } 11476 html += "</div>"; // Close datepicker_header 11477 return html; 11478 }, 11479 11480 /* Adjust one of the date sub-fields. */ 11481 _adjustInstDate: function (inst, offset, period) { 11482 var year = inst.selectedYear + (period === "Y" ? offset : 0), 11483 month = inst.selectedMonth + (period === "M" ? offset : 0), 11484 day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), 11485 date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); 11486 11487 inst.selectedDay = date.getDate(); 11488 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11489 inst.drawYear = inst.selectedYear = date.getFullYear(); 11490 if (period === "M" || period === "Y") { 11491 this._notifyChange(inst); 11492 } 11493 }, 11494 11495 /* Ensure a date is within any min/max bounds. */ 11496 _restrictMinMax: function (inst, date) { 11497 var minDate = this._getMinMaxDate(inst, "min"), 11498 maxDate = this._getMinMaxDate(inst, "max"), 11499 newDate = (minDate && date < minDate ? minDate : date); 11500 return (maxDate && newDate > maxDate ? maxDate : newDate); 11501 }, 11502 11503 /* Notify change of month/year. */ 11504 _notifyChange: function (inst) { 11505 var onChange = this._get(inst, "onChangeMonthYear"); 11506 if (onChange) { 11507 onChange.apply((inst.input ? inst.input[0] : null), 11508 [inst.selectedYear, inst.selectedMonth + 1, inst]); 11509 } 11510 }, 11511 11512 /* Determine the number of months to show. */ 11513 _getNumberOfMonths: function (inst) { 11514 var numMonths = this._get(inst, "numberOfMonths"); 11515 return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); 11516 }, 11517 11518 /* Determine the current maximum date - ensure no time components are set. */ 11519 _getMinMaxDate: function (inst, minMax) { 11520 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 11521 }, 11522 11523 /* Find the number of days in a given month. */ 11524 _getDaysInMonth: function (year, month) { 11525 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 11526 }, 11527 11528 /* Find the day of the week of the first of a month. */ 11529 _getFirstDayOfMonth: function (year, month) { 11530 return new Date(year, month, 1).getDay(); 11531 }, 11532 11533 /* Determines if we should allow a "next/prev" month display change. */ 11534 _canAdjustMonth: function (inst, offset, curYear, curMonth) { 11535 var numMonths = this._getNumberOfMonths(inst), 11536 date = this._daylightSavingAdjust(new Date(curYear, 11537 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 11538 11539 if (offset < 0) { 11540 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 11541 } 11542 return this._isInRange(inst, date); 11543 }, 11544 11545 /* Is the given date in the accepted range? */ 11546 _isInRange: function (inst, date) { 11547 var yearSplit, currentYear, 11548 minDate = this._getMinMaxDate(inst, "min"),
vendor: 30,046 bytes, lines 11549-12683
11549 maxDate = this._getMinMaxDate(inst, "max"), 11550 minYear = null, 11551 maxYear = null, 11552 years = this._get(inst, "yearRange"); 11553 if (years) { 11554 yearSplit = years.split(":"); 11555 currentYear = new Date().getFullYear(); 11556 minYear = parseInt(yearSplit[0], 10); 11557 maxYear = parseInt(yearSplit[1], 10); 11558 if (yearSplit[0].match(/[+\-].*/)) { 11559 minYear += currentYear; 11560 } 11561 if (yearSplit[1].match(/[+\-].*/)) { 11562 maxYear += currentYear; 11563 } 11564 } 11565 11566 return ((!minDate || date.getTime() >= minDate.getTime()) && 11567 (!maxDate || date.getTime() <= maxDate.getTime()) && 11568 (!minYear || date.getFullYear() >= minYear) && 11569 (!maxYear || date.getFullYear() <= maxYear)); 11570 }, 11571 11572 /* Provide the configuration settings for formatting/parsing. */ 11573 _getFormatConfig: function (inst) { 11574 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 11575 shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : 11576 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 11577 return { 11578 shortYearCutoff: shortYearCutoff, 11579 dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), 11580 monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames") 11581 }; 11582 }, 11583 11584 /* Format the given date for display. */ 11585 _formatDate: function (inst, day, month, year) { 11586 if (!day) { 11587 inst.currentDay = inst.selectedDay; 11588 inst.currentMonth = inst.selectedMonth; 11589 inst.currentYear = inst.selectedYear; 11590 } 11591 var date = (day ? (typeof day === "object" ? day : 11592 this._daylightSavingAdjust(new Date(year, month, day))) : 11593 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 11594 return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); 11595 } 11596 }); 11597 11598 /* 11599 * Bind hover events for datepicker elements. 11600 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 11601 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 11602 */ 11603 function datepicker_bindHover(dpDiv) { 11604 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 11605 return dpDiv.on("mouseout", selector, function () { 11606 $(this).removeClass("ui-state-hover"); 11607 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 11608 $(this).removeClass("ui-datepicker-prev-hover"); 11609 } 11610 if (this.className.indexOf("ui-datepicker-next") !== -1) { 11611 $(this).removeClass("ui-datepicker-next-hover"); 11612 } 11613 }) 11614 .on("mouseover", selector, datepicker_handleMouseover); 11615 } 11616 11617 function datepicker_handleMouseover() { 11618 if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { 11619 $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 11620 $(this).addClass("ui-state-hover"); 11621 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 11622 $(this).addClass("ui-datepicker-prev-hover"); 11623 } 11624 if (this.className.indexOf("ui-datepicker-next") !== -1) { 11625 $(this).addClass("ui-datepicker-next-hover"); 11626 } 11627 } 11628 } 11629 11630 /* jQuery extend now ignores nulls! */ 11631 function datepicker_extendRemove(target, props) { 11632 $.extend(target, props); 11633 for (var name in props) { 11634 if (props[name] == null) { 11635 target[name] = props[name]; 11636 } 11637 } 11638 return target; 11639 } 11640 11641 /* Invoke the datepicker functionality. 11642 @param options string - a command, optionally followed by additional parameters or 11643 Object - settings for attaching new datepicker functionality 11644 @return jQuery object */ 11645 $.fn.datepicker = function (options) { 11646 11647 /* Verify an empty collection wasn't passed - Fixes #6976 */ 11648 if (!this.length) { 11649 return this; 11650 } 11651 11652 /* Initialise the date picker. */ 11653 if (!$.datepicker.initialized) { 11654 $(document).on("mousedown", $.datepicker._checkExternalClick); 11655 $.datepicker.initialized = true; 11656 } 11657 11658 /* Append datepicker main container to body if not exist. */ 11659 if ($("#" + $.datepicker._mainDivId).length === 0) { 11660 $("body").append($.datepicker.dpDiv); 11661 } 11662 11663 var otherArgs = Array.prototype.slice.call(arguments, 1); 11664 if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { 11665 return $.datepicker["_" + options + "Datepicker"]. 11666 apply($.datepicker, [this[0]].concat(otherArgs)); 11667 } 11668 if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { 11669 return $.datepicker["_" + options + "Datepicker"]. 11670 apply($.datepicker, [this[0]].concat(otherArgs)); 11671 } 11672 return this.each(function () { 11673 typeof options === "string" ? 11674 $.datepicker["_" + options + "Datepicker"]. 11675 apply($.datepicker, [this].concat(otherArgs)) : 11676 $.datepicker._attachDatepicker(this, options); 11677 }); 11678 }; 11679 11680 $.datepicker = new Datepicker(); // singleton instance 11681 $.datepicker.initialized = false; 11682 $.datepicker.uuid = new Date().getTime(); 11683 $.datepicker.version = "1.12.1"; 11684 11685 var widgetsDatepicker = $.datepicker; 11686 11687 11688 /*! 11689 * jQuery UI Dialog 1.12.1 11690 * http://jqueryui.com 11691 * 11692 * Copyright jQuery Foundation and other contributors 11693 * Released under the MIT license. 11694 * http://jquery.org/license 11695 */ 11696 11697 //>>label: Dialog 11698 //>>group: Widgets 11699 //>>description: Displays customizable dialog windows. 11700 //>>docs: http://api.jqueryui.com/dialog/ 11701 //>>demos: http://jqueryui.com/dialog/ 11702 //>>css.structure: ../../themes/base/core.css 11703 //>>css.structure: ../../themes/base/dialog.css 11704 //>>css.theme: ../../themes/base/theme.css 11705 11706 11707 11708 $.widget("ui.dialog", { 11709 version: "1.12.1", 11710 options: { 11711 appendTo: "body", 11712 autoOpen: true, 11713 buttons: [], 11714 classes: { 11715 "ui-dialog": "ui-corner-all", 11716 "ui-dialog-titlebar": "ui-corner-all" 11717 }, 11718 closeOnEscape: true, 11719 closeText: "Close", 11720 draggable: true, 11721 hide: null, 11722 height: "auto", 11723 maxHeight: null, 11724 maxWidth: null, 11725 minHeight: 150, 11726 minWidth: 150, 11727 modal: false, 11728 position: { 11729 my: "center", 11730 at: "center", 11731 of: window, 11732 collision: "fit", 11733 11734 // Ensure the titlebar is always visible 11735 using: function (pos) { 11736 var topOffset = $(this).css(pos).offset().top; 11737 if (topOffset < 0) { 11738 $(this).css("top", pos.top - topOffset); 11739 } 11740 } 11741 }, 11742 resizable: true, 11743 show: null, 11744 title: null, 11745 width: 300, 11746 11747 // Callbacks 11748 beforeClose: null, 11749 close: null, 11750 drag: null, 11751 dragStart: null, 11752 dragStop: null, 11753 focus: null, 11754 open: null, 11755 resize: null, 11756 resizeStart: null, 11757 resizeStop: null 11758 }, 11759 11760 sizeRelatedOptions: { 11761 buttons: true, 11762 height: true, 11763 maxHeight: true, 11764 maxWidth: true, 11765 minHeight: true, 11766 minWidth: true, 11767 width: true 11768 }, 11769 11770 resizableRelatedOptions: { 11771 maxHeight: true, 11772 maxWidth: true, 11773 minHeight: true, 11774 minWidth: true 11775 }, 11776 11777 _create: function () { 11778 this.originalCss = { 11779 display: this.element[0].style.display, 11780 width: this.element[0].style.width, 11781 minHeight: this.element[0].style.minHeight, 11782 maxHeight: this.element[0].style.maxHeight, 11783 height: this.element[0].style.height 11784 }; 11785 this.originalPosition = { 11786 parent: this.element.parent(), 11787 index: this.element.parent().children().index(this.element) 11788 }; 11789 this.originalTitle = this.element.attr("title"); 11790 if (this.options.title == null && this.originalTitle != null) { 11791 this.options.title = this.originalTitle; 11792 } 11793 11794 // Dialogs can't be disabled 11795 if (this.options.disabled) { 11796 this.options.disabled = false; 11797 } 11798 11799 this._createWrapper(); 11800 11801 this.element 11802 .show() 11803 .removeAttr("title") 11804 .appendTo(this.uiDialog); 11805 11806 this._addClass("ui-dialog-content", "ui-widget-content"); 11807 11808 this._createTitlebar(); 11809 this._createButtonPane(); 11810 11811 if (this.options.draggable && $.fn.draggable) { 11812 this._makeDraggable(); 11813 } 11814 if (this.options.resizable && $.fn.resizable) { 11815 this._makeResizable(); 11816 } 11817 11818 this._isOpen = false; 11819 11820 this._trackFocus(); 11821 }, 11822 11823 _init: function () { 11824 if (this.options.autoOpen) { 11825 this.open(); 11826 } 11827 }, 11828 11829 _appendTo: function () { 11830 var element = this.options.appendTo; 11831 if (element && (element.jquery || element.nodeType)) { 11832 return $(element); 11833 } 11834 return this.document.find(element || "body").eq(0); 11835 }, 11836 11837 _destroy: function () { 11838 var next, 11839 originalPosition = this.originalPosition; 11840 11841 this._untrackInstance(); 11842 this._destroyOverlay(); 11843 11844 this.element 11845 .removeUniqueId() 11846 .css(this.originalCss) 11847 11848 // Without detaching first, the following becomes really slow 11849 .detach(); 11850 11851 this.uiDialog.remove(); 11852 11853 if (this.originalTitle) { 11854 this.element.attr("title", this.originalTitle); 11855 } 11856 11857 next = originalPosition.parent.children().eq(originalPosition.index); 11858 11859 // Don't try to place the dialog next to itself (#8613) 11860 if (next.length && next[0] !== this.element[0]) { 11861 next.before(this.element); 11862 } else { 11863 originalPosition.parent.append(this.element); 11864 } 11865 }, 11866 11867 widget: function () { 11868 return this.uiDialog; 11869 }, 11870 11871 disable: $.noop, 11872 enable: $.noop, 11873 11874 close: function (event) { 11875 var that = this; 11876 11877 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 11878 return; 11879 } 11880 11881 this._isOpen = false; 11882 this._focusedElement = null; 11883 this._destroyOverlay(); 11884 this._untrackInstance(); 11885 11886 if (!this.opener.filter(":focusable").trigger("focus").length) { 11887 11888 // Hiding a focused element doesn't trigger blur in WebKit 11889 // so in case we have nothing to focus on, explicitly blur the active element 11890 // https://bugs.webkit.org/show_bug.cgi?id=47182 11891 $.ui.safeBlur($.ui.safeActiveElement(this.document[0])); 11892 } 11893 11894 this._hide(this.uiDialog, this.options.hide, function () { 11895 that._trigger("close", event); 11896 }); 11897 }, 11898 11899 isOpen: function () { 11900 return this._isOpen; 11901 }, 11902 11903 moveToTop: function () { 11904 this._moveToTop(); 11905 }, 11906 11907 _moveToTop: function (event, silent) { 11908 var moved = false, 11909 zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () { 11910 return +$(this).css("z-index"); 11911 }).get(), 11912 zIndexMax = Math.max.apply(null, zIndices); 11913 11914 if (zIndexMax >= +this.uiDialog.css("z-index")) { 11915 this.uiDialog.css("z-index", zIndexMax + 1); 11916 moved = true; 11917 } 11918 11919 if (moved && !silent) { 11920 this._trigger("focus", event); 11921 } 11922 return moved; 11923 }, 11924 11925 open: function () { 11926 var that = this; 11927 if (this._isOpen) { 11928 if (this._moveToTop()) { 11929 this._focusTabbable(); 11930 } 11931 return; 11932 } 11933 11934 this._isOpen = true; 11935 this.opener = $($.ui.safeActiveElement(this.document[0])); 11936 11937 this._size(); 11938 this._position(); 11939 this._createOverlay(); 11940 this._moveToTop(null, true); 11941 11942 // Ensure the overlay is moved to the top with the dialog, but only when 11943 // opening. The overlay shouldn't move after the dialog is open so that 11944 // modeless dialogs opened after the modal dialog stack properly. 11945 if (this.overlay) { 11946 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 11947 } 11948 11949 this._show(this.uiDialog, this.options.show, function () { 11950 that._focusTabbable(); 11951 that._trigger("focus"); 11952 }); 11953 11954 // Track the dialog immediately upon openening in case a focus event 11955 // somehow occurs outside of the dialog before an element inside the 11956 // dialog is focused (#10152) 11957 this._makeFocusTarget(); 11958 11959 this._trigger("open"); 11960 }, 11961 11962 _focusTabbable: function () { 11963 11964 // Set focus to the first match: 11965 // 1. An element that was focused previously 11966 // 2. First element inside the dialog matching [autofocus] 11967 // 3. Tabbable element inside the content element 11968 // 4. Tabbable element inside the buttonpane 11969 // 5. The close button 11970 // 6. The dialog itself 11971 var hasFocus = this._focusedElement; 11972 if (!hasFocus) { 11973 hasFocus = this.element.find("[autofocus]"); 11974 } 11975 if (!hasFocus.length) { 11976 hasFocus = this.element.find(":tabbable"); 11977 } 11978 if (!hasFocus.length) { 11979 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 11980 } 11981 if (!hasFocus.length) { 11982 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 11983 } 11984 if (!hasFocus.length) { 11985 hasFocus = this.uiDialog; 11986 } 11987 hasFocus.eq(0).trigger("focus"); 11988 }, 11989 11990 _keepFocus: function (event) { 11991 function checkFocus() { 11992 var activeElement = $.ui.safeActiveElement(this.document[0]), 11993 isActive = this.uiDialog[0] === activeElement || 11994 $.contains(this.uiDialog[0], activeElement); 11995 if (!isActive) { 11996 this._focusTabbable(); 11997 } 11998 } 11999 event.preventDefault(); 12000 checkFocus.call(this); 12001 12002 // support: IE 12003 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 12004 // so we check again later 12005 this._delay(checkFocus); 12006 }, 12007 12008 _createWrapper: function () { 12009 this.uiDialog = $("<div>") 12010 .hide() 12011 .attr({ 12012 12013 // Setting tabIndex makes the div focusable 12014 tabIndex: -1, 12015 role: "dialog" 12016 }) 12017 .appendTo(this._appendTo()); 12018 12019 this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front"); 12020 this._on(this.uiDialog, { 12021 keydown: function (event) { 12022 if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12023 event.keyCode === $.ui.keyCode.ESCAPE) { 12024 event.preventDefault(); 12025 this.close(event); 12026 return; 12027 } 12028 12029 // Prevent tabbing out of dialogs 12030 if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) { 12031 return; 12032 } 12033 var tabbables = this.uiDialog.find(":tabbable"), 12034 first = tabbables.filter(":first"), 12035 last = tabbables.filter(":last"); 12036 12037 if ((event.target === last[0] || event.target === this.uiDialog[0]) && 12038 !event.shiftKey) { 12039 this._delay(function () { 12040 first.trigger("focus"); 12041 }); 12042 event.preventDefault(); 12043 } else if ((event.target === first[0] || 12044 event.target === this.uiDialog[0]) && event.shiftKey) { 12045 this._delay(function () { 12046 last.trigger("focus"); 12047 }); 12048 event.preventDefault(); 12049 } 12050 }, 12051 mousedown: function (event) { 12052 if (this._moveToTop(event)) { 12053 this._focusTabbable(); 12054 } 12055 } 12056 }); 12057 12058 // We assume that any existing aria-describedby attribute means 12059 // that the dialog content is marked up properly 12060 // otherwise we brute force the content as the description 12061 if (!this.element.find("[aria-describedby]").length) { 12062 this.uiDialog.attr({ 12063 "aria-describedby": this.element.uniqueId().attr("id") 12064 }); 12065 } 12066 }, 12067 12068 _createTitlebar: function () { 12069 var uiDialogTitle; 12070 12071 this.uiDialogTitlebar = $("<div>"); 12072 this._addClass(this.uiDialogTitlebar, 12073 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix"); 12074 this._on(this.uiDialogTitlebar, { 12075 mousedown: function (event) { 12076 12077 // Don't prevent click on close button (#8838) 12078 // Focusing a dialog that is partially scrolled out of view 12079 // causes the browser to scroll it into view, preventing the click event 12080 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 12081 12082 // Dialog isn't getting focus when dragging (#8063) 12083 this.uiDialog.trigger("focus"); 12084 } 12085 } 12086 }); 12087 12088 // Support: IE 12089 // Use type="button" to prevent enter keypresses in textboxes from closing the 12090 // dialog in IE (#9312) 12091 this.uiDialogTitlebarClose = $("<button type='button'></button>") 12092 .button({ 12093 label: $("<a>").text(this.options.closeText).html(), 12094 icon: "ui-icon-closethick", 12095 showLabel: false 12096 }) 12097 .appendTo(this.uiDialogTitlebar); 12098 12099 this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close"); 12100 this._on(this.uiDialogTitlebarClose, { 12101 click: function (event) { 12102 event.preventDefault(); 12103 this.close(event); 12104 } 12105 }); 12106 12107 uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar); 12108 this._addClass(uiDialogTitle, "ui-dialog-title"); 12109 this._title(uiDialogTitle); 12110 12111 this.uiDialogTitlebar.prependTo(this.uiDialog); 12112 12113 this.uiDialog.attr({ 12114 "aria-labelledby": uiDialogTitle.attr("id") 12115 }); 12116 }, 12117 12118 _title: function (title) { 12119 if (this.options.title) { 12120 title.text(this.options.title); 12121 } else { 12122 title.html(" "); 12123 } 12124 }, 12125 12126 _createButtonPane: function () { 12127 this.uiDialogButtonPane = $("<div>"); 12128 this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane", 12129 "ui-widget-content ui-helper-clearfix"); 12130 12131 this.uiButtonSet = $("<div>") 12132 .appendTo(this.uiDialogButtonPane); 12133 this._addClass(this.uiButtonSet, "ui-dialog-buttonset"); 12134 12135 this._createButtons(); 12136 }, 12137 12138 _createButtons: function () { 12139 var that = this, 12140 buttons = this.options.buttons; 12141 12142 // If we already have a button pane, remove it 12143 this.uiDialogButtonPane.remove(); 12144 this.uiButtonSet.empty(); 12145 12146 if ($.isEmptyObject(buttons) || ($.isArray(buttons) && !buttons.length)) { 12147 this._removeClass(this.uiDialog, "ui-dialog-buttons"); 12148 return; 12149 } 12150 12151 $.each(buttons, function (name, props) { 12152 var click, buttonOptions; 12153 props = $.isFunction(props) ? 12154 { click: props, text: name } : 12155 props; 12156 12157 // Default to a non-submitting button 12158 props = $.extend({ type: "button" }, props); 12159 12160 // Change the context for the click callback to be the main element 12161 click = props.click; 12162 buttonOptions = { 12163 icon: props.icon, 12164 iconPosition: props.iconPosition, 12165 showLabel: props.showLabel, 12166 12167 // Deprecated options 12168 icons: props.icons, 12169 text: props.text 12170 }; 12171 12172 delete props.click; 12173 delete props.icon; 12174 delete props.iconPosition; 12175 delete props.showLabel; 12176 12177 // Deprecated options 12178 delete props.icons; 12179 if (typeof props.text === "boolean") { 12180 delete props.text; 12181 } 12182 12183 $("<button></button>", props) 12184 .button(buttonOptions) 12185 .appendTo(that.uiButtonSet) 12186 .on("click", function () { 12187 click.apply(that.element[0], arguments); 12188 }); 12189 }); 12190 this._addClass(this.uiDialog, "ui-dialog-buttons"); 12191 this.uiDialogButtonPane.appendTo(this.uiDialog); 12192 }, 12193 12194 _makeDraggable: function () { 12195 var that = this, 12196 options = this.options; 12197 12198 function filteredUi(ui) { 12199 return { 12200 position: ui.position, 12201 offset: ui.offset 12202 }; 12203 } 12204 12205 this.uiDialog.draggable({ 12206 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12207 handle: ".ui-dialog-titlebar", 12208 containment: "document", 12209 start: function (event, ui) { 12210 that._addClass($(this), "ui-dialog-dragging"); 12211 that._blockFrames(); 12212 that._trigger("dragStart", event, filteredUi(ui)); 12213 }, 12214 drag: function (event, ui) { 12215 that._trigger("drag", event, filteredUi(ui)); 12216 }, 12217 stop: function (event, ui) { 12218 var left = ui.offset.left - that.document.scrollLeft(), 12219 top = ui.offset.top - that.document.scrollTop(); 12220 12221 options.position = { 12222 my: "left top", 12223 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12224 "top" + (top >= 0 ? "+" : "") + top, 12225 of: that.window 12226 }; 12227 that._removeClass($(this), "ui-dialog-dragging"); 12228 that._unblockFrames(); 12229 that._trigger("dragStop", event, filteredUi(ui)); 12230 } 12231 }); 12232 }, 12233 12234 _makeResizable: function () { 12235 var that = this, 12236 options = this.options, 12237 handles = options.resizable, 12238 12239 // .ui-resizable has position: relative defined in the stylesheet 12240 // but dialogs have to use absolute or fixed positioning 12241 position = this.uiDialog.css("position"), 12242 resizeHandles = typeof handles === "string" ? 12243 handles : 12244 "n,e,s,w,se,sw,ne,nw"; 12245 12246 function filteredUi(ui) { 12247 return { 12248 originalPosition: ui.originalPosition, 12249 originalSize: ui.originalSize, 12250 position: ui.position, 12251 size: ui.size 12252 }; 12253 } 12254 12255 this.uiDialog.resizable({ 12256 cancel: ".ui-dialog-content", 12257 containment: "document", 12258 alsoResize: this.element, 12259 maxWidth: options.maxWidth, 12260 maxHeight: options.maxHeight, 12261 minWidth: options.minWidth, 12262 minHeight: this._minHeight(), 12263 handles: resizeHandles, 12264 start: function (event, ui) { 12265 that._addClass($(this), "ui-dialog-resizing"); 12266 that._blockFrames(); 12267 that._trigger("resizeStart", event, filteredUi(ui)); 12268 }, 12269 resize: function (event, ui) { 12270 that._trigger("resize", event, filteredUi(ui)); 12271 }, 12272 stop: function (event, ui) { 12273 var offset = that.uiDialog.offset(), 12274 left = offset.left - that.document.scrollLeft(), 12275 top = offset.top - that.document.scrollTop(); 12276 12277 options.height = that.uiDialog.height(); 12278 options.width = that.uiDialog.width(); 12279 options.position = { 12280 my: "left top", 12281 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12282 "top" + (top >= 0 ? "+" : "") + top, 12283 of: that.window 12284 }; 12285 that._removeClass($(this), "ui-dialog-resizing"); 12286 that._unblockFrames(); 12287 that._trigger("resizeStop", event, filteredUi(ui)); 12288 } 12289 }) 12290 .css("position", position); 12291 }, 12292 12293 _trackFocus: function () { 12294 this._on(this.widget(), { 12295 focusin: function (event) { 12296 this._makeFocusTarget(); 12297 this._focusedElement = $(event.target); 12298 } 12299 }); 12300 }, 12301 12302 _makeFocusTarget: function () { 12303 this._untrackInstance(); 12304 this._trackingInstances().unshift(this); 12305 }, 12306 12307 _untrackInstance: function () { 12308 var instances = this._trackingInstances(), 12309 exists = $.inArray(this, instances); 12310 if (exists !== -1) { 12311 instances.splice(exists, 1); 12312 } 12313 }, 12314 12315 _trackingInstances: function () { 12316 var instances = this.document.data("ui-dialog-instances"); 12317 if (!instances) { 12318 instances = []; 12319 this.document.data("ui-dialog-instances", instances); 12320 } 12321 return instances; 12322 }, 12323 12324 _minHeight: function () { 12325 var options = this.options; 12326 12327 return options.height === "auto" ? 12328 options.minHeight : 12329 Math.min(options.minHeight, options.height); 12330 }, 12331 12332 _position: function () { 12333 12334 // Need to show the dialog to get the actual offset in the position plugin 12335 var isVisible = this.uiDialog.is(":visible"); 12336 if (!isVisible) { 12337 this.uiDialog.show(); 12338 } 12339 this.uiDialog.position(this.options.position); 12340 if (!isVisible) { 12341 this.uiDialog.hide(); 12342 } 12343 }, 12344 12345 _setOptions: function (options) { 12346 var that = this, 12347 resize = false, 12348 resizableOptions = {}; 12349 12350 $.each(options, function (key, value) { 12351 that._setOption(key, value); 12352 12353 if (key in that.sizeRelatedOptions) { 12354 resize = true; 12355 } 12356 if (key in that.resizableRelatedOptions) { 12357 resizableOptions[key] = value; 12358 } 12359 }); 12360 12361 if (resize) { 12362 this._size(); 12363 this._position(); 12364 } 12365 if (this.uiDialog.is(":data(ui-resizable)")) { 12366 this.uiDialog.resizable("option", resizableOptions); 12367 } 12368 }, 12369 12370 _setOption: function (key, value) { 12371 var isDraggable, isResizable, 12372 uiDialog = this.uiDialog; 12373 12374 if (key === "disabled") { 12375 return; 12376 } 12377 12378 this._super(key, value); 12379 12380 if (key === "appendTo") { 12381 this.uiDialog.appendTo(this._appendTo()); 12382 } 12383 12384 if (key === "buttons") { 12385 this._createButtons(); 12386 } 12387 12388 if (key === "closeText") { 12389 this.uiDialogTitlebarClose.button({ 12390 12391 // Ensure that we always pass a string 12392 label: $("<a>").text("" + this.options.closeText).html() 12393 }); 12394 } 12395 12396 if (key === "draggable") { 12397 isDraggable = uiDialog.is(":data(ui-draggable)"); 12398 if (isDraggable && !value) { 12399 uiDialog.draggable("destroy"); 12400 } 12401 12402 if (!isDraggable && value) { 12403 this._makeDraggable(); 12404 } 12405 } 12406 12407 if (key === "position") { 12408 this._position(); 12409 } 12410 12411 if (key === "resizable") { 12412 12413 // currently resizable, becoming non-resizable 12414 isResizable = uiDialog.is(":data(ui-resizable)"); 12415 if (isResizable && !value) { 12416 uiDialog.resizable("destroy"); 12417 } 12418 12419 // Currently resizable, changing handles 12420 if (isResizable && typeof value === "string") { 12421 uiDialog.resizable("option", "handles", value); 12422 } 12423 12424 // Currently non-resizable, becoming resizable 12425 if (!isResizable && value !== false) { 12426 this._makeResizable(); 12427 } 12428 } 12429 12430 if (key === "title") { 12431 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 12432 } 12433 }, 12434 12435 _size: function () { 12436 12437 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12438 // divs will both have width and height set, so we need to reset them 12439 var nonContentHeight, minContentHeight, maxContentHeight, 12440 options = this.options; 12441 12442 // Reset content sizing 12443 this.element.show().css({ 12444 width: "auto", 12445 minHeight: 0, 12446 maxHeight: "none", 12447 height: 0 12448 }); 12449 12450 if (options.minWidth > options.width) { 12451 options.width = options.minWidth; 12452 } 12453 12454 // Reset wrapper sizing 12455 // determine the height of all the non-content elements 12456 nonContentHeight = this.uiDialog.css({ 12457 height: "auto", 12458 width: options.width 12459 }) 12460 .outerHeight(); 12461 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 12462 maxContentHeight = typeof options.maxHeight === "number" ? 12463 Math.max(0, options.maxHeight - nonContentHeight) : 12464 "none"; 12465 12466 if (options.height === "auto") { 12467 this.element.css({ 12468 minHeight: minContentHeight, 12469 maxHeight: maxContentHeight, 12470 height: "auto" 12471 }); 12472 } else { 12473 this.element.height(Math.max(0, options.height - nonContentHeight)); 12474 } 12475 12476 if (this.uiDialog.is(":data(ui-resizable)")) { 12477 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 12478 } 12479 }, 12480 12481 _blockFrames: function () { 12482 this.iframeBlocks = this.document.find("iframe").map(function () { 12483 var iframe = $(this); 12484 12485 return $("<div>") 12486 .css({ 12487 position: "absolute", 12488 width: iframe.outerWidth(), 12489 height: iframe.outerHeight() 12490 }) 12491 .appendTo(iframe.parent()) 12492 .offset(iframe.offset())[0]; 12493 }); 12494 }, 12495 12496 _unblockFrames: function () { 12497 if (this.iframeBlocks) { 12498 this.iframeBlocks.remove(); 12499 delete this.iframeBlocks; 12500 } 12501 }, 12502 12503 _allowInteraction: function (event) { 12504 if ($(event.target).closest(".ui-dialog").length) { 12505 return true; 12506 } 12507 12508 // TODO: Remove hack when datepicker implements 12509 // the .ui-front logic (#8989) 12510 return !!$(event.target).closest(".ui-datepicker").length; 12511 }, 12512 12513 _createOverlay: function () { 12514 if (!this.options.modal) { 12515 return; 12516 } 12517 12518 // We use a delay in case the overlay is created from an 12519 // event that we're going to be cancelling (#2804) 12520 var isOpening = true; 12521 this._delay(function () { 12522 isOpening = false; 12523 }); 12524 12525 if (!this.document.data("ui-dialog-overlays")) { 12526 12527 // Prevent use of anchors and inputs 12528 // Using _on() for an event handler shared across many instances is 12529 // safe because the dialogs stack and must be closed in reverse order 12530 this._on(this.document, { 12531 focusin: function (event) { 12532 if (isOpening) { 12533 return; 12534 } 12535 12536 if (!this._allowInteraction(event)) { 12537 event.preventDefault(); 12538 this._trackingInstances()[0]._focusTabbable(); 12539 } 12540 } 12541 }); 12542 } 12543 12544 this.overlay = $("<div>") 12545 .appendTo(this._appendTo()); 12546 12547 this._addClass(this.overlay, null, "ui-widget-overlay ui-front"); 12548 this._on(this.overlay, { 12549 mousedown: "_keepFocus" 12550 }); 12551 this.document.data("ui-dialog-overlays", 12552 (this.document.data("ui-dialog-overlays") || 0) + 1); 12553 }, 12554 12555 _destroyOverlay: function () { 12556 if (!this.options.modal) { 12557 return; 12558 } 12559 12560 if (this.overlay) { 12561 var overlays = this.document.data("ui-dialog-overlays") - 1; 12562 12563 if (!overlays) { 12564 this._off(this.document, "focusin"); 12565 this.document.removeData("ui-dialog-overlays"); 12566 } else { 12567 this.document.data("ui-dialog-overlays", overlays); 12568 } 12569 12570 this.overlay.remove(); 12571 this.overlay = null; 12572 } 12573 } 12574 }); 12575 12576 // DEPRECATED 12577 // TODO: switch return back to widget declaration at top of file when this is removed 12578 if ($.uiBackCompat !== false) { 12579 12580 // Backcompat for dialogClass option 12581 $.widget("ui.dialog", $.ui.dialog, { 12582 options: { 12583 dialogClass: "" 12584 }, 12585 _createWrapper: function () { 12586 this._super(); 12587 this.uiDialog.addClass(this.options.dialogClass); 12588 }, 12589 _setOption: function (key, value) { 12590 if (key === "dialogClass") { 12591 this.uiDialog 12592 .removeClass(this.options.dialogClass) 12593 .addClass(value); 12594 } 12595 this._superApply(arguments); 12596 } 12597 }); 12598 } 12599 12600 var widgetsDialog = $.ui.dialog; 12601 12602 12603 /*! 12604 * jQuery UI Progressbar 1.12.1 12605 * http://jqueryui.com 12606 * 12607 * Copyright jQuery Foundation and other contributors 12608 * Released under the MIT license. 12609 * http://jquery.org/license 12610 */ 12611 12612 //>>label: Progressbar 12613 //>>group: Widgets 12614 // jscs:disable maximumLineLength 12615 //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 12616 // jscs:enable maximumLineLength 12617 //>>docs: http://api.jqueryui.com/progressbar/ 12618 //>>demos: http://jqueryui.com/progressbar/ 12619 //>>css.structure: ../../themes/base/core.css 12620 //>>css.structure: ../../themes/base/progressbar.css 12621 //>>css.theme: ../../themes/base/theme.css 12622 12623 12624 12625 var widgetsProgressbar = $.widget("ui.progressbar", { 12626 version: "1.12.1", 12627 options: { 12628 classes: { 12629 "ui-progressbar": "ui-corner-all", 12630 "ui-progressbar-value": "ui-corner-left", 12631 "ui-progressbar-complete": "ui-corner-right" 12632 }, 12633 max: 100, 12634 value: 0, 12635 12636 change: null, 12637 complete: null 12638 }, 12639 12640 min: 0, 12641 12642 _create: function () { 12643 12644 // Constrain initial value 12645 this.oldValue = this.options.value = this._constrainedValue(); 12646 12647 this.element.attr({ 12648 12649 // Only set static values; aria-valuenow and aria-valuemax are 12650 // set inside _refreshValue() 12651 role: "progressbar", 12652 "aria-valuemin": this.min 12653 }); 12654 this._addClass("ui-progressbar", "ui-widget ui-widget-content"); 12655 12656 this.valueDiv = $("<div>").appendTo(this.element); 12657 this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header"); 12658 this._refreshValue(); 12659 }, 12660 12661 _destroy: function () { 12662 this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"); 12663 12664 this.valueDiv.remove(); 12665 }, 12666 12667 value: function (newValue) { 12668 if (newValue === undefined) { 12669 return this.options.value; 12670 } 12671 12672 this.options.value = this._constrainedValue(newValue); 12673 this._refreshValue(); 12674 }, 12675 12676 _constrainedValue: function (newValue) { 12677 if (newValue === undefined) { 12678 newValue = this.options.value; 12679 } 12680 12681 this.indeterminate = newValue === false; 12682 12683 // Sanitize value
vendor: 5,752 bytes, lines 12684-12913
12684 if (typeof newValue !== "number") { 12685 newValue = 0; 12686 } 12687 12688 return this.indeterminate ? false : 12689 Math.min(this.options.max, Math.max(this.min, newValue)); 12690 }, 12691 12692 _setOptions: function (options) { 12693 12694 // Ensure "value" option is set after other values (like max) 12695 var value = options.value; 12696 delete options.value; 12697 12698 this._super(options); 12699 12700 this.options.value = this._constrainedValue(value); 12701 this._refreshValue(); 12702 }, 12703 12704 _setOption: function (key, value) { 12705 if (key === "max") { 12706 12707 // Don't allow a max less than min 12708 value = Math.max(this.min, value); 12709 } 12710 this._super(key, value); 12711 }, 12712 12713 _setOptionDisabled: function (value) { 12714 this._super(value); 12715 12716 this.element.attr("aria-disabled", value); 12717 this._toggleClass(null, "ui-state-disabled", !!value); 12718 }, 12719 12720 _percentage: function () { 12721 return this.indeterminate ? 12722 100 : 12723 100 * (this.options.value - this.min) / (this.options.max - this.min); 12724 }, 12725 12726 _refreshValue: function () { 12727 var value = this.options.value, 12728 percentage = this._percentage(); 12729 12730 this.valueDiv 12731 .toggle(this.indeterminate || value > this.min) 12732 .width(percentage.toFixed(0) + "%"); 12733 12734 this 12735 ._toggleClass(this.valueDiv, "ui-progressbar-complete", null, 12736 value === this.options.max) 12737 ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate); 12738 12739 if (this.indeterminate) { 12740 this.element.removeAttr("aria-valuenow"); 12741 if (!this.overlayDiv) { 12742 this.overlayDiv = $("<div>").appendTo(this.valueDiv); 12743 this._addClass(this.overlayDiv, "ui-progressbar-overlay"); 12744 } 12745 } else { 12746 this.element.attr({ 12747 "aria-valuemax": this.options.max, 12748 "aria-valuenow": value 12749 }); 12750 if (this.overlayDiv) { 12751 this.overlayDiv.remove(); 12752 this.overlayDiv = null; 12753 } 12754 } 12755 12756 if (this.oldValue !== value) { 12757 this.oldValue = value; 12758 this._trigger("change"); 12759 } 12760 if (value === this.options.max) { 12761 this._trigger("complete"); 12762 } 12763 } 12764 }); 12765 12766 12767 /*! 12768 * jQuery UI Selectmenu 1.12.1 12769 * http://jqueryui.com 12770 * 12771 * Copyright jQuery Foundation and other contributors 12772 * Released under the MIT license. 12773 * http://jquery.org/license 12774 */ 12775 12776 //>>label: Selectmenu 12777 //>>group: Widgets 12778 // jscs:disable maximumLineLength 12779 //>>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. 12780 // jscs:enable maximumLineLength 12781 //>>docs: http://api.jqueryui.com/selectmenu/ 12782 //>>demos: http://jqueryui.com/selectmenu/ 12783 //>>css.structure: ../../themes/base/core.css 12784 //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 12785 //>>css.theme: ../../themes/base/theme.css 12786 12787 12788 12789 var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, { 12790 version: "1.12.1", 12791 defaultElement: "<select>", 12792 options: { 12793 appendTo: null, 12794 classes: { 12795 "ui-selectmenu-button-open": "ui-corner-top", 12796 "ui-selectmenu-button-closed": "ui-corner-all" 12797 }, 12798 disabled: null, 12799 icons: { 12800 button: "ui-icon-triangle-1-s" 12801 }, 12802 position: { 12803 my: "left top", 12804 at: "left bottom", 12805 collision: "none" 12806 }, 12807 width: false, 12808 12809 // Callbacks 12810 change: null, 12811 close: null, 12812 focus: null, 12813 open: null, 12814 select: null 12815 }, 12816 12817 _create: function () { 12818 var selectmenuId = this.element.uniqueId().attr("id"); 12819 this.ids = { 12820 element: selectmenuId, 12821 button: selectmenuId + "-button", 12822 menu: selectmenuId + "-menu" 12823 }; 12824 12825 this._drawButton(); 12826 this._drawMenu(); 12827 this._bindFormResetHandler(); 12828 12829 this._rendered = false; 12830 this.menuItems = $(); 12831 }, 12832 12833 _drawButton: function () { 12834 var icon, 12835 that = this, 12836 item = this._parseOption( 12837 this.element.find("option:selected"), 12838 this.element[0].selectedIndex 12839 ); 12840 12841 // Associate existing label with the new button 12842 this.labels = this.element.labels().attr("for", this.ids.button); 12843 this._on(this.labels, { 12844 click: function (event) { 12845 this.button.focus(); 12846 event.preventDefault(); 12847 } 12848 }); 12849 12850 // Hide original select element 12851 this.element.hide(); 12852 12853 // Create button 12854 this.button = $("<span>", { 12855 tabindex: this.options.disabled ? -1 : 0, 12856 id: this.ids.button, 12857 role: "combobox", 12858 "aria-expanded": "false", 12859 "aria-autocomplete": "list", 12860 "aria-owns": this.ids.menu, 12861 "aria-haspopup": "true", 12862 title: this.element.attr("title") 12863 }) 12864 .insertAfter(this.element); 12865 12866 this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 12867 "ui-button ui-widget"); 12868 12869 icon = $("<span>").appendTo(this.button); 12870 this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button); 12871 this.buttonItem = this._renderButtonItem(item) 12872 .appendTo(this.button); 12873 12874 if (this.options.width !== false) { 12875 this._resizeButton(); 12876 } 12877 12878 this._on(this.button, this._buttonEvents); 12879 this.button.one("focusin", function () { 12880 12881 // Delay rendering the menu items until the button receives focus. 12882 // The menu may have already been rendered via a programmatic open. 12883 if (!that._rendered) { 12884 that._refreshMenu(); 12885 } 12886 }); 12887 }, 12888 12889 _drawMenu: function () { 12890 var that = this; 12891 12892 // Create menu 12893 this.menu = $("<ul>", { 12894 "aria-hidden": "true", 12895 "aria-labelledby": this.ids.button, 12896 id: this.ids.menu 12897 }); 12898 12899 // Wrap menu 12900 this.menuWrap = $("<div>").append(this.menu); 12901 this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front"); 12902 this.menuWrap.appendTo(this._appendTo()); 12903 12904 // Initialize menu widget 12905 this.menuInstance = this.menu 12906 .menu({ 12907 classes: { 12908 "ui-menu": "ui-corner-bottom" 12909 }, 12910 role: "listbox", 12911 select: function (event, ui) { 12912 event.preventDefault(); 12913
vendor: 6,793 bytes, lines 12914-13208
12914 // Support: IE8 12915 // If the item was selected via a click, the text selection 12916 // will be destroyed in IE 12917 that._setSelection(); 12918 12919 that._select(ui.item.data("ui-selectmenu-item"), event); 12920 }, 12921 focus: function (event, ui) { 12922 var item = ui.item.data("ui-selectmenu-item"); 12923 12924 // Prevent inital focus from firing and check if its a newly focused item 12925 if (that.focusIndex != null && item.index !== that.focusIndex) { 12926 that._trigger("focus", event, { item: item }); 12927 if (!that.isOpen) { 12928 that._select(item, event); 12929 } 12930 } 12931 that.focusIndex = item.index; 12932 12933 that.button.attr("aria-activedescendant", 12934 that.menuItems.eq(item.index).attr("id")); 12935 } 12936 }) 12937 .menu("instance"); 12938 12939 // Don't close the menu on mouseleave 12940 this.menuInstance._off(this.menu, "mouseleave"); 12941 12942 // Cancel the menu's collapseAll on document click 12943 this.menuInstance._closeOnDocumentClick = function () { 12944 return false; 12945 }; 12946 12947 // Selects often contain empty items, but never contain dividers 12948 this.menuInstance._isDivider = function () { 12949 return false; 12950 }; 12951 }, 12952 12953 refresh: function () { 12954 this._refreshMenu(); 12955 this.buttonItem.replaceWith( 12956 this.buttonItem = this._renderButtonItem( 12957 12958 // Fall back to an empty object in case there are no options 12959 this._getSelectedItem().data("ui-selectmenu-item") || {} 12960 ) 12961 ); 12962 if (this.options.width === null) { 12963 this._resizeButton(); 12964 } 12965 }, 12966 12967 _refreshMenu: function () { 12968 var item, 12969 options = this.element.find("option"); 12970 12971 this.menu.empty(); 12972 12973 this._parseOptions(options); 12974 this._renderMenu(this.menu, this.items); 12975 12976 this.menuInstance.refresh(); 12977 this.menuItems = this.menu.find("li") 12978 .not(".ui-selectmenu-optgroup") 12979 .find(".ui-menu-item-wrapper"); 12980 12981 this._rendered = true; 12982 12983 if (!options.length) { 12984 return; 12985 } 12986 12987 item = this._getSelectedItem(); 12988 12989 // Update the menu to have the correct item focused 12990 this.menuInstance.focus(null, item); 12991 this._setAria(item.data("ui-selectmenu-item")); 12992 12993 // Set disabled state 12994 this._setOption("disabled", this.element.prop("disabled")); 12995 }, 12996 12997 open: function (event) { 12998 if (this.options.disabled) { 12999 return; 13000 } 13001 13002 // If this is the first time the menu is being opened, render the items 13003 if (!this._rendered) { 13004 this._refreshMenu(); 13005 } else { 13006 13007 // Menu clears focus on close, reset focus to selected item 13008 this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active"); 13009 this.menuInstance.focus(null, this._getSelectedItem()); 13010 } 13011 13012 // If there are no options, don't open the menu 13013 if (!this.menuItems.length) { 13014 return; 13015 } 13016 13017 this.isOpen = true; 13018 this._toggleAttr(); 13019 this._resizeMenu(); 13020 this._position(); 13021 13022 this._on(this.document, this._documentClick); 13023 13024 this._trigger("open", event); 13025 }, 13026 13027 _position: function () { 13028 this.menuWrap.position($.extend({ of: this.button }, this.options.position)); 13029 }, 13030 13031 close: function (event) { 13032 if (!this.isOpen) { 13033 return; 13034 } 13035 13036 this.isOpen = false; 13037 this._toggleAttr(); 13038 13039 this.range = null; 13040 this._off(this.document); 13041 13042 this._trigger("close", event); 13043 }, 13044 13045 widget: function () { 13046 return this.button; 13047 }, 13048 13049 menuWidget: function () { 13050 return this.menu; 13051 }, 13052 13053 _renderButtonItem: function (item) { 13054 var buttonItem = $("<span>"); 13055 13056 this._setText(buttonItem, item.label); 13057 this._addClass(buttonItem, "ui-selectmenu-text"); 13058 13059 return buttonItem; 13060 }, 13061 13062 _renderMenu: function (ul, items) { 13063 var that = this, 13064 currentOptgroup = ""; 13065 13066 $.each(items, function (index, item) { 13067 var li; 13068 13069 if (item.optgroup !== currentOptgroup) { 13070 li = $("<li>", { 13071 text: item.optgroup 13072 }); 13073 that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" + 13074 (item.element.parent("optgroup").prop("disabled") ? 13075 " ui-state-disabled" : 13076 "")); 13077 13078 li.appendTo(ul); 13079 13080 currentOptgroup = item.optgroup; 13081 } 13082 13083 that._renderItemData(ul, item); 13084 }); 13085 }, 13086 13087 _renderItemData: function (ul, item) { 13088 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 13089 }, 13090 13091 _renderItem: function (ul, item) { 13092 var li = $("<li>"), 13093 wrapper = $("<div>", { 13094 title: item.element.attr("title") 13095 }); 13096 13097 if (item.disabled) { 13098 this._addClass(li, null, "ui-state-disabled"); 13099 } 13100 this._setText(wrapper, item.label); 13101 13102 return li.append(wrapper).appendTo(ul); 13103 }, 13104 13105 _setText: function (element, value) { 13106 if (value) { 13107 element.text(value); 13108 } else { 13109 element.html(" "); 13110 } 13111 }, 13112 13113 _move: function (direction, event) { 13114 var item, next, 13115 filter = ".ui-menu-item"; 13116 13117 if (this.isOpen) { 13118 item = this.menuItems.eq(this.focusIndex).parent("li"); 13119 } else { 13120 item = this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13121 filter += ":not(.ui-state-disabled)"; 13122 } 13123 13124 if (direction === "first" || direction === "last") { 13125 next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 13126 } else { 13127 next = item[direction + "All"](filter).eq(0); 13128 } 13129 13130 if (next.length) { 13131 this.menuInstance.focus(event, next); 13132 } 13133 }, 13134 13135 _getSelectedItem: function () { 13136 return this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13137 }, 13138 13139 _toggle: function (event) { 13140 this[this.isOpen ? "close" : "open"](event); 13141 }, 13142 13143 _setSelection: function () { 13144 var selection; 13145 13146 if (!this.range) { 13147 return; 13148 } 13149 13150 if (window.getSelection) { 13151 selection = window.getSelection(); 13152 selection.removeAllRanges(); 13153 selection.addRange(this.range); 13154 13155 // Support: IE8 13156 } else { 13157 this.range.select(); 13158 } 13159 13160 // Support: IE 13161 // Setting the text selection kills the button focus in IE, but 13162 // restoring the focus doesn't kill the selection. 13163 this.button.focus(); 13164 }, 13165 13166 _documentClick: { 13167 mousedown: function (event) { 13168 if (!this.isOpen) { 13169 return; 13170 } 13171 13172 if (!$(event.target).closest(".ui-selectmenu-menu, #" + 13173 $.ui.escapeSelector(this.ids.button)).length) { 13174 this.close(event); 13175 } 13176 } 13177 }, 13178 13179 _buttonEvents: { 13180 13181 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 13182 mousedown: function () { 13183 var selection; 13184 13185 if (window.getSelection) { 13186 selection = window.getSelection(); 13187 if (selection.rangeCount) { 13188 this.range = selection.getRangeAt(0); 13189 } 13190 13191 // Support: IE8 13192 } else { 13193 this.range = document.selection.createRange(); 13194 } 13195 }, 13196 13197 click: function (event) { 13198 this._setSelection(); 13199 this._toggle(event); 13200 }, 13201 13202 keydown: function (event) { 13203 var preventDefault = true; 13204 switch (event.keyCode) { 13205 case $.ui.keyCode.TAB: 13206 case $.ui.keyCode.ESCAPE: 13207 this.close(event); 13208 preventDefault = false;
vendor: 4,333 bytes, lines 13209-13384
13209 break; 13210 case $.ui.keyCode.ENTER: 13211 if (this.isOpen) { 13212 this._selectFocusedItem(event); 13213 } 13214 break; 13215 case $.ui.keyCode.UP: 13216 if (event.altKey) { 13217 this._toggle(event); 13218 } else { 13219 this._move("prev", event); 13220 } 13221 break; 13222 case $.ui.keyCode.DOWN: 13223 if (event.altKey) { 13224 this._toggle(event); 13225 } else { 13226 this._move("next", event); 13227 } 13228 break; 13229 case $.ui.keyCode.SPACE: 13230 if (this.isOpen) { 13231 this._selectFocusedItem(event); 13232 } else { 13233 this._toggle(event); 13234 } 13235 break; 13236 case $.ui.keyCode.LEFT: 13237 this._move("prev", event); 13238 break; 13239 case $.ui.keyCode.RIGHT: 13240 this._move("next", event); 13241 break; 13242 case $.ui.keyCode.HOME: 13243 case $.ui.keyCode.PAGE_UP: 13244 this._move("first", event); 13245 break; 13246 case $.ui.keyCode.END: 13247 case $.ui.keyCode.PAGE_DOWN: 13248 this._move("last", event); 13249 break; 13250 default: 13251 this.menu.trigger(event); 13252 preventDefault = false; 13253 } 13254 13255 if (preventDefault) { 13256 event.preventDefault(); 13257 } 13258 } 13259 }, 13260 13261 _selectFocusedItem: function (event) { 13262 var item = this.menuItems.eq(this.focusIndex).parent("li"); 13263 if (!item.hasClass("ui-state-disabled")) { 13264 this._select(item.data("ui-selectmenu-item"), event); 13265 } 13266 }, 13267 13268 _select: function (item, event) { 13269 var oldIndex = this.element[0].selectedIndex; 13270 13271 // Change native select element 13272 this.element[0].selectedIndex = item.index; 13273 this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item)); 13274 this._setAria(item); 13275 this._trigger("select", event, { item: item }); 13276 13277 if (item.index !== oldIndex) { 13278 this._trigger("change", event, { item: item }); 13279 } 13280 13281 this.close(event); 13282 }, 13283 13284 _setAria: function (item) { 13285 var id = this.menuItems.eq(item.index).attr("id"); 13286 13287 this.button.attr({ 13288 "aria-labelledby": id, 13289 "aria-activedescendant": id 13290 }); 13291 this.menu.attr("aria-activedescendant", id); 13292 }, 13293 13294 _setOption: function (key, value) { 13295 if (key === "icons") { 13296 var icon = this.button.find("span.ui-icon"); 13297 this._removeClass(icon, null, this.options.icons.button) 13298 ._addClass(icon, null, value.button); 13299 } 13300 13301 this._super(key, value); 13302 13303 if (key === "appendTo") { 13304 this.menuWrap.appendTo(this._appendTo()); 13305 } 13306 13307 if (key === "width") { 13308 this._resizeButton(); 13309 } 13310 }, 13311 13312 _setOptionDisabled: function (value) { 13313 this._super(value); 13314 13315 this.menuInstance.option("disabled", value); 13316 this.button.attr("aria-disabled", value); 13317 this._toggleClass(this.button, null, "ui-state-disabled", value); 13318 13319 this.element.prop("disabled", value); 13320 if (value) { 13321 this.button.attr("tabindex", -1); 13322 this.close(); 13323 } else { 13324 this.button.attr("tabindex", 0); 13325 } 13326 }, 13327 13328 _appendTo: function () { 13329 var element = this.options.appendTo; 13330 13331 if (element) { 13332 element = element.jquery || element.nodeType ? 13333 $(element) : 13334 this.document.find(element).eq(0); 13335 } 13336 13337 if (!element || !element[0]) { 13338 element = this.element.closest(".ui-front, dialog"); 13339 } 13340 13341 if (!element.length) { 13342 element = this.document[0].body; 13343 } 13344 13345 return element; 13346 }, 13347 13348 _toggleAttr: function () { 13349 this.button.attr("aria-expanded", this.isOpen); 13350 13351 // We can't use two _toggleClass() calls here, because we need to make sure 13352 // we always remove classes first and add them second, otherwise if both classes have the 13353 // same theme class, it will be removed after we add it. 13354 this._removeClass(this.button, "ui-selectmenu-button-" + 13355 (this.isOpen ? "closed" : "open")) 13356 ._addClass(this.button, "ui-selectmenu-button-" + 13357 (this.isOpen ? "open" : "closed")) 13358 ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen); 13359 13360 this.menu.attr("aria-hidden", !this.isOpen); 13361 }, 13362 13363 _resizeButton: function () { 13364 var width = this.options.width; 13365 13366 // For `width: false`, just remove inline style and stop 13367 if (width === false) { 13368 this.button.css("width", ""); 13369 return; 13370 } 13371 13372 // For `width: null`, match the width of the original element 13373 if (width === null) { 13374 width = this.element.show().outerWidth(); 13375 this.element.hide(); 13376 } 13377 13378 this.button.outerWidth(width); 13379 }, 13380 13381 _resizeMenu: function () { 13382 this.menu.outerWidth(Math.max( 13383 this.button.outerWidth(), 13384
vendor: 5,243 bytes, lines 13385-13598
13385 // Support: IE10 13386 // IE10 wraps long text (possibly a rounding bug) 13387 // so we add 1px to avoid the wrapping 13388 this.menu.width("").outerWidth() + 1 13389 )); 13390 }, 13391 13392 _getCreateOptions: function () { 13393 var options = this._super(); 13394 13395 options.disabled = this.element.prop("disabled"); 13396 13397 return options; 13398 }, 13399 13400 _parseOptions: function (options) { 13401 var that = this, 13402 data = []; 13403 options.each(function (index, item) { 13404 data.push(that._parseOption($(item), index)); 13405 }); 13406 this.items = data; 13407 }, 13408 13409 _parseOption: function (option, index) { 13410 var optgroup = option.parent("optgroup"); 13411 13412 return { 13413 element: option, 13414 index: index, 13415 value: option.val(), 13416 label: option.text(), 13417 optgroup: optgroup.attr("label") || "", 13418 disabled: optgroup.prop("disabled") || option.prop("disabled") 13419 }; 13420 }, 13421 13422 _destroy: function () { 13423 this._unbindFormResetHandler(); 13424 this.menuWrap.remove(); 13425 this.button.remove(); 13426 this.element.show(); 13427 this.element.removeUniqueId(); 13428 this.labels.attr("for", this.ids.element); 13429 } 13430 }]); 13431 13432 13433 /*! 13434 * jQuery UI Slider 1.12.1 13435 * http://jqueryui.com 13436 * 13437 * Copyright jQuery Foundation and other contributors 13438 * Released under the MIT license. 13439 * http://jquery.org/license 13440 */ 13441 13442 //>>label: Slider 13443 //>>group: Widgets 13444 //>>description: Displays a flexible slider with ranges and accessibility via keyboard. 13445 //>>docs: http://api.jqueryui.com/slider/ 13446 //>>demos: http://jqueryui.com/slider/ 13447 //>>css.structure: ../../themes/base/core.css 13448 //>>css.structure: ../../themes/base/slider.css 13449 //>>css.theme: ../../themes/base/theme.css 13450 13451 13452 13453 var widgetsSlider = $.widget("ui.slider", $.ui.mouse, { 13454 version: "1.12.1", 13455 widgetEventPrefix: "slide", 13456 13457 options: { 13458 animate: false, 13459 classes: { 13460 "ui-slider": "ui-corner-all", 13461 "ui-slider-handle": "ui-corner-all", 13462 13463 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 13464 // element, but worked best visually with a variety of themes 13465 "ui-slider-range": "ui-corner-all ui-widget-header" 13466 }, 13467 distance: 0, 13468 max: 100, 13469 min: 0, 13470 orientation: "horizontal", 13471 range: false, 13472 step: 1, 13473 value: 0, 13474 values: null, 13475 13476 // Callbacks 13477 change: null, 13478 slide: null, 13479 start: null, 13480 stop: null 13481 }, 13482 13483 // Number of pages in a slider 13484 // (how many times can you page up/down to go through the whole range) 13485 numPages: 5, 13486 13487 _create: function () { 13488 this._keySliding = false; 13489 this._mouseSliding = false; 13490 this._animateOff = true; 13491 this._handleIndex = null; 13492 this._detectOrientation(); 13493 this._mouseInit(); 13494 this._calculateNewMax(); 13495 13496 this._addClass("ui-slider ui-slider-" + this.orientation, 13497 "ui-widget ui-widget-content"); 13498 13499 this._refresh(); 13500 13501 this._animateOff = false; 13502 }, 13503 13504 _refresh: function () { 13505 this._createRange(); 13506 this._createHandles(); 13507 this._setupEvents(); 13508 this._refreshValue(); 13509 }, 13510 13511 _createHandles: function () { 13512 var i, handleCount, 13513 options = this.options, 13514 existingHandles = this.element.find(".ui-slider-handle"), 13515 handle = "<span tabindex='0'></span>", 13516 handles = []; 13517 13518 handleCount = (options.values && options.values.length) || 1; 13519 13520 if (existingHandles.length > handleCount) { 13521 existingHandles.slice(handleCount).remove(); 13522 existingHandles = existingHandles.slice(0, handleCount); 13523 } 13524 13525 for (i = existingHandles.length; i < handleCount; i++) { 13526 handles.push(handle); 13527 } 13528 13529 this.handles = existingHandles.add($(handles.join("")).appendTo(this.element)); 13530 13531 this._addClass(this.handles, "ui-slider-handle", "ui-state-default"); 13532 13533 this.handle = this.handles.eq(0); 13534 13535 this.handles.each(function (i) { 13536 $(this) 13537 .data("ui-slider-handle-index", i) 13538 .attr("tabIndex", 0); 13539 }); 13540 }, 13541 13542 _createRange: function () { 13543 var options = this.options; 13544 13545 if (options.range) { 13546 if (options.range === true) { 13547 if (!options.values) { 13548 options.values = [this._valueMin(), this._valueMin()]; 13549 } else if (options.values.length && options.values.length !== 2) { 13550 options.values = [options.values[0], options.values[0]]; 13551 } else if ($.isArray(options.values)) { 13552 options.values = options.values.slice(0); 13553 } 13554 } 13555 13556 if (!this.range || !this.range.length) { 13557 this.range = $("<div>") 13558 .appendTo(this.element); 13559 13560 this._addClass(this.range, "ui-slider-range"); 13561 } else { 13562 this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max"); 13563 13564 // Handle range switching from true to min/max 13565 this.range.css({ 13566 "left": "", 13567 "bottom": "" 13568 }); 13569 } 13570 if (options.range === "min" || options.range === "max") { 13571 this._addClass(this.range, "ui-slider-range-" + options.range); 13572 } 13573 } else { 13574 if (this.range) { 13575 this.range.remove(); 13576 } 13577 this.range = null; 13578 } 13579 }, 13580 13581 _setupEvents: function () { 13582 this._off(this.handles); 13583 this._on(this.handles, this._handleEvents); 13584 this._hoverable(this.handles); 13585 this._focusable(this.handles); 13586 }, 13587 13588 _destroy: function () { 13589 this.handles.remove(); 13590 if (this.range) { 13591 this.range.remove(); 13592 } 13593 13594 this._mouseDestroy(); 13595 }, 13596 13597 _mouseCapture: function (event) { 13598 var position, normValue, distance, closestHandle, index, allowed, offset, mou
vendor: 15,010 bytes, lines 13598-14159
13598seOverHandle, 13599 that = this, 13600 o = this.options; 13601 13602 if (o.disabled) { 13603 return false; 13604 } 13605 13606 this.elementSize = { 13607 width: this.element.outerWidth(), 13608 height: this.element.outerHeight() 13609 }; 13610 this.elementOffset = this.element.offset(); 13611 13612 position = { x: event.pageX, y: event.pageY }; 13613 normValue = this._normValueFromMouse(position); 13614 distance = this._valueMax() - this._valueMin() + 1; 13615 this.handles.each(function (i) { 13616 var thisDistance = Math.abs(normValue - that.values(i)); 13617 if ((distance > thisDistance) || 13618 (distance === thisDistance && 13619 (i === that._lastChangedValue || that.values(i) === o.min))) { 13620 distance = thisDistance; 13621 closestHandle = $(this); 13622 index = i; 13623 } 13624 }); 13625 13626 allowed = this._start(event, index); 13627 if (allowed === false) { 13628 return false; 13629 } 13630 this._mouseSliding = true; 13631 13632 this._handleIndex = index; 13633 13634 this._addClass(closestHandle, null, "ui-state-active"); 13635 closestHandle.trigger("focus"); 13636 13637 offset = closestHandle.offset(); 13638 mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle"); 13639 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 13640 left: event.pageX - offset.left - (closestHandle.width() / 2), 13641 top: event.pageY - offset.top - 13642 (closestHandle.height() / 2) - 13643 (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - 13644 (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + 13645 (parseInt(closestHandle.css("marginTop"), 10) || 0) 13646 }; 13647 13648 if (!this.handles.hasClass("ui-state-hover")) { 13649 this._slide(event, index, normValue); 13650 } 13651 this._animateOff = true; 13652 return true; 13653 }, 13654 13655 _mouseStart: function () { 13656 return true; 13657 }, 13658 13659 _mouseDrag: function (event) { 13660 var position = { x: event.pageX, y: event.pageY }, 13661 normValue = this._normValueFromMouse(position); 13662 13663 this._slide(event, this._handleIndex, normValue); 13664 13665 return false; 13666 }, 13667 13668 _mouseStop: function (event) { 13669 this._removeClass(this.handles, null, "ui-state-active"); 13670 this._mouseSliding = false; 13671 13672 this._stop(event, this._handleIndex); 13673 this._change(event, this._handleIndex); 13674 13675 this._handleIndex = null; 13676 this._clickOffset = null; 13677 this._animateOff = false; 13678 13679 return false; 13680 }, 13681 13682 _detectOrientation: function () { 13683 this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal"; 13684 }, 13685 13686 _normValueFromMouse: function (position) { 13687 var pixelTotal, 13688 pixelMouse, 13689 percentMouse, 13690 valueTotal, 13691 valueMouse; 13692 13693 if (this.orientation === "horizontal") { 13694 pixelTotal = this.elementSize.width; 13695 pixelMouse = position.x - this.elementOffset.left - 13696 (this._clickOffset ? this._clickOffset.left : 0); 13697 } else { 13698 pixelTotal = this.elementSize.height; 13699 pixelMouse = position.y - this.elementOffset.top - 13700 (this._clickOffset ? this._clickOffset.top : 0); 13701 } 13702 13703 percentMouse = (pixelMouse / pixelTotal); 13704 if (percentMouse > 1) { 13705 percentMouse = 1; 13706 } 13707 if (percentMouse < 0) { 13708 percentMouse = 0; 13709 } 13710 if (this.orientation === "vertical") { 13711 percentMouse = 1 - percentMouse; 13712 } 13713 13714 valueTotal = this._valueMax() - this._valueMin(); 13715 valueMouse = this._valueMin() + percentMouse * valueTotal; 13716 13717 return this._trimAlignValue(valueMouse); 13718 }, 13719 13720 _uiHash: function (index, value, values) { 13721 var uiHash = { 13722 handle: this.handles[index], 13723 handleIndex: index, 13724 value: value !== undefined ? value : this.value() 13725 }; 13726 13727 if (this._hasMultipleValues()) { 13728 uiHash.value = value !== undefined ? value : this.values(index); 13729 uiHash.values = values || this.values(); 13730 } 13731 13732 return uiHash; 13733 }, 13734 13735 _hasMultipleValues: function () { 13736 return this.options.values && this.options.values.length; 13737 }, 13738 13739 _start: function (event, index) { 13740 return this._trigger("start", event, this._uiHash(index)); 13741 }, 13742 13743 _slide: function (event, index, newVal) { 13744 var allowed, otherVal, 13745 currentValue = this.value(), 13746 newValues = this.values(); 13747 13748 if (this._hasMultipleValues()) { 13749 otherVal = this.values(index ? 0 : 1); 13750 currentValue = this.values(index); 13751 13752 if (this.options.values.length === 2 && this.options.range === true) { 13753 newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal); 13754 } 13755 13756 newValues[index] = newVal; 13757 } 13758 13759 if (newVal === currentValue) { 13760 return; 13761 } 13762 13763 allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues)); 13764 13765 // A slide can be canceled by returning false from the slide callback 13766 if (allowed === false) { 13767 return; 13768 } 13769 13770 if (this._hasMultipleValues()) { 13771 this.values(index, newVal); 13772 } else { 13773 this.value(newVal); 13774 } 13775 }, 13776 13777 _stop: function (event, index) { 13778 this._trigger("stop", event, this._uiHash(index)); 13779 }, 13780 13781 _change: function (event, index) { 13782 if (!this._keySliding && !this._mouseSliding) { 13783 13784 //store the last changed value index for reference when handles overlap 13785 this._lastChangedValue = index; 13786 this._trigger("change", event, this._uiHash(index)); 13787 } 13788 }, 13789 13790 value: function (newValue) { 13791 if (arguments.length) { 13792 this.options.value = this._trimAlignValue(newValue); 13793 this._refreshValue(); 13794 this._change(null, 0); 13795 return; 13796 } 13797 13798 return this._value(); 13799 }, 13800 13801 values: function (index, newValue) { 13802 var vals, 13803 newValues, 13804 i; 13805 13806 if (arguments.length > 1) { 13807 this.options.values[index] = this._trimAlignValue(newValue); 13808 this._refreshValue(); 13809 this._change(null, index); 13810 return; 13811 } 13812 13813 if (arguments.length) { 13814 if ($.isArray(arguments[0])) { 13815 vals = this.options.values; 13816 newValues = arguments[0]; 13817 for (i = 0; i < vals.length; i += 1) { 13818 vals[i] = this._trimAlignValue(newValues[i]); 13819 this._change(null, i); 13820 } 13821 this._refreshValue(); 13822 } else { 13823 if (this._hasMultipleValues()) { 13824 return this._values(index); 13825 } else { 13826 return this.value(); 13827 } 13828 } 13829 } else { 13830 return this._values(); 13831 } 13832 }, 13833 13834 _setOption: function (key, value) { 13835 var i, 13836 valsLength = 0; 13837 13838 if (key === "range" && this.options.range === true) { 13839 if (value === "min") { 13840 this.options.value = this._values(0); 13841 this.options.values = null; 13842 } else if (value === "max") { 13843 this.options.value = this._values(this.options.values.length - 1); 13844 this.options.values = null; 13845 } 13846 } 13847 13848 if ($.isArray(this.options.values)) { 13849 valsLength = this.options.values.length; 13850 } 13851 13852 this._super(key, value); 13853 13854 switch (key) { 13855 case "orientation": 13856 this._detectOrientation(); 13857 this._removeClass("ui-slider-horizontal ui-slider-vertical") 13858 ._addClass("ui-slider-" + this.orientation); 13859 this._refreshValue(); 13860 if (this.options.range) { 13861 this._refreshRange(value); 13862 } 13863 13864 // Reset positioning from previous orientation 13865 this.handles.css(value === "horizontal" ? "bottom" : "left", ""); 13866 break; 13867 case "value": 13868 this._animateOff = true; 13869 this._refreshValue(); 13870 this._change(null, 0); 13871 this._animateOff = false; 13872 break; 13873 case "values": 13874 this._animateOff = true; 13875 this._refreshValue(); 13876 13877 // Start from the last handle to prevent unreachable handles (#9046) 13878 for (i = valsLength - 1; i >= 0; i--) { 13879 this._change(null, i); 13880 } 13881 this._animateOff = false; 13882 break; 13883 case "step": 13884 case "min": 13885 case "max": 13886 this._animateOff = true; 13887 this._calculateNewMax(); 13888 this._refreshValue(); 13889 this._animateOff = false; 13890 break; 13891 case "range": 13892 this._animateOff = true; 13893 this._refresh(); 13894 this._animateOff = false; 13895 break; 13896 } 13897 }, 13898 13899 _setOptionDisabled: function (value) { 13900 this._super(value); 13901 13902 this._toggleClass(null, "ui-state-disabled", !!value); 13903 }, 13904 13905 //internal value getter 13906 // _value() returns value trimmed by min and max, aligned by step 13907 _value: function () { 13908 var val = this.options.value; 13909 val = this._trimAlignValue(val); 13910 13911 return val; 13912 }, 13913 13914 //internal values getter 13915 // _values() returns array of values trimmed by min and max, aligned by step 13916 // _values( index ) returns single value trimmed by min and max, aligned by step 13917 _values: function (index) { 13918 var val, 13919 vals, 13920 i; 13921 13922 if (arguments.length) { 13923 val = this.options.values[index]; 13924 val = this._trimAlignValue(val); 13925 13926 return val; 13927 } else if (this._hasMultipleValues()) { 13928 13929 // .slice() creates a copy of the array 13930 // this copy gets trimmed by min and max and then returned 13931 vals = this.options.values.slice(); 13932 for (i = 0; i < vals.length; i += 1) { 13933 vals[i] = this._trimAlignValue(vals[i]); 13934 } 13935 13936 return vals; 13937 } else { 13938 return []; 13939 } 13940 }, 13941 13942 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 13943 _trimAlignValue: function (val) { 13944 if (val <= this._valueMin()) { 13945 return this._valueMin(); 13946 } 13947 if (val >= this._valueMax()) { 13948 return this._valueMax(); 13949 } 13950 var step = (this.options.step > 0) ? this.options.step : 1, 13951 valModStep = (val - this._valueMin()) % step, 13952 alignValue = val - valModStep; 13953 13954 if (Math.abs(valModStep) * 2 >= step) { 13955 alignValue += (valModStep > 0) ? step : (-step); 13956 } 13957 13958 // Since JavaScript has problems with large floats, round 13959 // the final value to 5 digits after the decimal point (see #4124) 13960 return parseFloat(alignValue.toFixed(5)); 13961 }, 13962 13963 _calculateNewMax: function () { 13964 var max = this.options.max, 13965 min = this._valueMin(), 13966 step = this.options.step, 13967 aboveMin = Math.round((max - min) / step) * step; 13968 max = aboveMin + min; 13969 if (max > this.options.max) { 13970 13971 //If max is not divisible by step, rounding off may increase its value 13972 max -= step; 13973 } 13974 this.max = parseFloat(max.toFixed(this._precision())); 13975 }, 13976 13977 _precision: function () { 13978 var precision = this._precisionOf(this.options.step); 13979 if (this.options.min !== null) { 13980 precision = Math.max(precision, this._precisionOf(this.options.min)); 13981 } 13982 return precision; 13983 }, 13984 13985 _precisionOf: function (num) { 13986 var str = num.toString(), 13987 decimal = str.indexOf("."); 13988 return decimal === -1 ? 0 : str.length - decimal - 1; 13989 }, 13990 13991 _valueMin: function () { 13992 return this.options.min; 13993 }, 13994 13995 _valueMax: function () { 13996 return this.max; 13997 }, 13998 13999 _refreshRange: function (orientation) { 14000 if (orientation === "vertical") { 14001 this.range.css({ "width": "", "left": "" }); 14002 } 14003 if (orientation === "horizontal") { 14004 this.range.css({ "height": "", "bottom": "" }); 14005 } 14006 }, 14007 14008 _refreshValue: function () { 14009 var lastValPercent, valPercent, value, valueMin, valueMax, 14010 oRange = this.options.range, 14011 o = this.options, 14012 that = this, 14013 animate = (!this._animateOff) ? o.animate : false, 14014 _set = {}; 14015 14016 if (this._hasMultipleValues()) { 14017 this.handles.each(function (i) { 14018 valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - 14019 that._valueMin()) * 100; 14020 _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 14021 $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 14022 if (that.options.range === true) { 14023 if (that.orientation === "horizontal") { 14024 if (i === 0) { 14025 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 14026 left: valPercent + "%" 14027 }, o.animate); 14028 } 14029 if (i === 1) { 14030 that.range[animate ? "animate" : "css"]({ 14031 width: (valPercent - lastValPercent) + "%" 14032 }, { 14033 queue: false, 14034 duration: o.animate 14035 }); 14036 } 14037 } else { 14038 if (i === 0) { 14039 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 14040 bottom: (valPercent) + "%" 14041 }, o.animate); 14042 } 14043 if (i === 1) { 14044 that.range[animate ? "animate" : "css"]({ 14045 height: (valPercent - lastValPercent) + "%" 14046 }, { 14047 queue: false, 14048 duration: o.animate 14049 }); 14050 } 14051 } 14052 } 14053 lastValPercent = valPercent; 14054 }); 14055 } else { 14056 value = this.value(); 14057 valueMin = this._valueMin(); 14058 valueMax = this._valueMax(); 14059 valPercent = (valueMax !== valueMin) ? 14060 (value - valueMin) / (valueMax - valueMin) * 100 : 14061 0; 14062 _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 14063 this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 14064 14065 if (oRange === "min" && this.orientation === "horizontal") { 14066 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14067 width: valPercent + "%" 14068 }, o.animate); 14069 } 14070 if (oRange === "max" && this.orientation === "horizontal") { 14071 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14072 width: (100 - valPercent) + "%" 14073 }, o.animate); 14074 } 14075 if (oRange === "min" && this.orientation === "vertical") { 14076 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14077 height: valPercent + "%" 14078 }, o.animate); 14079 } 14080 if (oRange === "max" && this.orientation === "vertical") { 14081 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14082 height: (100 - valPercent) + "%" 14083 }, o.animate); 14084 } 14085 } 14086 }, 14087 14088 _handleEvents: { 14089 keydown: function (event) { 14090 var allowed, curVal, newVal, step, 14091 index = $(event.target).data("ui-slider-handle-index"); 14092 14093 switch (event.keyCode) { 14094 case $.ui.keyCode.HOME: 14095 case $.ui.keyCode.END: 14096 case $.ui.keyCode.PAGE_UP: 14097 case $.ui.keyCode.PAGE_DOWN: 14098 case $.ui.keyCode.UP: 14099 case $.ui.keyCode.RIGHT: 14100 case $.ui.keyCode.DOWN: 14101 case $.ui.keyCode.LEFT: 14102 event.preventDefault(); 14103 if (!this._keySliding) { 14104 this._keySliding = true; 14105 this._addClass($(event.target), null, "ui-state-active"); 14106 allowed = this._start(event, index); 14107 if (allowed === false) { 14108 return; 14109 } 14110 } 14111 break; 14112 } 14113 14114 step = this.options.step; 14115 if (this._hasMultipleValues()) { 14116 curVal = newVal = this.values(index); 14117 } else { 14118 curVal = newVal = this.value(); 14119 } 14120 14121 switch (event.keyCode) { 14122 case $.ui.keyCode.HOME: 14123 newVal = this._valueMin(); 14124 break; 14125 case $.ui.keyCode.END: 14126 newVal = this._valueMax(); 14127 break; 14128 case $.ui.keyCode.PAGE_UP: 14129 newVal = this._trimAlignValue( 14130 curVal + ((this._valueMax() - this._valueMin()) / this.numPages) 14131 ); 14132 break; 14133 case $.ui.keyCode.PAGE_DOWN: 14134 newVal = this._trimAlignValue( 14135 curVal - ((this._valueMax() - this._valueMin()) / this.numPages)); 14136 break; 14137 case $.ui.keyCode.UP: 14138 case $.ui.keyCode.RIGHT: 14139 if (curVal === this._valueMax()) { 14140 return; 14141 } 14142 newVal = this._trimAlignValue(curVal + step); 14143 break; 14144 case $.ui.keyCode.DOWN: 14145 case $.ui.keyCode.LEFT: 14146 if (curVal === this._valueMin()) { 14147 return; 14148 } 14149 newVal = this._trimAlignValue(curVal - step); 14150 break; 14151 } 14152 14153 this._slide(event, index, newVal); 14154 }, 14155 keyup: function (event) { 14156 var index = $(event.target).data("ui-slider-handle-index"); 14157 14158 if (this._keySliding) { 14159 this._keySliding = false;
vendor: 9,099 bytes, lines 14160-14515
14160 this._stop(event, index); 14161 this._change(event, index); 14162 this._removeClass($(event.target), null, "ui-state-active"); 14163 } 14164 } 14165 } 14166 }); 14167 14168 14169 /*! 14170 * jQuery UI Spinner 1.12.1 14171 * http://jqueryui.com 14172 * 14173 * Copyright jQuery Foundation and other contributors 14174 * Released under the MIT license. 14175 * http://jquery.org/license 14176 */ 14177 14178 //>>label: Spinner 14179 //>>group: Widgets 14180 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. 14181 //>>docs: http://api.jqueryui.com/spinner/ 14182 //>>demos: http://jqueryui.com/spinner/ 14183 //>>css.structure: ../../themes/base/core.css 14184 //>>css.structure: ../../themes/base/spinner.css 14185 //>>css.theme: ../../themes/base/theme.css 14186 14187 14188 14189 function spinnerModifer(fn) { 14190 return function () { 14191 var previous = this.element.val(); 14192 fn.apply(this, arguments); 14193 this._refresh(); 14194 if (previous !== this.element.val()) { 14195 this._trigger("change"); 14196 } 14197 }; 14198 } 14199 14200 $.widget("ui.spinner", { 14201 version: "1.12.1", 14202 defaultElement: "<input>", 14203 widgetEventPrefix: "spin", 14204 options: { 14205 classes: { 14206 "ui-spinner": "ui-corner-all", 14207 "ui-spinner-down": "ui-corner-br", 14208 "ui-spinner-up": "ui-corner-tr" 14209 }, 14210 culture: null, 14211 icons: { 14212 down: "ui-icon-triangle-1-s", 14213 up: "ui-icon-triangle-1-n" 14214 }, 14215 incremental: true, 14216 max: null, 14217 min: null, 14218 numberFormat: null, 14219 page: 10, 14220 step: 1, 14221 14222 change: null, 14223 spin: null, 14224 start: null, 14225 stop: null 14226 }, 14227 14228 _create: function () { 14229 14230 // handle string values that need to be parsed 14231 this._setOption("max", this.options.max); 14232 this._setOption("min", this.options.min); 14233 this._setOption("step", this.options.step); 14234 14235 // Only format if there is a value, prevents the field from being marked 14236 // as invalid in Firefox, see #9573. 14237 if (this.value() !== "") { 14238 14239 // Format the value, but don't constrain. 14240 this._value(this.element.val(), true); 14241 } 14242 14243 this._draw(); 14244 this._on(this._events); 14245 this._refresh(); 14246 14247 // Turning off autocomplete prevents the browser from remembering the 14248 // value when navigating through history, so we re-enable autocomplete 14249 // if the page is unloaded before the widget is destroyed. #7790 14250 this._on(this.window, { 14251 beforeunload: function () { 14252 this.element.removeAttr("autocomplete"); 14253 } 14254 }); 14255 }, 14256 14257 _getCreateOptions: function () { 14258 var options = this._super(); 14259 var element = this.element; 14260 14261 $.each(["min", "max", "step"], function (i, option) { 14262 var value = element.attr(option); 14263 if (value != null && value.length) { 14264 options[option] = value; 14265 } 14266 }); 14267 14268 return options; 14269 }, 14270 14271 _events: { 14272 keydown: function (event) { 14273 if (this._start(event) && this._keydown(event)) { 14274 event.preventDefault(); 14275 } 14276 }, 14277 keyup: "_stop", 14278 focus: function () { 14279 this.previous = this.element.val(); 14280 }, 14281 blur: function (event) { 14282 if (this.cancelBlur) { 14283 delete this.cancelBlur; 14284 return; 14285 } 14286 14287 this._stop(); 14288 this._refresh(); 14289 if (this.previous !== this.element.val()) { 14290 this._trigger("change", event); 14291 } 14292 }, 14293 mousewheel: function (event, delta) { 14294 if (!delta) { 14295 return; 14296 } 14297 if (!this.spinning && !this._start(event)) { 14298 return false; 14299 } 14300 14301 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 14302 clearTimeout(this.mousewheelTimer); 14303 this.mousewheelTimer = this._delay(function () { 14304 if (this.spinning) { 14305 this._stop(event); 14306 } 14307 }, 100); 14308 event.preventDefault(); 14309 }, 14310 "mousedown .ui-spinner-button": function (event) { 14311 var previous; 14312 14313 // We never want the buttons to have focus; whenever the user is 14314 // interacting with the spinner, the focus should be on the input. 14315 // If the input is focused then this.previous is properly set from 14316 // when the input first received focus. If the input is not focused 14317 // then we need to set this.previous based on the value before spinning. 14318 previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ? 14319 this.previous : this.element.val(); 14320 function checkFocus() { 14321 var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]); 14322 if (!isActive) { 14323 this.element.trigger("focus"); 14324 this.previous = previous; 14325 14326 // support: IE 14327 // IE sets focus asynchronously, so we need to check if focus 14328 // moved off of the input because the user clicked on the button. 14329 this._delay(function () { 14330 this.previous = previous; 14331 }); 14332 } 14333 } 14334 14335 // Ensure focus is on (or stays on) the text field 14336 event.preventDefault(); 14337 checkFocus.call(this); 14338 14339 // Support: IE 14340 // IE doesn't prevent moving focus even with event.preventDefault() 14341 // so we set a flag to know when we should ignore the blur event 14342 // and check (again) if focus moved off of the input. 14343 this.cancelBlur = true; 14344 this._delay(function () { 14345 delete this.cancelBlur; 14346 checkFocus.call(this); 14347 }); 14348 14349 if (this._start(event) === false) { 14350 return; 14351 } 14352 14353 this._repeat(null, $(event.currentTarget) 14354 .hasClass("ui-spinner-up") ? 1 : -1, event); 14355 }, 14356 "mouseup .ui-spinner-button": "_stop", 14357 "mouseenter .ui-spinner-button": function (event) { 14358 14359 // button will add ui-state-active if mouse was down while mouseleave and kept down 14360 if (!$(event.currentTarget).hasClass("ui-state-active")) { 14361 return; 14362 } 14363 14364 if (this._start(event) === false) { 14365 return false; 14366 } 14367 this._repeat(null, $(event.currentTarget) 14368 .hasClass("ui-spinner-up") ? 1 : -1, event); 14369 }, 14370 14371 // TODO: do we really want to consider this a stop? 14372 // shouldn't we just stop the repeater and wait until mouseup before 14373 // we trigger the stop event? 14374 "mouseleave .ui-spinner-button": "_stop" 14375 }, 14376 14377 // Support mobile enhanced option and make backcompat more sane 14378 _enhance: function () { 14379 this.uiSpinner = this.element 14380 .attr("autocomplete", "off") 14381 .wrap("<span>") 14382 .parent() 14383 14384 // Add buttons 14385 .append( 14386 "<a></a><a></a>" 14387 ); 14388 }, 14389 14390 _draw: function () { 14391 this._enhance(); 14392 14393 this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content"); 14394 this._addClass("ui-spinner-input"); 14395 14396 this.element.attr("role", "spinbutton"); 14397 14398 // Button bindings 14399 this.buttons = this.uiSpinner.children("a") 14400 .attr("tabIndex", -1) 14401 .attr("aria-hidden", true) 14402 .button({ 14403 classes: { 14404 "ui-button": "" 14405 } 14406 }); 14407 14408 // TODO: Right now button does not support classes this is already updated in button PR 14409 this._removeClass(this.buttons, "ui-corner-all"); 14410 14411 this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"); 14412 this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"); 14413 this.buttons.first().button({ 14414 "icon": this.options.icons.up, 14415 "showLabel": false 14416 }); 14417 this.buttons.last().button({ 14418 "icon": this.options.icons.down, 14419 "showLabel": false 14420 }); 14421 14422 // IE 6 doesn't understand height: 50% for the buttons 14423 // unless the wrapper has an explicit height 14424 if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && 14425 this.uiSpinner.height() > 0) { 14426 this.uiSpinner.height(this.uiSpinner.height()); 14427 } 14428 }, 14429 14430 _keydown: function (event) { 14431 var options = this.options, 14432 keyCode = $.ui.keyCode; 14433 14434 switch (event.keyCode) { 14435 case keyCode.UP: 14436 this._repeat(null, 1, event); 14437 return true; 14438 case keyCode.DOWN: 14439 this._repeat(null, -1, event); 14440 return true; 14441 case keyCode.PAGE_UP: 14442 this._repeat(null, options.page, event); 14443 return true; 14444 case keyCode.PAGE_DOWN: 14445 this._repeat(null, -options.page, event); 14446 return true; 14447 } 14448 14449 return false; 14450 }, 14451 14452 _start: function (event) { 14453 if (!this.spinning && this._trigger("start", event) === false) { 14454 return false; 14455 } 14456 14457 if (!this.counter) { 14458 this.counter = 1; 14459 } 14460 this.spinning = true; 14461 return true; 14462 }, 14463 14464 _repeat: function (i, steps, event) { 14465 i = i || 500; 14466 14467 clearTimeout(this.timer); 14468 this.timer = this._delay(function () { 14469 this._repeat(40, steps, event); 14470 }, i); 14471 14472 this._spin(steps * this.options.step, event); 14473 }, 14474 14475 _spin: function (step, event) { 14476 var value = this.value() || 0; 14477 14478 if (!this.counter) { 14479 this.counter = 1; 14480 } 14481 14482 value = this._adjustValue(value + step * this._increment(this.counter)); 14483 14484 if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) { 14485 this._value(value); 14486 this.counter++; 14487 } 14488 }, 14489 14490 _increment: function (i) { 14491 var incremental = this.options.incremental; 14492 14493 if (incremental) { 14494 return $.isFunction(incremental) ? 14495 incremental(i) : 14496 Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1); 14497 } 14498 14499 return 1; 14500 }, 14501 14502 _precision: function () { 14503 var precision = this._precisionOf(this.options.step); 14504 if (this.options.min !== null) { 14505 precision = Math.max(precision, this._precisionOf(this.options.min)); 14506 } 14507 return precision; 14508 }, 14509 14510 _precisionOf: function (num) { 14511 var str = num.toString(), 14512 decimal = str.indexOf("."); 14513 return decimal === -1 ? 0 : str.length - decimal - 1; 14514 }, 14515
vendor: 12,584 bytes, lines 14516-15021
14516 _adjustValue: function (value) { 14517 var base, aboveMin, 14518 options = this.options; 14519 14520 // Make sure we're at a valid step 14521 // - find out where we are relative to the base (min or 0) 14522 base = options.min !== null ? options.min : 0; 14523 aboveMin = value - base; 14524 14525 // - round to the nearest step 14526 aboveMin = Math.round(aboveMin / options.step) * options.step; 14527 14528 // - rounding is based on 0, so adjust back to our base 14529 value = base + aboveMin; 14530 14531 // Fix precision from bad JS floating point math 14532 value = parseFloat(value.toFixed(this._precision())); 14533 14534 // Clamp the value 14535 if (options.max !== null && value > options.max) { 14536 return options.max; 14537 } 14538 if (options.min !== null && value < options.min) { 14539 return options.min; 14540 } 14541 14542 return value; 14543 }, 14544 14545 _stop: function (event) { 14546 if (!this.spinning) { 14547 return; 14548 } 14549 14550 clearTimeout(this.timer); 14551 clearTimeout(this.mousewheelTimer); 14552 this.counter = 0; 14553 this.spinning = false; 14554 this._trigger("stop", event); 14555 }, 14556 14557 _setOption: function (key, value) { 14558 var prevValue, first, last; 14559 14560 if (key === "culture" || key === "numberFormat") { 14561 prevValue = this._parse(this.element.val()); 14562 this.options[key] = value; 14563 this.element.val(this._format(prevValue)); 14564 return; 14565 } 14566 14567 if (key === "max" || key === "min" || key === "step") { 14568 if (typeof value === "string") { 14569 value = this._parse(value); 14570 } 14571 } 14572 if (key === "icons") { 14573 first = this.buttons.first().find(".ui-icon"); 14574 this._removeClass(first, null, this.options.icons.up); 14575 this._addClass(first, null, value.up); 14576 last = this.buttons.last().find(".ui-icon"); 14577 this._removeClass(last, null, this.options.icons.down); 14578 this._addClass(last, null, value.down); 14579 } 14580 14581 this._super(key, value); 14582 }, 14583 14584 _setOptionDisabled: function (value) { 14585 this._super(value); 14586 14587 this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value); 14588 this.element.prop("disabled", !!value); 14589 this.buttons.button(value ? "disable" : "enable"); 14590 }, 14591 14592 _setOptions: spinnerModifer(function (options) { 14593 this._super(options); 14594 }), 14595 14596 _parse: function (val) { 14597 if (typeof val === "string" && val !== "") { 14598 val = window.Globalize && this.options.numberFormat ? 14599 Globalize.parseFloat(val, 10, this.options.culture) : +val; 14600 } 14601 return val === "" || isNaN(val) ? null : val; 14602 }, 14603 14604 _format: function (value) { 14605 if (value === "") { 14606 return ""; 14607 } 14608 return window.Globalize && this.options.numberFormat ? 14609 Globalize.format(value, this.options.numberFormat, this.options.culture) : 14610 value; 14611 }, 14612 14613 _refresh: function () { 14614 this.element.attr({ 14615 "aria-valuemin": this.options.min, 14616 "aria-valuemax": this.options.max, 14617 14618 // TODO: what should we do with values that can't be parsed? 14619 "aria-valuenow": this._parse(this.element.val()) 14620 }); 14621 }, 14622 14623 isValid: function () { 14624 var value = this.value(); 14625 14626 // Null is invalid 14627 if (value === null) { 14628 return false; 14629 } 14630 14631 // If value gets adjusted, it's invalid 14632 return value === this._adjustValue(value); 14633 }, 14634 14635 // Update the value without triggering change 14636 _value: function (value, allowAny) { 14637 var parsed; 14638 if (value !== "") { 14639 parsed = this._parse(value); 14640 if (parsed !== null) { 14641 if (!allowAny) { 14642 parsed = this._adjustValue(parsed); 14643 } 14644 value = this._format(parsed); 14645 } 14646 } 14647 this.element.val(value); 14648 this._refresh(); 14649 }, 14650 14651 _destroy: function () { 14652 this.element 14653 .prop("disabled", false) 14654 .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"); 14655 14656 this.uiSpinner.replaceWith(this.element); 14657 }, 14658 14659 stepUp: spinnerModifer(function (steps) { 14660 this._stepUp(steps); 14661 }), 14662 _stepUp: function (steps) { 14663 if (this._start()) { 14664 this._spin((steps || 1) * this.options.step); 14665 this._stop(); 14666 } 14667 }, 14668 14669 stepDown: spinnerModifer(function (steps) { 14670 this._stepDown(steps); 14671 }), 14672 _stepDown: function (steps) { 14673 if (this._start()) { 14674 this._spin((steps || 1) * -this.options.step); 14675 this._stop(); 14676 } 14677 }, 14678 14679 pageUp: spinnerModifer(function (pages) { 14680 this._stepUp((pages || 1) * this.options.page); 14681 }), 14682 14683 pageDown: spinnerModifer(function (pages) { 14684 this._stepDown((pages || 1) * this.options.page); 14685 }), 14686 14687 value: function (newVal) { 14688 if (!arguments.length) { 14689 return this._parse(this.element.val()); 14690 } 14691 spinnerModifer(this._value).call(this, newVal); 14692 }, 14693 14694 widget: function () { 14695 return this.uiSpinner; 14696 } 14697 }); 14698 14699 // DEPRECATED 14700 // TODO: switch return back to widget declaration at top of file when this is removed 14701 if ($.uiBackCompat !== false) { 14702 14703 // Backcompat for spinner html extension points 14704 $.widget("ui.spinner", $.ui.spinner, { 14705 _enhance: function () { 14706 this.uiSpinner = this.element 14707 .attr("autocomplete", "off") 14708 .wrap(this._uiSpinnerHtml()) 14709 .parent() 14710 14711 // Add buttons 14712 .append(this._buttonHtml()); 14713 }, 14714 _uiSpinnerHtml: function () { 14715 return "<span>"; 14716 }, 14717 14718 _buttonHtml: function () { 14719 return "<a></a><a></a>"; 14720 } 14721 }); 14722 } 14723 14724 var widgetsSpinner = $.ui.spinner; 14725 14726 14727 /*! 14728 * jQuery UI Tabs 1.12.1 14729 * http://jqueryui.com 14730 * 14731 * Copyright jQuery Foundation and other contributors 14732 * Released under the MIT license. 14733 * http://jquery.org/license 14734 */ 14735 14736 //>>label: Tabs 14737 //>>group: Widgets 14738 //>>description: Transforms a set of container elements into a tab structure. 14739 //>>docs: http://api.jqueryui.com/tabs/ 14740 //>>demos: http://jqueryui.com/tabs/ 14741 //>>css.structure: ../../themes/base/core.css 14742 //>>css.structure: ../../themes/base/tabs.css 14743 //>>css.theme: ../../themes/base/theme.css 14744 14745 14746 14747 $.widget("ui.tabs", { 14748 version: "1.12.1", 14749 delay: 300, 14750 options: { 14751 active: null, 14752 classes: { 14753 "ui-tabs": "ui-corner-all", 14754 "ui-tabs-nav": "ui-corner-all", 14755 "ui-tabs-panel": "ui-corner-bottom", 14756 "ui-tabs-tab": "ui-corner-top" 14757 }, 14758 collapsible: false, 14759 event: "click", 14760 heightStyle: "content", 14761 hide: null, 14762 show: null, 14763 14764 // Callbacks 14765 activate: null, 14766 beforeActivate: null, 14767 beforeLoad: null, 14768 load: null 14769 }, 14770 14771 _isLocal: (function () { 14772 var rhash = /#.*$/; 14773 14774 return function (anchor) { 14775 var anchorUrl, locationUrl; 14776 14777 anchorUrl = anchor.href.replace(rhash, ""); 14778 locationUrl = location.href.replace(rhash, ""); 14779 14780 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 14781 try { 14782 anchorUrl = decodeURIComponent(anchorUrl); 14783 } catch (error) { } 14784 try { 14785 locationUrl = decodeURIComponent(locationUrl); 14786 } catch (error) { } 14787 14788 return anchor.hash.length > 1 && anchorUrl === locationUrl; 14789 }; 14790 })(), 14791 14792 _create: function () { 14793 var that = this, 14794 options = this.options; 14795 14796 this.running = false; 14797 14798 this._addClass("ui-tabs", "ui-widget ui-widget-content"); 14799 this._toggleClass("ui-tabs-collapsible", null, options.collapsible); 14800 14801 this._processTabs(); 14802 options.active = this._initialActive(); 14803 14804 // Take disabling tabs via class attribute from HTML 14805 // into account and update option properly. 14806 if ($.isArray(options.disabled)) { 14807 options.disabled = $.unique(options.disabled.concat( 14808 $.map(this.tabs.filter(".ui-state-disabled"), function (li) { 14809 return that.tabs.index(li); 14810 }) 14811 )).sort(); 14812 } 14813 14814 // Check for length avoids error when initializing empty list 14815 if (this.options.active !== false && this.anchors.length) { 14816 this.active = this._findActive(options.active); 14817 } else { 14818 this.active = $(); 14819 } 14820 14821 this._refresh(); 14822 14823 if (this.active.length) { 14824 this.load(options.active); 14825 } 14826 }, 14827 14828 _initialActive: function () { 14829 var active = this.options.active, 14830 collapsible = this.options.collapsible, 14831 locationHash = location.hash.substring(1); 14832 14833 if (active === null) { 14834 14835 // check the fragment identifier in the URL 14836 if (locationHash) { 14837 this.tabs.each(function (i, tab) { 14838 if ($(tab).attr("aria-controls") === locationHash) { 14839 active = i; 14840 return false; 14841 } 14842 }); 14843 } 14844 14845 // Check for a tab marked active via a class 14846 if (active === null) { 14847 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 14848 } 14849 14850 // No active tab, set to false 14851 if (active === null || active === -1) { 14852 active = this.tabs.length ? 0 : false; 14853 } 14854 } 14855 14856 // Handle numbers: negative, out of range 14857 if (active !== false) { 14858 active = this.tabs.index(this.tabs.eq(active)); 14859 if (active === -1) { 14860 active = collapsible ? false : 0; 14861 } 14862 } 14863 14864 // Don't allow collapsible: false and active: false 14865 if (!collapsible && active === false && this.anchors.length) { 14866 active = 0; 14867 } 14868 14869 return active; 14870 }, 14871 14872 _getCreateEventData: function () { 14873 return { 14874 tab: this.active, 14875 panel: !this.active.length ? $() : this._getPanelForTab(this.active) 14876 }; 14877 }, 14878 14879 _tabKeydown: function (event) { 14880 var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"), 14881 selectedIndex = this.tabs.index(focusedTab), 14882 goingForward = true; 14883 14884 if (this._handlePageNav(event)) { 14885 return; 14886 } 14887 14888 switch (event.keyCode) { 14889 case $.ui.keyCode.RIGHT: 14890 case $.ui.keyCode.DOWN: 14891 selectedIndex++; 14892 break; 14893 case $.ui.keyCode.UP: 14894 case $.ui.keyCode.LEFT: 14895 goingForward = false; 14896 selectedIndex--; 14897 break; 14898 case $.ui.keyCode.END: 14899 selectedIndex = this.anchors.length - 1; 14900 break; 14901 case $.ui.keyCode.HOME: 14902 selectedIndex = 0; 14903 break; 14904 case $.ui.keyCode.SPACE: 14905 14906 // Activate only, no collapsing 14907 event.preventDefault(); 14908 clearTimeout(this.activating); 14909 this._activate(selectedIndex); 14910 return; 14911 case $.ui.keyCode.ENTER: 14912 14913 // Toggle (cancel delayed activation, allow collapsing) 14914 event.preventDefault(); 14915 clearTimeout(this.activating); 14916 14917 // Determine if we should collapse or activate 14918 this._activate(selectedIndex === this.options.active ? false : selectedIndex); 14919 return; 14920 default: 14921 return; 14922 } 14923 14924 // Focus the appropriate tab, based on which key was pressed 14925 event.preventDefault(); 14926 clearTimeout(this.activating); 14927 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 14928 14929 // Navigating with control/command key will prevent automatic activation 14930 if (!event.ctrlKey && !event.metaKey) { 14931 14932 // Update aria-selected immediately so that AT think the tab is already selected. 14933 // Otherwise AT may confuse the user by stating that they need to activate the tab, 14934 // but the tab will already be activated by the time the announcement finishes. 14935 focusedTab.attr("aria-selected", "false"); 14936 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 14937 14938 this.activating = this._delay(function () { 14939 this.option("active", selectedIndex); 14940 }, this.delay); 14941 } 14942 }, 14943 14944 _panelKeydown: function (event) { 14945 if (this._handlePageNav(event)) { 14946 return; 14947 } 14948 14949 // Ctrl+up moves focus to the current tab 14950 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 14951 event.preventDefault(); 14952 this.active.trigger("focus"); 14953 } 14954 }, 14955 14956 // Alt+page up/down moves focus to the previous/next tab (and activates) 14957 _handlePageNav: function (event) { 14958 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 14959 this._activate(this._focusNextTab(this.options.active - 1, false)); 14960 return true; 14961 } 14962 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 14963 this._activate(this._focusNextTab(this.options.active + 1, true)); 14964 return true; 14965 } 14966 }, 14967 14968 _findNextTab: function (index, goingForward) { 14969 var lastTabIndex = this.tabs.length - 1; 14970 14971 function constrain() { 14972 if (index > lastTabIndex) { 14973 index = 0; 14974 } 14975 if (index < 0) { 14976 index = lastTabIndex; 14977 } 14978 return index; 14979 } 14980 14981 while ($.inArray(constrain(), this.options.disabled) !== -1) { 14982 index = goingForward ? index + 1 : index - 1; 14983 } 14984 14985 return index; 14986 }, 14987 14988 _focusNextTab: function (index, goingForward) { 14989 index = this._findNextTab(index, goingForward); 14990 this.tabs.eq(index).trigger("focus"); 14991 return index; 14992 }, 14993 14994 _setOption: function (key, value) { 14995 if (key === "active") { 14996 14997 // _activate() will handle invalid values and update this.options 14998 this._activate(value); 14999 return; 15000 } 15001 15002 this._super(key, value); 15003 15004 if (key === "collapsible") { 15005 this._toggleClass("ui-tabs-collapsible", null, value); 15006 15007 // Setting collapsible: false while collapsed; open first panel 15008 if (!value && this.options.active === false) { 15009 this._activate(0); 15010 } 15011 } 15012 15013 if (key === "event") { 15014 this._setupEvents(value); 15015 } 15016 15017 if (key === "heightStyle") { 15018 this._setupHeightStyle(value); 15019 } 15020 }, 15021
vendor: 4,428 bytes, lines 15022-15178
15022 _sanitizeSelector: function (hash) { 15023 return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : ""; 15024 }, 15025 15026 refresh: function () { 15027 var options = this.options, 15028 lis = this.tablist.children(":has(a[href])"); 15029 15030 // Get disabled tabs from class attribute from HTML 15031 // this will get converted to a boolean if needed in _refresh() 15032 options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) { 15033 return lis.index(tab); 15034 }); 15035 15036 this._processTabs(); 15037 15038 // Was collapsed or no tabs 15039 if (options.active === false || !this.anchors.length) { 15040 options.active = false; 15041 this.active = $(); 15042 15043 // was active, but active tab is gone 15044 } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) { 15045 15046 // all remaining tabs are disabled 15047 if (this.tabs.length === options.disabled.length) { 15048 options.active = false; 15049 this.active = $(); 15050 15051 // activate previous tab 15052 } else { 15053 this._activate(this._findNextTab(Math.max(0, options.active - 1), false)); 15054 } 15055 15056 // was active, active tab still exists 15057 } else { 15058 15059 // make sure active index is correct 15060 options.active = this.tabs.index(this.active); 15061 } 15062 15063 this._refresh(); 15064 }, 15065 15066 _refresh: function () { 15067 this._setOptionDisabled(this.options.disabled); 15068 this._setupEvents(this.options.event); 15069 this._setupHeightStyle(this.options.heightStyle); 15070 15071 this.tabs.not(this.active).attr({ 15072 "aria-selected": "false", 15073 "aria-expanded": "false", 15074 tabIndex: -1 15075 }); 15076 this.panels.not(this._getPanelForTab(this.active)) 15077 .hide() 15078 .attr({ 15079 "aria-hidden": "true" 15080 }); 15081 15082 // Make sure one tab is in the tab order 15083 if (!this.active.length) { 15084 this.tabs.eq(0).attr("tabIndex", 0); 15085 } else { 15086 this.active 15087 .attr({ 15088 "aria-selected": "true", 15089 "aria-expanded": "true", 15090 tabIndex: 0 15091 }); 15092 this._addClass(this.active, "ui-tabs-active", "ui-state-active"); 15093 this._getPanelForTab(this.active) 15094 .show() 15095 .attr({ 15096 "aria-hidden": "false" 15097 }); 15098 } 15099 }, 15100 15101 _processTabs: function () { 15102 var that = this, 15103 prevTabs = this.tabs, 15104 prevAnchors = this.anchors, 15105 prevPanels = this.panels; 15106 15107 this.tablist = this._getList().attr("role", "tablist"); 15108 this._addClass(this.tablist, "ui-tabs-nav", 15109 "ui-helper-reset ui-helper-clearfix ui-widget-header"); 15110 15111 // Prevent users from focusing disabled tabs via click 15112 this.tablist 15113 .on("mousedown" + this.eventNamespace, "> li", function (event) { 15114 if ($(this).is(".ui-state-disabled")) { 15115 event.preventDefault(); 15116 } 15117 }) 15118 15119 // Support: IE <9 15120 // Preventing the default action in mousedown doesn't prevent IE 15121 // from focusing the element, so if the anchor gets focused, blur. 15122 // We don't have to worry about focusing the previously focused 15123 // element since clicking on a non-focusable element should focus 15124 // the body anyway. 15125 .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () { 15126 if ($(this).closest("li").is(".ui-state-disabled")) { 15127 this.blur(); 15128 } 15129 }); 15130 15131 this.tabs = this.tablist.find("> li:has(a[href])") 15132 .attr({ 15133 role: "tab", 15134 tabIndex: -1 15135 }); 15136 this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"); 15137 15138 this.anchors = this.tabs.map(function () { 15139 return $("a", this)[0]; 15140 }) 15141 .attr({ 15142 role: "presentation", 15143 tabIndex: -1 15144 }); 15145 this._addClass(this.anchors, "ui-tabs-anchor"); 15146 15147 this.panels = $(); 15148 15149 this.anchors.each(function (i, anchor) { 15150 var selector, panel, panelId, 15151 anchorId = $(anchor).uniqueId().attr("id"), 15152 tab = $(anchor).closest("li"), 15153 originalAriaControls = tab.attr("aria-controls"); 15154 15155 // Inline tab 15156 if (that._isLocal(anchor)) { 15157 selector = anchor.hash; 15158 panelId = selector.substring(1); 15159 panel = that.element.find(that._sanitizeSelector(selector)); 15160 15161 // remote tab 15162 } else { 15163 15164 // If the tab doesn't already have aria-controls, 15165 // generate an id by using a throw-away element 15166 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 15167 selector = "#" + panelId; 15168 panel = that.element.find(selector); 15169 if (!panel.length) { 15170 panel = that._createPanel(panelId); 15171 panel.insertAfter(that.panels[i - 1] || that.tablist); 15172 } 15173 panel.attr("aria-live", "polite"); 15174 } 15175 15176 if (panel.length) { 15177 that.panels = that.panels.add(panel); 15178 }
vendor: 4,787 bytes, lines 15179-15359
15179 if (originalAriaControls) { 15180 tab.data("ui-tabs-aria-controls", originalAriaControls); 15181 } 15182 tab.attr({ 15183 "aria-controls": panelId, 15184 "aria-labelledby": anchorId 15185 }); 15186 panel.attr("aria-labelledby", anchorId); 15187 }); 15188 15189 this.panels.attr("role", "tabpanel"); 15190 this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"); 15191 15192 // Avoid memory leaks (#10056) 15193 if (prevTabs) { 15194 this._off(prevTabs.not(this.tabs)); 15195 this._off(prevAnchors.not(this.anchors)); 15196 this._off(prevPanels.not(this.panels)); 15197 } 15198 }, 15199 15200 // Allow overriding how to find the list for rare usage scenarios (#7715) 15201 _getList: function () { 15202 return this.tablist || this.element.find("ol, ul").eq(0); 15203 }, 15204 15205 _createPanel: function (id) { 15206 return $("<div>") 15207 .attr("id", id) 15208 .data("ui-tabs-destroy", true); 15209 }, 15210 15211 _setOptionDisabled: function (disabled) { 15212 var currentItem, li, i; 15213 15214 if ($.isArray(disabled)) { 15215 if (!disabled.length) { 15216 disabled = false; 15217 } else if (disabled.length === this.anchors.length) { 15218 disabled = true; 15219 } 15220 } 15221 15222 // Disable tabs 15223 for (i = 0; (li = this.tabs[i]); i++) { 15224 currentItem = $(li); 15225 if (disabled === true || $.inArray(i, disabled) !== -1) { 15226 currentItem.attr("aria-disabled", "true"); 15227 this._addClass(currentItem, null, "ui-state-disabled"); 15228 } else { 15229 currentItem.removeAttr("aria-disabled"); 15230 this._removeClass(currentItem, null, "ui-state-disabled"); 15231 } 15232 } 15233 15234 this.options.disabled = disabled; 15235 15236 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, 15237 disabled === true); 15238 }, 15239 15240 _setupEvents: function (event) { 15241 var events = {}; 15242 if (event) { 15243 $.each(event.split(" "), function (index, eventName) { 15244 events[eventName] = "_eventHandler"; 15245 }); 15246 } 15247 15248 this._off(this.anchors.add(this.tabs).add(this.panels)); 15249 15250 // Always prevent the default action, even when disabled 15251 this._on(true, this.anchors, { 15252 click: function (event) { 15253 event.preventDefault(); 15254 } 15255 }); 15256 this._on(this.anchors, events); 15257 this._on(this.tabs, { keydown: "_tabKeydown" }); 15258 this._on(this.panels, { keydown: "_panelKeydown" }); 15259 15260 this._focusable(this.tabs); 15261 this._hoverable(this.tabs); 15262 }, 15263 15264 _setupHeightStyle: function (heightStyle) { 15265 var maxHeight, 15266 parent = this.element.parent(); 15267 15268 if (heightStyle === "fill") { 15269 maxHeight = parent.height(); 15270 maxHeight -= this.element.outerHeight() - this.element.height(); 15271 15272 this.element.siblings(":visible").each(function () { 15273 var elem = $(this), 15274 position = elem.css("position"); 15275 15276 if (position === "absolute" || position === "fixed") { 15277 return; 15278 } 15279 maxHeight -= elem.outerHeight(true); 15280 }); 15281 15282 this.element.children().not(this.panels).each(function () { 15283 maxHeight -= $(this).outerHeight(true); 15284 }); 15285 15286 this.panels.each(function () { 15287 $(this).height(Math.max(0, maxHeight - 15288 $(this).innerHeight() + $(this).height())); 15289 }) 15290 .css("overflow", "auto"); 15291 } else if (heightStyle === "auto") { 15292 maxHeight = 0; 15293 this.panels.each(function () { 15294 maxHeight = Math.max(maxHeight, $(this).height("").height()); 15295 }).height(maxHeight); 15296 } 15297 }, 15298 15299 _eventHandler: function (event) { 15300 var options = this.options, 15301 active = this.active, 15302 anchor = $(event.currentTarget), 15303 tab = anchor.closest("li"), 15304 clickedIsActive = tab[0] === active[0], 15305 collapsing = clickedIsActive && options.collapsible, 15306 toShow = collapsing ? $() : this._getPanelForTab(tab), 15307 toHide = !active.length ? $() : this._getPanelForTab(active), 15308 eventData = { 15309 oldTab: active, 15310 oldPanel: toHide, 15311 newTab: collapsing ? $() : tab, 15312 newPanel: toShow 15313 }; 15314 15315 event.preventDefault(); 15316 15317 if (tab.hasClass("ui-state-disabled") || 15318 15319 // tab is already loading 15320 tab.hasClass("ui-tabs-loading") || 15321 15322 // can't switch durning an animation 15323 this.running || 15324 15325 // click on active header, but not collapsible 15326 (clickedIsActive && !options.collapsible) || 15327 15328 // allow canceling activation 15329 (this._trigger("beforeActivate", event, eventData) === false)) { 15330 return; 15331 } 15332 15333 options.active = collapsing ? false : this.tabs.index(tab); 15334 15335 this.active = clickedIsActive ? $() : tab; 15336 if (this.xhr) { 15337 this.xhr.abort(); 15338 } 15339 15340 if (!toHide.length && !toShow.length) { 15341 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 15342 } 15343 15344 if (toShow.length) { 15345 this.load(this.tabs.index(tab), event); 15346 } 15347 this._toggle(event, eventData); 15348 }, 15349 15350 // Handles show/hide for selecting tabs 15351 _toggle: function (event, eventData) { 15352 var that = this, 15353 toShow = eventData.newPanel, 15354 toHide = eventData.oldPanel; 15355 15356 this.running = true; 15357 15358 function complete() { 15359 that.running = false;
vendor: 24,684 bytes, lines 15360-16303
15360 that._trigger("activate", event, eventData); 15361 } 15362 15363 function show() { 15364 that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active"); 15365 15366 if (toShow.length && that.options.show) { 15367 that._show(toShow, that.options.show, complete); 15368 } else { 15369 toShow.show(); 15370 complete(); 15371 } 15372 } 15373 15374 // Start out by hiding, then showing, then completing 15375 if (toHide.length && this.options.hide) { 15376 this._hide(toHide, this.options.hide, function () { 15377 that._removeClass(eventData.oldTab.closest("li"), 15378 "ui-tabs-active", "ui-state-active"); 15379 show(); 15380 }); 15381 } else { 15382 this._removeClass(eventData.oldTab.closest("li"), 15383 "ui-tabs-active", "ui-state-active"); 15384 toHide.hide(); 15385 show(); 15386 } 15387 15388 toHide.attr("aria-hidden", "true"); 15389 eventData.oldTab.attr({ 15390 "aria-selected": "false", 15391 "aria-expanded": "false" 15392 }); 15393 15394 // If we're switching tabs, remove the old tab from the tab order. 15395 // If we're opening from collapsed state, remove the previous tab from the tab order. 15396 // If we're collapsing, then keep the collapsing tab in the tab order. 15397 if (toShow.length && toHide.length) { 15398 eventData.oldTab.attr("tabIndex", -1); 15399 } else if (toShow.length) { 15400 this.tabs.filter(function () { 15401 return $(this).attr("tabIndex") === 0; 15402 }) 15403 .attr("tabIndex", -1); 15404 } 15405 15406 toShow.attr("aria-hidden", "false"); 15407 eventData.newTab.attr({ 15408 "aria-selected": "true", 15409 "aria-expanded": "true", 15410 tabIndex: 0 15411 }); 15412 }, 15413 15414 _activate: function (index) { 15415 var anchor, 15416 active = this._findActive(index); 15417 15418 // Trying to activate the already active panel 15419 if (active[0] === this.active[0]) { 15420 return; 15421 } 15422 15423 // Trying to collapse, simulate a click on the current active header 15424 if (!active.length) { 15425 active = this.active; 15426 } 15427 15428 anchor = active.find(".ui-tabs-anchor")[0]; 15429 this._eventHandler({ 15430 target: anchor, 15431 currentTarget: anchor, 15432 preventDefault: $.noop 15433 }); 15434 }, 15435 15436 _findActive: function (index) { 15437 return index === false ? $() : this.tabs.eq(index); 15438 }, 15439 15440 _getIndex: function (index) { 15441 15442 // meta-function to give users option to provide a href string instead of a numerical index. 15443 if (typeof index === "string") { 15444 index = this.anchors.index(this.anchors.filter("[href$='" + 15445 $.ui.escapeSelector(index) + "']")); 15446 } 15447 15448 return index; 15449 }, 15450 15451 _destroy: function () { 15452 if (this.xhr) { 15453 this.xhr.abort(); 15454 } 15455 15456 this.tablist 15457 .removeAttr("role") 15458 .off(this.eventNamespace); 15459 15460 this.anchors 15461 .removeAttr("role tabIndex") 15462 .removeUniqueId(); 15463 15464 this.tabs.add(this.panels).each(function () { 15465 if ($.data(this, "ui-tabs-destroy")) { 15466 $(this).remove(); 15467 } else { 15468 $(this).removeAttr("role tabIndex " + 15469 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded"); 15470 } 15471 }); 15472 15473 this.tabs.each(function () { 15474 var li = $(this), 15475 prev = li.data("ui-tabs-aria-controls"); 15476 if (prev) { 15477 li 15478 .attr("aria-controls", prev) 15479 .removeData("ui-tabs-aria-controls"); 15480 } else { 15481 li.removeAttr("aria-controls"); 15482 } 15483 }); 15484 15485 this.panels.show(); 15486 15487 if (this.options.heightStyle !== "content") { 15488 this.panels.css("height", ""); 15489 } 15490 }, 15491 15492 enable: function (index) { 15493 var disabled = this.options.disabled; 15494 if (disabled === false) { 15495 return; 15496 } 15497 15498 if (index === undefined) { 15499 disabled = false; 15500 } else { 15501 index = this._getIndex(index); 15502 if ($.isArray(disabled)) { 15503 disabled = $.map(disabled, function (num) { 15504 return num !== index ? num : null; 15505 }); 15506 } else { 15507 disabled = $.map(this.tabs, function (li, num) { 15508 return num !== index ? num : null; 15509 }); 15510 } 15511 } 15512 this._setOptionDisabled(disabled); 15513 }, 15514 15515 disable: function (index) { 15516 var disabled = this.options.disabled; 15517 if (disabled === true) { 15518 return; 15519 } 15520 15521 if (index === undefined) { 15522 disabled = true; 15523 } else { 15524 index = this._getIndex(index); 15525 if ($.inArray(index, disabled) !== -1) { 15526 return; 15527 } 15528 if ($.isArray(disabled)) { 15529 disabled = $.merge([index], disabled).sort(); 15530 } else { 15531 disabled = [index]; 15532 } 15533 } 15534 this._setOptionDisabled(disabled); 15535 }, 15536 15537 load: function (index, event) { 15538 index = this._getIndex(index); 15539 var that = this, 15540 tab = this.tabs.eq(index), 15541 anchor = tab.find(".ui-tabs-anchor"), 15542 panel = this._getPanelForTab(tab), 15543 eventData = { 15544 tab: tab, 15545 panel: panel 15546 }, 15547 complete = function (jqXHR, status) { 15548 if (status === "abort") { 15549 that.panels.stop(false, true); 15550 } 15551 15552 that._removeClass(tab, "ui-tabs-loading"); 15553 panel.removeAttr("aria-busy"); 15554 15555 if (jqXHR === that.xhr) { 15556 delete that.xhr; 15557 } 15558 }; 15559 15560 // Not remote 15561 if (this._isLocal(anchor[0])) { 15562 return; 15563 } 15564 15565 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 15566 15567 // Support: jQuery <1.8 15568 // jQuery <1.8 returns false if the request is canceled in beforeSend, 15569 // but as of 1.8, $.ajax() always returns a jqXHR object. 15570 if (this.xhr && this.xhr.statusText !== "canceled") { 15571 this._addClass(tab, "ui-tabs-loading"); 15572 panel.attr("aria-busy", "true"); 15573 15574 this.xhr 15575 .done(function (response, status, jqXHR) { 15576 15577 // support: jQuery <1.8 15578 // http://bugs.jquery.com/ticket/11778 15579 setTimeout(function () { 15580 panel.html(response); 15581 that._trigger("load", event, eventData); 15582 15583 complete(jqXHR, status); 15584 }, 1); 15585 }) 15586 .fail(function (jqXHR, status) { 15587 15588 // support: jQuery <1.8 15589 // http://bugs.jquery.com/ticket/11778 15590 setTimeout(function () { 15591 complete(jqXHR, status); 15592 }, 1); 15593 }); 15594 } 15595 }, 15596 15597 _ajaxSettings: function (anchor, event, eventData) { 15598 var that = this; 15599 return { 15600 15601 // Support: IE <11 only 15602 // Strip any hash that exists to prevent errors with the Ajax request 15603 url: anchor.attr("href").replace(/#.*$/, ""), 15604 beforeSend: function (jqXHR, settings) { 15605 return that._trigger("beforeLoad", event, 15606 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData)); 15607 } 15608 }; 15609 }, 15610 15611 _getPanelForTab: function (tab) { 15612 var id = $(tab).attr("aria-controls"); 15613 return this.element.find(this._sanitizeSelector("#" + id)); 15614 } 15615 }); 15616 15617 // DEPRECATED 15618 // TODO: Switch return back to widget declaration at top of file when this is removed 15619 if ($.uiBackCompat !== false) { 15620 15621 // Backcompat for ui-tab class (now ui-tabs-tab) 15622 $.widget("ui.tabs", $.ui.tabs, { 15623 _processTabs: function () { 15624 this._superApply(arguments); 15625 this._addClass(this.tabs, "ui-tab"); 15626 } 15627 }); 15628 } 15629 15630 var widgetsTabs = $.ui.tabs; 15631 15632 15633 /*! 15634 * jQuery UI Tooltip 1.12.1 15635 * http://jqueryui.com 15636 * 15637 * Copyright jQuery Foundation and other contributors 15638 * Released under the MIT license. 15639 * http://jquery.org/license 15640 */ 15641 15642 //>>label: Tooltip 15643 //>>group: Widgets 15644 //>>description: Shows additional information for any element on hover or focus. 15645 //>>docs: http://api.jqueryui.com/tooltip/ 15646 //>>demos: http://jqueryui.com/tooltip/ 15647 //>>css.structure: ../../themes/base/core.css 15648 //>>css.structure: ../../themes/base/tooltip.css 15649 //>>css.theme: ../../themes/base/theme.css 15650 15651 15652 15653 $.widget("ui.tooltip", { 15654 version: "1.12.1", 15655 options: { 15656 classes: { 15657 "ui-tooltip": "ui-corner-all ui-widget-shadow" 15658 }, 15659 content: function () { 15660 15661 // support: IE<9, Opera in jQuery <1.7 15662 // .text() can't accept undefined, so coerce to a string 15663 var title = $(this).attr("title") || ""; 15664 15665 // Escape title, since we're going from an attribute to raw HTML 15666 return $("<a>").text(title).html(); 15667 }, 15668 hide: true, 15669 15670 // Disabled elements have inconsistent behavior across browsers (#8661) 15671 items: "[title]:not([disabled])", 15672 position: { 15673 my: "left top+15", 15674 at: "left bottom", 15675 collision: "flipfit flip" 15676 }, 15677 show: true, 15678 track: false, 15679 15680 // Callbacks 15681 close: null, 15682 open: null 15683 }, 15684 15685 _addDescribedBy: function (elem, id) { 15686 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 15687 describedby.push(id); 15688 elem 15689 .data("ui-tooltip-id", id) 15690 .attr("aria-describedby", $.trim(describedby.join(" "))); 15691 }, 15692 15693 _removeDescribedBy: function (elem) { 15694 var id = elem.data("ui-tooltip-id"), 15695 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 15696 index = $.inArray(id, describedby); 15697 15698 if (index !== -1) { 15699 describedby.splice(index, 1); 15700 } 15701 15702 elem.removeData("ui-tooltip-id"); 15703 describedby = $.trim(describedby.join(" ")); 15704 if (describedby) { 15705 elem.attr("aria-describedby", describedby); 15706 } else { 15707 elem.removeAttr("aria-describedby"); 15708 } 15709 }, 15710 15711 _create: function () { 15712 this._on({ 15713 mouseover: "open", 15714 focusin: "open" 15715 }); 15716 15717 // IDs of generated tooltips, needed for destroy 15718 this.tooltips = {}; 15719 15720 // IDs of parent tooltips where we removed the title attribute 15721 this.parents = {}; 15722 15723 // Append the aria-live region so tooltips announce correctly 15724 this.liveRegion = $("<div>") 15725 .attr({ 15726 role: "log", 15727 "aria-live": "assertive", 15728 "aria-relevant": "additions" 15729 }) 15730 .appendTo(this.document[0].body); 15731 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 15732 15733 this.disabledTitles = $([]); 15734 }, 15735 15736 _setOption: function (key, value) { 15737 var that = this; 15738 15739 this._super(key, value); 15740 15741 if (key === "content") { 15742 $.each(this.tooltips, function (id, tooltipData) { 15743 that._updateContent(tooltipData.element); 15744 }); 15745 } 15746 }, 15747 15748 _setOptionDisabled: function (value) { 15749 this[value ? "_disable" : "_enable"](); 15750 }, 15751 15752 _disable: function () { 15753 var that = this; 15754 15755 // Close open tooltips 15756 $.each(this.tooltips, function (id, tooltipData) { 15757 var event = $.Event("blur"); 15758 event.target = event.currentTarget = tooltipData.element[0]; 15759 that.close(event, true); 15760 }); 15761 15762 // Remove title attributes to prevent native tooltips 15763 this.disabledTitles = this.disabledTitles.add( 15764 this.element.find(this.options.items).addBack() 15765 .filter(function () { 15766 var element = $(this); 15767 if (element.is("[title]")) { 15768 return element 15769 .data("ui-tooltip-title", element.attr("title")) 15770 .removeAttr("title"); 15771 } 15772 }) 15773 ); 15774 }, 15775 15776 _enable: function () { 15777 15778 // restore title attributes 15779 this.disabledTitles.each(function () { 15780 var element = $(this); 15781 if (element.data("ui-tooltip-title")) { 15782 element.attr("title", element.data("ui-tooltip-title")); 15783 } 15784 }); 15785 this.disabledTitles = $([]); 15786 }, 15787 15788 open: function (event) { 15789 var that = this, 15790 target = $(event ? event.target : this.element) 15791 15792 // we need closest here due to mouseover bubbling, 15793 // but always pointing at the same event target 15794 .closest(this.options.items); 15795 15796 // No element to show a tooltip for or the tooltip is already open 15797 if (!target.length || target.data("ui-tooltip-id")) { 15798 return; 15799 } 15800 15801 if (target.attr("title")) { 15802 target.data("ui-tooltip-title", target.attr("title")); 15803 } 15804 15805 target.data("ui-tooltip-open", true); 15806 15807 // Kill parent tooltips, custom or native, for hover 15808 if (event && event.type === "mouseover") { 15809 target.parents().each(function () { 15810 var parent = $(this), 15811 blurEvent; 15812 if (parent.data("ui-tooltip-open")) { 15813 blurEvent = $.Event("blur"); 15814 blurEvent.target = blurEvent.currentTarget = this; 15815 that.close(blurEvent, true); 15816 } 15817 if (parent.attr("title")) { 15818 parent.uniqueId(); 15819 that.parents[this.id] = { 15820 element: this, 15821 title: parent.attr("title") 15822 }; 15823 parent.attr("title", ""); 15824 } 15825 }); 15826 } 15827 15828 this._registerCloseHandlers(event, target); 15829 this._updateContent(target, event); 15830 }, 15831 15832 _updateContent: function (target, event) { 15833 var content, 15834 contentOption = this.options.content, 15835 that = this, 15836 eventType = event ? event.type : null; 15837 15838 if (typeof contentOption === "string" || contentOption.nodeType || 15839 contentOption.jquery) { 15840 return this._open(event, target, contentOption); 15841 } 15842 15843 content = contentOption.call(target[0], function (response) { 15844 15845 // IE may instantly serve a cached response for ajax requests 15846 // delay this call to _open so the other call to _open runs first 15847 that._delay(function () { 15848 15849 // Ignore async response if tooltip was closed already 15850 if (!target.data("ui-tooltip-open")) { 15851 return; 15852 } 15853 15854 // JQuery creates a special event for focusin when it doesn't 15855 // exist natively. To improve performance, the native event 15856 // object is reused and the type is changed. Therefore, we can't 15857 // rely on the type being correct after the event finished 15858 // bubbling, so we set it back to the previous value. (#8740) 15859 if (event) { 15860 event.type = eventType; 15861 } 15862 this._open(event, target, response); 15863 }); 15864 }); 15865 if (content) { 15866 this._open(event, target, content); 15867 } 15868 }, 15869 15870 _open: function (event, target, content) { 15871 var tooltipData, tooltip, delayedShow, a11yContent, 15872 positionOption = $.extend({}, this.options.position); 15873 15874 if (!content) { 15875 return; 15876 } 15877 15878 // Content can be updated multiple times. If the tooltip already 15879 // exists, then just update the content and bail. 15880 tooltipData = this._find(target); 15881 if (tooltipData) { 15882 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 15883 return; 15884 } 15885 15886 // If we have a title, clear it to prevent the native tooltip 15887 // we have to check first to avoid defining a title if none exists 15888 // (we don't want to cause an element to start matching [title]) 15889 // 15890 // We use removeAttr only for key events, to allow IE to export the correct 15891 // accessible attributes. For mouse events, set to empty string to avoid 15892 // native tooltip showing up (happens only when removing inside mouseover). 15893 if (target.is("[title]")) { 15894 if (event && event.type === "mouseover") { 15895 target.attr("title", ""); 15896 } else { 15897 target.removeAttr("title"); 15898 } 15899 } 15900 15901 tooltipData = this._tooltip(target); 15902 tooltip = tooltipData.tooltip; 15903 this._addDescribedBy(target, tooltip.attr("id")); 15904 tooltip.find(".ui-tooltip-content").html(content); 15905 15906 // Support: Voiceover on OS X, JAWS on IE <= 9 15907 // JAWS announces deletions even when aria-relevant="additions" 15908 // Voiceover will sometimes re-read the entire log region's contents from the beginning 15909 this.liveRegion.children().hide(); 15910 a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html()); 15911 a11yContent.removeAttr("name").find("[name]").removeAttr("name"); 15912 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 15913 a11yContent.appendTo(this.liveRegion); 15914 15915 function position(event) { 15916 positionOption.of = event; 15917 if (tooltip.is(":hidden")) { 15918 return; 15919 } 15920 tooltip.position(positionOption); 15921 } 15922 if (this.options.track && event && /^mouse/.test(event.type)) { 15923 this._on(this.document, { 15924 mousemove: position 15925 }); 15926 15927 // trigger once to override element-relative positioning 15928 position(event); 15929 } else { 15930 tooltip.position($.extend({ 15931 of: target 15932 }, this.options.position)); 15933 } 15934 15935 tooltip.hide(); 15936 15937 this._show(tooltip, this.options.show); 15938 15939 // Handle tracking tooltips that are shown with a delay (#8644). As soon 15940 // as the tooltip is visible, position the tooltip using the most recent 15941 // event. 15942 // Adds the check to add the timers only when both delay and track options are set (#14682) 15943 if (this.options.track && this.options.show && this.options.show.delay) { 15944 delayedShow = this.delayedShow = setInterval(function () { 15945 if (tooltip.is(":visible")) { 15946 position(positionOption.of); 15947 clearInterval(delayedShow); 15948 } 15949 }, $.fx.interval); 15950 } 15951 15952 this._trigger("open", event, { tooltip: tooltip }); 15953 }, 15954 15955 _registerCloseHandlers: function (event, target) { 15956 var events = { 15957 keyup: function (event) { 15958 if (event.keyCode === $.ui.keyCode.ESCAPE) { 15959 var fakeEvent = $.Event(event); 15960 fakeEvent.currentTarget = target[0]; 15961 this.close(fakeEvent, true); 15962 } 15963 } 15964 }; 15965 15966 // Only bind remove handler for delegated targets. Non-delegated 15967 // tooltips will handle this in destroy. 15968 if (target[0] !== this.element[0]) { 15969 events.remove = function () { 15970 this._removeTooltip(this._find(target).tooltip); 15971 }; 15972 } 15973 15974 if (!event || event.type === "mouseover") { 15975 events.mouseleave = "close"; 15976 } 15977 if (!event || event.type === "focusin") { 15978 events.focusout = "close"; 15979 } 15980 this._on(true, target, events); 15981 }, 15982 15983 close: function (event) { 15984 var tooltip, 15985 that = this, 15986 target = $(event ? event.currentTarget : this.element), 15987 tooltipData = this._find(target); 15988 15989 // The tooltip may already be closed 15990 if (!tooltipData) { 15991 15992 // We set ui-tooltip-open immediately upon open (in open()), but only set the 15993 // additional data once there's actually content to show (in _open()). So even if the 15994 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 15995 // the period between open() and _open(). 15996 target.removeData("ui-tooltip-open"); 15997 return; 15998 } 15999 16000 tooltip = tooltipData.tooltip; 16001 16002 // Disabling closes the tooltip, so we need to track when we're closing 16003 // to avoid an infinite loop in case the tooltip becomes disabled on close 16004 if (tooltipData.closing) { 16005 return; 16006 } 16007 16008 // Clear the interval for delayed tracking tooltips 16009 clearInterval(this.delayedShow); 16010 16011 // Only set title if we had one before (see comment in _open()) 16012 // If the title attribute has changed since open(), don't restore 16013 if (target.data("ui-tooltip-title") && !target.attr("title")) { 16014 target.attr("title", target.data("ui-tooltip-title")); 16015 } 16016 16017 this._removeDescribedBy(target); 16018 16019 tooltipData.hiding = true; 16020 tooltip.stop(true); 16021 this._hide(tooltip, this.options.hide, function () { 16022 that._removeTooltip($(this)); 16023 }); 16024 16025 target.removeData("ui-tooltip-open"); 16026 this._off(target, "mouseleave focusout keyup"); 16027 16028 // Remove 'remove' binding only on delegated targets 16029 if (target[0] !== this.element[0]) { 16030 this._off(target, "remove"); 16031 } 16032 this._off(this.document, "mousemove"); 16033 16034 if (event && event.type === "mouseleave") { 16035 $.each(this.parents, function (id, parent) { 16036 $(parent.element).attr("title", parent.title); 16037 delete that.parents[id]; 16038 }); 16039 } 16040 16041 tooltipData.closing = true; 16042 this._trigger("close", event, { tooltip: tooltip }); 16043 if (!tooltipData.hiding) { 16044 tooltipData.closing = false; 16045 } 16046 }, 16047 16048 _tooltip: function (element) { 16049 var tooltip = $("<div>").attr("role", "tooltip"), 16050 content = $("<div>").appendTo(tooltip), 16051 id = tooltip.uniqueId().attr("id"); 16052 16053 this._addClass(content, "ui-tooltip-content"); 16054 this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content"); 16055 16056 tooltip.appendTo(this._appendTo(element)); 16057 16058 return this.tooltips[id] = { 16059 element: element, 16060 tooltip: tooltip 16061 }; 16062 }, 16063 16064 _find: function (target) { 16065 var id = target.data("ui-tooltip-id"); 16066 return id ? this.tooltips[id] : null; 16067 }, 16068 16069 _removeTooltip: function (tooltip) { 16070 tooltip.remove(); 16071 delete this.tooltips[tooltip.attr("id")]; 16072 }, 16073 16074 _appendTo: function (target) { 16075 var element = target.closest(".ui-front, dialog"); 16076 16077 if (!element.length) { 16078 element = this.document[0].body; 16079 } 16080 16081 return element; 16082 }, 16083 16084 _destroy: function () { 16085 var that = this; 16086 16087 // Close open tooltips 16088 $.each(this.tooltips, function (id, tooltipData) { 16089 16090 // Delegate to close method to handle common cleanup 16091 var event = $.Event("blur"), 16092 element = tooltipData.element; 16093 event.target = event.currentTarget = element[0]; 16094 that.close(event, true); 16095 16096 // Remove immediately; destroying an open tooltip doesn't use the 16097 // hide animation 16098 $("#" + id).remove(); 16099 16100 // Restore the title 16101 if (element.data("ui-tooltip-title")) { 16102 16103 // If the title attribute has changed since open(), don't restore 16104 if (!element.attr("title")) { 16105 element.attr("title", element.data("ui-tooltip-title")); 16106 } 16107 element.removeData("ui-tooltip-title"); 16108 } 16109 }); 16110 this.liveRegion.remove(); 16111 } 16112 }); 16113 16114 // DEPRECATED 16115 // TODO: Switch return back to widget declaration at top of file when this is removed 16116 if ($.uiBackCompat !== false) { 16117 16118 // Backcompat for tooltipClass option 16119 $.widget("ui.tooltip", $.ui.tooltip, { 16120 options: { 16121 tooltipClass: null 16122 }, 16123 _tooltip: function () { 16124 var tooltipData = this._superApply(arguments); 16125 if (this.options.tooltipClass) { 16126 tooltipData.tooltip.addClass(this.options.tooltipClass); 16127 } 16128 return tooltipData; 16129 } 16130 }); 16131 } 16132 16133 var widgetsTooltip = $.ui.tooltip; 16134 16135 16136 /*! 16137 * jQuery UI Effects 1.12.1 16138 * http://jqueryui.com 16139 * 16140 * Copyright jQuery Foundation and other contributors 16141 * Released under the MIT license. 16142 * http://jquery.org/license 16143 */ 16144 16145 //>>label: Effects Core 16146 //>>group: Effects 16147 // jscs:disable maximumLineLength 16148 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 16149 // jscs:enable maximumLineLength 16150 //>>docs: http://api.jqueryui.com/category/effects-core/ 16151 //>>demos: http://jqueryui.com/effect/ 16152 16153 16154 16155 var dataSpace = "ui-effects-", 16156 dataSpaceStyle = "ui-effects-style", 16157 dataSpaceAnimated = "ui-effects-animated", 16158 16159 // Create a local jQuery because jQuery Color relies on it and the 16160 // global may not exist with AMD and a custom build (#10199) 16161 jQuery = $; 16162 16163 $.effects = { 16164 effect: {} 16165 }; 16166 16167 /*! 16168 * jQuery Color Animations v2.1.2 16169 * https://github.com/jquery/jquery-color 16170 * 16171 * Copyright 2014 jQuery Foundation and other contributors 16172 * Released under the MIT license. 16173 * http://jquery.org/license 16174 * 16175 * Date: Wed Jan 16 08:47:09 2013 -0600 16176 */ 16177 (function (jQuery, undefined) { 16178 16179 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 16180 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 16181 16182 // Plusequals test for += 100 -= 100 16183 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 16184 16185 // A set of RE's that can match strings and generate color tuples. 16186 stringParsers = [{ 16187 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16188 parse: function (execResult) { 16189 return [ 16190 execResult[1], 16191 execResult[2], 16192 execResult[3], 16193 execResult[4] 16194 ]; 16195 } 16196 }, { 16197 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16198 parse: function (execResult) { 16199 return [ 16200 execResult[1] * 2.55, 16201 execResult[2] * 2.55, 16202 execResult[3] * 2.55, 16203 execResult[4] 16204 ]; 16205 } 16206 }, { 16207 16208 // This regex ignores A-F because it's compared against an already lowercased string 16209 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, 16210 parse: function (execResult) { 16211 return [ 16212 parseInt(execResult[1], 16), 16213 parseInt(execResult[2], 16), 16214 parseInt(execResult[3], 16) 16215 ]; 16216 } 16217 }, { 16218 16219 // This regex ignores A-F because it's compared against an already lowercased string 16220 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, 16221 parse: function (execResult) { 16222 return [ 16223 parseInt(execResult[1] + execResult[1], 16), 16224 parseInt(execResult[2] + execResult[2], 16), 16225 parseInt(execResult[3] + execResult[3], 16) 16226 ]; 16227 } 16228 }, { 16229 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16230 space: "hsla", 16231 parse: function (execResult) { 16232 return [ 16233 execResult[1], 16234 execResult[2] / 100, 16235 execResult[3] / 100, 16236 execResult[4] 16237 ]; 16238 } 16239 }], 16240 16241 // JQuery.Color( ) 16242 color = jQuery.Color = function (color, green, blue, alpha) { 16243 return new jQuery.Color.fn.parse(color, green, blue, alpha); 16244 }, 16245 spaces = { 16246 rgba: { 16247 props: { 16248 red: { 16249 idx: 0, 16250 type: "byte" 16251 }, 16252 green: { 16253 idx: 1, 16254 type: "byte" 16255 }, 16256 blue: { 16257 idx: 2, 16258 type: "byte" 16259 } 16260 } 16261 }, 16262 16263 hsla: { 16264 props: { 16265 hue: { 16266 idx: 0, 16267 type: "degrees" 16268 }, 16269 saturation: { 16270 idx: 1, 16271 type: "percent" 16272 }, 16273 lightness: { 16274 idx: 2, 16275 type: "percent" 16276 } 16277 } 16278 } 16279 }, 16280 propTypes = { 16281 "byte": { 16282 floor: true, 16283 max: 255 16284 }, 16285 "percent": { 16286 max: 1 16287 }, 16288 "degrees": { 16289 mod: 360, 16290 floor: true 16291 } 16292 }, 16293 support = color.support = {}, 16294 16295 // Element for support tests 16296 supportElem = jQuery("<p>")[0], 16297 16298 // Colors = jQuery.Color.names 16299 colors, 16300 16301 // Local aliases of functions called often 16302 each = jQuery.each; 16303
vendor: 12,329 bytes, lines 16304-16782
16304 // Determine rgba support immediately 16305 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 16306 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 16307 16308 // Define cache name and alpha properties 16309 // for rgba and hsla spaces 16310 each(spaces, function (spaceName, space) { 16311 space.cache = "_" + spaceName; 16312 space.props.alpha = { 16313 idx: 3, 16314 type: "percent", 16315 def: 1 16316 }; 16317 }); 16318 16319 function clamp(value, prop, allowEmpty) { 16320 var type = propTypes[prop.type] || {}; 16321 16322 if (value == null) { 16323 return (allowEmpty || !prop.def) ? null : prop.def; 16324 } 16325 16326 // ~~ is an short way of doing floor for positive numbers 16327 value = type.floor ? ~~value : parseFloat(value); 16328 16329 // IE will pass in empty strings as value for alpha, 16330 // which will hit this case 16331 if (isNaN(value)) { 16332 return prop.def; 16333 } 16334 16335 if (type.mod) { 16336 16337 // We add mod before modding to make sure that negatives values 16338 // get converted properly: -10 -> 350 16339 return (value + type.mod) % type.mod; 16340 } 16341 16342 // For now all property types without mod have min and max 16343 return 0 > value ? 0 : type.max < value ? type.max : value; 16344 } 16345 16346 function stringParse(string) { 16347 var inst = color(), 16348 rgba = inst._rgba = []; 16349 16350 string = string.toLowerCase(); 16351 16352 each(stringParsers, function (i, parser) { 16353 var parsed, 16354 match = parser.re.exec(string), 16355 values = match && parser.parse(match), 16356 spaceName = parser.space || "rgba"; 16357 16358 if (values) { 16359 parsed = inst[spaceName](values); 16360 16361 // If this was an rgba parse the assignment might happen twice 16362 // oh well.... 16363 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 16364 rgba = inst._rgba = parsed._rgba; 16365 16366 // Exit each( stringParsers ) here because we matched 16367 return false; 16368 } 16369 }); 16370 16371 // Found a stringParser that handled it 16372 if (rgba.length) { 16373 16374 // If this came from a parsed string, force "transparent" when alpha is 0 16375 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 16376 if (rgba.join() === "0,0,0,0") { 16377 jQuery.extend(rgba, colors.transparent); 16378 } 16379 return inst; 16380 } 16381 16382 // Named colors 16383 return colors[string]; 16384 } 16385 16386 color.fn = jQuery.extend(color.prototype, { 16387 parse: function (red, green, blue, alpha) { 16388 if (red === undefined) { 16389 this._rgba = [null, null, null, null]; 16390 return this; 16391 } 16392 if (red.jquery || red.nodeType) { 16393 red = jQuery(red).css(green); 16394 green = undefined; 16395 } 16396 16397 var inst = this, 16398 type = jQuery.type(red), 16399 rgba = this._rgba = []; 16400 16401 // More than 1 argument specified - assume ( red, green, blue, alpha ) 16402 if (green !== undefined) { 16403 red = [red, green, blue, alpha]; 16404 type = "array"; 16405 } 16406 16407 if (type === "string") { 16408 return this.parse(stringParse(red) || colors._default); 16409 } 16410 16411 if (type === "array") { 16412 each(spaces.rgba.props, function (key, prop) { 16413 rgba[prop.idx] = clamp(red[prop.idx], prop); 16414 }); 16415 return this; 16416 } 16417 16418 if (type === "object") { 16419 if (red instanceof color) { 16420 each(spaces, function (spaceName, space) { 16421 if (red[space.cache]) { 16422 inst[space.cache] = red[space.cache].slice(); 16423 } 16424 }); 16425 } else { 16426 each(spaces, function (spaceName, space) { 16427 var cache = space.cache; 16428 each(space.props, function (key, prop) { 16429 16430 // If the cache doesn't exist, and we know how to convert 16431 if (!inst[cache] && space.to) { 16432 16433 // If the value was null, we don't need to copy it 16434 // if the key was alpha, we don't need to copy it either 16435 if (key === "alpha" || red[key] == null) { 16436 return; 16437 } 16438 inst[cache] = space.to(inst._rgba); 16439 } 16440 16441 // This is the only case where we allow nulls for ALL properties. 16442 // call clamp with alwaysAllowEmpty 16443 inst[cache][prop.idx] = clamp(red[key], prop, true); 16444 }); 16445 16446 // Everything defined but alpha? 16447 if (inst[cache] && 16448 jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) { 16449 16450 // Use the default of 1 16451 inst[cache][3] = 1; 16452 if (space.from) { 16453 inst._rgba = space.from(inst[cache]); 16454 } 16455 } 16456 }); 16457 } 16458 return this; 16459 } 16460 }, 16461 is: function (compare) { 16462 var is = color(compare), 16463 same = true, 16464 inst = this; 16465 16466 each(spaces, function (_, space) { 16467 var localCache, 16468 isCache = is[space.cache]; 16469 if (isCache) { 16470 localCache = inst[space.cache] || space.to && space.to(inst._rgba) || []; 16471 each(space.props, function (_, prop) { 16472 if (isCache[prop.idx] != null) { 16473 same = (isCache[prop.idx] === localCache[prop.idx]); 16474 return same; 16475 } 16476 }); 16477 } 16478 return same; 16479 }); 16480 return same; 16481 }, 16482 _space: function () { 16483 var used = [], 16484 inst = this; 16485 each(spaces, function (spaceName, space) { 16486 if (inst[space.cache]) { 16487 used.push(spaceName); 16488 } 16489 }); 16490 return used.pop(); 16491 }, 16492 transition: function (other, distance) { 16493 var end = color(other), 16494 spaceName = end._space(), 16495 space = spaces[spaceName], 16496 startColor = this.alpha() === 0 ? color("transparent") : this, 16497 start = startColor[space.cache] || space.to(startColor._rgba), 16498 result = start.slice(); 16499 16500 end = end[space.cache]; 16501 each(space.props, function (key, prop) { 16502 var index = prop.idx, 16503 startValue = start[index], 16504 endValue = end[index], 16505 type = propTypes[prop.type] || {}; 16506 16507 // If null, don't override start value 16508 if (endValue === null) { 16509 return; 16510 } 16511 16512 // If null - use end 16513 if (startValue === null) { 16514 result[index] = endValue; 16515 } else { 16516 if (type.mod) { 16517 if (endValue - startValue > type.mod / 2) { 16518 startValue += type.mod; 16519 } else if (startValue - endValue > type.mod / 2) { 16520 startValue -= type.mod; 16521 } 16522 } 16523 result[index] = clamp((endValue - startValue) * distance + startValue, prop); 16524 } 16525 }); 16526 return this[spaceName](result); 16527 }, 16528 blend: function (opaque) { 16529 16530 // If we are already opaque - return ourself 16531 if (this._rgba[3] === 1) { 16532 return this; 16533 } 16534 16535 var rgb = this._rgba.slice(), 16536 a = rgb.pop(), 16537 blend = color(opaque)._rgba; 16538 16539 return color(jQuery.map(rgb, function (v, i) { 16540 return (1 - a) * blend[i] + a * v; 16541 })); 16542 }, 16543 toRgbaString: function () { 16544 var prefix = "rgba(", 16545 rgba = jQuery.map(this._rgba, function (v, i) { 16546 return v == null ? (i > 2 ? 1 : 0) : v; 16547 }); 16548 16549 if (rgba[3] === 1) { 16550 rgba.pop(); 16551 prefix = "rgb("; 16552 } 16553 16554 return prefix + rgba.join() + ")"; 16555 }, 16556 toHslaString: function () { 16557 var prefix = "hsla(", 16558 hsla = jQuery.map(this.hsla(), function (v, i) { 16559 if (v == null) { 16560 v = i > 2 ? 1 : 0; 16561 } 16562 16563 // Catch 1 and 2 16564 if (i && i < 3) { 16565 v = Math.round(v * 100) + "%"; 16566 } 16567 return v; 16568 }); 16569 16570 if (hsla[3] === 1) { 16571 hsla.pop(); 16572 prefix = "hsl("; 16573 } 16574 return prefix + hsla.join() + ")"; 16575 }, 16576 toHexString: function (includeAlpha) { 16577 var rgba = this._rgba.slice(), 16578 alpha = rgba.pop(); 16579 16580 if (includeAlpha) { 16581 rgba.push(~~(alpha * 255)); 16582 } 16583 16584 return "#" + jQuery.map(rgba, function (v) { 16585 16586 // Default to 0 when nulls exist 16587 v = (v || 0).toString(16); 16588 return v.length === 1 ? "0" + v : v; 16589 }).join(""); 16590 }, 16591 toString: function () { 16592 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 16593 } 16594 }); 16595 color.fn.parse.prototype = color.fn; 16596 16597 // Hsla conversions adapted from: 16598 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 16599 16600 function hue2rgb(p, q, h) { 16601 h = (h + 1) % 1; 16602 if (h * 6 < 1) { 16603 return p + (q - p) * h * 6; 16604 } 16605 if (h * 2 < 1) { 16606 return q; 16607 } 16608 if (h * 3 < 2) { 16609 return p + (q - p) * ((2 / 3) - h) * 6; 16610 } 16611 return p; 16612 } 16613 16614 spaces.hsla.to = function (rgba) { 16615 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 16616 return [null, null, null, rgba[3]]; 16617 } 16618 var r = rgba[0] / 255, 16619 g = rgba[1] / 255, 16620 b = rgba[2] / 255, 16621 a = rgba[3], 16622 max = Math.max(r, g, b), 16623 min = Math.min(r, g, b), 16624 diff = max - min, 16625 add = max + min, 16626 l = add * 0.5, 16627 h, s; 16628 16629 if (min === max) { 16630 h = 0; 16631 } else if (r === max) { 16632 h = (60 * (g - b) / diff) + 360; 16633 } else if (g === max) { 16634 h = (60 * (b - r) / diff) + 120; 16635 } else { 16636 h = (60 * (r - g) / diff) + 240; 16637 } 16638 16639 // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 16640 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 16641 if (diff === 0) { 16642 s = 0; 16643 } else if (l <= 0.5) { 16644 s = diff / add; 16645 } else { 16646 s = diff / (2 - add); 16647 } 16648 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 16649 }; 16650 16651 spaces.hsla.from = function (hsla) { 16652 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 16653 return [null, null, null, hsla[3]]; 16654 } 16655 var h = hsla[0] / 360, 16656 s = hsla[1], 16657 l = hsla[2], 16658 a = hsla[3], 16659 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 16660 p = 2 * l - q; 16661 16662 return [ 16663 Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), 16664 Math.round(hue2rgb(p, q, h) * 255), 16665 Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), 16666 a 16667 ]; 16668 }; 16669 16670 each(spaces, function (spaceName, space) { 16671 var props = space.props, 16672 cache = space.cache, 16673 to = space.to, 16674 from = space.from; 16675 16676 // Makes rgba() and hsla() 16677 color.fn[spaceName] = function (value) { 16678 16679 // Generate a cache for this space if it doesn't exist 16680 if (to && !this[cache]) { 16681 this[cache] = to(this._rgba); 16682 } 16683 if (value === undefined) { 16684 return this[cache].slice(); 16685 } 16686 16687 var ret, 16688 type = jQuery.type(value), 16689 arr = (type === "array" || type === "object") ? value : arguments, 16690 local = this[cache].slice(); 16691 16692 each(props, function (key, prop) { 16693 var val = arr[type === "object" ? key : prop.idx]; 16694 if (val == null) { 16695 val = local[prop.idx]; 16696 } 16697 local[prop.idx] = clamp(val, prop); 16698 }); 16699 16700 if (from) { 16701 ret = color(from(local)); 16702 ret[cache] = local; 16703 return ret; 16704 } else { 16705 return color(local); 16706 } 16707 }; 16708 16709 // Makes red() green() blue() alpha() hue() saturation() lightness() 16710 each(props, function (key, prop) { 16711 16712 // Alpha is included in more than one space 16713 if (color.fn[key]) { 16714 return; 16715 } 16716 color.fn[key] = function (value) { 16717 var vtype = jQuery.type(value), 16718 fn = (key === "alpha" ? (this._hsla ? "hsla" : "rgba") : spaceName), 16719 local = this[fn](), 16720 cur = local[prop.idx], 16721 match; 16722 16723 if (vtype === "undefined") { 16724 return cur; 16725 } 16726 16727 if (vtype === "function") { 16728 value = value.call(this, cur); 16729 vtype = jQuery.type(value); 16730 } 16731 if (value == null && prop.empty) { 16732 return this; 16733 } 16734 if (vtype === "string") { 16735 match = rplusequals.exec(value); 16736 if (match) { 16737 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 16738 } 16739 } 16740 local[prop.idx] = value; 16741 return this[fn](local); 16742 }; 16743 }); 16744 }); 16745 16746 // Add cssHook and .fx.step function for each named hook. 16747 // accept a space separated string of properties 16748 color.hook = function (hook) { 16749 var hooks = hook.split(" "); 16750 each(hooks, function (i, hook) { 16751 jQuery.cssHooks[hook] = { 16752 set: function (elem, value) { 16753 var parsed, curElem, 16754 backgroundColor = ""; 16755 16756 if (value !== "transparent" && (jQuery.type(value) !== "string" || 16757 (parsed = stringParse(value)))) { 16758 value = color(parsed || value); 16759 if (!support.rgba && value._rgba[3] !== 1) { 16760 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 16761 while ( 16762 (backgroundColor === "" || backgroundColor === "transparent") && 16763 curElem && curElem.style 16764 ) { 16765 try { 16766 backgroundColor = jQuery.css(curElem, "backgroundColor"); 16767 curElem = curElem.parentNode; 16768 } catch (e) { 16769 } 16770 } 16771 16772 value = value.blend(backgroundColor && backgroundColor !== "transparent" ? 16773 backgroundColor : 16774 "_default"); 16775 } 16776 16777 value = value.toRgbaString(); 16778 } 16779 try { 16780 elem.style[hook] = value; 16781 } catch (e) { 16782
vendor: 8,121 bytes, lines 16783-17098
16783 // Wrapped to prevent IE from throwing errors on "invalid" values like 16784 // 'auto' or 'inherit' 16785 } 16786 } 16787 }; 16788 jQuery.fx.step[hook] = function (fx) { 16789 if (!fx.colorInit) { 16790 fx.start = color(fx.elem, hook); 16791 fx.end = color(fx.end); 16792 fx.colorInit = true; 16793 } 16794 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 16795 }; 16796 }); 16797 16798 }; 16799 16800 color.hook(stepHooks); 16801 16802 jQuery.cssHooks.borderColor = { 16803 expand: function (value) { 16804 var expanded = {}; 16805 16806 each(["Top", "Right", "Bottom", "Left"], function (i, part) { 16807 expanded["border" + part + "Color"] = value; 16808 }); 16809 return expanded; 16810 } 16811 }; 16812 16813 // Basic color names only. 16814 // Usage of any of the other color names requires adding yourself or including 16815 // jquery.color.svg-names.js. 16816 colors = jQuery.Color.names = { 16817 16818 // 4.1. Basic color keywords 16819 aqua: "#00ffff", 16820 black: "#000000", 16821 blue: "#0000ff", 16822 fuchsia: "#ff00ff", 16823 gray: "#808080", 16824 green: "#008000", 16825 lime: "#00ff00", 16826 maroon: "#800000", 16827 navy: "#000080", 16828 olive: "#808000", 16829 purple: "#800080", 16830 red: "#ff0000", 16831 silver: "#c0c0c0", 16832 teal: "#008080", 16833 white: "#ffffff", 16834 yellow: "#ffff00", 16835 16836 // 4.2.3. "transparent" color keyword 16837 transparent: [null, null, null, 0], 16838 16839 _default: "#ffffff" 16840 }; 16841 16842 })(jQuery); 16843 16844 /******************************************************************************/ 16845 /****************************** CLASS ANIMATIONS ******************************/ 16846 /******************************************************************************/ 16847 (function () { 16848 16849 var classAnimationActions = ["add", "remove", "toggle"], 16850 shorthandStyles = { 16851 border: 1, 16852 borderBottom: 1, 16853 borderColor: 1, 16854 borderLeft: 1, 16855 borderRight: 1, 16856 borderTop: 1, 16857 borderWidth: 1, 16858 margin: 1, 16859 padding: 1 16860 }; 16861 16862 $.each( 16863 ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], 16864 function (_, prop) { 16865 $.fx.step[prop] = function (fx) { 16866 if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) { 16867 jQuery.style(fx.elem, prop, fx.end); 16868 fx.setAttr = true; 16869 } 16870 }; 16871 } 16872 ); 16873 16874 function getElementStyles(elem) { 16875 var key, len, 16876 style = elem.ownerDocument.defaultView ? 16877 elem.ownerDocument.defaultView.getComputedStyle(elem, null) : 16878 elem.currentStyle, 16879 styles = {}; 16880 16881 if (style && style.length && style[0] && style[style[0]]) { 16882 len = style.length; 16883 while (len--) { 16884 key = style[len]; 16885 if (typeof style[key] === "string") { 16886 styles[$.camelCase(key)] = style[key]; 16887 } 16888 } 16889 16890 // Support: Opera, IE <9 16891 } else { 16892 for (key in style) { 16893 if (typeof style[key] === "string") { 16894 styles[key] = style[key]; 16895 } 16896 } 16897 } 16898 16899 return styles; 16900 } 16901 16902 function styleDifference(oldStyle, newStyle) { 16903 var diff = {}, 16904 name, value; 16905 16906 for (name in newStyle) { 16907 value = newStyle[name]; 16908 if (oldStyle[name] !== value) { 16909 if (!shorthandStyles[name]) { 16910 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 16911 diff[name] = value; 16912 } 16913 } 16914 } 16915 } 16916 16917 return diff; 16918 } 16919 16920 // Support: jQuery <1.8 16921 if (!$.fn.addBack) { 16922 $.fn.addBack = function (selector) { 16923 return this.add(selector == null ? 16924 this.prevObject : this.prevObject.filter(selector) 16925 ); 16926 }; 16927 } 16928 16929 $.effects.animateClass = function (value, duration, easing, callback) { 16930 var o = $.speed(duration, easing, callback); 16931 16932 return this.queue(function () { 16933 var animated = $(this), 16934 baseClass = animated.attr("class") || "", 16935 applyClassChange, 16936 allAnimations = o.children ? animated.find("*").addBack() : animated; 16937 16938 // Map the animated objects to store the original styles. 16939 allAnimations = allAnimations.map(function () { 16940 var el = $(this); 16941 return { 16942 el: el, 16943 start: getElementStyles(this) 16944 }; 16945 }); 16946 16947 // Apply class change 16948 applyClassChange = function () { 16949 $.each(classAnimationActions, function (i, action) { 16950 if (value[action]) { 16951 animated[action + "Class"](value[action]); 16952 } 16953 }); 16954 }; 16955 applyClassChange(); 16956 16957 // Map all animated objects again - calculate new styles and diff 16958 allAnimations = allAnimations.map(function () { 16959 this.end = getElementStyles(this.el[0]); 16960 this.diff = styleDifference(this.start, this.end); 16961 return this; 16962 }); 16963 16964 // Apply original class 16965 animated.attr("class", baseClass); 16966 16967 // Map all animated objects again - this time collecting a promise 16968 allAnimations = allAnimations.map(function () { 16969 var styleInfo = this, 16970 dfd = $.Deferred(), 16971 opts = $.extend({}, o, { 16972 queue: false, 16973 complete: function () { 16974 dfd.resolve(styleInfo); 16975 } 16976 }); 16977 16978 this.el.animate(this.diff, opts); 16979 return dfd.promise(); 16980 }); 16981 16982 // Once all animations have completed: 16983 $.when.apply($, allAnimations.get()).done(function () { 16984 16985 // Set the final class 16986 applyClassChange(); 16987 16988 // For each animated element, 16989 // clear all css properties that were animated 16990 $.each(arguments, function () { 16991 var el = this.el; 16992 $.each(this.diff, function (key) { 16993 el.css(key, ""); 16994 }); 16995 }); 16996 16997 // This is guarnteed to be there if you use jQuery.speed() 16998 // it also handles dequeuing the next anim... 16999 o.complete.call(animated[0]); 17000 }); 17001 }); 17002 }; 17003 17004 $.fn.extend({ 17005 addClass: (function (orig) { 17006 return function (classNames, speed, easing, callback) { 17007 return speed ? 17008 $.effects.animateClass.call(this, 17009 { add: classNames }, speed, easing, callback) : 17010 orig.apply(this, arguments); 17011 }; 17012 })($.fn.addClass), 17013 17014 removeClass: (function (orig) { 17015 return function (classNames, speed, easing, callback) { 17016 return arguments.length > 1 ? 17017 $.effects.animateClass.call(this, 17018 { remove: classNames }, speed, easing, callback) : 17019 orig.apply(this, arguments); 17020 }; 17021 })($.fn.removeClass), 17022 17023 toggleClass: (function (orig) { 17024 return function (classNames, force, speed, easing, callback) { 17025 if (typeof force === "boolean" || force === undefined) { 17026 if (!speed) { 17027 17028 // Without speed parameter 17029 return orig.apply(this, arguments); 17030 } else { 17031 return $.effects.animateClass.call(this, 17032 (force ? { add: classNames } : { remove: classNames }), 17033 speed, easing, callback); 17034 } 17035 } else { 17036 17037 // Without force parameter 17038 return $.effects.animateClass.call(this, 17039 { toggle: classNames }, force, speed, easing); 17040 } 17041 }; 17042 })($.fn.toggleClass), 17043 17044 switchClass: function (remove, add, speed, easing, callback) { 17045 return $.effects.animateClass.call(this, { 17046 add: add, 17047 remove: remove 17048 }, speed, easing, callback); 17049 } 17050 }); 17051 17052 })(); 17053 17054 /******************************************************************************/ 17055 /*********************************** EFFECTS **********************************/ 17056 /******************************************************************************/ 17057 17058 (function () { 17059 17060 if ($.expr && $.expr.filters && $.expr.filters.animated) { 17061 $.expr.filters.animated = (function (orig) { 17062 return function (elem) { 17063 return !!$(elem).data(dataSpaceAnimated) || orig(elem); 17064 }; 17065 })($.expr.filters.animated); 17066 } 17067 17068 if ($.uiBackCompat !== false) { 17069 $.extend($.effects, { 17070 17071 // Saves a set of properties in a data storage 17072 save: function (element, set) { 17073 var i = 0, length = set.length; 17074 for (; i < length; i++) { 17075 if (set[i] !== null) { 17076 element.data(dataSpace + set[i], element[0].style[set[i]]); 17077 } 17078 } 17079 }, 17080 17081 // Restores a set of previously saved properties from a data storage 17082 restore: function (element, set) { 17083 var val, i = 0, length = set.length; 17084 for (; i < length; i++) { 17085 if (set[i] !== null) { 17086 val = element.data(dataSpace + set[i]); 17087 element.css(set[i], val); 17088 } 17089 } 17090 }, 17091 17092 setMode: function (el, mode) { 17093 if (mode === "toggle") { 17094 mode = el.is(":hidden") ? "show" : "hide"; 17095 } 17096 return mode; 17097 }, 17098
vendor: 4,773 bytes, lines 17099-17291
17099 // Wraps the element around a wrapper that copies position properties 17100 createWrapper: function (element) { 17101 17102 // If the element is already wrapped, return it 17103 if (element.parent().is(".ui-effects-wrapper")) { 17104 return element.parent(); 17105 } 17106 17107 // Wrap the element 17108 var props = { 17109 width: element.outerWidth(true), 17110 height: element.outerHeight(true), 17111 "float": element.css("float") 17112 }, 17113 wrapper = $("<div></div>") 17114 .addClass("ui-effects-wrapper") 17115 .css({ 17116 fontSize: "100%", 17117 background: "transparent", 17118 border: "none", 17119 margin: 0, 17120 padding: 0 17121 }), 17122 17123 // Store the size in case width/height are defined in % - Fixes #5245 17124 size = { 17125 width: element.width(), 17126 height: element.height() 17127 }, 17128 active = document.activeElement; 17129 17130 // Support: Firefox 17131 // Firefox incorrectly exposes anonymous content 17132 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 17133 try { 17134 active.id; 17135 } catch (e) { 17136 active = document.body; 17137 } 17138 17139 element.wrap(wrapper); 17140 17141 // Fixes #7595 - Elements lose focus when wrapped. 17142 if (element[0] === active || $.contains(element[0], active)) { 17143 $(active).trigger("focus"); 17144 } 17145 17146 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 17147 // lose the reference to the wrapped element 17148 wrapper = element.parent(); 17149 17150 // Transfer positioning properties to the wrapper 17151 if (element.css("position") === "static") { 17152 wrapper.css({ position: "relative" }); 17153 element.css({ position: "relative" }); 17154 } else { 17155 $.extend(props, { 17156 position: element.css("position"), 17157 zIndex: element.css("z-index") 17158 }); 17159 $.each(["top", "left", "bottom", "right"], function (i, pos) { 17160 props[pos] = element.css(pos); 17161 if (isNaN(parseInt(props[pos], 10))) { 17162 props[pos] = "auto"; 17163 } 17164 }); 17165 element.css({ 17166 position: "relative", 17167 top: 0, 17168 left: 0, 17169 right: "auto", 17170 bottom: "auto" 17171 }); 17172 } 17173 element.css(size); 17174 17175 return wrapper.css(props).show(); 17176 }, 17177 17178 removeWrapper: function (element) { 17179 var active = document.activeElement; 17180 17181 if (element.parent().is(".ui-effects-wrapper")) { 17182 element.parent().replaceWith(element); 17183 17184 // Fixes #7595 - Elements lose focus when wrapped. 17185 if (element[0] === active || $.contains(element[0], active)) { 17186 $(active).trigger("focus"); 17187 } 17188 } 17189 17190 return element; 17191 } 17192 }); 17193 } 17194 17195 $.extend($.effects, { 17196 version: "1.12.1", 17197 17198 define: function (name, mode, effect) { 17199 if (!effect) { 17200 effect = mode; 17201 mode = "effect"; 17202 } 17203 17204 $.effects.effect[name] = effect; 17205 $.effects.effect[name].mode = mode; 17206 17207 return effect; 17208 }, 17209 17210 scaledDimensions: function (element, percent, direction) { 17211 if (percent === 0) { 17212 return { 17213 height: 0, 17214 width: 0, 17215 outerHeight: 0, 17216 outerWidth: 0 17217 }; 17218 } 17219 17220 var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1, 17221 y = direction !== "vertical" ? ((percent || 100) / 100) : 1; 17222 17223 return { 17224 height: element.height() * y, 17225 width: element.width() * x, 17226 outerHeight: element.outerHeight() * y, 17227 outerWidth: element.outerWidth() * x 17228 }; 17229 17230 }, 17231 17232 clipToBox: function (animation) { 17233 return { 17234 width: animation.clip.right - animation.clip.left, 17235 height: animation.clip.bottom - animation.clip.top, 17236 left: animation.clip.left, 17237 top: animation.clip.top 17238 }; 17239 }, 17240 17241 // Injects recently queued functions to be first in line (after "inprogress") 17242 unshift: function (element, queueLength, count) { 17243 var queue = element.queue(); 17244 17245 if (queueLength > 1) { 17246 queue.splice.apply(queue, 17247 [1, 0].concat(queue.splice(queueLength, count))); 17248 } 17249 element.dequeue(); 17250 }, 17251 17252 saveStyle: function (element) { 17253 element.data(dataSpaceStyle, element[0].style.cssText); 17254 }, 17255 17256 restoreStyle: function (element) { 17257 element[0].style.cssText = element.data(dataSpaceStyle) || ""; 17258 element.removeData(dataSpaceStyle); 17259 }, 17260 17261 mode: function (element, mode) { 17262 var hidden = element.is(":hidden"); 17263 17264 if (mode === "toggle") { 17265 mode = hidden ? "show" : "hide"; 17266 } 17267 if (hidden ? mode === "hide" : mode === "show") { 17268 mode = "none"; 17269 } 17270 return mode; 17271 }, 17272 17273 // Translates a [top,left] array into a baseline value 17274 getBaseline: function (origin, original) { 17275 var y, x; 17276 17277 switch (origin[0]) { 17278 case "top": 17279 y = 0; 17280 break; 17281 case "middle": 17282 y = 0.5; 17283 break; 17284 case "bottom": 17285 y = 1; 17286 break; 17287 default: 17288 y = origin[0] / original.height; 17289 } 17290 17291 switch (origin[1]) {
vendor: 19,964 bytes, lines 17292-18051
17292 case "left": 17293 x = 0; 17294 break; 17295 case "center": 17296 x = 0.5; 17297 break; 17298 case "right": 17299 x = 1; 17300 break; 17301 default: 17302 x = origin[1] / original.width; 17303 } 17304 17305 return { 17306 x: x, 17307 y: y 17308 }; 17309 }, 17310 17311 // Creates a placeholder element so that the original element can be made absolute 17312 createPlaceholder: function (element) { 17313 var placeholder, 17314 cssPosition = element.css("position"), 17315 position = element.position(); 17316 17317 // Lock in margins first to account for form elements, which 17318 // will change margin if you explicitly set height 17319 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 17320 // Support: Safari 17321 element.css({ 17322 marginTop: element.css("marginTop"), 17323 marginBottom: element.css("marginBottom"), 17324 marginLeft: element.css("marginLeft"), 17325 marginRight: element.css("marginRight") 17326 }) 17327 .outerWidth(element.outerWidth()) 17328 .outerHeight(element.outerHeight()); 17329 17330 if (/^(static|relative)/.test(cssPosition)) { 17331 cssPosition = "absolute"; 17332 17333 placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({ 17334 17335 // Convert inline to inline block to account for inline elements 17336 // that turn to inline block based on content (like img) 17337 display: /^(inline|ruby)/.test(element.css("display")) ? 17338 "inline-block" : 17339 "block", 17340 visibility: "hidden", 17341 17342 // Margins need to be set to account for margin collapse 17343 marginTop: element.css("marginTop"), 17344 marginBottom: element.css("marginBottom"), 17345 marginLeft: element.css("marginLeft"), 17346 marginRight: element.css("marginRight"), 17347 "float": element.css("float") 17348 }) 17349 .outerWidth(element.outerWidth()) 17350 .outerHeight(element.outerHeight()) 17351 .addClass("ui-effects-placeholder"); 17352 17353 element.data(dataSpace + "placeholder", placeholder); 17354 } 17355 17356 element.css({ 17357 position: cssPosition, 17358 left: position.left, 17359 top: position.top 17360 }); 17361 17362 return placeholder; 17363 }, 17364 17365 removePlaceholder: function (element) { 17366 var dataKey = dataSpace + "placeholder", 17367 placeholder = element.data(dataKey); 17368 17369 if (placeholder) { 17370 placeholder.remove(); 17371 element.removeData(dataKey); 17372 } 17373 }, 17374 17375 // Removes a placeholder if it exists and restores 17376 // properties that were modified during placeholder creation 17377 cleanUp: function (element) { 17378 $.effects.restoreStyle(element); 17379 $.effects.removePlaceholder(element); 17380 }, 17381 17382 setTransition: function (element, list, factor, value) { 17383 value = value || {}; 17384 $.each(list, function (i, x) { 17385 var unit = element.cssUnit(x); 17386 if (unit[0] > 0) { 17387 value[x] = unit[0] * factor + unit[1]; 17388 } 17389 }); 17390 return value; 17391 } 17392 }); 17393 17394 // Return an effect options object for the given parameters: 17395 function _normalizeArguments(effect, options, speed, callback) { 17396 17397 // Allow passing all options as the first parameter 17398 if ($.isPlainObject(effect)) { 17399 options = effect; 17400 effect = effect.effect; 17401 } 17402 17403 // Convert to an object 17404 effect = { effect: effect }; 17405 17406 // Catch (effect, null, ...) 17407 if (options == null) { 17408 options = {}; 17409 } 17410 17411 // Catch (effect, callback) 17412 if ($.isFunction(options)) { 17413 callback = options; 17414 speed = null; 17415 options = {}; 17416 } 17417 17418 // Catch (effect, speed, ?) 17419 if (typeof options === "number" || $.fx.speeds[options]) { 17420 callback = speed; 17421 speed = options; 17422 options = {}; 17423 } 17424 17425 // Catch (effect, options, callback) 17426 if ($.isFunction(speed)) { 17427 callback = speed; 17428 speed = null; 17429 } 17430 17431 // Add options to effect 17432 if (options) { 17433 $.extend(effect, options); 17434 } 17435 17436 speed = speed || options.duration; 17437 effect.duration = $.fx.off ? 0 : 17438 typeof speed === "number" ? speed : 17439 speed in $.fx.speeds ? $.fx.speeds[speed] : 17440 $.fx.speeds._default; 17441 17442 effect.complete = callback || options.complete; 17443 17444 return effect; 17445 } 17446 17447 function standardAnimationOption(option) { 17448 17449 // Valid standard speeds (nothing, number, named speed) 17450 if (!option || typeof option === "number" || $.fx.speeds[option]) { 17451 return true; 17452 } 17453 17454 // Invalid strings - treat as "normal" speed 17455 if (typeof option === "string" && !$.effects.effect[option]) { 17456 return true; 17457 } 17458 17459 // Complete callback 17460 if ($.isFunction(option)) { 17461 return true; 17462 } 17463 17464 // Options hash (but not naming an effect) 17465 if (typeof option === "object" && !option.effect) { 17466 return true; 17467 } 17468 17469 // Didn't match any standard API 17470 return false; 17471 } 17472 17473 $.fn.extend({ 17474 effect: function ( /* effect, options, speed, callback */) { 17475 var args = _normalizeArguments.apply(this, arguments), 17476 effectMethod = $.effects.effect[args.effect], 17477 defaultMode = effectMethod.mode, 17478 queue = args.queue, 17479 queueName = queue || "fx", 17480 complete = args.complete, 17481 mode = args.mode, 17482 modes = [], 17483 prefilter = function (next) { 17484 var el = $(this), 17485 normalizedMode = $.effects.mode(el, mode) || defaultMode; 17486 17487 // Sentinel for duck-punching the :animated psuedo-selector 17488 el.data(dataSpaceAnimated, true); 17489 17490 // Save effect mode for later use, 17491 // we can't just call $.effects.mode again later, 17492 // as the .show() below destroys the initial state 17493 modes.push(normalizedMode); 17494 17495 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13 17496 if (defaultMode && (normalizedMode === "show" || 17497 (normalizedMode === defaultMode && normalizedMode === "hide"))) { 17498 el.show(); 17499 } 17500 17501 if (!defaultMode || normalizedMode !== "none") { 17502 $.effects.saveStyle(el); 17503 } 17504 17505 if ($.isFunction(next)) { 17506 next(); 17507 } 17508 }; 17509 17510 if ($.fx.off || !effectMethod) { 17511 17512 // Delegate to the original method (e.g., .show()) if possible 17513 if (mode) { 17514 return this[mode](args.duration, complete); 17515 } else { 17516 return this.each(function () { 17517 if (complete) { 17518 complete.call(this); 17519 } 17520 }); 17521 } 17522 } 17523 17524 function run(next) { 17525 var elem = $(this); 17526 17527 function cleanup() { 17528 elem.removeData(dataSpaceAnimated); 17529 17530 $.effects.cleanUp(elem); 17531 17532 if (args.mode === "hide") { 17533 elem.hide(); 17534 } 17535 17536 done(); 17537 } 17538 17539 function done() { 17540 if ($.isFunction(complete)) { 17541 complete.call(elem[0]); 17542 } 17543 17544 if ($.isFunction(next)) { 17545 next(); 17546 } 17547 } 17548 17549 // Override mode option on a per element basis, 17550 // as toggle can be either show or hide depending on element state 17551 args.mode = modes.shift(); 17552 17553 if ($.uiBackCompat !== false && !defaultMode) { 17554 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 17555 17556 // Call the core method to track "olddisplay" properly 17557 elem[mode](); 17558 done(); 17559 } else { 17560 effectMethod.call(elem[0], args, done); 17561 } 17562 } else { 17563 if (args.mode === "none") { 17564 17565 // Call the core method to track "olddisplay" properly 17566 elem[mode](); 17567 done(); 17568 } else { 17569 effectMethod.call(elem[0], args, cleanup); 17570 } 17571 } 17572 } 17573 17574 // Run prefilter on all elements first to ensure that 17575 // any showing or hiding happens before placeholder creation, 17576 // which ensures that any layout changes are correctly captured. 17577 return queue === false ? 17578 this.each(prefilter).each(run) : 17579 this.queue(queueName, prefilter).queue(queueName, run); 17580 }, 17581 17582 show: (function (orig) { 17583 return function (option) { 17584 if (standardAnimationOption(option)) { 17585 return orig.apply(this, arguments); 17586 } else { 17587 var args = _normalizeArguments.apply(this, arguments); 17588 args.mode = "show"; 17589 return this.effect.call(this, args); 17590 } 17591 }; 17592 })($.fn.show), 17593 17594 hide: (function (orig) { 17595 return function (option) { 17596 if (standardAnimationOption(option)) { 17597 return orig.apply(this, arguments); 17598 } else { 17599 var args = _normalizeArguments.apply(this, arguments); 17600 args.mode = "hide"; 17601 return this.effect.call(this, args); 17602 } 17603 }; 17604 })($.fn.hide), 17605 17606 toggle: (function (orig) { 17607 return function (option) { 17608 if (standardAnimationOption(option) || typeof option === "boolean") { 17609 return orig.apply(this, arguments); 17610 } else { 17611 var args = _normalizeArguments.apply(this, arguments); 17612 args.mode = "toggle"; 17613 return this.effect.call(this, args); 17614 } 17615 }; 17616 })($.fn.toggle), 17617 17618 cssUnit: function (key) { 17619 var style = this.css(key), 17620 val = []; 17621 17622 $.each(["em", "px", "%", "pt"], function (i, unit) { 17623 if (style.indexOf(unit) > 0) { 17624 val = [parseFloat(style), unit]; 17625 } 17626 }); 17627 return val; 17628 }, 17629 17630 cssClip: function (clipObj) { 17631 if (clipObj) { 17632 return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 17633 clipObj.bottom + "px " + clipObj.left + "px)"); 17634 } 17635 return parseClip(this.css("clip"), this); 17636 }, 17637 17638 transfer: function (options, done) { 17639 var element = $(this), 17640 target = $(options.to), 17641 targetFixed = target.css("position") === "fixed", 17642 body = $("body"), 17643 fixTop = targetFixed ? body.scrollTop() : 0, 17644 fixLeft = targetFixed ? body.scrollLeft() : 0, 17645 endPosition = target.offset(), 17646 animation = { 17647 top: endPosition.top - fixTop, 17648 left: endPosition.left - fixLeft, 17649 height: target.innerHeight(), 17650 width: target.innerWidth() 17651 }, 17652 startPosition = element.offset(), 17653 transfer = $("<div class='ui-effects-transfer'></div>") 17654 .appendTo("body") 17655 .addClass(options.className) 17656 .css({ 17657 top: startPosition.top - fixTop, 17658 left: startPosition.left - fixLeft, 17659 height: element.innerHeight(), 17660 width: element.innerWidth(), 17661 position: targetFixed ? "fixed" : "absolute" 17662 }) 17663 .animate(animation, options.duration, options.easing, function () { 17664 transfer.remove(); 17665 if ($.isFunction(done)) { 17666 done(); 17667 } 17668 }); 17669 } 17670 }); 17671 17672 function parseClip(str, element) { 17673 var outerWidth = element.outerWidth(), 17674 outerHeight = element.outerHeight(), 17675 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)\)$/, 17676 values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0]; 17677 17678 return { 17679 top: parseFloat(values[1]) || 0, 17680 right: values[2] === "auto" ? outerWidth : parseFloat(values[2]), 17681 bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]), 17682 left: parseFloat(values[4]) || 0 17683 }; 17684 } 17685 17686 $.fx.step.clip = function (fx) { 17687 if (!fx.clipInit) { 17688 fx.start = $(fx.elem).cssClip(); 17689 if (typeof fx.end === "string") { 17690 fx.end = parseClip(fx.end, fx.elem); 17691 } 17692 fx.clipInit = true; 17693 } 17694 17695 $(fx.elem).cssClip({ 17696 top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top, 17697 right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right, 17698 bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom, 17699 left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left 17700 }); 17701 }; 17702 17703 })(); 17704 17705 /******************************************************************************/ 17706 /*********************************** EASING ***********************************/ 17707 /******************************************************************************/ 17708 17709 (function () { 17710 17711 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 17712 17713 var baseEasings = {}; 17714 17715 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) { 17716 baseEasings[name] = function (p) { 17717 return Math.pow(p, i + 2); 17718 }; 17719 }); 17720 17721 $.extend(baseEasings, { 17722 Sine: function (p) { 17723 return 1 - Math.cos(p * Math.PI / 2); 17724 }, 17725 Circ: function (p) { 17726 return 1 - Math.sqrt(1 - p * p); 17727 }, 17728 Elastic: function (p) { 17729 return p === 0 || p === 1 ? p : 17730 -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); 17731 }, 17732 Back: function (p) { 17733 return p * p * (3 * p - 2); 17734 }, 17735 Bounce: function (p) { 17736 var pow2, 17737 bounce = 4; 17738 17739 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { } 17740 return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); 17741 } 17742 }); 17743 17744 $.each(baseEasings, function (name, easeIn) { 17745 $.easing["easeIn" + name] = easeIn; 17746 $.easing["easeOut" + name] = function (p) { 17747 return 1 - easeIn(1 - p); 17748 }; 17749 $.easing["easeInOut" + name] = function (p) { 17750 return p < 0.5 ? 17751 easeIn(p * 2) / 2 : 17752 1 - easeIn(p * -2 + 2) / 2; 17753 }; 17754 }); 17755 17756 })(); 17757 17758 var effect = $.effects; 17759 17760 17761 /*! 17762 * jQuery UI Effects Blind 1.12.1 17763 * http://jqueryui.com 17764 * 17765 * Copyright jQuery Foundation and other contributors 17766 * Released under the MIT license. 17767 * http://jquery.org/license 17768 */ 17769 17770 //>>label: Blind Effect 17771 //>>group: Effects 17772 //>>description: Blinds the element. 17773 //>>docs: http://api.jqueryui.com/blind-effect/ 17774 //>>demos: http://jqueryui.com/effect/ 17775 17776 17777 17778 var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) { 17779 var map = { 17780 up: ["bottom", "top"], 17781 vertical: ["bottom", "top"], 17782 down: ["top", "bottom"], 17783 left: ["right", "left"], 17784 horizontal: ["right", "left"], 17785 right: ["left", "right"] 17786 }, 17787 element = $(this), 17788 direction = options.direction || "up", 17789 start = element.cssClip(), 17790 animate = { clip: $.extend({}, start) }, 17791 placeholder = $.effects.createPlaceholder(element); 17792 17793 animate.clip[map[direction][0]] = animate.clip[map[direction][1]]; 17794 17795 if (options.mode === "show") { 17796 element.cssClip(animate.clip); 17797 if (placeholder) { 17798 placeholder.css($.effects.clipToBox(animate)); 17799 } 17800 17801 animate.clip = start; 17802 } 17803 17804 if (placeholder) { 17805 placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing); 17806 } 17807 17808 element.animate(animate, { 17809 queue: false, 17810 duration: options.duration, 17811 easing: options.easing, 17812 complete: done 17813 }); 17814 }); 17815 17816 17817 /*! 17818 * jQuery UI Effects Bounce 1.12.1 17819 * http://jqueryui.com 17820 * 17821 * Copyright jQuery Foundation and other contributors 17822 * Released under the MIT license. 17823 * http://jquery.org/license 17824 */ 17825 17826 //>>label: Bounce Effect 17827 //>>group: Effects 17828 //>>description: Bounces an element horizontally or vertically n times. 17829 //>>docs: http://api.jqueryui.com/bounce-effect/ 17830 //>>demos: http://jqueryui.com/effect/ 17831 17832 17833 17834 var effectsEffectBounce = $.effects.define("bounce", function (options, done) { 17835 var upAnim, downAnim, refValue, 17836 element = $(this), 17837 17838 // Defaults: 17839 mode = options.mode, 17840 hide = mode === "hide", 17841 show = mode === "show", 17842 direction = options.direction || "up", 17843 distance = options.distance, 17844 times = options.times || 5, 17845 17846 // Number of internal animations 17847 anims = times * 2 + (show || hide ? 1 : 0), 17848 speed = options.duration / anims, 17849 easing = options.easing, 17850 17851 // Utility: 17852 ref = (direction === "up" || direction === "down") ? "top" : "left", 17853 motion = (direction === "up" || direction === "left"), 17854 i = 0, 17855 17856 queuelen = element.queue().length; 17857 17858 $.effects.createPlaceholder(element); 17859 17860 refValue = element.css(ref); 17861 17862 // Default distance for the BIGGEST bounce is the outer Distance / 3 17863 if (!distance) { 17864 distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 17865 } 17866 17867 if (show) { 17868 downAnim = { opacity: 1 }; 17869 downAnim[ref] = refValue; 17870 17871 // If we are showing, force opacity 0 and set the initial position 17872 // then do the "first" animation 17873 element 17874 .css("opacity", 0) 17875 .css(ref, motion ? -distance * 2 : distance * 2) 17876 .animate(downAnim, speed, easing); 17877 } 17878 17879 // Start at the smallest distance if we are hiding 17880 if (hide) { 17881 distance = distance / Math.pow(2, times - 1); 17882 } 17883 17884 downAnim = {}; 17885 downAnim[ref] = refValue; 17886 17887 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 17888 for (; i < times; i++) { 17889 upAnim = {}; 17890 upAnim[ref] = (motion ? "-=" : "+=") + distance; 17891 17892 element 17893 .animate(upAnim, speed, easing) 17894 .animate(downAnim, speed, easing); 17895 17896 distance = hide ? distance * 2 : distance / 2; 17897 } 17898 17899 // Last Bounce when Hiding 17900 if (hide) { 17901 upAnim = { opacity: 0 }; 17902 upAnim[ref] = (motion ? "-=" : "+=") + distance; 17903 17904 element.animate(upAnim, speed, easing); 17905 } 17906 17907 element.queue(done); 17908 17909 $.effects.unshift(element, queuelen, anims + 1); 17910 }); 17911 17912 17913 /*! 17914 * jQuery UI Effects Clip 1.12.1 17915 * http://jqueryui.com 17916 * 17917 * Copyright jQuery Foundation and other contributors 17918 * Released under the MIT license. 17919 * http://jquery.org/license 17920 */ 17921 17922 //>>label: Clip Effect 17923 //>>group: Effects 17924 //>>description: Clips the element on and off like an old TV. 17925 //>>docs: http://api.jqueryui.com/clip-effect/ 17926 //>>demos: http://jqueryui.com/effect/ 17927 17928 17929 17930 var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) { 17931 var start, 17932 animate = {}, 17933 element = $(this), 17934 direction = options.direction || "vertical", 17935 both = direction === "both", 17936 horizontal = both || direction === "horizontal", 17937 vertical = both || direction === "vertical"; 17938 17939 start = element.cssClip(); 17940 animate.clip = { 17941 top: vertical ? (start.bottom - start.top) / 2 : start.top, 17942 right: horizontal ? (start.right - start.left) / 2 : start.right, 17943 bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom, 17944 left: horizontal ? (start.right - start.left) / 2 : start.left 17945 }; 17946 17947 $.effects.createPlaceholder(element); 17948 17949 if (options.mode === "show") { 17950 element.cssClip(animate.clip); 17951 animate.clip = start; 17952 } 17953 17954 element.animate(animate, { 17955 queue: false, 17956 duration: options.duration, 17957 easing: options.easing, 17958 complete: done 17959 }); 17960 17961 }); 17962 17963 17964 /*! 17965 * jQuery UI Effects Drop 1.12.1 17966 * http://jqueryui.com 17967 * 17968 * Copyright jQuery Foundation and other contributors 17969 * Released under the MIT license. 17970 * http://jquery.org/license 17971 */ 17972 17973 //>>label: Drop Effect 17974 //>>group: Effects 17975 //>>description: Moves an element in one direction and hides it at the same time. 17976 //>>docs: http://api.jqueryui.com/drop-effect/ 17977 //>>demos: http://jqueryui.com/effect/ 17978 17979 17980 17981 var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) { 17982 17983 var distance, 17984 element = $(this), 17985 mode = options.mode, 17986 show = mode === "show", 17987 direction = options.direction || "left", 17988 ref = (direction === "up" || direction === "down") ? "top" : "left", 17989 motion = (direction === "up" || direction === "left") ? "-=" : "+=", 17990 oppositeMotion = (motion === "+=") ? "-=" : "+=", 17991 animation = { 17992 opacity: 0 17993 }; 17994 17995 $.effects.createPlaceholder(element); 17996 17997 distance = options.distance || 17998 element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 17999 18000 animation[ref] = motion + distance; 18001 18002 if (show) { 18003 element.css(animation); 18004 18005 animation[ref] = oppositeMotion + distance; 18006 animation.opacity = 1; 18007 } 18008 18009 // Animate 18010 element.animate(animation, { 18011 queue: false, 18012 duration: options.duration, 18013 easing: options.easing, 18014 complete: done 18015 }); 18016 }); 18017 18018 18019 /*! 18020 * jQuery UI Effects Explode 1.12.1 18021 * http://jqueryui.com 18022 * 18023 * Copyright jQuery Foundation and other contributors 18024 * Released under the MIT license. 18025 * http://jquery.org/license 18026 */ 18027 18028 //>>label: Explode Effect 18029 //>>group: Effects 18030 // jscs:disable maximumLineLength 18031 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 18032 // jscs:enable maximumLineLength 18033 //>>docs: http://api.jqueryui.com/explode-effect/ 18034 //>>demos: http://jqueryui.com/effect/ 18035 18036 18037 18038 var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) { 18039 18040 var i, j, left, top, mx, my, 18041 rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, 18042 cells = rows, 18043 element = $(this), 18044 mode = options.mode, 18045 show = mode === "show", 18046 18047 // Show and then visibility:hidden the element before calculating offset 18048 offset = element.show().css("visibility", "hidden").offset(), 18049 18050 // Width and height of a piece 18051 width = Math.ceil(element.outerWidth() / cells),
vendor: 5,368 bytes, lines 18052-18276
18052 height = Math.ceil(element.outerHeight() / rows), 18053 pieces = []; 18054 18055 // Children animate complete: 18056 function childComplete() { 18057 pieces.push(this); 18058 if (pieces.length === rows * cells) { 18059 animComplete(); 18060 } 18061 } 18062 18063 // Clone the element for each row and cell. 18064 for (i = 0; i < rows; i++) { // ===> 18065 top = offset.top + i * height; 18066 my = i - (rows - 1) / 2; 18067 18068 for (j = 0; j < cells; j++) { // ||| 18069 left = offset.left + j * width; 18070 mx = j - (cells - 1) / 2; 18071 18072 // Create a clone of the now hidden main element that will be absolute positioned 18073 // within a wrapper div off the -left and -top equal to size of our pieces 18074 element 18075 .clone() 18076 .appendTo("body") 18077 .wrap("<div></div>") 18078 .css({ 18079 position: "absolute", 18080 visibility: "visible", 18081 left: -j * width, 18082 top: -i * height 18083 }) 18084 18085 // Select the wrapper - make it overflow: hidden and absolute positioned based on 18086 // where the original was located +left and +top equal to the size of pieces 18087 .parent() 18088 .addClass("ui-effects-explode") 18089 .css({ 18090 position: "absolute", 18091 overflow: "hidden", 18092 width: width, 18093 height: height, 18094 left: left + (show ? mx * width : 0), 18095 top: top + (show ? my * height : 0), 18096 opacity: show ? 0 : 1 18097 }) 18098 .animate({ 18099 left: left + (show ? 0 : mx * width), 18100 top: top + (show ? 0 : my * height), 18101 opacity: show ? 1 : 0 18102 }, options.duration || 500, options.easing, childComplete); 18103 } 18104 } 18105 18106 function animComplete() { 18107 element.css({ 18108 visibility: "visible" 18109 }); 18110 $(pieces).remove(); 18111 done(); 18112 } 18113 }); 18114 18115 18116 /*! 18117 * jQuery UI Effects Fade 1.12.1 18118 * http://jqueryui.com 18119 * 18120 * Copyright jQuery Foundation and other contributors 18121 * Released under the MIT license. 18122 * http://jquery.org/license 18123 */ 18124 18125 //>>label: Fade Effect 18126 //>>group: Effects 18127 //>>description: Fades the element. 18128 //>>docs: http://api.jqueryui.com/fade-effect/ 18129 //>>demos: http://jqueryui.com/effect/ 18130 18131 18132 18133 var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) { 18134 var show = options.mode === "show"; 18135 18136 $(this) 18137 .css("opacity", show ? 0 : 1) 18138 .animate({ 18139 opacity: show ? 1 : 0 18140 }, { 18141 queue: false, 18142 duration: options.duration, 18143 easing: options.easing, 18144 complete: done 18145 }); 18146 }); 18147 18148 18149 /*! 18150 * jQuery UI Effects Fold 1.12.1 18151 * http://jqueryui.com 18152 * 18153 * Copyright jQuery Foundation and other contributors 18154 * Released under the MIT license. 18155 * http://jquery.org/license 18156 */ 18157 18158 //>>label: Fold Effect 18159 //>>group: Effects 18160 //>>description: Folds an element first horizontally and then vertically. 18161 //>>docs: http://api.jqueryui.com/fold-effect/ 18162 //>>demos: http://jqueryui.com/effect/ 18163 18164 18165 18166 var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) { 18167 18168 // Create element 18169 var element = $(this), 18170 mode = options.mode, 18171 show = mode === "show", 18172 hide = mode === "hide", 18173 size = options.size || 15, 18174 percent = /([0-9]+)%/.exec(size), 18175 horizFirst = !!options.horizFirst, 18176 ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"], 18177 duration = options.duration / 2, 18178 18179 placeholder = $.effects.createPlaceholder(element), 18180 18181 start = element.cssClip(), 18182 animation1 = { clip: $.extend({}, start) }, 18183 animation2 = { clip: $.extend({}, start) }, 18184 18185 distance = [start[ref[0]], start[ref[1]]], 18186 18187 queuelen = element.queue().length; 18188 18189 if (percent) { 18190 size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1]; 18191 } 18192 animation1.clip[ref[0]] = size; 18193 animation2.clip[ref[0]] = size; 18194 animation2.clip[ref[1]] = 0; 18195 18196 if (show) { 18197 element.cssClip(animation2.clip); 18198 if (placeholder) { 18199 placeholder.css($.effects.clipToBox(animation2)); 18200 } 18201 18202 animation2.clip = start; 18203 } 18204 18205 // Animate 18206 element 18207 .queue(function (next) { 18208 if (placeholder) { 18209 placeholder 18210 .animate($.effects.clipToBox(animation1), duration, options.easing) 18211 .animate($.effects.clipToBox(animation2), duration, options.easing); 18212 } 18213 18214 next(); 18215 }) 18216 .animate(animation1, duration, options.easing) 18217 .animate(animation2, duration, options.easing) 18218 .queue(done); 18219 18220 $.effects.unshift(element, queuelen, 4); 18221 }); 18222 18223 18224 /*! 18225 * jQuery UI Effects Highlight 1.12.1 18226 * http://jqueryui.com 18227 * 18228 * Copyright jQuery Foundation and other contributors 18229 * Released under the MIT license. 18230 * http://jquery.org/license 18231 */ 18232 18233 //>>label: Highlight Effect 18234 //>>group: Effects 18235 //>>description: Highlights the background of an element in a defined color for a custom duration. 18236 //>>docs: http://api.jqueryui.com/highlight-effect/ 18237 //>>demos: http://jqueryui.com/effect/ 18238 18239 18240 18241 var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) { 18242 var element = $(this), 18243 animation = { 18244 backgroundColor: element.css("backgroundColor") 18245 }; 18246 18247 if (options.mode === "hide") { 18248 animation.opacity = 0; 18249 } 18250 18251 $.effects.saveStyle(element); 18252 18253 element 18254 .css({ 18255 backgroundImage: "none", 18256 backgroundColor: options.color || "#ffff99" 18257 }) 18258 .animate(animation, { 18259 queue: false, 18260 duration: options.duration, 18261 easing: options.easing, 18262 complete: done 18263 }); 18264 }); 18265 18266 18267 /*! 18268 * jQuery UI Effects Size 1.12.1 18269 * http://jqueryui.com 18270 * 18271 * Copyright jQuery Foundation and other contributors 18272 * Released under the MIT license. 18273 * http://jquery.org/license 18274 */ 18275 18276 //>>
vendor: 4,126 bytes, lines 18276-18403
18276label: Size Effect 18277 //>>group: Effects 18278 //>>description: Resize an element to a specified width and height. 18279 //>>docs: http://api.jqueryui.com/size-effect/ 18280 //>>demos: http://jqueryui.com/effect/ 18281 18282 18283 18284 var effectsEffectSize = $.effects.define("size", function (options, done) { 18285 18286 // Create element 18287 var baseline, factor, temp, 18288 element = $(this), 18289 18290 // Copy for children 18291 cProps = ["fontSize"], 18292 vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 18293 hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"], 18294 18295 // Set options 18296 mode = options.mode, 18297 restore = mode !== "effect", 18298 scale = options.scale || "both", 18299 origin = options.origin || ["middle", "center"], 18300 position = element.css("position"), 18301 pos = element.position(), 18302 original = $.effects.scaledDimensions(element), 18303 from = options.from || original, 18304 to = options.to || $.effects.scaledDimensions(element, 0); 18305 18306 $.effects.createPlaceholder(element); 18307 18308 if (mode === "show") { 18309 temp = from; 18310 from = to; 18311 to = temp; 18312 } 18313 18314 // Set scaling factor 18315 factor = { 18316 from: { 18317 y: from.height / original.height, 18318 x: from.width / original.width 18319 }, 18320 to: { 18321 y: to.height / original.height, 18322 x: to.width / original.width 18323 } 18324 }; 18325 18326 // Scale the css box 18327 if (scale === "box" || scale === "both") { 18328 18329 // Vertical props scaling 18330 if (factor.from.y !== factor.to.y) { 18331 from = $.effects.setTransition(element, vProps, factor.from.y, from); 18332 to = $.effects.setTransition(element, vProps, factor.to.y, to); 18333 } 18334 18335 // Horizontal props scaling 18336 if (factor.from.x !== factor.to.x) { 18337 from = $.effects.setTransition(element, hProps, factor.from.x, from); 18338 to = $.effects.setTransition(element, hProps, factor.to.x, to); 18339 } 18340 } 18341 18342 // Scale the content 18343 if (scale === "content" || scale === "both") { 18344 18345 // Vertical props scaling 18346 if (factor.from.y !== factor.to.y) { 18347 from = $.effects.setTransition(element, cProps, factor.from.y, from); 18348 to = $.effects.setTransition(element, cProps, factor.to.y, to); 18349 } 18350 } 18351 18352 // Adjust the position properties based on the provided origin points 18353 if (origin) { 18354 baseline = $.effects.getBaseline(origin, original); 18355 from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top; 18356 from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left; 18357 to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top; 18358 to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left; 18359 } 18360 element.css(from); 18361 18362 // Animate the children if desired 18363 if (scale === "content" || scale === "both") { 18364 18365 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 18366 hProps = hProps.concat(["marginLeft", "marginRight"]); 18367 18368 // Only animate children with width attributes specified 18369 // TODO: is this right? should we include anything with css width specified as well 18370 element.find("*[width]").each(function () { 18371 var child = $(this), 18372 childOriginal = $.effects.scaledDimensions(child), 18373 childFrom = { 18374 height: childOriginal.height * factor.from.y, 18375 width: childOriginal.width * factor.from.x, 18376 outerHeight: childOriginal.outerHeight * factor.from.y, 18377 outerWidth: childOriginal.outerWidth * factor.from.x 18378 }, 18379 childTo = { 18380 height: childOriginal.height * factor.to.y, 18381 width: childOriginal.width * factor.to.x, 18382 outerHeight: childOriginal.height * factor.to.y, 18383 outerWidth: childOriginal.width * factor.to.x 18384 }; 18385 18386 // Vertical props scaling 18387 if (factor.from.y !== factor.to.y) { 18388 childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom); 18389 childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo); 18390 } 18391 18392 // Horizontal props scaling 18393 if (factor.from.x !== factor.to.x) { 18394 childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom); 18395 childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo); 18396 } 18397 18398 if (restore) { 18399 $.effects.saveStyle(child); 18400 } 18401 18402 // Animate children 18403 child.css(childFrom);
vendor: 7,727 bytes, lines 18404-18712
18404 child.animate(childTo, options.duration, options.easing, function () { 18405 18406 // Restore children 18407 if (restore) { 18408 $.effects.restoreStyle(child); 18409 } 18410 }); 18411 }); 18412 } 18413 18414 // Animate 18415 element.animate(to, { 18416 queue: false, 18417 duration: options.duration, 18418 easing: options.easing, 18419 complete: function () { 18420 18421 var offset = element.offset(); 18422 18423 if (to.opacity === 0) { 18424 element.css("opacity", from.opacity); 18425 } 18426 18427 if (!restore) { 18428 element 18429 .css("position", position === "static" ? "relative" : position) 18430 .offset(offset); 18431 18432 // Need to save style here so that automatic style restoration 18433 // doesn't restore to the original styles from before the animation. 18434 $.effects.saveStyle(element); 18435 } 18436 18437 done(); 18438 } 18439 }); 18440 18441 }); 18442 18443 18444 /*! 18445 * jQuery UI Effects Scale 1.12.1 18446 * http://jqueryui.com 18447 * 18448 * Copyright jQuery Foundation and other contributors 18449 * Released under the MIT license. 18450 * http://jquery.org/license 18451 */ 18452 18453 //>>label: Scale Effect 18454 //>>group: Effects 18455 //>>description: Grows or shrinks an element and its content. 18456 //>>docs: http://api.jqueryui.com/scale-effect/ 18457 //>>demos: http://jqueryui.com/effect/ 18458 18459 18460 18461 var effectsEffectScale = $.effects.define("scale", function (options, done) { 18462 18463 // Create element 18464 var el = $(this), 18465 mode = options.mode, 18466 percent = parseInt(options.percent, 10) || 18467 (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)), 18468 18469 newOptions = $.extend(true, { 18470 from: $.effects.scaledDimensions(el), 18471 to: $.effects.scaledDimensions(el, percent, options.direction || "both"), 18472 origin: options.origin || ["middle", "center"] 18473 }, options); 18474 18475 // Fade option to support puff 18476 if (options.fade) { 18477 newOptions.from.opacity = 1; 18478 newOptions.to.opacity = 0; 18479 } 18480 18481 $.effects.effect.size.call(this, newOptions, done); 18482 }); 18483 18484 18485 /*! 18486 * jQuery UI Effects Puff 1.12.1 18487 * http://jqueryui.com 18488 * 18489 * Copyright jQuery Foundation and other contributors 18490 * Released under the MIT license. 18491 * http://jquery.org/license 18492 */ 18493 18494 //>>label: Puff Effect 18495 //>>group: Effects 18496 //>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 18497 //>>docs: http://api.jqueryui.com/puff-effect/ 18498 //>>demos: http://jqueryui.com/effect/ 18499 18500 18501 18502 var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) { 18503 var newOptions = $.extend(true, {}, options, { 18504 fade: true, 18505 percent: parseInt(options.percent, 10) || 150 18506 }); 18507 18508 $.effects.effect.scale.call(this, newOptions, done); 18509 }); 18510 18511 18512 /*! 18513 * jQuery UI Effects Pulsate 1.12.1 18514 * http://jqueryui.com 18515 * 18516 * Copyright jQuery Foundation and other contributors 18517 * Released under the MIT license. 18518 * http://jquery.org/license 18519 */ 18520 18521 //>>label: Pulsate Effect 18522 //>>group: Effects 18523 //>>description: Pulsates an element n times by changing the opacity to zero and back. 18524 //>>docs: http://api.jqueryui.com/pulsate-effect/ 18525 //>>demos: http://jqueryui.com/effect/ 18526 18527 18528 18529 var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) { 18530 var element = $(this), 18531 mode = options.mode, 18532 show = mode === "show", 18533 hide = mode === "hide", 18534 showhide = show || hide, 18535 18536 // Showing or hiding leaves off the "last" animation 18537 anims = ((options.times || 5) * 2) + (showhide ? 1 : 0), 18538 duration = options.duration / anims, 18539 animateTo = 0, 18540 i = 1, 18541 queuelen = element.queue().length; 18542 18543 if (show || !element.is(":visible")) { 18544 element.css("opacity", 0).show(); 18545 animateTo = 1; 18546 } 18547 18548 // Anims - 1 opacity "toggles" 18549 for (; i < anims; i++) { 18550 element.animate({ opacity: animateTo }, duration, options.easing); 18551 animateTo = 1 - animateTo; 18552 } 18553 18554 element.animate({ opacity: animateTo }, duration, options.easing); 18555 18556 element.queue(done); 18557 18558 $.effects.unshift(element, queuelen, anims + 1); 18559 }); 18560 18561 18562 /*! 18563 * jQuery UI Effects Shake 1.12.1 18564 * http://jqueryui.com 18565 * 18566 * Copyright jQuery Foundation and other contributors 18567 * Released under the MIT license. 18568 * http://jquery.org/license 18569 */ 18570 18571 //>>label: Shake Effect 18572 //>>group: Effects 18573 //>>description: Shakes an element horizontally or vertically n times. 18574 //>>docs: http://api.jqueryui.com/shake-effect/ 18575 //>>demos: http://jqueryui.com/effect/ 18576 18577 18578 18579 var effectsEffectShake = $.effects.define("shake", function (options, done) { 18580 18581 var i = 1, 18582 element = $(this), 18583 direction = options.direction || "left", 18584 distance = options.distance || 20, 18585 times = options.times || 3, 18586 anims = times * 2 + 1, 18587 speed = Math.round(options.duration / anims), 18588 ref = (direction === "up" || direction === "down") ? "top" : "left", 18589 positiveMotion = (direction === "up" || direction === "left"), 18590 animation = {}, 18591 animation1 = {}, 18592 animation2 = {}, 18593 18594 queuelen = element.queue().length; 18595 18596 $.effects.createPlaceholder(element); 18597 18598 // Animation 18599 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 18600 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 18601 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 18602 18603 // Animate 18604 element.animate(animation, speed, options.easing); 18605 18606 // Shakes 18607 for (; i < times; i++) { 18608 element 18609 .animate(animation1, speed, options.easing) 18610 .animate(animation2, speed, options.easing); 18611 } 18612 18613 element 18614 .animate(animation1, speed, options.easing) 18615 .animate(animation, speed / 2, options.easing) 18616 .queue(done); 18617 18618 $.effects.unshift(element, queuelen, anims + 1); 18619 }); 18620 18621 18622 /*! 18623 * jQuery UI Effects Slide 1.12.1 18624 * http://jqueryui.com 18625 * 18626 * Copyright jQuery Foundation and other contributors 18627 * Released under the MIT license. 18628 * http://jquery.org/license 18629 */ 18630 18631 //>>label: Slide Effect 18632 //>>group: Effects 18633 //>>description: Slides an element in and out of the viewport. 18634 //>>docs: http://api.jqueryui.com/slide-effect/ 18635 //>>demos: http://jqueryui.com/effect/ 18636 18637 18638 18639 var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) { 18640 var startClip, startRef, 18641 element = $(this), 18642 map = { 18643 up: ["bottom", "top"], 18644 down: ["top", "bottom"], 18645 left: ["right", "left"], 18646 right: ["left", "right"] 18647 }, 18648 mode = options.mode, 18649 direction = options.direction || "left", 18650 ref = (direction === "up" || direction === "down") ? "top" : "left", 18651 positiveMotion = (direction === "up" || direction === "left"), 18652 distance = options.distance || 18653 element[ref === "top" ? "outerHeight" : "outerWidth"](true), 18654 animation = {}; 18655 18656 $.effects.createPlaceholder(element); 18657 18658 startClip = element.cssClip(); 18659 startRef = element.position()[ref]; 18660 18661 // Define hide animation 18662 animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef; 18663 animation.clip = element.cssClip(); 18664 animation.clip[map[direction][1]] = animation.clip[map[direction][0]]; 18665 18666 // Reverse the animation if we're showing 18667 if (mode === "show") { 18668 element.cssClip(animation.clip); 18669 element.css(ref, animation[ref]); 18670 animation.clip = startClip; 18671 animation[ref] = startRef; 18672 } 18673 18674 // Actually animate 18675 element.animate(animation, { 18676 queue: false, 18677 duration: options.duration, 18678 easing: options.easing, 18679 complete: done 18680 }); 18681 }); 18682 18683 18684 /*! 18685 * jQuery UI Effects Transfer 1.12.1 18686 * http://jqueryui.com 18687 * 18688 * Copyright jQuery Foundation and other contributors 18689 * Released under the MIT license. 18690 * http://jquery.org/license 18691 */ 18692 18693 //>>label: Transfer Effect 18694 //>>group: Effects 18695 //>>description: Displays a transfer effect from one element to another. 18696 //>>docs: http://api.jqueryui.com/transfer-effect/ 18697 //>>demos: http://jqueryui.com/effect/ 18698 18699 18700 18701 var effect; 18702 if ($.uiBackCompat !== false) { 18703 effect = $.effects.define("transfer", function (options, done) { 18704 $(this).transfer(options, done); 18705 }); 18706 } 18707 var effectsEffectTransfer = effect; 18708 18709 18710 18711 18712}));
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.