vendor: 10,446 bytes, lines 1-263
1/*! jQuery UI - v1.12.1 - 2017-10-14 2 * http://jqueryui.com 3 * 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/spinner.js, widgets/tabs.js, widgets/tooltip.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js 4 * Copyright jQuery Foundation and other contributors; Licensed MIT */ 5 6(function(factory) { 7 if (typeof define === "function" && define.amd) { 8 9 // AMD. Register as an anonymous module. 10 define(["jquery"], factory); 11 } else { 12 13 // Browser globals 14 factory(jQuery); 15 } 16}(function($) { 17 18 $.ui = $.ui || {}; 19 20 var version = $.ui.version = "1.12.1"; 21 22 23 /*! 24 * jQuery UI Widget 1.12.1 25 * http://jqueryui.com 26 * 27 * Copyright jQuery Foundation and other contributors 28 * Released under the MIT license. 29 * http://jquery.org/license 30 */ 31 32 //>>label: Widget 33 //>>group: Core 34 //>>description: Provides a factory for creating stateful widgets with a common API. 35 //>>docs: http://api.jqueryui.com/jQuery.widget/ 36 //>>demos: http://jqueryui.com/widget/ 37 38 39 40 var widgetUuid = 0; 41 var widgetSlice = Array.prototype.slice; 42 43 $.cleanData = (function(orig) { 44 return function(elems) { 45 var events, elem, i; 46 for (i = 0; 47 (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;
vendor: 6,151 bytes, lines 264-466
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
vendor: 4,524 bytes, lines 467-582
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: 13,056 bytes, lines 583-931
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]) ? ["center"].concat(pos) : ["center", "center"]; 913 } 914 pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center"; 915 pos[1] = rvertical.test(pos[1]) ? pos[1] : "center"; 916 917 // Calculate offsets 918 horizontalOffset = roffset.exec(pos[0]); 919 verticalOffset = roffset.exec(pos[1]); 920 offsets[this] = [ 921 horizontalOffset ? horizontalOffset[0] : 0, 922 verticalOffset ? verticalOffset[0] : 0 923 ]; 924 925 // Reduce to just the positions without the offsets 926 options[this] = [ 927 rposition.exec(pos[0])[0], 928 rposition.exec(pos[1])[0] 929 ]; 930 }); 931
vendor: 5,960 bytes, lines 932-1061
932 // Normalize collision option 933 if (collision.length === 1) { 934 collision[1] = collision[0]; 935 } 936 937 if (options.at[0] === "right") { 938 basePosition.left += targetWidth; 939 } else if (options.at[0] === "center") { 940 basePosition.left += targetWidth / 2; 941 } 942 943 if (options.at[1] === "bottom") { 944 basePosition.top += targetHeight; 945 } else if (options.at[1] === "center") { 946 basePosition.top += targetHeight / 2; 947 } 948 949 atOffset = getOffsets(offsets.at, targetWidth, targetHeight); 950 basePosition.left += atOffset[0]; 951 basePosition.top += atOffset[1]; 952 953 return this.each(function() { 954 var collisionPosition, using, 955 elem = $(this), 956 elemWidth = elem.outerWidth(), 957 elemHeight = elem.outerHeight(), 958 marginLeft = parseCss(this, "marginLeft"), 959 marginTop = parseCss(this, "marginTop"), 960 collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") + 961 scrollInfo.width, 962 collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") + 963 scrollInfo.height, 964 position = $.extend({}, basePosition), 965 myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight()); 966 967 if (options.my[0] === "right") { 968 position.left -= elemWidth; 969 } else if (options.my[0] === "center") { 970 position.left -= elemWidth / 2; 971 } 972 973 if (options.my[1] === "bottom") { 974 position.top -= elemHeight; 975 } else if (options.my[1] === "center") { 976 position.top -= elemHeight / 2; 977 } 978 979 position.left += myOffset[0]; 980 position.top += myOffset[1]; 981 982 collisionPosition = { 983 marginLeft: marginLeft, 984 marginTop: marginTop 985 }; 986 987 $.each(["left", "top"], function(i, dir) { 988 if ($.ui.position[collision[i]]) { 989 $.ui.position[collision[i]][dir](position, { 990 targetWidth: targetWidth, 991 targetHeight: targetHeight, 992 elemWidth: elemWidth, 993 elemHeight: elemHeight, 994 collisionPosition: collisionPosition, 995 collisionWidth: collisionWidth, 996 collisionHeight: collisionHeight, 997 offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]], 998 my: options.my, 999 at: options.at, 1000 within: within, 1001 elem: elem 1002 }); 1003 } 1004 }); 1005 1006 if (options.using) { 1007 1008 // Adds feedback as second argument to using callback, if present 1009 using = function(props) { 1010 var left = targetOffset.left - position.left, 1011 right = left + targetWidth - elemWidth, 1012 top = targetOffset.top - position.top, 1013 bottom = top + targetHeight - elemHeight, 1014 feedback = { 1015 target: { 1016 element: target, 1017 left: targetOffset.left, 1018 top: targetOffset.top, 1019 width: targetWidth, 1020 height: targetHeight 1021 }, 1022 element: { 1023 element: elem, 1024 left: position.left, 1025 top: position.top, 1026 width: elemWidth, 1027 height: elemHeight 1028 }, 1029 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1030 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1031 }; 1032 if (targetWidth < elemWidth && abs(left + right) < targetWidth) { 1033 feedback.horizontal = "center"; 1034 } 1035 if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) { 1036 feedback.vertical = "middle"; 1037 } 1038 if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) { 1039 feedback.important = "horizontal"; 1040 } else { 1041 feedback.important = "vertical"; 1042 } 1043 options.using.call(this, props, feedback); 1044 }; 1045 } 1046 1047 elem.offset($.extend(position, { using: using })); 1048 }); 1049 }; 1050 1051 $.ui.position = { 1052 fit: { 1053 left: function(position, data) { 1054 var within = data.within, 1055 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1056 outerWidth = within.width, 1057 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1058 overLeft = withinOffset - collisionPosLeft, 1059 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1060 newOverRight; 1061
vendor: 15,213 bytes, lines 1062-1460
1062 // Element is wider than within 1063 if (data.collisionWidth > outerWidth) { 1064 1065 // Element is initially over the left side of within 1066 if (overLeft > 0 && overRight <= 0) { 1067 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1068 withinOffset; 1069 position.left += overLeft - newOverRight; 1070 1071 // Element is initially over right side of within 1072 } else if (overRight > 0 && overLeft <= 0) { 1073 position.left = withinOffset; 1074 1075 // Element is initially over both left and right sides of within 1076 } else { 1077 if (overLeft > overRight) { 1078 position.left = withinOffset + outerWidth - data.collisionWidth; 1079 } else { 1080 position.left = withinOffset; 1081 } 1082 } 1083 1084 // Too far left -> align with left edge 1085 } else if (overLeft > 0) { 1086 position.left += overLeft; 1087 1088 // Too far right -> align with right edge 1089 } else if (overRight > 0) { 1090 position.left -= overRight; 1091 1092 // Adjust based on position and margin 1093 } else { 1094 position.left = max(position.left - collisionPosLeft, position.left); 1095 } 1096 }, 1097 top: function(position, data) { 1098 var within = data.within, 1099 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1100 outerHeight = data.within.height, 1101 collisionPosTop = position.top - data.collisionPosition.marginTop, 1102 overTop = withinOffset - collisionPosTop, 1103 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1104 newOverBottom; 1105 1106 // Element is taller than within 1107 if (data.collisionHeight > outerHeight) { 1108 1109 // Element is initially over the top of within 1110 if (overTop > 0 && overBottom <= 0) { 1111 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1112 withinOffset; 1113 position.top += overTop - newOverBottom; 1114 1115 // Element is initially over bottom of within 1116 } else if (overBottom > 0 && overTop <= 0) { 1117 position.top = withinOffset; 1118 1119 // Element is initially over both top and bottom of within 1120 } else { 1121 if (overTop > overBottom) { 1122 position.top = withinOffset + outerHeight - data.collisionHeight; 1123 } else { 1124 position.top = withinOffset; 1125 } 1126 } 1127 1128 // Too far up -> align with top 1129 } else if (overTop > 0) { 1130 position.top += overTop; 1131 1132 // Too far down -> align with bottom edge 1133 } else if (overBottom > 0) { 1134 position.top -= overBottom; 1135 1136 // Adjust based on position and margin 1137 } else { 1138 position.top = max(position.top - collisionPosTop, position.top); 1139 } 1140 } 1141 }, 1142 flip: { 1143 left: function(position, data) { 1144 var within = data.within, 1145 withinOffset = within.offset.left + within.scrollLeft, 1146 outerWidth = within.width, 1147 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1148 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1149 overLeft = collisionPosLeft - offsetLeft, 1150 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1151 myOffset = data.my[0] === "left" ? 1152 -data.elemWidth : 1153 data.my[0] === "right" ? 1154 data.elemWidth : 1155 0, 1156 atOffset = data.at[0] === "left" ? 1157 data.targetWidth : 1158 data.at[0] === "right" ? 1159 -data.targetWidth : 1160 0, 1161 offset = -2 * data.offset[0], 1162 newOverRight, 1163 newOverLeft; 1164 1165 if (overLeft < 0) { 1166 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1167 outerWidth - withinOffset; 1168 if (newOverRight < 0 || newOverRight < abs(overLeft)) { 1169 position.left += myOffset + atOffset + offset; 1170 } 1171 } else if (overRight > 0) { 1172 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1173 atOffset + offset - offsetLeft; 1174 if (newOverLeft > 0 || abs(newOverLeft) < overRight) { 1175 position.left += myOffset + atOffset + offset; 1176 } 1177 } 1178 }, 1179 top: function(position, data) { 1180 var within = data.within, 1181 withinOffset = within.offset.top + within.scrollTop, 1182 outerHeight = within.height, 1183 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1184 collisionPosTop = position.top - data.collisionPosition.marginTop, 1185 overTop = collisionPosTop - offsetTop, 1186 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1187 top = data.my[1] === "top", 1188 myOffset = top ? 1189 -data.elemHeight : 1190 data.my[1] === "bottom" ? 1191 data.elemHeight : 1192 0, 1193 atOffset = data.at[1] === "top" ? 1194 data.targetHeight : 1195 data.at[1] === "bottom" ? 1196 -data.targetHeight : 1197 0, 1198 offset = -2 * data.offset[1], 1199 newOverTop, 1200 newOverBottom; 1201 if (overTop < 0) { 1202 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1203 outerHeight - withinOffset; 1204 if (newOverBottom < 0 || newOverBottom < abs(overTop)) { 1205 position.top += myOffset + atOffset + offset; 1206 } 1207 } else if (overBottom > 0) { 1208 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1209 offset - offsetTop; 1210 if (newOverTop > 0 || abs(newOverTop) < overBottom) { 1211 position.top += myOffset + atOffset + offset; 1212 } 1213 } 1214 } 1215 }, 1216 flipfit: { 1217 left: function() { 1218 $.ui.position.flip.left.apply(this, arguments); 1219 $.ui.position.fit.left.apply(this, arguments); 1220 }, 1221 top: function() { 1222 $.ui.position.flip.top.apply(this, arguments); 1223 $.ui.position.fit.top.apply(this, arguments); 1224 } 1225 } 1226 }; 1227 1228 })(); 1229 1230 var position = $.ui.position; 1231 1232 1233 /*! 1234 * jQuery UI :data 1.12.1 1235 * http://jqueryui.com 1236 * 1237 * Copyright jQuery Foundation and other contributors 1238 * Released under the MIT license. 1239 * http://jquery.org/license 1240 */ 1241 1242 //>>label: :data Selector 1243 //>>group: Core 1244 //>>description: Selects elements which have data stored under the specified key. 1245 //>>docs: http://api.jqueryui.com/data-selector/ 1246 1247 1248 var data = $.extend($.expr[":"], { 1249 data: $.expr.createPseudo ? 1250 $.expr.createPseudo(function(dataName) { 1251 return function(elem) { 1252 return !!$.data(elem, dataName); 1253 }; 1254 }) : 1255 1256 // Support: jQuery <1.8 1257 function(elem, i, match) { 1258 return !!$.data(elem, match[3]); 1259 } 1260 }); 1261 1262 /*! 1263 * jQuery UI Disable Selection 1.12.1 1264 * http://jqueryui.com 1265 * 1266 * Copyright jQuery Foundation and other contributors 1267 * Released under the MIT license. 1268 * http://jquery.org/license 1269 */ 1270 1271 //>>label: disableSelection 1272 //>>group: Core 1273 //>>description: Disable selection of text content within the set of matched elements. 1274 //>>docs: http://api.jqueryui.com/disableSelection/ 1275 1276 // This file is deprecated 1277 1278 1279 var disableSelection = $.fn.extend({ 1280 disableSelection: (function() { 1281 var eventType = "onselectstart" in document.createElement("div") ? 1282 "selectstart" : 1283 "mousedown"; 1284 1285 return function() { 1286 return this.on(eventType + ".ui-disableSelection", function(event) { 1287 event.preventDefault(); 1288 }); 1289 }; 1290 })(), 1291 1292 enableSelection: function() { 1293 return this.off(".ui-disableSelection"); 1294 } 1295 }); 1296 1297 1298 /*! 1299 * jQuery UI Focusable 1.12.1 1300 * http://jqueryui.com 1301 * 1302 * Copyright jQuery Foundation and other contributors 1303 * Released under the MIT license. 1304 * http://jquery.org/license 1305 */ 1306 1307 //>>label: :focusable Selector 1308 //>>group: Core 1309 //>>description: Selects elements which can be focused. 1310 //>>docs: http://api.jqueryui.com/focusable-selector/ 1311 1312 1313 1314 // Selectors 1315 $.ui.focusable = function(element, hasTabindex) { 1316 var map, mapName, img, focusableIfVisible, fieldset, 1317 nodeName = element.nodeName.toLowerCase(); 1318 1319 if ("area" === nodeName) { 1320 map = element.parentNode; 1321 mapName = map.name; 1322 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 1323 return false; 1324 } 1325 img = $("img[usemap='#" + mapName + "']"); 1326 return img.length > 0 && img.is(":visible"); 1327 } 1328 1329 if (/^(input|select|textarea|button|object)$/.test(nodeName)) { 1330 focusableIfVisible = !element.disabled; 1331 1332 if (focusableIfVisible) { 1333 1334 // Form controls within a disabled fieldset are disabled. 1335 // However, controls within the fieldset's legend do not get disabled. 1336 // Since controls generally aren't placed inside legends, we skip 1337 // this portion of the check. 1338 fieldset = $(element).closest("fieldset")[0]; 1339 if (fieldset) { 1340 focusableIfVisible = !fieldset.disabled; 1341 } 1342 } 1343 } else if ("a" === nodeName) { 1344 focusableIfVisible = element.href || hasTabindex; 1345 } else { 1346 focusableIfVisible = hasTabindex; 1347 } 1348 1349 return focusableIfVisible && $(element).is(":visible") && visible($(element)); 1350 }; 1351 1352 // Support: IE 8 only 1353 // IE 8 doesn't resolve inherit to visible/hidden for computed values 1354 function visible(element) { 1355 var visibility = element.css("visibility"); 1356 while (visibility === "inherit") { 1357 element = element.parent(); 1358 visibility = element.css("visibility"); 1359 } 1360 return visibility !== "hidden"; 1361 } 1362 1363 $.extend($.expr[":"], { 1364 focusable: function(element) { 1365 return $.ui.focusable(element, $.attr(element, "tabindex") != null); 1366 } 1367 }); 1368 1369 var focusable = $.ui.focusable; 1370 1371 1372 1373 1374 // Support: IE8 Only 1375 // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 1376 // with a string, so we need to find the proper form. 1377 var form = $.fn.form = function() { 1378 return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form); 1379 }; 1380 1381 1382 /*! 1383 * jQuery UI Form Reset Mixin 1.12.1 1384 * http://jqueryui.com 1385 * 1386 * Copyright jQuery Foundation and other contributors 1387 * Released under the MIT license. 1388 * http://jquery.org/license 1389 */ 1390 1391 //>>label: Form Reset Mixin 1392 //>>group: Core 1393 //>>description: Refresh input widgets when their form is reset 1394 //>>docs: http://api.jqueryui.com/form-reset-mixin/ 1395 1396 1397 1398 var formResetMixin = $.ui.formResetMixin = { 1399 _formResetHandler: function() { 1400 var form = $(this); 1401 1402 // Wait for the form reset to actually happen before refreshing 1403 setTimeout(function() { 1404 var instances = form.data("ui-form-reset-instances"); 1405 $.each(instances, function() { 1406 this.refresh(); 1407 }); 1408 }); 1409 }, 1410 1411 _bindFormResetHandler: function() { 1412 this.form = this.element.form(); 1413 if (!this.form.length) { 1414 return; 1415 } 1416 1417 var instances = this.form.data("ui-form-reset-instances") || []; 1418 if (!instances.length) { 1419 1420 // We don't use _on() here because we use a single event handler per form 1421 this.form.on("reset.ui-form-reset", this._formResetHandler); 1422 } 1423 instances.push(this); 1424 this.form.data("ui-form-reset-instances", instances); 1425 }, 1426 1427 _unbindFormResetHandler: function() { 1428 if (!this.form.length) { 1429 return; 1430 } 1431 1432 var instances = this.form.data("ui-form-reset-instances"); 1433 instances.splice($.inArray(this, instances), 1); 1434 if (instances.length) { 1435 this.form.data("ui-form-reset-instances", instances); 1436 } else { 1437 this.form 1438 .removeData("ui-form-reset-instances") 1439 .off("reset.ui-form-reset"); 1440 } 1441 } 1442 }; 1443 1444 1445 /*! 1446 * jQuery UI Support for jQuery core 1.7.x 1.12.1 1447 * http://jqueryui.com 1448 * 1449 * Copyright jQuery Foundation and other contributors 1450 * Released under the MIT license. 1451 * http://jquery.org/license 1452 * 1453 */ 1454 1455 //>>label: jQuery 1.7 Support 1456 //>>group: Core 1457 //>>description: Support version 1.7.x of jQuery core 1458 1459 1460
vendor: 4,127 bytes, lines 1461-1593
1461 // Support: jQuery 1.7 only 1462 // Not a great way to check versions, but since we only support 1.7+ and only 1463 // need to detect <1.8, this is a simple check that should suffice. Checking 1464 // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0 1465 // and we'll never reach 1.70.0 (if we do, we certainly won't be supporting 1466 // 1.7 anymore). See #11197 for why we're not using feature detection. 1467 if ($.fn.jquery.substring(0, 3) === "1.7") { 1468 1469 // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight() 1470 // Unlike jQuery Core 1.8+, these only support numeric values to set the 1471 // dimensions in pixels 1472 $.each(["Width", "Height"], function(i, name) { 1473 var side = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"], 1474 type = name.toLowerCase(), 1475 orig = { 1476 innerWidth: $.fn.innerWidth, 1477 innerHeight: $.fn.innerHeight, 1478 outerWidth: $.fn.outerWidth, 1479 outerHeight: $.fn.outerHeight 1480 }; 1481 1482 function reduce(elem, size, border, margin) { 1483 $.each(side, function() { 1484 size -= parseFloat($.css(elem, "padding" + this)) || 0; 1485 if (border) { 1486 size -= parseFloat($.css(elem, "border" + this + "Width")) || 0; 1487 } 1488 if (margin) { 1489 size -= parseFloat($.css(elem, "margin" + this)) || 0; 1490 } 1491 }); 1492 return size; 1493 } 1494 1495 $.fn["inner" + name] = function(size) { 1496 if (size === undefined) { 1497 return orig["inner" + name].call(this); 1498 } 1499 1500 return this.each(function() { 1501 $(this).css(type, reduce(this, size) + "px"); 1502 }); 1503 }; 1504 1505 $.fn["outer" + name] = function(size, margin) { 1506 if (typeof size !== "number") { 1507 return orig["outer" + name].call(this, size); 1508 } 1509 1510 return this.each(function() { 1511 $(this).css(type, reduce(this, size, true, margin) + "px"); 1512 }); 1513 }; 1514 }); 1515 1516 $.fn.addBack = function(selector) { 1517 return this.add(selector == null ? 1518 this.prevObject : this.prevObject.filter(selector) 1519 ); 1520 }; 1521 } 1522 1523 ; 1524 /*! 1525 * jQuery UI Keycode 1.12.1 1526 * http://jqueryui.com 1527 * 1528 * Copyright jQuery Foundation and other contributors 1529 * Released under the MIT license. 1530 * http://jquery.org/license 1531 */ 1532 1533 //>>label: Keycode 1534 //>>group: Core 1535 //>>description: Provide keycodes as keynames 1536 //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 1537 1538 1539 var keycode = $.ui.keyCode = { 1540 BACKSPACE: 8, 1541 COMMA: 188, 1542 DELETE: 46, 1543 DOWN: 40, 1544 END: 35, 1545 ENTER: 13, 1546 ESCAPE: 27, 1547 HOME: 36, 1548 LEFT: 37, 1549 PAGE_DOWN: 34, 1550 PAGE_UP: 33, 1551 PERIOD: 190, 1552 RIGHT: 39, 1553 SPACE: 32, 1554 TAB: 9, 1555 UP: 38 1556 }; 1557 1558 1559 1560 1561 // Internal use only 1562 var escapeSelector = $.ui.escapeSelector = (function() { 1563 var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g; 1564 return function(selector) { 1565 return selector.replace(selectorEscape, "\\$1"); 1566 }; 1567 })(); 1568 1569 1570 /*! 1571 * jQuery UI Labels 1.12.1 1572 * http://jqueryui.com 1573 * 1574 * Copyright jQuery Foundation and other contributors 1575 * Released under the MIT license. 1576 * http://jquery.org/license 1577 */ 1578 1579 //>>label: labels 1580 //>>group: Core 1581 //>>description: Find all the labels associated with a given input 1582 //>>docs: http://api.jqueryui.com/labels/ 1583 1584 1585 1586 var labels = $.fn.labels = function() { 1587 var ancestor, selector, id, labels, ancestors; 1588 1589 // Check control.labels first 1590 if (this[0].labels && this[0].labels.length) { 1591 return this.pushStack(this[0].labels); 1592 } 1593
vendor: 4,398 bytes, lines 1594-1742
1594 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 1595 // Above browsers do not support control.labels. Everything below is to support them 1596 // as well as document fragments. control.labels does not work on document fragments 1597 labels = this.eq(0).parents("label"); 1598 1599 // Look for the label based on the id 1600 id = this.attr("id"); 1601 if (id) { 1602 1603 // We don't search against the document in case the element 1604 // is disconnected from the DOM 1605 ancestor = this.eq(0).parents().last(); 1606 1607 // Get a full set of top level ancestors 1608 ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings()); 1609 1610 // Create a selector for the label based on the id 1611 selector = "label[for='" + $.ui.escapeSelector(id) + "']"; 1612 1613 labels = labels.add(ancestors.find(selector).addBack(selector)); 1614 1615 } 1616 1617 // Return whatever we have found for labels 1618 return this.pushStack(labels); 1619 }; 1620 1621 1622 /*! 1623 * jQuery UI Scroll Parent 1.12.1 1624 * http://jqueryui.com 1625 * 1626 * Copyright jQuery Foundation and other contributors 1627 * Released under the MIT license. 1628 * http://jquery.org/license 1629 */ 1630 1631 //>>label: scrollParent 1632 //>>group: Core 1633 //>>description: Get the closest ancestor element that is scrollable. 1634 //>>docs: http://api.jqueryui.com/scrollParent/ 1635 1636 1637 1638 var scrollParent = $.fn.scrollParent = function(includeHidden) { 1639 var position = this.css("position"), 1640 excludeStaticParent = position === "absolute", 1641 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 1642 scrollParent = this.parents().filter(function() { 1643 var parent = $(this); 1644 if (excludeStaticParent && parent.css("position") === "static") { 1645 return false; 1646 } 1647 return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + 1648 parent.css("overflow-x")); 1649 }).eq(0); 1650 1651 return position === "fixed" || !scrollParent.length ? 1652 $(this[0].ownerDocument || document) : 1653 scrollParent; 1654 }; 1655 1656 1657 /*! 1658 * jQuery UI Tabbable 1.12.1 1659 * http://jqueryui.com 1660 * 1661 * Copyright jQuery Foundation and other contributors 1662 * Released under the MIT license. 1663 * http://jquery.org/license 1664 */ 1665 1666 //>>label: :tabbable Selector 1667 //>>group: Core 1668 //>>description: Selects elements which can be tabbed to. 1669 //>>docs: http://api.jqueryui.com/tabbable-selector/ 1670 1671 1672 1673 var tabbable = $.extend($.expr[":"], { 1674 tabbable: function(element) { 1675 var tabIndex = $.attr(element, "tabindex"), 1676 hasTabindex = tabIndex != null; 1677 return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex); 1678 } 1679 }); 1680 1681 1682 /*! 1683 * jQuery UI Unique ID 1.12.1 1684 * http://jqueryui.com 1685 * 1686 * Copyright jQuery Foundation and other contributors 1687 * Released under the MIT license. 1688 * http://jquery.org/license 1689 */ 1690 1691 //>>label: uniqueId 1692 //>>group: Core 1693 //>>description: Functions to generate and remove uniqueId's 1694 //>>docs: http://api.jqueryui.com/uniqueId/ 1695 1696 1697 1698 var uniqueId = $.fn.extend({ 1699 uniqueId: (function() { 1700 var uuid = 0; 1701 1702 return function() { 1703 return this.each(function() { 1704 if (!this.id) { 1705 this.id = "ui-id-" + (++uuid); 1706 } 1707 }); 1708 }; 1709 })(), 1710 1711 removeUniqueId: function() { 1712 return this.each(function() { 1713 if (/^ui-id-\d+$/.test(this.id)) { 1714 $(this).removeAttr("id"); 1715 } 1716 }); 1717 } 1718 }); 1719 1720 1721 1722 1723 // This file is deprecated 1724 var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); 1725 1726 /*! 1727 * jQuery UI Mouse 1.12.1 1728 * http://jqueryui.com 1729 * 1730 * Copyright jQuery Foundation and other contributors 1731 * Released under the MIT license. 1732 * http://jquery.org/license 1733 */ 1734 1735 //>>label: Mouse 1736 //>>group: Widgets 1737 //>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 1738 //>>docs: http://api.jqueryui.com/mouse/ 1739 1740 1741 1742 var mouseHandled = false;
vendor: 4,458 bytes, lines 1743-1861
1743 $(document).on("mouseup", function() { 1744 mouseHandled = false; 1745 }); 1746 1747 var widgetsMouse = $.widget("ui.mouse", { 1748 version: "1.12.1", 1749 options: { 1750 cancel: "input, textarea, button, select, option", 1751 distance: 1, 1752 delay: 0 1753 }, 1754 _mouseInit: function() { 1755 var that = this; 1756 1757 this.element 1758 .on("mousedown." + this.widgetName, function(event) { 1759 return that._mouseDown(event); 1760 }) 1761 .on("click." + this.widgetName, function(event) { 1762 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 1763 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 1764 event.stopImmediatePropagation(); 1765 return false; 1766 } 1767 }); 1768 1769 this.started = false; 1770 }, 1771 1772 // TODO: make sure destroying one instance of mouse doesn't mess with 1773 // other instances of mouse 1774 _mouseDestroy: function() { 1775 this.element.off("." + this.widgetName); 1776 if (this._mouseMoveDelegate) { 1777 this.document 1778 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 1779 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 1780 } 1781 }, 1782 1783 _mouseDown: function(event) { 1784 1785 // don't let more than one widget handle mouseStart 1786 if (mouseHandled) { 1787 return; 1788 } 1789 1790 this._mouseMoved = false; 1791 1792 // We may have missed mouseup (out of window) 1793 (this._mouseStarted && this._mouseUp(event)); 1794 1795 this._mouseDownEvent = event; 1796 1797 var that = this, 1798 btnIsLeft = (event.which === 1), 1799 1800 // event.target.nodeName works around a bug in IE 8 with 1801 // disabled inputs (#7620) 1802 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? 1803 $(event.target).closest(this.options.cancel).length : false); 1804 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 1805 return true; 1806 } 1807 1808 this.mouseDelayMet = !this.options.delay; 1809 if (!this.mouseDelayMet) { 1810 this._mouseDelayTimer = setTimeout(function() { 1811 that.mouseDelayMet = true; 1812 }, this.options.delay); 1813 } 1814 1815 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 1816 this._mouseStarted = (this._mouseStart(event) !== false); 1817 if (!this._mouseStarted) { 1818 event.preventDefault(); 1819 return true; 1820 } 1821 } 1822 1823 // Click event may never have fired (Gecko & Opera) 1824 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 1825 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 1826 } 1827 1828 // These delegates are required to keep context 1829 this._mouseMoveDelegate = function(event) { 1830 return that._mouseMove(event); 1831 }; 1832 this._mouseUpDelegate = function(event) { 1833 return that._mouseUp(event); 1834 }; 1835 1836 this.document 1837 .on("mousemove." + this.widgetName, this._mouseMoveDelegate) 1838 .on("mouseup." + this.widgetName, this._mouseUpDelegate); 1839 1840 event.preventDefault(); 1841 1842 mouseHandled = true; 1843 return true; 1844 }, 1845 1846 _mouseMove: function(event) { 1847 1848 // Only check for mouseups outside the document if you've moved inside the document 1849 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 1850 // fire a mousemove event if content is placed under the cursor. See #7778 1851 // Support: IE <9 1852 if (this._mouseMoved) { 1853 1854 // IE mouseup check - mouseup happened when mouse was out of window 1855 if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && 1856 !event.button) { 1857 return this._mouseUp(event); 1858 1859 // Iframe mouseup check - mouseup occurred in another document 1860 } else if (!event.which) { 1861
vendor: 16,856 bytes, lines 1862-2375
1862 // Support: Safari <=8 - 9 1863 // Safari sets which to 0 if you press any of the following keys 1864 // during a drag (#14461) 1865 if (event.originalEvent.altKey || event.originalEvent.ctrlKey || 1866 event.originalEvent.metaKey || event.originalEvent.shiftKey) { 1867 this.ignoreMissingWhich = true; 1868 } else if (!this.ignoreMissingWhich) { 1869 return this._mouseUp(event); 1870 } 1871 } 1872 } 1873 1874 if (event.which || event.button) { 1875 this._mouseMoved = true; 1876 } 1877 1878 if (this._mouseStarted) { 1879 this._mouseDrag(event); 1880 return event.preventDefault(); 1881 } 1882 1883 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 1884 this._mouseStarted = 1885 (this._mouseStart(this._mouseDownEvent, event) !== false); 1886 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 1887 } 1888 1889 return !this._mouseStarted; 1890 }, 1891 1892 _mouseUp: function(event) { 1893 this.document 1894 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 1895 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 1896 1897 if (this._mouseStarted) { 1898 this._mouseStarted = false; 1899 1900 if (event.target === this._mouseDownEvent.target) { 1901 $.data(event.target, this.widgetName + ".preventClickEvent", true); 1902 } 1903 1904 this._mouseStop(event); 1905 } 1906 1907 if (this._mouseDelayTimer) { 1908 clearTimeout(this._mouseDelayTimer); 1909 delete this._mouseDelayTimer; 1910 } 1911 1912 this.ignoreMissingWhich = false; 1913 mouseHandled = false; 1914 event.preventDefault(); 1915 }, 1916 1917 _mouseDistanceMet: function(event) { 1918 return (Math.max( 1919 Math.abs(this._mouseDownEvent.pageX - event.pageX), 1920 Math.abs(this._mouseDownEvent.pageY - event.pageY) 1921 ) >= this.options.distance); 1922 }, 1923 1924 _mouseDelayMet: function( /* event */ ) { 1925 return this.mouseDelayMet; 1926 }, 1927 1928 // These are placeholder methods, to be overriden by extending plugin 1929 _mouseStart: function( /* event */ ) {}, 1930 _mouseDrag: function( /* event */ ) {}, 1931 _mouseStop: function( /* event */ ) {}, 1932 _mouseCapture: function( /* event */ ) { return true; } 1933 }); 1934 1935 1936 1937 1938 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 1939 var plugin = $.ui.plugin = { 1940 add: function(module, option, set) { 1941 var i, 1942 proto = $.ui[module].prototype; 1943 for (i in set) { 1944 proto.plugins[i] = proto.plugins[i] || []; 1945 proto.plugins[i].push([option, set[i]]); 1946 } 1947 }, 1948 call: function(instance, name, args, allowDisconnected) { 1949 var i, 1950 set = instance.plugins[name]; 1951 1952 if (!set) { 1953 return; 1954 } 1955 1956 if (!allowDisconnected && (!instance.element[0].parentNode || 1957 instance.element[0].parentNode.nodeType === 11)) { 1958 return; 1959 } 1960 1961 for (i = 0; i < set.length; i++) { 1962 if (instance.options[set[i][0]]) { 1963 set[i][1].apply(instance.element, args); 1964 } 1965 } 1966 } 1967 }; 1968 1969 1970 1971 var safeActiveElement = $.ui.safeActiveElement = function(document) { 1972 var activeElement; 1973 1974 // Support: IE 9 only 1975 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 1976 try { 1977 activeElement = document.activeElement; 1978 } catch (error) { 1979 activeElement = document.body; 1980 } 1981 1982 // Support: IE 9 - 11 only 1983 // IE may return null instead of an element 1984 // Interestingly, this only seems to occur when NOT in an iframe 1985 if (!activeElement) { 1986 activeElement = document.body; 1987 } 1988 1989 // Support: IE 11 only 1990 // IE11 returns a seemingly empty object in some cases when accessing 1991 // document.activeElement from an <iframe> 1992 if (!activeElement.nodeName) { 1993 activeElement = document.body; 1994 } 1995 1996 return activeElement; 1997 }; 1998 1999 2000 2001 var safeBlur = $.ui.safeBlur = function(element) { 2002 2003 // Support: IE9 - 10 only 2004 // If the <body> is blurred, IE will switch windows, see #9420 2005 if (element && element.nodeName.toLowerCase() !== "body") { 2006 $(element).trigger("blur"); 2007 } 2008 }; 2009 2010 2011 /*! 2012 * jQuery UI Draggable 1.12.1 2013 * http://jqueryui.com 2014 * 2015 * Copyright jQuery Foundation and other contributors 2016 * Released under the MIT license. 2017 * http://jquery.org/license 2018 */ 2019 2020 //>>label: Draggable 2021 //>>group: Interactions 2022 //>>description: Enables dragging functionality for any element. 2023 //>>docs: http://api.jqueryui.com/draggable/ 2024 //>>demos: http://jqueryui.com/draggable/ 2025 //>>css.structure: ../../themes/base/draggable.css 2026 2027 2028 2029 $.widget("ui.draggable", $.ui.mouse, { 2030 version: "1.12.1", 2031 widgetEventPrefix: "drag", 2032 options: { 2033 addClasses: true, 2034 appendTo: "parent", 2035 axis: false, 2036 connectToSortable: false, 2037 containment: false, 2038 cursor: "auto", 2039 cursorAt: false, 2040 grid: false, 2041 handle: false, 2042 helper: "original", 2043 iframeFix: false, 2044 opacity: false, 2045 refreshPositions: false, 2046 revert: false, 2047 revertDuration: 500, 2048 scope: "default", 2049 scroll: true, 2050 scrollSensitivity: 20, 2051 scrollSpeed: 20, 2052 snap: false, 2053 snapMode: "both", 2054 snapTolerance: 20, 2055 stack: false, 2056 zIndex: false, 2057 2058 // Callbacks 2059 drag: null, 2060 start: null, 2061 stop: null 2062 }, 2063 _create: function() { 2064 2065 if (this.options.helper === "original") { 2066 this._setPositionRelative(); 2067 } 2068 if (this.options.addClasses) { 2069 this._addClass("ui-draggable"); 2070 } 2071 this._setHandleClassName(); 2072 2073 this._mouseInit(); 2074 }, 2075 2076 _setOption: function(key, value) { 2077 this._super(key, value); 2078 if (key === "handle") { 2079 this._removeHandleClassName(); 2080 this._setHandleClassName(); 2081 } 2082 }, 2083 2084 _destroy: function() { 2085 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 2086 this.destroyOnClear = true; 2087 return; 2088 } 2089 this._removeHandleClassName(); 2090 this._mouseDestroy(); 2091 }, 2092 2093 _mouseCapture: function(event) { 2094 var o = this.options; 2095 2096 // Among others, prevent a drag on a resizable-handle 2097 if (this.helper || o.disabled || 2098 $(event.target).closest(".ui-resizable-handle").length > 0) { 2099 return false; 2100 } 2101 2102 //Quit if we're not on a valid handle 2103 this.handle = this._getHandle(event); 2104 if (!this.handle) { 2105 return false; 2106 } 2107 2108 this._blurActiveElement(event); 2109 2110 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 2111 2112 return true; 2113 2114 }, 2115 2116 _blockFrames: function(selector) { 2117 this.iframeBlocks = this.document.find(selector).map(function() { 2118 var iframe = $(this); 2119 2120 return $("<div>") 2121 .css("position", "absolute") 2122 .appendTo(iframe.parent()) 2123 .outerWidth(iframe.outerWidth()) 2124 .outerHeight(iframe.outerHeight()) 2125 .offset(iframe.offset())[0]; 2126 }); 2127 }, 2128 2129 _unblockFrames: function() { 2130 if (this.iframeBlocks) { 2131 this.iframeBlocks.remove(); 2132 delete this.iframeBlocks; 2133 } 2134 }, 2135 2136 _blurActiveElement: function(event) { 2137 var activeElement = $.ui.safeActiveElement(this.document[0]), 2138 target = $(event.target); 2139 2140 // Don't blur if the event occurred on an element that is within 2141 // the currently focused element 2142 // See #10527, #12472 2143 if (target.closest(activeElement).length) { 2144 return; 2145 } 2146 2147 // Blur any element that currently has focus, see #4261 2148 $.ui.safeBlur(activeElement); 2149 }, 2150 2151 _mouseStart: function(event) { 2152 2153 var o = this.options; 2154 2155 //Create and append the visible helper 2156 this.helper = this._createHelper(event); 2157 2158 this._addClass(this.helper, "ui-draggable-dragging"); 2159 2160 //Cache the helper size 2161 this._cacheHelperProportions(); 2162 2163 //If ddmanager is used for droppables, set the global draggable 2164 if ($.ui.ddmanager) { 2165 $.ui.ddmanager.current = this; 2166 } 2167 2168 /* 2169 * - Position generation - 2170 * This block generates everything position related - it's the core of draggables. 2171 */ 2172 2173 //Cache the margins of the original element 2174 this._cacheMargins(); 2175 2176 //Store the helper's css position 2177 this.cssPosition = this.helper.css("position"); 2178 this.scrollParent = this.helper.scrollParent(true); 2179 this.offsetParent = this.helper.offsetParent(); 2180 this.hasFixedAncestor = this.helper.parents().filter(function() { 2181 return $(this).css("position") === "fixed"; 2182 }).length > 0; 2183 2184 //The element's absolute position on the page minus margins 2185 this.positionAbs = this.element.offset(); 2186 this._refreshOffsets(event); 2187 2188 //Generate the original position 2189 this.originalPosition = this.position = this._generatePosition(event, false); 2190 this.originalPageX = event.pageX; 2191 this.originalPageY = event.pageY; 2192 2193 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 2194 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 2195 2196 //Set a containment if given in the options 2197 this._setContainment(); 2198 2199 //Trigger event + callbacks 2200 if (this._trigger("start", event) === false) { 2201 this._clear(); 2202 return false; 2203 } 2204 2205 //Recache the helper size 2206 this._cacheHelperProportions(); 2207 2208 //Prepare the droppable offsets 2209 if ($.ui.ddmanager && !o.dropBehaviour) { 2210 $.ui.ddmanager.prepareOffsets(this, event); 2211 } 2212 2213 // Execute the drag once - this causes the helper not to be visible before getting its 2214 // correct position 2215 this._mouseDrag(event, true); 2216 2217 // If the ddmanager is used for droppables, inform the manager that dragging has started 2218 // (see #5003) 2219 if ($.ui.ddmanager) { 2220 $.ui.ddmanager.dragStart(this, event); 2221 } 2222 2223 return true; 2224 }, 2225 2226 _refreshOffsets: function(event) { 2227 this.offset = { 2228 top: this.positionAbs.top - this.margins.top, 2229 left: this.positionAbs.left - this.margins.left, 2230 scroll: false, 2231 parent: this._getParentOffset(), 2232 relative: this._getRelativeOffset() 2233 }; 2234 2235 this.offset.click = { 2236 left: event.pageX - this.offset.left, 2237 top: event.pageY - this.offset.top 2238 }; 2239 }, 2240 2241 _mouseDrag: function(event, noPropagation) { 2242 2243 // reset any necessary cached properties (see #5009) 2244 if (this.hasFixedAncestor) { 2245 this.offset.parent = this._getParentOffset(); 2246 } 2247 2248 //Compute the helpers position 2249 this.position = this._generatePosition(event, true); 2250 this.positionAbs = this._convertPositionTo("absolute"); 2251 2252 //Call plugins and callbacks and use the resulting position if something is returned 2253 if (!noPropagation) { 2254 var ui = this._uiHash(); 2255 if (this._trigger("drag", event, ui) === false) { 2256 this._mouseUp(new $.Event("mouseup", event)); 2257 return false; 2258 } 2259 this.position = ui.position; 2260 } 2261 2262 this.helper[0].style.left = this.position.left + "px"; 2263 this.helper[0].style.top = this.position.top + "px"; 2264 2265 if ($.ui.ddmanager) { 2266 $.ui.ddmanager.drag(this, event); 2267 } 2268 2269 return false; 2270 }, 2271 2272 _mouseStop: function(event) { 2273 2274 //If we are using droppables, inform the manager about the drop 2275 var that = this, 2276 dropped = false; 2277 if ($.ui.ddmanager && !this.options.dropBehaviour) { 2278 dropped = $.ui.ddmanager.drop(this, event); 2279 } 2280 2281 //if a drop comes from outside (a sortable) 2282 if (this.dropped) { 2283 dropped = this.dropped; 2284 this.dropped = false; 2285 } 2286 2287 if ((this.options.revert === "invalid" && !dropped) || 2288 (this.options.revert === "valid" && dropped) || 2289 this.options.revert === true || ($.isFunction(this.options.revert) && 2290 this.options.revert.call(this.element, dropped)) 2291 ) { 2292 $(this.helper).animate( 2293 this.originalPosition, 2294 parseInt(this.options.revertDuration, 10), 2295 function() { 2296 if (that._trigger("stop", event) !== false) { 2297 that._clear(); 2298 } 2299 } 2300 ); 2301 } else { 2302 if (this._trigger("stop", event) !== false) { 2303 this._clear(); 2304 } 2305 } 2306 2307 return false; 2308 }, 2309 2310 _mouseUp: function(event) { 2311 this._unblockFrames(); 2312 2313 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 2314 // (see #5003) 2315 if ($.ui.ddmanager) { 2316 $.ui.ddmanager.dragStop(this, event); 2317 } 2318 2319 // Only need to focus if the event occurred on the draggable itself, see #10527 2320 if (this.handleElement.is(event.target)) { 2321 2322 // The interaction is over; whether or not the click resulted in a drag, 2323 // focus the element 2324 this.element.trigger("focus"); 2325 } 2326 2327 return $.ui.mouse.prototype._mouseUp.call(this, event); 2328 }, 2329 2330 cancel: function() { 2331 2332 if (this.helper.is(".ui-draggable-dragging")) { 2333 this._mouseUp(new $.Event("mouseup", { target: this.element[0] })); 2334 } else { 2335 this._clear(); 2336 } 2337 2338 return this; 2339 2340 }, 2341 2342 _getHandle: function(event) { 2343 return this.options.handle ? 2344 !!$(event.target).closest(this.element.find(this.options.handle)).length : 2345 true; 2346 }, 2347 2348 _setHandleClassName: function() { 2349 this.handleElement = this.options.handle ? 2350 this.element.find(this.options.handle) : this.element; 2351 this._addClass(this.handleElement, "ui-draggable-handle"); 2352 }, 2353 2354 _removeHandleClassName: function() { 2355 this._removeClass(this.handleElement, "ui-draggable-handle"); 2356 }, 2357 2358 _createHelper: function(event) { 2359 2360 var o = this.options, 2361 helperIsFunction = $.isFunction(o.helper), 2362 helper = helperIsFunction ? 2363 $(o.helper.apply(this.element[0], [event])) : 2364 (o.helper === "clone" ? 2365 this.element.clone().removeAttr("id") : 2366 this.element); 2367 2368 if (!helper.parents("body").length) { 2369 helper.appendTo((o.appendTo === "parent" ? 2370 this.element[0].parentNode : 2371 o.appendTo)); 2372 } 2373 2374 // Http://bugs.jqueryui.com/ticket/9446 2375 // a helper function can return the original element
vendor: 28,772 bytes, lines 2376-3075
2376 // which wouldn't have been set to relative in _create 2377 if (helperIsFunction && helper[0] === this.element[0]) { 2378 this._setPositionRelative(); 2379 } 2380 2381 if (helper[0] !== this.element[0] && 2382 !(/(fixed|absolute)/).test(helper.css("position"))) { 2383 helper.css("position", "absolute"); 2384 } 2385 2386 return helper; 2387 2388 }, 2389 2390 _setPositionRelative: function() { 2391 if (!(/^(?:r|a|f)/).test(this.element.css("position"))) { 2392 this.element[0].style.position = "relative"; 2393 } 2394 }, 2395 2396 _adjustOffsetFromHelper: function(obj) { 2397 if (typeof obj === "string") { 2398 obj = obj.split(" "); 2399 } 2400 if ($.isArray(obj)) { 2401 obj = { left: +obj[0], top: +obj[1] || 0 }; 2402 } 2403 if ("left" in obj) { 2404 this.offset.click.left = obj.left + this.margins.left; 2405 } 2406 if ("right" in obj) { 2407 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 2408 } 2409 if ("top" in obj) { 2410 this.offset.click.top = obj.top + this.margins.top; 2411 } 2412 if ("bottom" in obj) { 2413 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 2414 } 2415 }, 2416 2417 _isRootNode: function(element) { 2418 return (/(html|body)/i).test(element.tagName) || element === this.document[0]; 2419 }, 2420 2421 _getParentOffset: function() { 2422 2423 //Get the offsetParent and cache its position 2424 var po = this.offsetParent.offset(), 2425 document = this.document[0]; 2426 2427 // This is a special case where we need to modify a offset calculated on start, since the 2428 // following happened: 2429 // 1. The position of the helper is absolute, so it's position is calculated based on the 2430 // next positioned parent 2431 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 2432 // the document, which means that the scroll is included in the initial calculation of the 2433 // offset of the parent, and never recalculated upon drag 2434 if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && 2435 $.contains(this.scrollParent[0], this.offsetParent[0])) { 2436 po.left += this.scrollParent.scrollLeft(); 2437 po.top += this.scrollParent.scrollTop(); 2438 } 2439 2440 if (this._isRootNode(this.offsetParent[0])) { 2441 po = { top: 0, left: 0 }; 2442 } 2443 2444 return { 2445 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 2446 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 2447 }; 2448 2449 }, 2450 2451 _getRelativeOffset: function() { 2452 if (this.cssPosition !== "relative") { 2453 return { top: 0, left: 0 }; 2454 } 2455 2456 var p = this.element.position(), 2457 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 2458 2459 return { 2460 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 2461 (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 2462 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 2463 (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) 2464 }; 2465 2466 }, 2467 2468 _cacheMargins: function() { 2469 this.margins = { 2470 left: (parseInt(this.element.css("marginLeft"), 10) || 0), 2471 top: (parseInt(this.element.css("marginTop"), 10) || 0), 2472 right: (parseInt(this.element.css("marginRight"), 10) || 0), 2473 bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) 2474 }; 2475 }, 2476 2477 _cacheHelperProportions: function() { 2478 this.helperProportions = { 2479 width: this.helper.outerWidth(), 2480 height: this.helper.outerHeight() 2481 }; 2482 }, 2483 2484 _setContainment: function() { 2485 2486 var isUserScrollable, c, ce, 2487 o = this.options, 2488 document = this.document[0]; 2489 2490 this.relativeContainer = null; 2491 2492 if (!o.containment) { 2493 this.containment = null; 2494 return; 2495 } 2496 2497 if (o.containment === "window") { 2498 this.containment = [ 2499 $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 2500 $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 2501 $(window).scrollLeft() + $(window).width() - 2502 this.helperProportions.width - this.margins.left, 2503 $(window).scrollTop() + 2504 ($(window).height() || document.body.parentNode.scrollHeight) - 2505 this.helperProportions.height - this.margins.top 2506 ]; 2507 return; 2508 } 2509 2510 if (o.containment === "document") { 2511 this.containment = [ 2512 0, 2513 0, 2514 $(document).width() - this.helperProportions.width - this.margins.left, 2515 ($(document).height() || document.body.parentNode.scrollHeight) - 2516 this.helperProportions.height - this.margins.top 2517 ]; 2518 return; 2519 } 2520 2521 if (o.containment.constructor === Array) { 2522 this.containment = o.containment; 2523 return; 2524 } 2525 2526 if (o.containment === "parent") { 2527 o.containment = this.helper[0].parentNode; 2528 } 2529 2530 c = $(o.containment); 2531 ce = c[0]; 2532 2533 if (!ce) { 2534 return; 2535 } 2536 2537 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 2538 2539 this.containment = [ 2540 (parseInt(c.css("borderLeftWidth"), 10) || 0) + 2541 (parseInt(c.css("paddingLeft"), 10) || 0), 2542 (parseInt(c.css("borderTopWidth"), 10) || 0) + 2543 (parseInt(c.css("paddingTop"), 10) || 0), 2544 (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 2545 (parseInt(c.css("borderRightWidth"), 10) || 0) - 2546 (parseInt(c.css("paddingRight"), 10) || 0) - 2547 this.helperProportions.width - 2548 this.margins.left - 2549 this.margins.right, 2550 (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 2551 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 2552 (parseInt(c.css("paddingBottom"), 10) || 0) - 2553 this.helperProportions.height - 2554 this.margins.top - 2555 this.margins.bottom 2556 ]; 2557 this.relativeContainer = c; 2558 }, 2559 2560 _convertPositionTo: function(d, pos) { 2561 2562 if (!pos) { 2563 pos = this.position; 2564 } 2565 2566 var mod = d === "absolute" ? 1 : -1, 2567 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 2568 2569 return { 2570 top: ( 2571 2572 // The absolute mouse position 2573 pos.top + 2574 2575 // Only for relative positioned nodes: Relative offset from element to offset parent 2576 this.offset.relative.top * mod + 2577 2578 // The offsetParent's offset without borders (offset + border) 2579 this.offset.parent.top * mod - 2580 ((this.cssPosition === "fixed" ? 2581 -this.offset.scroll.top : 2582 (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod) 2583 ), 2584 left: ( 2585 2586 // The absolute mouse position 2587 pos.left + 2588 2589 // Only for relative positioned nodes: Relative offset from element to offset parent 2590 this.offset.relative.left * mod + 2591 2592 // The offsetParent's offset without borders (offset + border) 2593 this.offset.parent.left * mod - 2594 ((this.cssPosition === "fixed" ? 2595 -this.offset.scroll.left : 2596 (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod) 2597 ) 2598 }; 2599 2600 }, 2601 2602 _generatePosition: function(event, constrainPosition) { 2603 2604 var containment, co, top, left, 2605 o = this.options, 2606 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 2607 pageX = event.pageX, 2608 pageY = event.pageY; 2609 2610 // Cache the scroll 2611 if (!scrollIsRootNode || !this.offset.scroll) { 2612 this.offset.scroll = { 2613 top: this.scrollParent.scrollTop(), 2614 left: this.scrollParent.scrollLeft() 2615 }; 2616 } 2617 2618 /* 2619 * - Position constraining - 2620 * Constrain the position to a mix of grid, containment. 2621 */ 2622 2623 // If we are not dragging yet, we won't check for options 2624 if (constrainPosition) { 2625 if (this.containment) { 2626 if (this.relativeContainer) { 2627 co = this.relativeContainer.offset(); 2628 containment = [ 2629 this.containment[0] + co.left, 2630 this.containment[1] + co.top, 2631 this.containment[2] + co.left, 2632 this.containment[3] + co.top 2633 ]; 2634 } else { 2635 containment = this.containment; 2636 } 2637 2638 if (event.pageX - this.offset.click.left < containment[0]) { 2639 pageX = containment[0] + this.offset.click.left; 2640 } 2641 if (event.pageY - this.offset.click.top < containment[1]) { 2642 pageY = containment[1] + this.offset.click.top; 2643 } 2644 if (event.pageX - this.offset.click.left > containment[2]) { 2645 pageX = containment[2] + this.offset.click.left; 2646 } 2647 if (event.pageY - this.offset.click.top > containment[3]) { 2648 pageY = containment[3] + this.offset.click.top; 2649 } 2650 } 2651 2652 if (o.grid) { 2653 2654 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 2655 // argument errors in IE (see ticket #6950) 2656 top = o.grid[1] ? this.originalPageY + Math.round((pageY - 2657 this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 2658 pageY = containment ? ((top - this.offset.click.top >= containment[1] || 2659 top - this.offset.click.top > containment[3]) ? 2660 top : 2661 ((top - this.offset.click.top >= containment[1]) ? 2662 top - o.grid[1] : top + o.grid[1])) : top; 2663 2664 left = o.grid[0] ? this.originalPageX + 2665 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : 2666 this.originalPageX; 2667 pageX = containment ? ((left - this.offset.click.left >= containment[0] || 2668 left - this.offset.click.left > containment[2]) ? 2669 left : 2670 ((left - this.offset.click.left >= containment[0]) ? 2671 left - o.grid[0] : left + o.grid[0])) : left; 2672 } 2673 2674 if (o.axis === "y") { 2675 pageX = this.originalPageX; 2676 } 2677 2678 if (o.axis === "x") { 2679 pageY = this.originalPageY; 2680 } 2681 } 2682 2683 return { 2684 top: ( 2685 2686 // The absolute mouse position 2687 pageY - 2688 2689 // Click offset (relative to the element) 2690 this.offset.click.top - 2691 2692 // Only for relative positioned nodes: Relative offset from element to offset parent 2693 this.offset.relative.top - 2694 2695 // The offsetParent's offset without borders (offset + border) 2696 this.offset.parent.top + 2697 (this.cssPosition === "fixed" ? 2698 -this.offset.scroll.top : 2699 (scrollIsRootNode ? 0 : this.offset.scroll.top)) 2700 ), 2701 left: ( 2702 2703 // The absolute mouse position 2704 pageX - 2705 2706 // Click offset (relative to the element) 2707 this.offset.click.left - 2708 2709 // Only for relative positioned nodes: Relative offset from element to offset parent 2710 this.offset.relative.left - 2711 2712 // The offsetParent's offset without borders (offset + border) 2713 this.offset.parent.left + 2714 (this.cssPosition === "fixed" ? 2715 -this.offset.scroll.left : 2716 (scrollIsRootNode ? 0 : this.offset.scroll.left)) 2717 ) 2718 }; 2719 2720 }, 2721 2722 _clear: function() { 2723 this._removeClass(this.helper, "ui-draggable-dragging"); 2724 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 2725 this.helper.remove(); 2726 } 2727 this.helper = null; 2728 this.cancelHelperRemoval = false; 2729 if (this.destroyOnClear) { 2730 this.destroy(); 2731 } 2732 }, 2733 2734 // From now on bulk stuff - mainly helpers 2735 2736 _trigger: function(type, event, ui) { 2737 ui = ui || this._uiHash(); 2738 $.ui.plugin.call(this, type, [event, ui, this], true); 2739 2740 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 2741 if (/^(drag|start|stop)/.test(type)) { 2742 this.positionAbs = this._convertPositionTo("absolute"); 2743 ui.offset = this.positionAbs; 2744 } 2745 return $.Widget.prototype._trigger.call(this, type, event, ui); 2746 }, 2747 2748 plugins: {}, 2749 2750 _uiHash: function() { 2751 return { 2752 helper: this.helper, 2753 position: this.position, 2754 originalPosition: this.originalPosition, 2755 offset: this.positionAbs 2756 }; 2757 } 2758 2759 }); 2760 2761 $.ui.plugin.add("draggable", "connectToSortable", { 2762 start: function(event, ui, draggable) { 2763 var uiSortable = $.extend({}, ui, { 2764 item: draggable.element 2765 }); 2766 2767 draggable.sortables = []; 2768 $(draggable.options.connectToSortable).each(function() { 2769 var sortable = $(this).sortable("instance"); 2770 2771 if (sortable && !sortable.options.disabled) { 2772 draggable.sortables.push(sortable); 2773 2774 // RefreshPositions is called at drag start to refresh the containerCache 2775 // which is used in drag. This ensures it's initialized and synchronized 2776 // with any changes that might have happened on the page since initialization. 2777 sortable.refreshPositions(); 2778 sortable._trigger("activate", event, uiSortable); 2779 } 2780 }); 2781 }, 2782 stop: function(event, ui, draggable) { 2783 var uiSortable = $.extend({}, ui, { 2784 item: draggable.element 2785 }); 2786 2787 draggable.cancelHelperRemoval = false; 2788 2789 $.each(draggable.sortables, function() { 2790 var sortable = this; 2791 2792 if (sortable.isOver) { 2793 sortable.isOver = 0; 2794 2795 // Allow this sortable to handle removing the helper 2796 draggable.cancelHelperRemoval = true; 2797 sortable.cancelHelperRemoval = false; 2798 2799 // Use _storedCSS To restore properties in the sortable, 2800 // as this also handles revert (#9675) since the draggable 2801 // may have modified them in unexpected ways (#8809) 2802 sortable._storedCSS = { 2803 position: sortable.placeholder.css("position"), 2804 top: sortable.placeholder.css("top"), 2805 left: sortable.placeholder.css("left") 2806 }; 2807 2808 sortable._mouseStop(event); 2809 2810 // Once drag has ended, the sortable should return to using 2811 // its original helper, not the shared helper from draggable 2812 sortable.options.helper = sortable.options._helper; 2813 } else { 2814 2815 // Prevent this Sortable from removing the helper. 2816 // However, don't set the draggable to remove the helper 2817 // either as another connected Sortable may yet handle the removal. 2818 sortable.cancelHelperRemoval = true; 2819 2820 sortable._trigger("deactivate", event, uiSortable); 2821 } 2822 }); 2823 }, 2824 drag: function(event, ui, draggable) { 2825 $.each(draggable.sortables, function() { 2826 var innermostIntersecting = false, 2827 sortable = this; 2828 2829 // Copy over variables that sortable's _intersectsWith uses 2830 sortable.positionAbs = draggable.positionAbs; 2831 sortable.helperProportions = draggable.helperProportions; 2832 sortable.offset.click = draggable.offset.click; 2833 2834 if (sortable._intersectsWith(sortable.containerCache)) { 2835 innermostIntersecting = true; 2836 2837 $.each(draggable.sortables, function() { 2838 2839 // Copy over variables that sortable's _intersectsWith uses 2840 this.positionAbs = draggable.positionAbs; 2841 this.helperProportions = draggable.helperProportions; 2842 this.offset.click = draggable.offset.click; 2843 2844 if (this !== sortable && 2845 this._intersectsWith(this.containerCache) && 2846 $.contains(sortable.element[0], this.element[0])) { 2847 innermostIntersecting = false; 2848 } 2849 2850 return innermostIntersecting; 2851 }); 2852 } 2853 2854 if (innermostIntersecting) { 2855 2856 // If it intersects, we use a little isOver variable and set it once, 2857 // so that the move-in stuff gets fired only once. 2858 if (!sortable.isOver) { 2859 sortable.isOver = 1; 2860 2861 // Store draggable's parent in case we need to reappend to it later. 2862 draggable._parent = ui.helper.parent(); 2863 2864 sortable.currentItem = ui.helper 2865 .appendTo(sortable.element) 2866 .data("ui-sortable-item", true); 2867 2868 // Store helper option to later restore it 2869 sortable.options._helper = sortable.options.helper; 2870 2871 sortable.options.helper = function() { 2872 return ui.helper[0]; 2873 }; 2874 2875 // Fire the start events of the sortable with our passed browser event, 2876 // and our own helper (so it doesn't create a new one) 2877 event.target = sortable.currentItem[0]; 2878 sortable._mouseCapture(event, true); 2879 sortable._mouseStart(event, true, true); 2880 2881 // Because the browser event is way off the new appended portlet, 2882 // modify necessary variables to reflect the changes 2883 sortable.offset.click.top = draggable.offset.click.top; 2884 sortable.offset.click.left = draggable.offset.click.left; 2885 sortable.offset.parent.left -= draggable.offset.parent.left - 2886 sortable.offset.parent.left; 2887 sortable.offset.parent.top -= draggable.offset.parent.top - 2888 sortable.offset.parent.top; 2889 2890 draggable._trigger("toSortable", event); 2891 2892 // Inform draggable that the helper is in a valid drop zone, 2893 // used solely in the revert option to handle "valid/invalid". 2894 draggable.dropped = sortable.element; 2895 2896 // Need to refreshPositions of all sortables in the case that 2897 // adding to one sortable changes the location of the other sortables (#9675) 2898 $.each(draggable.sortables, function() { 2899 this.refreshPositions(); 2900 }); 2901 2902 // Hack so receive/update callbacks work (mostly) 2903 draggable.currentItem = draggable.element; 2904 sortable.fromOutside = draggable; 2905 } 2906 2907 if (sortable.currentItem) { 2908 sortable._mouseDrag(event); 2909 2910 // Copy the sortable's position because the draggable's can potentially reflect 2911 // a relative position, while sortable is always absolute, which the dragged 2912 // element has now become. (#8809) 2913 ui.position = sortable.position; 2914 } 2915 } else { 2916 2917 // If it doesn't intersect with the sortable, and it intersected before, 2918 // we fake the drag stop of the sortable, but make sure it doesn't remove 2919 // the helper by using cancelHelperRemoval. 2920 if (sortable.isOver) { 2921 2922 sortable.isOver = 0; 2923 sortable.cancelHelperRemoval = true; 2924 2925 // Calling sortable's mouseStop would trigger a revert, 2926 // so revert must be temporarily false until after mouseStop is called. 2927 sortable.options._revert = sortable.options.revert; 2928 sortable.options.revert = false; 2929 2930 sortable._trigger("out", event, sortable._uiHash(sortable)); 2931 sortable._mouseStop(event, true); 2932 2933 // Restore sortable behaviors that were modfied 2934 // when the draggable entered the sortable area (#9481) 2935 sortable.options.revert = sortable.options._revert; 2936 sortable.options.helper = sortable.options._helper; 2937 2938 if (sortable.placeholder) { 2939 sortable.placeholder.remove(); 2940 } 2941 2942 // Restore and recalculate the draggable's offset considering the sortable 2943 // may have modified them in unexpected ways. (#8809, #10669) 2944 ui.helper.appendTo(draggable._parent); 2945 draggable._refreshOffsets(event); 2946 ui.position = draggable._generatePosition(event, true); 2947 2948 draggable._trigger("fromSortable", event); 2949 2950 // Inform draggable that the helper is no longer in a valid drop zone 2951 draggable.dropped = false; 2952 2953 // Need to refreshPositions of all sortables just in case removing 2954 // from one sortable changes the location of other sortables (#9675) 2955 $.each(draggable.sortables, function() { 2956 this.refreshPositions(); 2957 }); 2958 } 2959 } 2960 }); 2961 } 2962 }); 2963 2964 $.ui.plugin.add("draggable", "cursor", { 2965 start: function(event, ui, instance) { 2966 var t = $("body"), 2967 o = instance.options; 2968 2969 if (t.css("cursor")) { 2970 o._cursor = t.css("cursor"); 2971 } 2972 t.css("cursor", o.cursor); 2973 }, 2974 stop: function(event, ui, instance) { 2975 var o = instance.options; 2976 if (o._cursor) { 2977 $("body").css("cursor", o._cursor); 2978 } 2979 } 2980 }); 2981 2982 $.ui.plugin.add("draggable", "opacity", { 2983 start: function(event, ui, instance) { 2984 var t = $(ui.helper), 2985 o = instance.options; 2986 if (t.css("opacity")) { 2987 o._opacity = t.css("opacity"); 2988 } 2989 t.css("opacity", o.opacity); 2990 }, 2991 stop: function(event, ui, instance) { 2992 var o = instance.options; 2993 if (o._opacity) { 2994 $(ui.helper).css("opacity", o._opacity); 2995 } 2996 } 2997 }); 2998 2999 $.ui.plugin.add("draggable", "scroll", { 3000 start: function(event, ui, i) { 3001 if (!i.scrollParentNotHidden) { 3002 i.scrollParentNotHidden = i.helper.scrollParent(false); 3003 } 3004 3005 if (i.scrollParentNotHidden[0] !== i.document[0] && 3006 i.scrollParentNotHidden[0].tagName !== "HTML") { 3007 i.overflowOffset = i.scrollParentNotHidden.offset(); 3008 } 3009 }, 3010 drag: function(event, ui, i) { 3011 3012 var o = i.options, 3013 scrolled = false, 3014 scrollParent = i.scrollParentNotHidden[0], 3015 document = i.document[0]; 3016 3017 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 3018 if (!o.axis || o.axis !== "x") { 3019 if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < 3020 o.scrollSensitivity) { 3021 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 3022 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 3023 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 3024 } 3025 } 3026 3027 if (!o.axis || o.axis !== "y") { 3028 if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < 3029 o.scrollSensitivity) { 3030 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 3031 } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 3032 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 3033 } 3034 } 3035 3036 } else { 3037 3038 if (!o.axis || o.axis !== "x") { 3039 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 3040 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 3041 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < 3042 o.scrollSensitivity) { 3043 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 3044 } 3045 } 3046 3047 if (!o.axis || o.axis !== "y") { 3048 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 3049 scrolled = $(document).scrollLeft( 3050 $(document).scrollLeft() - o.scrollSpeed 3051 ); 3052 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < 3053 o.scrollSensitivity) { 3054 scrolled = $(document).scrollLeft( 3055 $(document).scrollLeft() + o.scrollSpeed 3056 ); 3057 } 3058 } 3059 3060 } 3061 3062 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 3063 $.ui.ddmanager.prepareOffsets(i, event); 3064 } 3065 3066 } 3067 }); 3068 3069 $.ui.plugin.add("draggable", "snap", { 3070 start: function(event, ui, i) { 3071 3072 var o = i.options; 3073 3074 i.snapElements = []; 3075
vendor: 6,953 bytes, lines 3076-3267
3076 $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap) 3077 .each(function() { 3078 var $t = $(this), 3079 $o = $t.offset(); 3080 if (this !== i.element[0]) { 3081 i.snapElements.push({ 3082 item: this, 3083 width: $t.outerWidth(), 3084 height: $t.outerHeight(), 3085 top: $o.top, 3086 left: $o.left 3087 }); 3088 } 3089 }); 3090 3091 }, 3092 drag: function(event, ui, inst) { 3093 3094 var ts, bs, ls, rs, l, r, t, b, i, first, 3095 o = inst.options, 3096 d = o.snapTolerance, 3097 x1 = ui.offset.left, 3098 x2 = x1 + inst.helperProportions.width, 3099 y1 = ui.offset.top, 3100 y2 = y1 + inst.helperProportions.height; 3101 3102 for (i = inst.snapElements.length - 1; i >= 0; i--) { 3103 3104 l = inst.snapElements[i].left - inst.margins.left; 3105 r = l + inst.snapElements[i].width; 3106 t = inst.snapElements[i].top - inst.margins.top; 3107 b = t + inst.snapElements[i].height; 3108 3109 if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 3110 !$.contains(inst.snapElements[i].item.ownerDocument, 3111 inst.snapElements[i].item)) { 3112 if (inst.snapElements[i].snapping) { 3113 (inst.options.snap.release && 3114 inst.options.snap.release.call( 3115 inst.element, 3116 event, 3117 $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }) 3118 )); 3119 } 3120 inst.snapElements[i].snapping = false; 3121 continue; 3122 } 3123 3124 if (o.snapMode !== "inner") { 3125 ts = Math.abs(t - y2) <= d; 3126 bs = Math.abs(b - y1) <= d; 3127 ls = Math.abs(l - x2) <= d; 3128 rs = Math.abs(r - x1) <= d; 3129 if (ts) { 3130 ui.position.top = inst._convertPositionTo("relative", { 3131 top: t - inst.helperProportions.height, 3132 left: 0 3133 }).top; 3134 } 3135 if (bs) { 3136 ui.position.top = inst._convertPositionTo("relative", { 3137 top: b, 3138 left: 0 3139 }).top; 3140 } 3141 if (ls) { 3142 ui.position.left = inst._convertPositionTo("relative", { 3143 top: 0, 3144 left: l - inst.helperProportions.width 3145 }).left; 3146 } 3147 if (rs) { 3148 ui.position.left = inst._convertPositionTo("relative", { 3149 top: 0, 3150 left: r 3151 }).left; 3152 } 3153 } 3154 3155 first = (ts || bs || ls || rs); 3156 3157 if (o.snapMode !== "outer") { 3158 ts = Math.abs(t - y1) <= d; 3159 bs = Math.abs(b - y2) <= d; 3160 ls = Math.abs(l - x1) <= d; 3161 rs = Math.abs(r - x2) <= d; 3162 if (ts) { 3163 ui.position.top = inst._convertPositionTo("relative", { 3164 top: t, 3165 left: 0 3166 }).top; 3167 } 3168 if (bs) { 3169 ui.position.top = inst._convertPositionTo("relative", { 3170 top: b - inst.helperProportions.height, 3171 left: 0 3172 }).top; 3173 } 3174 if (ls) { 3175 ui.position.left = inst._convertPositionTo("relative", { 3176 top: 0, 3177 left: l 3178 }).left; 3179 } 3180 if (rs) { 3181 ui.position.left = inst._convertPositionTo("relative", { 3182 top: 0, 3183 left: r - inst.helperProportions.width 3184 }).left; 3185 } 3186 } 3187 3188 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 3189 (inst.options.snap.snap && 3190 inst.options.snap.snap.call( 3191 inst.element, 3192 event, 3193 $.extend(inst._uiHash(), { 3194 snapItem: inst.snapElements[i].item 3195 }))); 3196 } 3197 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 3198 3199 } 3200 3201 } 3202 }); 3203 3204 $.ui.plugin.add("draggable", "stack", { 3205 start: function(event, ui, instance) { 3206 var min, 3207 o = instance.options, 3208 group = $.makeArray($(o.stack)).sort(function(a, b) { 3209 return (parseInt($(a).css("zIndex"), 10) || 0) - 3210 (parseInt($(b).css("zIndex"), 10) || 0); 3211 }); 3212 3213 if (!group.length) { return; } 3214 3215 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 3216 $(group).each(function(i) { 3217 $(this).css("zIndex", min + i); 3218 }); 3219 this.css("zIndex", (min + group.length)); 3220 } 3221 }); 3222 3223 $.ui.plugin.add("draggable", "zIndex", { 3224 start: function(event, ui, instance) { 3225 var t = $(ui.helper), 3226 o = instance.options; 3227 3228 if (t.css("zIndex")) { 3229 o._zIndex = t.css("zIndex"); 3230 } 3231 t.css("zIndex", o.zIndex); 3232 }, 3233 stop: function(event, ui, instance) { 3234 var o = instance.options; 3235 3236 if (o._zIndex) { 3237 $(ui.helper).css("zIndex", o._zIndex); 3238 } 3239 } 3240 }); 3241 3242 var widgetsDraggable = $.ui.draggable; 3243 3244 3245 /*! 3246 * jQuery UI Droppable 1.12.1 3247 * http://jqueryui.com 3248 * 3249 * Copyright jQuery Foundation and other contributors 3250 * Released under the MIT license. 3251 * http://jquery.org/license 3252 */ 3253 3254 //>>label: Droppable 3255 //>>group: Interactions 3256 //>>description: Enables drop targets for draggable elements. 3257 //>>docs: http://api.jqueryui.com/droppable/ 3258 //>>demos: http://jqueryui.com/droppable/ 3259 3260 3261 3262 $.widget("ui.droppable", { 3263 version: "1.12.1", 3264 widgetEventPrefix: "drop", 3265 options: { 3266 accept: "*", 3267 addClasses: true,
vendor: 13,513 bytes, lines 3268-3651
3268 greedy: false, 3269 scope: "default", 3270 tolerance: "intersect", 3271 3272 // Callbacks 3273 activate: null, 3274 deactivate: null, 3275 drop: null, 3276 out: null, 3277 over: null 3278 }, 3279 _create: function() { 3280 3281 var proportions, 3282 o = this.options, 3283 accept = o.accept; 3284 3285 this.isover = false; 3286 this.isout = true; 3287 3288 this.accept = $.isFunction(accept) ? accept : function(d) { 3289 return d.is(accept); 3290 }; 3291 3292 this.proportions = function( /* valueToWrite */ ) { 3293 if (arguments.length) { 3294 3295 // Store the droppable's proportions 3296 proportions = arguments[0]; 3297 } else { 3298 3299 // Retrieve or derive the droppable's proportions 3300 return proportions ? 3301 proportions : 3302 proportions = { 3303 width: this.element[0].offsetWidth, 3304 height: this.element[0].offsetHeight 3305 }; 3306 } 3307 }; 3308 3309 this._addToManager(o.scope); 3310 3311 o.addClasses && this._addClass("ui-droppable"); 3312 3313 }, 3314 3315 _addToManager: function(scope) { 3316 3317 // Add the reference and positions to the manager 3318 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 3319 $.ui.ddmanager.droppables[scope].push(this); 3320 }, 3321 3322 _splice: function(drop) { 3323 var i = 0; 3324 for (; i < drop.length; i++) { 3325 if (drop[i] === this) { 3326 drop.splice(i, 1); 3327 } 3328 } 3329 }, 3330 3331 _destroy: function() { 3332 var drop = $.ui.ddmanager.droppables[this.options.scope]; 3333 3334 this._splice(drop); 3335 }, 3336 3337 _setOption: function(key, value) { 3338 3339 if (key === "accept") { 3340 this.accept = $.isFunction(value) ? value : function(d) { 3341 return d.is(value); 3342 }; 3343 } else if (key === "scope") { 3344 var drop = $.ui.ddmanager.droppables[this.options.scope]; 3345 3346 this._splice(drop); 3347 this._addToManager(value); 3348 } 3349 3350 this._super(key, value); 3351 }, 3352 3353 _activate: function(event) { 3354 var draggable = $.ui.ddmanager.current; 3355 3356 this._addActiveClass(); 3357 if (draggable) { 3358 this._trigger("activate", event, this.ui(draggable)); 3359 } 3360 }, 3361 3362 _deactivate: function(event) { 3363 var draggable = $.ui.ddmanager.current; 3364 3365 this._removeActiveClass(); 3366 if (draggable) { 3367 this._trigger("deactivate", event, this.ui(draggable)); 3368 } 3369 }, 3370 3371 _over: function(event) { 3372 3373 var draggable = $.ui.ddmanager.current; 3374 3375 // Bail if draggable and droppable are same element 3376 if (!draggable || (draggable.currentItem || 3377 draggable.element)[0] === this.element[0]) { 3378 return; 3379 } 3380 3381 if (this.accept.call(this.element[0], (draggable.currentItem || 3382 draggable.element))) { 3383 this._addHoverClass(); 3384 this._trigger("over", event, this.ui(draggable)); 3385 } 3386 3387 }, 3388 3389 _out: function(event) { 3390 3391 var draggable = $.ui.ddmanager.current; 3392 3393 // Bail if draggable and droppable are same element 3394 if (!draggable || (draggable.currentItem || 3395 draggable.element)[0] === this.element[0]) { 3396 return; 3397 } 3398 3399 if (this.accept.call(this.element[0], (draggable.currentItem || 3400 draggable.element))) { 3401 this._removeHoverClass(); 3402 this._trigger("out", event, this.ui(draggable)); 3403 } 3404 3405 }, 3406 3407 _drop: function(event, custom) { 3408 3409 var draggable = custom || $.ui.ddmanager.current, 3410 childrenIntersection = false; 3411 3412 // Bail if draggable and droppable are same element 3413 if (!draggable || (draggable.currentItem || 3414 draggable.element)[0] === this.element[0]) { 3415 return false; 3416 } 3417 3418 this.element 3419 .find(":data(ui-droppable)") 3420 .not(".ui-draggable-dragging") 3421 .each(function() { 3422 var inst = $(this).droppable("instance"); 3423 if ( 3424 inst.options.greedy && 3425 !inst.options.disabled && 3426 inst.options.scope === draggable.options.scope && 3427 inst.accept.call( 3428 inst.element[0], (draggable.currentItem || draggable.element) 3429 ) && 3430 intersect( 3431 draggable, 3432 $.extend(inst, { offset: inst.element.offset() }), 3433 inst.options.tolerance, event 3434 ) 3435 ) { 3436 childrenIntersection = true; 3437 return false; 3438 } 3439 }); 3440 if (childrenIntersection) { 3441 return false; 3442 } 3443 3444 if (this.accept.call(this.element[0], 3445 (draggable.currentItem || draggable.element))) { 3446 this._removeActiveClass(); 3447 this._removeHoverClass(); 3448 3449 this._trigger("drop", event, this.ui(draggable)); 3450 return this.element; 3451 } 3452 3453 return false; 3454 3455 }, 3456 3457 ui: function(c) { 3458 return { 3459 draggable: (c.currentItem || c.element), 3460 helper: c.helper, 3461 position: c.position, 3462 offset: c.positionAbs 3463 }; 3464 }, 3465 3466 // Extension points just to make backcompat sane and avoid duplicating logic 3467 // TODO: Remove in 1.13 along with call to it below 3468 _addHoverClass: function() { 3469 this._addClass("ui-droppable-hover"); 3470 }, 3471 3472 _removeHoverClass: function() { 3473 this._removeClass("ui-droppable-hover"); 3474 }, 3475 3476 _addActiveClass: function() { 3477 this._addClass("ui-droppable-active"); 3478 }, 3479 3480 _removeActiveClass: function() { 3481 this._removeClass("ui-droppable-active"); 3482 } 3483 }); 3484 3485 var intersect = $.ui.intersect = (function() { 3486 function isOverAxis(x, reference, size) { 3487 return (x >= reference) && (x < (reference + size)); 3488 } 3489 3490 return function(draggable, droppable, toleranceMode, event) { 3491 3492 if (!droppable.offset) { 3493 return false; 3494 } 3495 3496 var x1 = (draggable.positionAbs || 3497 draggable.position.absolute).left + draggable.margins.left, 3498 y1 = (draggable.positionAbs || 3499 draggable.position.absolute).top + draggable.margins.top, 3500 x2 = x1 + draggable.helperProportions.width, 3501 y2 = y1 + draggable.helperProportions.height, 3502 l = droppable.offset.left, 3503 t = droppable.offset.top, 3504 r = l + droppable.proportions().width, 3505 b = t + droppable.proportions().height; 3506 3507 switch (toleranceMode) { 3508 case "fit": 3509 return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 3510 case "intersect": 3511 return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 3512 x2 - (draggable.helperProportions.width / 2) < r && // Left Half 3513 t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 3514 y2 - (draggable.helperProportions.height / 2) < b); // Top Half 3515 case "pointer": 3516 return isOverAxis(event.pageY, t, droppable.proportions().height) && 3517 isOverAxis(event.pageX, l, droppable.proportions().width); 3518 case "touch": 3519 return ( 3520 (y1 >= t && y1 <= b) || // Top edge touching 3521 (y2 >= t && y2 <= b) || // Bottom edge touching 3522 (y1 < t && y2 > b) // Surrounded vertically 3523 ) && ( 3524 (x1 >= l && x1 <= r) || // Left edge touching 3525 (x2 >= l && x2 <= r) || // Right edge touching 3526 (x1 < l && x2 > r) // Surrounded horizontally 3527 ); 3528 default: 3529 return false; 3530 } 3531 }; 3532 })(); 3533 3534 /* 3535 This manager tracks offsets of draggables and droppables 3536 */ 3537 $.ui.ddmanager = { 3538 current: null, 3539 droppables: { "default": [] }, 3540 prepareOffsets: function(t, event) { 3541 3542 var i, j, 3543 m = $.ui.ddmanager.droppables[t.options.scope] || [], 3544 type = event ? event.type : null, // workaround for #2317 3545 list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 3546 3547 droppablesLoop: for (i = 0; i < m.length; i++) { 3548 3549 // No disabled and non-accepted 3550 if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], 3551 (t.currentItem || t.element)))) { 3552 continue; 3553 } 3554 3555 // Filter out elements in the current dragged item 3556 for (j = 0; j < list.length; j++) { 3557 if (list[j] === m[i].element[0]) { 3558 m[i].proportions().height = 0; 3559 continue droppablesLoop; 3560 } 3561 } 3562 3563 m[i].visible = m[i].element.css("display") !== "none"; 3564 if (!m[i].visible) { 3565 continue; 3566 } 3567 3568 // Activate the droppable if used directly from draggables 3569 if (type === "mousedown") { 3570 m[i]._activate.call(m[i], event); 3571 } 3572 3573 m[i].offset = m[i].element.offset(); 3574 m[i].proportions({ 3575 width: m[i].element[0].offsetWidth, 3576 height: m[i].element[0].offsetHeight 3577 }); 3578 3579 } 3580 3581 }, 3582 drop: function(draggable, event) { 3583 3584 var dropped = false; 3585 3586 // Create a copy of the droppables in case the list changes during the drop (#9116) 3587 $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function() { 3588 3589 if (!this.options) { 3590 return; 3591 } 3592 if (!this.options.disabled && this.visible && 3593 intersect(draggable, this, this.options.tolerance, event)) { 3594 dropped = this._drop.call(this, event) || dropped; 3595 } 3596 3597 if (!this.options.disabled && this.visible && this.accept.call(this.element[0], 3598 (draggable.currentItem || draggable.element))) { 3599 this.isout = true; 3600 this.isover = false; 3601 this._deactivate.call(this, event); 3602 } 3603 3604 }); 3605 return dropped; 3606 3607 }, 3608 dragStart: function(draggable, event) { 3609 3610 // Listen for scrolling so that if the dragging causes scrolling the position of the 3611 // droppables can be recalculated (see #5003) 3612 draggable.element.parentsUntil("body").on("scroll.droppable", function() { 3613 if (!draggable.options.refreshPositions) { 3614 $.ui.ddmanager.prepareOffsets(draggable, event); 3615 } 3616 }); 3617 }, 3618 drag: function(draggable, event) { 3619 3620 // If you have a highly dynamic page, you might try this option. It renders positions 3621 // every time you move the mouse. 3622 if (draggable.options.refreshPositions) { 3623 $.ui.ddmanager.prepareOffsets(draggable, event); 3624 } 3625 3626 // Run through all droppables and check their positions based on specific tolerance options 3627 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { 3628 3629 if (this.options.disabled || this.greedyChild || !this.visible) { 3630 return; 3631 } 3632 3633 var parentInstance, scope, parent, 3634 intersects = intersect(draggable, this, this.options.tolerance, event), 3635 c = !intersects && this.isover ? 3636 "isout" : 3637 (intersects && !this.isover ? "isover" : null); 3638 if (!c) { 3639 return; 3640 } 3641 3642 if (this.options.greedy) { 3643 3644 // find droppable parents with same scope 3645 scope = this.options.scope; 3646 parent = this.element.parents(":data(ui-droppable)").filter(function() { 3647 return $(this).droppable("instance").options.scope === scope; 3648 }); 3649 3650 if (parent.length) { 3651 parentInstance = $(parent[0]).droppable("instance");
vendor: 4,400 bytes, lines 3652-3790
3652 parentInstance.greedyChild = (c === "isover"); 3653 } 3654 } 3655 3656 // We just moved into a greedy child 3657 if (parentInstance && c === "isover") { 3658 parentInstance.isover = false; 3659 parentInstance.isout = true; 3660 parentInstance._out.call(parentInstance, event); 3661 } 3662 3663 this[c] = true; 3664 this[c === "isout" ? "isover" : "isout"] = false; 3665 this[c === "isover" ? "_over" : "_out"].call(this, event); 3666 3667 // We just moved out of a greedy child 3668 if (parentInstance && c === "isout") { 3669 parentInstance.isout = false; 3670 parentInstance.isover = true; 3671 parentInstance._over.call(parentInstance, event); 3672 } 3673 }); 3674 3675 }, 3676 dragStop: function(draggable, event) { 3677 draggable.element.parentsUntil("body").off("scroll.droppable"); 3678 3679 // Call prepareOffsets one final time since IE does not fire return scroll events when 3680 // overflow was caused by drag (see #5003) 3681 if (!draggable.options.refreshPositions) { 3682 $.ui.ddmanager.prepareOffsets(draggable, event); 3683 } 3684 } 3685 }; 3686 3687 // DEPRECATED 3688 // TODO: switch return back to widget declaration at top of file when this is removed 3689 if ($.uiBackCompat !== false) { 3690 3691 // Backcompat for activeClass and hoverClass options 3692 $.widget("ui.droppable", $.ui.droppable, { 3693 options: { 3694 hoverClass: false, 3695 activeClass: false 3696 }, 3697 _addActiveClass: function() { 3698 this._super(); 3699 if (this.options.activeClass) { 3700 this.element.addClass(this.options.activeClass); 3701 } 3702 }, 3703 _removeActiveClass: function() { 3704 this._super(); 3705 if (this.options.activeClass) { 3706 this.element.removeClass(this.options.activeClass); 3707 } 3708 }, 3709 _addHoverClass: function() { 3710 this._super(); 3711 if (this.options.hoverClass) { 3712 this.element.addClass(this.options.hoverClass); 3713 } 3714 }, 3715 _removeHoverClass: function() { 3716 this._super(); 3717 if (this.options.hoverClass) { 3718 this.element.removeClass(this.options.hoverClass); 3719 } 3720 } 3721 }); 3722 } 3723 3724 var widgetsDroppable = $.ui.droppable; 3725 3726 3727 /*! 3728 * jQuery UI Resizable 1.12.1 3729 * http://jqueryui.com 3730 * 3731 * Copyright jQuery Foundation and other contributors 3732 * Released under the MIT license. 3733 * http://jquery.org/license 3734 */ 3735 3736 //>>label: Resizable 3737 //>>group: Interactions 3738 //>>description: Enables resize functionality for any element. 3739 //>>docs: http://api.jqueryui.com/resizable/ 3740 //>>demos: http://jqueryui.com/resizable/ 3741 //>>css.structure: ../../themes/base/core.css 3742 //>>css.structure: ../../themes/base/resizable.css 3743 //>>css.theme: ../../themes/base/theme.css 3744 3745 3746 3747 $.widget("ui.resizable", $.ui.mouse, { 3748 version: "1.12.1", 3749 widgetEventPrefix: "resize", 3750 options: { 3751 alsoResize: false, 3752 animate: false, 3753 animateDuration: "slow", 3754 animateEasing: "swing", 3755 aspectRatio: false, 3756 autoHide: false, 3757 classes: { 3758 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 3759 }, 3760 containment: false, 3761 ghost: false, 3762 grid: false, 3763 handles: "e,s,se", 3764 helper: false, 3765 maxHeight: null, 3766 maxWidth: null, 3767 minHeight: 10, 3768 minWidth: 10, 3769 3770 // See #7960 3771 zIndex: 90, 3772 3773 // Callbacks 3774 resize: null, 3775 start: null, 3776 stop: null 3777 }, 3778 3779 _num: function(value) { 3780 return parseFloat(value) || 0; 3781 }, 3782 3783 _isNumber: function(value) { 3784 return !isNaN(parseFloat(value)); 3785 }, 3786 3787 _hasScroll: function(el, a) { 3788 3789 if ($(el).css("overflow") === "hidden") { 3790 return false;
vendor: 7,681 bytes, lines 3791-4009
3791 } 3792 3793 var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop", 3794 has = false; 3795 3796 if (el[scroll] > 0) { 3797 return true; 3798 } 3799 3800 // TODO: determine which cases actually cause this to happen 3801 // if the element doesn't have the scroll set, see if it's possible to 3802 // set the scroll 3803 el[scroll] = 1; 3804 has = (el[scroll] > 0); 3805 el[scroll] = 0; 3806 return has; 3807 }, 3808 3809 _create: function() { 3810 3811 var margins, 3812 o = this.options, 3813 that = this; 3814 this._addClass("ui-resizable"); 3815 3816 $.extend(this, { 3817 _aspectRatio: !!(o.aspectRatio), 3818 aspectRatio: o.aspectRatio, 3819 originalElement: this.element, 3820 _proportionallyResizeElements: [], 3821 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 3822 }); 3823 3824 // Wrap the element if it cannot hold child nodes 3825 if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) { 3826 3827 this.element.wrap( 3828 $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ 3829 position: this.element.css("position"), 3830 width: this.element.outerWidth(), 3831 height: this.element.outerHeight(), 3832 top: this.element.css("top"), 3833 left: this.element.css("left") 3834 }) 3835 ); 3836 3837 this.element = this.element.parent().data( 3838 "ui-resizable", this.element.resizable("instance") 3839 ); 3840 3841 this.elementIsWrapper = true; 3842 3843 margins = { 3844 marginTop: this.originalElement.css("marginTop"), 3845 marginRight: this.originalElement.css("marginRight"), 3846 marginBottom: this.originalElement.css("marginBottom"), 3847 marginLeft: this.originalElement.css("marginLeft") 3848 }; 3849 3850 this.element.css(margins); 3851 this.originalElement.css("margin", 0); 3852 3853 // support: Safari 3854 // Prevent Safari textarea resize 3855 this.originalResizeStyle = this.originalElement.css("resize"); 3856 this.originalElement.css("resize", "none"); 3857 3858 this._proportionallyResizeElements.push(this.originalElement.css({ 3859 position: "static", 3860 zoom: 1, 3861 display: "block" 3862 })); 3863 3864 // Support: IE9 3865 // avoid IE jump (hard set the margin) 3866 this.originalElement.css(margins); 3867 3868 this._proportionallyResize(); 3869 } 3870 3871 this._setupHandles(); 3872 3873 if (o.autoHide) { 3874 $(this.element) 3875 .on("mouseenter", function() { 3876 if (o.disabled) { 3877 return; 3878 } 3879 that._removeClass("ui-resizable-autohide"); 3880 that._handles.show(); 3881 }) 3882 .on("mouseleave", function() { 3883 if (o.disabled) { 3884 return; 3885 } 3886 if (!that.resizing) { 3887 that._addClass("ui-resizable-autohide"); 3888 that._handles.hide(); 3889 } 3890 }); 3891 } 3892 3893 this._mouseInit(); 3894 }, 3895 3896 _destroy: function() { 3897 3898 this._mouseDestroy(); 3899 3900 var wrapper, 3901 _destroy = function(exp) { 3902 $(exp) 3903 .removeData("resizable") 3904 .removeData("ui-resizable") 3905 .off(".resizable") 3906 .find(".ui-resizable-handle") 3907 .remove(); 3908 }; 3909 3910 // TODO: Unwrap at same DOM position 3911 if (this.elementIsWrapper) { 3912 _destroy(this.element); 3913 wrapper = this.element; 3914 this.originalElement.css({ 3915 position: wrapper.css("position"), 3916 width: wrapper.outerWidth(), 3917 height: wrapper.outerHeight(), 3918 top: wrapper.css("top"), 3919 left: wrapper.css("left") 3920 }).insertAfter(wrapper); 3921 wrapper.remove(); 3922 } 3923 3924 this.originalElement.css("resize", this.originalResizeStyle); 3925 _destroy(this.originalElement); 3926 3927 return this; 3928 }, 3929 3930 _setOption: function(key, value) { 3931 this._super(key, value); 3932 3933 switch (key) { 3934 case "handles": 3935 this._removeHandles(); 3936 this._setupHandles(); 3937 break; 3938 default: 3939 break; 3940 } 3941 }, 3942 3943 _setupHandles: function() { 3944 var o = this.options, 3945 handle, i, n, hname, axis, that = this; 3946 this.handles = o.handles || 3947 (!$(".ui-resizable-handle", this.element).length ? 3948 "e,s,se" : { 3949 n: ".ui-resizable-n", 3950 e: ".ui-resizable-e", 3951 s: ".ui-resizable-s", 3952 w: ".ui-resizable-w", 3953 se: ".ui-resizable-se", 3954 sw: ".ui-resizable-sw", 3955 ne: ".ui-resizable-ne", 3956 nw: ".ui-resizable-nw" 3957 }); 3958 3959 this._handles = $(); 3960 if (this.handles.constructor === String) { 3961 3962 if (this.handles === "all") { 3963 this.handles = "n,e,s,w,se,sw,ne,nw"; 3964 } 3965 3966 n = this.handles.split(","); 3967 this.handles = {}; 3968 3969 for (i = 0; i < n.length; i++) { 3970 3971 handle = $.trim(n[i]); 3972 hname = "ui-resizable-" + handle; 3973 axis = $("<div>"); 3974 this._addClass(axis, "ui-resizable-handle " + hname); 3975 3976 axis.css({ zIndex: o.zIndex }); 3977 3978 this.handles[handle] = ".ui-resizable-" + handle; 3979 this.element.append(axis); 3980 } 3981 3982 } 3983 3984 this._renderAxis = function(target) { 3985 3986 var i, axis, padPos, padWrapper; 3987 3988 target = target || this.element; 3989 3990 for (i in this.handles) { 3991 3992 if (this.handles[i].constructor === String) { 3993 this.handles[i] = this.element.children(this.handles[i]).first().show(); 3994 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 3995 this.handles[i] = $(this.handles[i]); 3996 this._on(this.handles[i], { "mousedown": that._mouseDown }); 3997 } 3998 3999 if (this.elementIsWrapper && 4000 this.originalElement[0] 4001 .nodeName 4002 .match(/^(textarea|input|select|button)$/i)) { 4003 axis = $(this.handles[i], this.element); 4004 4005 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? 4006 axis.outerHeight() : 4007 axis.outerWidth(); 4008 4009 padPos = ["padding",
vendor: 4,748 bytes, lines 4010-4160
4010 /ne|nw|n/.test(i) ? "Top" : 4011 /se|sw|s/.test(i) ? "Bottom" : 4012 /^e$/.test(i) ? "Right" : "Left" 4013 ].join(""); 4014 4015 target.css(padPos, padWrapper); 4016 4017 this._proportionallyResize(); 4018 } 4019 4020 this._handles = this._handles.add(this.handles[i]); 4021 } 4022 }; 4023 4024 // TODO: make renderAxis a prototype function 4025 this._renderAxis(this.element); 4026 4027 this._handles = this._handles.add(this.element.find(".ui-resizable-handle")); 4028 this._handles.disableSelection(); 4029 4030 this._handles.on("mouseover", function() { 4031 if (!that.resizing) { 4032 if (this.className) { 4033 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 4034 } 4035 that.axis = axis && axis[1] ? axis[1] : "se"; 4036 } 4037 }); 4038 4039 if (o.autoHide) { 4040 this._handles.hide(); 4041 this._addClass("ui-resizable-autohide"); 4042 } 4043 }, 4044 4045 _removeHandles: function() { 4046 this._handles.remove(); 4047 }, 4048 4049 _mouseCapture: function(event) { 4050 var i, handle, 4051 capture = false; 4052 4053 for (i in this.handles) { 4054 handle = $(this.handles[i])[0]; 4055 if (handle === event.target || $.contains(handle, event.target)) { 4056 capture = true; 4057 } 4058 } 4059 4060 return !this.options.disabled && capture; 4061 }, 4062 4063 _mouseStart: function(event) { 4064 4065 var curleft, curtop, cursor, 4066 o = this.options, 4067 el = this.element; 4068 4069 this.resizing = true; 4070 4071 this._renderProxy(); 4072 4073 curleft = this._num(this.helper.css("left")); 4074 curtop = this._num(this.helper.css("top")); 4075 4076 if (o.containment) { 4077 curleft += $(o.containment).scrollLeft() || 0; 4078 curtop += $(o.containment).scrollTop() || 0; 4079 } 4080 4081 this.offset = this.helper.offset(); 4082 this.position = { left: curleft, top: curtop }; 4083 4084 this.size = this._helper ? { 4085 width: this.helper.width(), 4086 height: this.helper.height() 4087 } : { 4088 width: el.width(), 4089 height: el.height() 4090 }; 4091 4092 this.originalSize = this._helper ? { 4093 width: el.outerWidth(), 4094 height: el.outerHeight() 4095 } : { 4096 width: el.width(), 4097 height: el.height() 4098 }; 4099 4100 this.sizeDiff = { 4101 width: el.outerWidth() - el.width(), 4102 height: el.outerHeight() - el.height() 4103 }; 4104 4105 this.originalPosition = { left: curleft, top: curtop }; 4106 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 4107 4108 this.aspectRatio = (typeof o.aspectRatio === "number") ? 4109 o.aspectRatio : 4110 ((this.originalSize.width / this.originalSize.height) || 1); 4111 4112 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 4113 $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); 4114 4115 this._addClass("ui-resizable-resizing"); 4116 this._propagate("start", event); 4117 return true; 4118 }, 4119 4120 _mouseDrag: function(event) { 4121 4122 var data, props, 4123 smp = this.originalMousePosition, 4124 a = this.axis, 4125 dx = (event.pageX - smp.left) || 0, 4126 dy = (event.pageY - smp.top) || 0, 4127 trigger = this._change[a]; 4128 4129 this._updatePrevProperties(); 4130 4131 if (!trigger) { 4132 return false; 4133 } 4134 4135 data = trigger.apply(this, [event, dx, dy]); 4136 4137 this._updateVirtualBoundaries(event.shiftKey); 4138 if (this._aspectRatio || event.shiftKey) { 4139 data = this._updateRatio(data, event); 4140 } 4141 4142 data = this._respectSize(data, event); 4143 4144 this._updateCache(data); 4145 4146 this._propagate("resize", event); 4147 4148 props = this._applyChanges(); 4149 4150 if (!this._helper && this._proportionallyResizeElements.length) { 4151 this._proportionallyResize(); 4152 } 4153 4154 if (!$.isEmptyObject(props)) { 4155 this._updatePrevProperties(); 4156 this._trigger("resize", event, this.ui()); 4157 this._applyChanges(); 4158 } 4159 4160 return false;
vendor: 15,220 bytes, lines 4161-4601
4161 }, 4162 4163 _mouseStop: function(event) { 4164 4165 this.resizing = false; 4166 var pr, ista, soffseth, soffsetw, s, left, top, 4167 o = this.options, 4168 that = this; 4169 4170 if (this._helper) { 4171 4172 pr = this._proportionallyResizeElements; 4173 ista = pr.length && (/textarea/i).test(pr[0].nodeName); 4174 soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 4175 soffsetw = ista ? 0 : that.sizeDiff.width; 4176 4177 s = { 4178 width: (that.helper.width() - soffsetw), 4179 height: (that.helper.height() - soffseth) 4180 }; 4181 left = (parseFloat(that.element.css("left")) + 4182 (that.position.left - that.originalPosition.left)) || null; 4183 top = (parseFloat(that.element.css("top")) + 4184 (that.position.top - that.originalPosition.top)) || null; 4185 4186 if (!o.animate) { 4187 this.element.css($.extend(s, { top: top, left: left })); 4188 } 4189 4190 that.helper.height(that.size.height); 4191 that.helper.width(that.size.width); 4192 4193 if (this._helper && !o.animate) { 4194 this._proportionallyResize(); 4195 } 4196 } 4197 4198 $("body").css("cursor", "auto"); 4199 4200 this._removeClass("ui-resizable-resizing"); 4201 4202 this._propagate("stop", event); 4203 4204 if (this._helper) { 4205 this.helper.remove(); 4206 } 4207 4208 return false; 4209 4210 }, 4211 4212 _updatePrevProperties: function() { 4213 this.prevPosition = { 4214 top: this.position.top, 4215 left: this.position.left 4216 }; 4217 this.prevSize = { 4218 width: this.size.width, 4219 height: this.size.height 4220 }; 4221 }, 4222 4223 _applyChanges: function() { 4224 var props = {}; 4225 4226 if (this.position.top !== this.prevPosition.top) { 4227 props.top = this.position.top + "px"; 4228 } 4229 if (this.position.left !== this.prevPosition.left) { 4230 props.left = this.position.left + "px"; 4231 } 4232 if (this.size.width !== this.prevSize.width) { 4233 props.width = this.size.width + "px"; 4234 } 4235 if (this.size.height !== this.prevSize.height) { 4236 props.height = this.size.height + "px"; 4237 } 4238 4239 this.helper.css(props); 4240 4241 return props; 4242 }, 4243 4244 _updateVirtualBoundaries: function(forceAspectRatio) { 4245 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 4246 o = this.options; 4247 4248 b = { 4249 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 4250 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 4251 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 4252 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity 4253 }; 4254 4255 if (this._aspectRatio || forceAspectRatio) { 4256 pMinWidth = b.minHeight * this.aspectRatio; 4257 pMinHeight = b.minWidth / this.aspectRatio; 4258 pMaxWidth = b.maxHeight * this.aspectRatio; 4259 pMaxHeight = b.maxWidth / this.aspectRatio; 4260 4261 if (pMinWidth > b.minWidth) { 4262 b.minWidth = pMinWidth; 4263 } 4264 if (pMinHeight > b.minHeight) { 4265 b.minHeight = pMinHeight; 4266 } 4267 if (pMaxWidth < b.maxWidth) { 4268 b.maxWidth = pMaxWidth; 4269 } 4270 if (pMaxHeight < b.maxHeight) { 4271 b.maxHeight = pMaxHeight; 4272 } 4273 } 4274 this._vBoundaries = b; 4275 }, 4276 4277 _updateCache: function(data) { 4278 this.offset = this.helper.offset(); 4279 if (this._isNumber(data.left)) { 4280 this.position.left = data.left; 4281 } 4282 if (this._isNumber(data.top)) { 4283 this.position.top = data.top; 4284 } 4285 if (this._isNumber(data.height)) { 4286 this.size.height = data.height; 4287 } 4288 if (this._isNumber(data.width)) { 4289 this.size.width = data.width; 4290 } 4291 }, 4292 4293 _updateRatio: function(data) { 4294 4295 var cpos = this.position, 4296 csize = this.size, 4297 a = this.axis; 4298 4299 if (this._isNumber(data.height)) { 4300 data.width = (data.height * this.aspectRatio); 4301 } else if (this._isNumber(data.width)) { 4302 data.height = (data.width / this.aspectRatio); 4303 } 4304 4305 if (a === "sw") { 4306 data.left = cpos.left + (csize.width - data.width); 4307 data.top = null; 4308 } 4309 if (a === "nw") { 4310 data.top = cpos.top + (csize.height - data.height); 4311 data.left = cpos.left + (csize.width - data.width); 4312 } 4313 4314 return data; 4315 }, 4316 4317 _respectSize: function(data) { 4318 4319 var o = this._vBoundaries, 4320 a = this.axis, 4321 ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), 4322 ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 4323 isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), 4324 isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), 4325 dw = this.originalPosition.left + this.originalSize.width, 4326 dh = this.originalPosition.top + this.originalSize.height, 4327 cw = /sw|nw|w/.test(a), 4328 ch = /nw|ne|n/.test(a); 4329 if (isminw) { 4330 data.width = o.minWidth; 4331 } 4332 if (isminh) { 4333 data.height = o.minHeight; 4334 } 4335 if (ismaxw) { 4336 data.width = o.maxWidth; 4337 } 4338 if (ismaxh) { 4339 data.height = o.maxHeight; 4340 } 4341 4342 if (isminw && cw) { 4343 data.left = dw - o.minWidth; 4344 } 4345 if (ismaxw && cw) { 4346 data.left = dw - o.maxWidth; 4347 } 4348 if (isminh && ch) { 4349 data.top = dh - o.minHeight; 4350 } 4351 if (ismaxh && ch) { 4352 data.top = dh - o.maxHeight; 4353 } 4354 4355 // Fixing jump error on top/left - bug #2330 4356 if (!data.width && !data.height && !data.left && data.top) { 4357 data.top = null; 4358 } else if (!data.width && !data.height && !data.top && data.left) { 4359 data.left = null; 4360 } 4361 4362 return data; 4363 }, 4364 4365 _getPaddingPlusBorderDimensions: function(element) { 4366 var i = 0, 4367 widths = [], 4368 borders = [ 4369 element.css("borderTopWidth"), 4370 element.css("borderRightWidth"), 4371 element.css("borderBottomWidth"), 4372 element.css("borderLeftWidth") 4373 ], 4374 paddings = [ 4375 element.css("paddingTop"), 4376 element.css("paddingRight"), 4377 element.css("paddingBottom"), 4378 element.css("paddingLeft") 4379 ]; 4380 4381 for (; i < 4; i++) { 4382 widths[i] = (parseFloat(borders[i]) || 0); 4383 widths[i] += (parseFloat(paddings[i]) || 0); 4384 } 4385 4386 return { 4387 height: widths[0] + widths[2], 4388 width: widths[1] + widths[3] 4389 }; 4390 }, 4391 4392 _proportionallyResize: function() { 4393 4394 if (!this._proportionallyResizeElements.length) { 4395 return; 4396 } 4397 4398 var prel, 4399 i = 0, 4400 element = this.helper || this.element; 4401 4402 for (; i < this._proportionallyResizeElements.length; i++) { 4403 4404 prel = this._proportionallyResizeElements[i]; 4405 4406 // TODO: Seems like a bug to cache this.outerDimensions 4407 // considering that we are in a loop. 4408 if (!this.outerDimensions) { 4409 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 4410 } 4411 4412 prel.css({ 4413 height: (element.height() - this.outerDimensions.height) || 0, 4414 width: (element.width() - this.outerDimensions.width) || 0 4415 }); 4416 4417 } 4418 4419 }, 4420 4421 _renderProxy: function() { 4422 4423 var el = this.element, 4424 o = this.options; 4425 this.elementOffset = el.offset(); 4426 4427 if (this._helper) { 4428 4429 this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); 4430 4431 this._addClass(this.helper, this._helper); 4432 this.helper.css({ 4433 width: this.element.outerWidth(), 4434 height: this.element.outerHeight(), 4435 position: "absolute", 4436 left: this.elementOffset.left + "px", 4437 top: this.elementOffset.top + "px", 4438 zIndex: ++o.zIndex //TODO: Don't modify option 4439 }); 4440 4441 this.helper 4442 .appendTo("body") 4443 .disableSelection(); 4444 4445 } else { 4446 this.helper = this.element; 4447 } 4448 4449 }, 4450 4451 _change: { 4452 e: function(event, dx) { 4453 return { width: this.originalSize.width + dx }; 4454 }, 4455 w: function(event, dx) { 4456 var cs = this.originalSize, 4457 sp = this.originalPosition; 4458 return { left: sp.left + dx, width: cs.width - dx }; 4459 }, 4460 n: function(event, dx, dy) { 4461 var cs = this.originalSize, 4462 sp = this.originalPosition; 4463 return { top: sp.top + dy, height: cs.height - dy }; 4464 }, 4465 s: function(event, dx, dy) { 4466 return { height: this.originalSize.height + dy }; 4467 }, 4468 se: function(event, dx, dy) { 4469 return $.extend(this._change.s.apply(this, arguments), 4470 this._change.e.apply(this, [event, dx, dy])); 4471 }, 4472 sw: function(event, dx, dy) { 4473 return $.extend(this._change.s.apply(this, arguments), 4474 this._change.w.apply(this, [event, dx, dy])); 4475 }, 4476 ne: function(event, dx, dy) { 4477 return $.extend(this._change.n.apply(this, arguments), 4478 this._change.e.apply(this, [event, dx, dy])); 4479 }, 4480 nw: function(event, dx, dy) { 4481 return $.extend(this._change.n.apply(this, arguments), 4482 this._change.w.apply(this, [event, dx, dy])); 4483 } 4484 }, 4485 4486 _propagate: function(n, event) { 4487 $.ui.plugin.call(this, n, [event, this.ui()]); 4488 (n !== "resize" && this._trigger(n, event, this.ui())); 4489 }, 4490 4491 plugins: {}, 4492 4493 ui: function() { 4494 return { 4495 originalElement: this.originalElement, 4496 element: this.element, 4497 helper: this.helper, 4498 position: this.position, 4499 size: this.size, 4500 originalSize: this.originalSize, 4501 originalPosition: this.originalPosition 4502 }; 4503 } 4504 4505 }); 4506 4507 /* 4508 * Resizable Extensions 4509 */ 4510 4511 $.ui.plugin.add("resizable", "animate", { 4512 4513 stop: function(event) { 4514 var that = $(this).resizable("instance"), 4515 o = that.options, 4516 pr = that._proportionallyResizeElements, 4517 ista = pr.length && (/textarea/i).test(pr[0].nodeName), 4518 soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 4519 soffsetw = ista ? 0 : that.sizeDiff.width, 4520 style = { 4521 width: (that.size.width - soffsetw), 4522 height: (that.size.height - soffseth) 4523 }, 4524 left = (parseFloat(that.element.css("left")) + 4525 (that.position.left - that.originalPosition.left)) || null, 4526 top = (parseFloat(that.element.css("top")) + 4527 (that.position.top - that.originalPosition.top)) || null; 4528 4529 that.element.animate( 4530 $.extend(style, top && left ? { top: top, left: left } : {}), { 4531 duration: o.animateDuration, 4532 easing: o.animateEasing, 4533 step: function() { 4534 4535 var data = { 4536 width: parseFloat(that.element.css("width")), 4537 height: parseFloat(that.element.css("height")), 4538 top: parseFloat(that.element.css("top")), 4539 left: parseFloat(that.element.css("left")) 4540 }; 4541 4542 if (pr && pr.length) { 4543 $(pr[0]).css({ width: data.width, height: data.height }); 4544 } 4545 4546 // Propagating resize, and updating values for each animation step 4547 that._updateCache(data); 4548 that._propagate("resize", event); 4549 4550 } 4551 } 4552 ); 4553 } 4554 4555 }); 4556 4557 $.ui.plugin.add("resizable", "containment", { 4558 4559 start: function() { 4560 var element, p, co, ch, cw, width, height, 4561 that = $(this).resizable("instance"), 4562 o = that.options, 4563 el = that.element, 4564 oc = o.containment, 4565 ce = (oc instanceof $) ? 4566 oc.get(0) : 4567 (/parent/.test(oc)) ? el.parent().get(0) : oc; 4568 4569 if (!ce) { 4570 return; 4571 } 4572 4573 that.containerElement = $(ce); 4574 4575 if (/document/.test(oc) || oc === document) { 4576 that.containerOffset = { 4577 left: 0, 4578 top: 0 4579 }; 4580 that.containerPosition = { 4581 left: 0, 4582 top: 0 4583 }; 4584 4585 that.parentData = { 4586 element: $(document), 4587 left: 0, 4588 top: 0, 4589 width: $(document).width(), 4590 height: $(document).height() || document.body.parentNode.scrollHeight 4591 }; 4592 } else { 4593 element = $(ce); 4594 p = []; 4595 $(["Top", "Right", "Left", "Bottom"]).each(function(i, name) { 4596 p[i] = that._num(element.css("padding" + name)); 4597 }); 4598 4599 that.containerOffset = element.offset(); 4600 that.containerPosition = element.position(); 4601 that.containerSize = {
vendor: 4,589 bytes, lines 4602-4721
4602 height: (element.innerHeight() - p[3]), 4603 width: (element.innerWidth() - p[1]) 4604 }; 4605 4606 co = that.containerOffset; 4607 ch = that.containerSize.height; 4608 cw = that.containerSize.width; 4609 width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw); 4610 height = (that._hasScroll(ce) ? ce.scrollHeight : ch); 4611 4612 that.parentData = { 4613 element: ce, 4614 left: co.left, 4615 top: co.top, 4616 width: width, 4617 height: height 4618 }; 4619 } 4620 }, 4621 4622 resize: function(event) { 4623 var woset, hoset, isParent, isOffsetRelative, 4624 that = $(this).resizable("instance"), 4625 o = that.options, 4626 co = that.containerOffset, 4627 cp = that.position, 4628 pRatio = that._aspectRatio || event.shiftKey, 4629 cop = { 4630 top: 0, 4631 left: 0 4632 }, 4633 ce = that.containerElement, 4634 continueResize = true; 4635 4636 if (ce[0] !== document && (/static/).test(ce.css("position"))) { 4637 cop = co; 4638 } 4639 4640 if (cp.left < (that._helper ? co.left : 0)) { 4641 that.size.width = that.size.width + 4642 (that._helper ? 4643 (that.position.left - co.left) : 4644 (that.position.left - cop.left)); 4645 4646 if (pRatio) { 4647 that.size.height = that.size.width / that.aspectRatio; 4648 continueResize = false; 4649 } 4650 that.position.left = o.helper ? co.left : 0; 4651 } 4652 4653 if (cp.top < (that._helper ? co.top : 0)) { 4654 that.size.height = that.size.height + 4655 (that._helper ? 4656 (that.position.top - co.top) : 4657 that.position.top); 4658 4659 if (pRatio) { 4660 that.size.width = that.size.height * that.aspectRatio; 4661 continueResize = false; 4662 } 4663 that.position.top = that._helper ? co.top : 0; 4664 } 4665 4666 isParent = that.containerElement.get(0) === that.element.parent().get(0); 4667 isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); 4668 4669 if (isParent && isOffsetRelative) { 4670 that.offset.left = that.parentData.left + that.position.left; 4671 that.offset.top = that.parentData.top + that.position.top; 4672 } else { 4673 that.offset.left = that.element.offset().left; 4674 that.offset.top = that.element.offset().top; 4675 } 4676 4677 woset = Math.abs(that.sizeDiff.width + 4678 (that._helper ? 4679 that.offset.left - cop.left : 4680 (that.offset.left - co.left))); 4681 4682 hoset = Math.abs(that.sizeDiff.height + 4683 (that._helper ? 4684 that.offset.top - cop.top : 4685 (that.offset.top - co.top))); 4686 4687 if (woset + that.size.width >= that.parentData.width) { 4688 that.size.width = that.parentData.width - woset; 4689 if (pRatio) { 4690 that.size.height = that.size.width / that.aspectRatio; 4691 continueResize = false; 4692 } 4693 } 4694 4695 if (hoset + that.size.height >= that.parentData.height) { 4696 that.size.height = that.parentData.height - hoset; 4697 if (pRatio) { 4698 that.size.width = that.size.height * that.aspectRatio; 4699 continueResize = false; 4700 } 4701 } 4702 4703 if (!continueResize) { 4704 that.position.left = that.prevPosition.left; 4705 that.position.top = that.prevPosition.top; 4706 that.size.width = that.prevSize.width; 4707 that.size.height = that.prevSize.height; 4708 } 4709 }, 4710 4711 stop: function() { 4712 var that = $(this).resizable("instance"), 4713 o = that.options, 4714 co = that.containerOffset, 4715 cop = that.containerPosition, 4716 ce = that.containerElement, 4717 helper = $(that.helper), 4718 ho = helper.offset(), 4719 w = helper.outerWidth() - that.sizeDiff.width, 4720 h = helper.outerHeight() - that.sizeDiff.height; 4721
vendor: 4,199 bytes, lines 4722-4854
4722 if (that._helper && !o.animate && (/relative/).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 if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { 4731 $(this).css({ 4732 left: ho.left - cop.left - co.left, 4733 width: w, 4734 height: h 4735 }); 4736 } 4737 } 4738 }); 4739 4740 $.ui.plugin.add("resizable", "alsoResize", { 4741 4742 start: function() { 4743 var that = $(this).resizable("instance"), 4744 o = that.options; 4745 4746 $(o.alsoResize).each(function() { 4747 var el = $(this); 4748 el.data("ui-resizable-alsoresize", { 4749 width: parseFloat(el.width()), 4750 height: parseFloat(el.height()), 4751 left: parseFloat(el.css("left")), 4752 top: parseFloat(el.css("top")) 4753 }); 4754 }); 4755 }, 4756 4757 resize: function(event, ui) { 4758 var that = $(this).resizable("instance"), 4759 o = that.options, 4760 os = that.originalSize, 4761 op = that.originalPosition, 4762 delta = { 4763 height: (that.size.height - os.height) || 0, 4764 width: (that.size.width - os.width) || 0, 4765 top: (that.position.top - op.top) || 0, 4766 left: (that.position.left - op.left) || 0 4767 }; 4768 4769 $(o.alsoResize).each(function() { 4770 var el = $(this), 4771 start = $(this).data("ui-resizable-alsoresize"), 4772 style = {}, 4773 css = el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"]; 4774 4775 $.each(css, function(i, prop) { 4776 var sum = (start[prop] || 0) + (delta[prop] || 0); 4777 if (sum && sum >= 0) { 4778 style[prop] = sum || null; 4779 } 4780 }); 4781 4782 el.css(style); 4783 }); 4784 }, 4785 4786 stop: function() { 4787 $(this).removeData("ui-resizable-alsoresize"); 4788 } 4789 }); 4790 4791 $.ui.plugin.add("resizable", "ghost", { 4792 4793 start: function() { 4794 4795 var that = $(this).resizable("instance"), 4796 cs = that.size; 4797 4798 that.ghost = that.originalElement.clone(); 4799 that.ghost.css({ 4800 opacity: 0.25, 4801 display: "block", 4802 position: "relative", 4803 height: cs.height, 4804 width: cs.width, 4805 margin: 0, 4806 left: 0, 4807 top: 0 4808 }); 4809 4810 that._addClass(that.ghost, "ui-resizable-ghost"); 4811 4812 // DEPRECATED 4813 // TODO: remove after 1.12 4814 if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { 4815 4816 // Ghost option 4817 that.ghost.addClass(this.options.ghost); 4818 } 4819 4820 that.ghost.appendTo(that.helper); 4821 4822 }, 4823 4824 resize: function() { 4825 var that = $(this).resizable("instance"); 4826 if (that.ghost) { 4827 that.ghost.css({ 4828 position: "relative", 4829 height: that.size.height, 4830 width: that.size.width 4831 }); 4832 } 4833 }, 4834 4835 stop: function() { 4836 var that = $(this).resizable("instance"); 4837 if (that.ghost && that.helper) { 4838 that.helper.get(0).removeChild(that.ghost.get(0)); 4839 } 4840 } 4841 4842 }); 4843 4844 $.ui.plugin.add("resizable", "grid", { 4845 4846 resize: function() { 4847 var outerDimensions, 4848 that = $(this).resizable("instance"), 4849 o = that.options, 4850 cs = that.size, 4851 os = that.originalSize, 4852 op = that.originalPosition, 4853 a = that.axis, 4854 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
vendor: 17,138 bytes, lines 4855-5351
4855 gridX = (grid[0] || 1), 4856 gridY = (grid[1] || 1), 4857 ox = Math.round((cs.width - os.width) / gridX) * gridX, 4858 oy = Math.round((cs.height - os.height) / gridY) * gridY, 4859 newWidth = os.width + ox, 4860 newHeight = os.height + oy, 4861 isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), 4862 isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), 4863 isMinWidth = o.minWidth && (o.minWidth > newWidth), 4864 isMinHeight = o.minHeight && (o.minHeight > newHeight); 4865 4866 o.grid = grid; 4867 4868 if (isMinWidth) { 4869 newWidth += gridX; 4870 } 4871 if (isMinHeight) { 4872 newHeight += gridY; 4873 } 4874 if (isMaxWidth) { 4875 newWidth -= gridX; 4876 } 4877 if (isMaxHeight) { 4878 newHeight -= gridY; 4879 } 4880 4881 if (/^(se|s|e)$/.test(a)) { 4882 that.size.width = newWidth; 4883 that.size.height = newHeight; 4884 } else if (/^(ne)$/.test(a)) { 4885 that.size.width = newWidth; 4886 that.size.height = newHeight; 4887 that.position.top = op.top - oy; 4888 } else if (/^(sw)$/.test(a)) { 4889 that.size.width = newWidth; 4890 that.size.height = newHeight; 4891 that.position.left = op.left - ox; 4892 } else { 4893 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 4894 outerDimensions = that._getPaddingPlusBorderDimensions(this); 4895 } 4896 4897 if (newHeight - gridY > 0) { 4898 that.size.height = newHeight; 4899 that.position.top = op.top - oy; 4900 } else { 4901 newHeight = gridY - outerDimensions.height; 4902 that.size.height = newHeight; 4903 that.position.top = op.top + os.height - newHeight; 4904 } 4905 if (newWidth - gridX > 0) { 4906 that.size.width = newWidth; 4907 that.position.left = op.left - ox; 4908 } else { 4909 newWidth = gridX - outerDimensions.width; 4910 that.size.width = newWidth; 4911 that.position.left = op.left + os.width - newWidth; 4912 } 4913 } 4914 } 4915 4916 }); 4917 4918 var widgetsResizable = $.ui.resizable; 4919 4920 4921 /*! 4922 * jQuery UI Selectable 1.12.1 4923 * http://jqueryui.com 4924 * 4925 * Copyright jQuery Foundation and other contributors 4926 * Released under the MIT license. 4927 * http://jquery.org/license 4928 */ 4929 4930 //>>label: Selectable 4931 //>>group: Interactions 4932 //>>description: Allows groups of elements to be selected with the mouse. 4933 //>>docs: http://api.jqueryui.com/selectable/ 4934 //>>demos: http://jqueryui.com/selectable/ 4935 //>>css.structure: ../../themes/base/selectable.css 4936 4937 4938 4939 var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, { 4940 version: "1.12.1", 4941 options: { 4942 appendTo: "body", 4943 autoRefresh: true, 4944 distance: 0, 4945 filter: "*", 4946 tolerance: "touch", 4947 4948 // Callbacks 4949 selected: null, 4950 selecting: null, 4951 start: null, 4952 stop: null, 4953 unselected: null, 4954 unselecting: null 4955 }, 4956 _create: function() { 4957 var that = this; 4958 4959 this._addClass("ui-selectable"); 4960 4961 this.dragged = false; 4962 4963 // Cache selectee children based on filter 4964 this.refresh = function() { 4965 that.elementPos = $(that.element[0]).offset(); 4966 that.selectees = $(that.options.filter, that.element[0]); 4967 that._addClass(that.selectees, "ui-selectee"); 4968 that.selectees.each(function() { 4969 var $this = $(this), 4970 selecteeOffset = $this.offset(), 4971 pos = { 4972 left: selecteeOffset.left - that.elementPos.left, 4973 top: selecteeOffset.top - that.elementPos.top 4974 }; 4975 $.data(this, "selectable-item", { 4976 element: this, 4977 $element: $this, 4978 left: pos.left, 4979 top: pos.top, 4980 right: pos.left + $this.outerWidth(), 4981 bottom: pos.top + $this.outerHeight(), 4982 startselected: false, 4983 selected: $this.hasClass("ui-selected"), 4984 selecting: $this.hasClass("ui-selecting"), 4985 unselecting: $this.hasClass("ui-unselecting") 4986 }); 4987 }); 4988 }; 4989 this.refresh(); 4990 4991 this._mouseInit(); 4992 4993 this.helper = $("<div>"); 4994 this._addClass(this.helper, "ui-selectable-helper"); 4995 }, 4996 4997 _destroy: function() { 4998 this.selectees.removeData("selectable-item"); 4999 this._mouseDestroy(); 5000 }, 5001 5002 _mouseStart: function(event) { 5003 var that = this, 5004 options = this.options; 5005 5006 this.opos = [event.pageX, event.pageY]; 5007 this.elementPos = $(this.element[0]).offset(); 5008 5009 if (this.options.disabled) { 5010 return; 5011 } 5012 5013 this.selectees = $(options.filter, this.element[0]); 5014 5015 this._trigger("start", event); 5016 5017 $(options.appendTo).append(this.helper); 5018 5019 // position helper (lasso) 5020 this.helper.css({ 5021 "left": event.pageX, 5022 "top": event.pageY, 5023 "width": 0, 5024 "height": 0 5025 }); 5026 5027 if (options.autoRefresh) { 5028 this.refresh(); 5029 } 5030 5031 this.selectees.filter(".ui-selected").each(function() { 5032 var selectee = $.data(this, "selectable-item"); 5033 selectee.startselected = true; 5034 if (!event.metaKey && !event.ctrlKey) { 5035 that._removeClass(selectee.$element, "ui-selected"); 5036 selectee.selected = false; 5037 that._addClass(selectee.$element, "ui-unselecting"); 5038 selectee.unselecting = true; 5039 5040 // selectable UNSELECTING callback 5041 that._trigger("unselecting", event, { 5042 unselecting: selectee.element 5043 }); 5044 } 5045 }); 5046 5047 $(event.target).parents().addBack().each(function() { 5048 var doSelect, 5049 selectee = $.data(this, "selectable-item"); 5050 if (selectee) { 5051 doSelect = (!event.metaKey && !event.ctrlKey) || 5052 !selectee.$element.hasClass("ui-selected"); 5053 that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected") 5054 ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting"); 5055 selectee.unselecting = !doSelect; 5056 selectee.selecting = doSelect; 5057 selectee.selected = doSelect; 5058 5059 // selectable (UN)SELECTING callback 5060 if (doSelect) { 5061 that._trigger("selecting", event, { 5062 selecting: selectee.element 5063 }); 5064 } else { 5065 that._trigger("unselecting", event, { 5066 unselecting: selectee.element 5067 }); 5068 } 5069 return false; 5070 } 5071 }); 5072 5073 }, 5074 5075 _mouseDrag: function(event) { 5076 5077 this.dragged = true; 5078 5079 if (this.options.disabled) { 5080 return; 5081 } 5082 5083 var tmp, 5084 that = this, 5085 options = this.options, 5086 x1 = this.opos[0], 5087 y1 = this.opos[1], 5088 x2 = event.pageX, 5089 y2 = event.pageY; 5090 5091 if (x1 > x2) { 5092 tmp = x2; 5093 x2 = x1; 5094 x1 = tmp; 5095 } 5096 if (y1 > y2) { 5097 tmp = y2; 5098 y2 = y1; 5099 y1 = tmp; 5100 } 5101 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 5102 5103 this.selectees.each(function() { 5104 var selectee = $.data(this, "selectable-item"), 5105 hit = false, 5106 offset = {}; 5107 5108 //prevent helper from being selected if appendTo: selectable 5109 if (!selectee || selectee.element === that.element[0]) { 5110 return; 5111 } 5112 5113 offset.left = selectee.left + that.elementPos.left; 5114 offset.right = selectee.right + that.elementPos.left; 5115 offset.top = selectee.top + that.elementPos.top; 5116 offset.bottom = selectee.bottom + that.elementPos.top; 5117 5118 if (options.tolerance === "touch") { 5119 hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 || 5120 offset.bottom < y1)); 5121 } else if (options.tolerance === "fit") { 5122 hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 && 5123 offset.bottom < y2); 5124 } 5125 5126 if (hit) { 5127 5128 // SELECT 5129 if (selectee.selected) { 5130 that._removeClass(selectee.$element, "ui-selected"); 5131 selectee.selected = false; 5132 } 5133 if (selectee.unselecting) { 5134 that._removeClass(selectee.$element, "ui-unselecting"); 5135 selectee.unselecting = false; 5136 } 5137 if (!selectee.selecting) { 5138 that._addClass(selectee.$element, "ui-selecting"); 5139 selectee.selecting = true; 5140 5141 // selectable SELECTING callback 5142 that._trigger("selecting", event, { 5143 selecting: selectee.element 5144 }); 5145 } 5146 } else { 5147 5148 // UNSELECT 5149 if (selectee.selecting) { 5150 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 5151 that._removeClass(selectee.$element, "ui-selecting"); 5152 selectee.selecting = false; 5153 that._addClass(selectee.$element, "ui-selected"); 5154 selectee.selected = true; 5155 } else { 5156 that._removeClass(selectee.$element, "ui-selecting"); 5157 selectee.selecting = false; 5158 if (selectee.startselected) { 5159 that._addClass(selectee.$element, "ui-unselecting"); 5160 selectee.unselecting = true; 5161 } 5162 5163 // selectable UNSELECTING callback 5164 that._trigger("unselecting", event, { 5165 unselecting: selectee.element 5166 }); 5167 } 5168 } 5169 if (selectee.selected) { 5170 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 5171 that._removeClass(selectee.$element, "ui-selected"); 5172 selectee.selected = false; 5173 5174 that._addClass(selectee.$element, "ui-unselecting"); 5175 selectee.unselecting = true; 5176 5177 // selectable UNSELECTING callback 5178 that._trigger("unselecting", event, { 5179 unselecting: selectee.element 5180 }); 5181 } 5182 } 5183 } 5184 }); 5185 5186 return false; 5187 }, 5188 5189 _mouseStop: function(event) { 5190 var that = this; 5191 5192 this.dragged = false; 5193 5194 $(".ui-unselecting", this.element[0]).each(function() { 5195 var selectee = $.data(this, "selectable-item"); 5196 that._removeClass(selectee.$element, "ui-unselecting"); 5197 selectee.unselecting = false; 5198 selectee.startselected = false; 5199 that._trigger("unselected", event, { 5200 unselected: selectee.element 5201 }); 5202 }); 5203 $(".ui-selecting", this.element[0]).each(function() { 5204 var selectee = $.data(this, "selectable-item"); 5205 that._removeClass(selectee.$element, "ui-selecting") 5206 ._addClass(selectee.$element, "ui-selected"); 5207 selectee.selecting = false; 5208 selectee.selected = true; 5209 selectee.startselected = true; 5210 that._trigger("selected", event, { 5211 selected: selectee.element 5212 }); 5213 }); 5214 this._trigger("stop", event); 5215 5216 this.helper.remove(); 5217 5218 return false; 5219 } 5220 5221 }); 5222 5223 5224 /*! 5225 * jQuery UI Sortable 1.12.1 5226 * http://jqueryui.com 5227 * 5228 * Copyright jQuery Foundation and other contributors 5229 * Released under the MIT license. 5230 * http://jquery.org/license 5231 */ 5232 5233 //>>label: Sortable 5234 //>>group: Interactions 5235 //>>description: Enables items in a list to be sorted using the mouse. 5236 //>>docs: http://api.jqueryui.com/sortable/ 5237 //>>demos: http://jqueryui.com/sortable/ 5238 //>>css.structure: ../../themes/base/sortable.css 5239 5240 5241 5242 var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, { 5243 version: "1.12.1", 5244 widgetEventPrefix: "sort", 5245 ready: false, 5246 options: { 5247 appendTo: "parent", 5248 axis: false, 5249 connectWith: false, 5250 containment: false, 5251 cursor: "auto", 5252 cursorAt: false, 5253 dropOnEmpty: true, 5254 forcePlaceholderSize: false, 5255 forceHelperSize: false, 5256 grid: false, 5257 handle: false, 5258 helper: "original", 5259 items: "> *", 5260 opacity: false, 5261 placeholder: false, 5262 revert: false, 5263 scroll: true, 5264 scrollSensitivity: 20, 5265 scrollSpeed: 20, 5266 scope: "default", 5267 tolerance: "intersect", 5268 zIndex: 1000, 5269 5270 // Callbacks 5271 activate: null, 5272 beforeStop: null, 5273 change: null, 5274 deactivate: null, 5275 out: null, 5276 over: null, 5277 receive: null, 5278 remove: null, 5279 sort: null, 5280 start: null, 5281 stop: null, 5282 update: null 5283 }, 5284 5285 _isOverAxis: function(x, reference, size) { 5286 return (x >= reference) && (x < (reference + size)); 5287 }, 5288 5289 _isFloating: function(item) { 5290 return (/left|right/).test(item.css("float")) || 5291 (/inline|table-cell/).test(item.css("display")); 5292 }, 5293 5294 _create: function() { 5295 this.containerCache = {}; 5296 this._addClass("ui-sortable"); 5297 5298 //Get the items 5299 this.refresh(); 5300 5301 //Let's determine the parent's offset 5302 this.offset = this.element.offset(); 5303 5304 //Initialize mouse events for interaction 5305 this._mouseInit(); 5306 5307 this._setHandleClassName(); 5308 5309 //We're ready to go 5310 this.ready = true; 5311 5312 }, 5313 5314 _setOption: function(key, value) { 5315 this._super(key, value); 5316 5317 if (key === "handle") { 5318 this._setHandleClassName(); 5319 } 5320 }, 5321 5322 _setHandleClassName: function() { 5323 var that = this; 5324 this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle"); 5325 $.each(this.items, function() { 5326 that._addClass( 5327 this.instance.options.handle ? 5328 this.item.find(this.instance.options.handle) : 5329 this.item, 5330 "ui-sortable-handle" 5331 ); 5332 }); 5333 }, 5334 5335 _destroy: function() { 5336 this._mouseDestroy(); 5337 5338 for (var i = this.items.length - 1; i >= 0; i--) { 5339 this.items[i].item.removeData(this.widgetName + "-item"); 5340 } 5341 5342 return this; 5343 }, 5344 5345 _mouseCapture: function(event, overrideHandle) { 5346 var currentItem = null, 5347 validHandle = false, 5348 that = this; 5349 5350 if (this.reverting) { 5351 return false;
vendor: 4,464 bytes, lines 5352-5474
5352 } 5353 5354 if (this.options.disabled || this.options.type === "static") { 5355 return false; 5356 } 5357 5358 //We have to refresh the items data once first 5359 this._refreshItems(event); 5360 5361 //Find out if the clicked node (or one of its parents) is a actual item in this.items 5362 $(event.target).parents().each(function() { 5363 if ($.data(this, that.widgetName + "-item") === that) { 5364 currentItem = $(this); 5365 return false; 5366 } 5367 }); 5368 if ($.data(event.target, that.widgetName + "-item") === that) { 5369 currentItem = $(event.target); 5370 } 5371 5372 if (!currentItem) { 5373 return false; 5374 } 5375 if (this.options.handle && !overrideHandle) { 5376 $(this.options.handle, currentItem).find("*").addBack().each(function() { 5377 if (this === event.target) { 5378 validHandle = true; 5379 } 5380 }); 5381 if (!validHandle) { 5382 return false; 5383 } 5384 } 5385 5386 this.currentItem = currentItem; 5387 this._removeCurrentsFromItems(); 5388 return true; 5389 5390 }, 5391 5392 _mouseStart: function(event, overrideHandle, noActivation) { 5393 5394 var i, body, 5395 o = this.options; 5396 5397 this.currentContainer = this; 5398 5399 //We only need to call refreshPositions, because the refreshItems call has been moved to 5400 // mouseCapture 5401 this.refreshPositions(); 5402 5403 //Create and append the visible helper 5404 this.helper = this._createHelper(event); 5405 5406 //Cache the helper size 5407 this._cacheHelperProportions(); 5408 5409 /* 5410 * - Position generation - 5411 * This block generates everything position related - it's the core of draggables. 5412 */ 5413 5414 //Cache the margins of the original element 5415 this._cacheMargins(); 5416 5417 //Get the next scrolling parent 5418 this.scrollParent = this.helper.scrollParent(); 5419 5420 //The element's absolute position on the page minus margins 5421 this.offset = this.currentItem.offset(); 5422 this.offset = { 5423 top: this.offset.top - this.margins.top, 5424 left: this.offset.left - this.margins.left 5425 }; 5426 5427 $.extend(this.offset, { 5428 click: { //Where the click happened, relative to the element 5429 left: event.pageX - this.offset.left, 5430 top: event.pageY - this.offset.top 5431 }, 5432 parent: this._getParentOffset(), 5433 5434 // This is a relative to absolute position minus the actual position calculation - 5435 // only used for relative positioned helper 5436 relative: this._getRelativeOffset() 5437 }); 5438 5439 // Only after we got the offset, we can change the helper's position to absolute 5440 // TODO: Still need to figure out a way to make relative sorting possible 5441 this.helper.css("position", "absolute"); 5442 this.cssPosition = this.helper.css("position"); 5443 5444 //Generate the original position 5445 this.originalPosition = this._generatePosition(event); 5446 this.originalPageX = event.pageX; 5447 this.originalPageY = event.pageY; 5448 5449 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 5450 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 5451 5452 //Cache the former DOM position 5453 this.domPosition = { 5454 prev: this.currentItem.prev()[0], 5455 parent: this.currentItem.parent()[0] 5456 }; 5457 5458 // If the helper is not the original, hide the original so it's not playing any role during 5459 // the drag, won't cause anything bad this way 5460 if (this.helper[0] !== this.currentItem[0]) { 5461 this.currentItem.hide(); 5462 } 5463 5464 //Create the placeholder 5465 this._createPlaceholder(); 5466 5467 //Set a containment if given in the options 5468 if (o.containment) { 5469 this._setContainment(); 5470 } 5471 5472 if (o.cursor && o.cursor !== "auto") { // cursor option 5473 body = this.document.find("body"); 5474
vendor: 6,332 bytes, lines 5475-5627
5475 // Support: IE 5476 this.storedCursor = body.css("cursor"); 5477 body.css("cursor", o.cursor); 5478 5479 this.storedStylesheet = 5480 $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body); 5481 } 5482 5483 if (o.opacity) { // opacity option 5484 if (this.helper.css("opacity")) { 5485 this._storedOpacity = this.helper.css("opacity"); 5486 } 5487 this.helper.css("opacity", o.opacity); 5488 } 5489 5490 if (o.zIndex) { // zIndex option 5491 if (this.helper.css("zIndex")) { 5492 this._storedZIndex = this.helper.css("zIndex"); 5493 } 5494 this.helper.css("zIndex", o.zIndex); 5495 } 5496 5497 //Prepare scrolling 5498 if (this.scrollParent[0] !== this.document[0] && 5499 this.scrollParent[0].tagName !== "HTML") { 5500 this.overflowOffset = this.scrollParent.offset(); 5501 } 5502 5503 //Call callbacks 5504 this._trigger("start", event, this._uiHash()); 5505 5506 //Recache the helper size 5507 if (!this._preserveHelperProportions) { 5508 this._cacheHelperProportions(); 5509 } 5510 5511 //Post "activate" events to possible containers 5512 if (!noActivation) { 5513 for (i = this.containers.length - 1; i >= 0; i--) { 5514 this.containers[i]._trigger("activate", event, this._uiHash(this)); 5515 } 5516 } 5517 5518 //Prepare possible droppables 5519 if ($.ui.ddmanager) { 5520 $.ui.ddmanager.current = this; 5521 } 5522 5523 if ($.ui.ddmanager && !o.dropBehaviour) { 5524 $.ui.ddmanager.prepareOffsets(this, event); 5525 } 5526 5527 this.dragging = true; 5528 5529 this._addClass(this.helper, "ui-sortable-helper"); 5530 5531 // Execute the drag once - this causes the helper not to be visiblebefore getting its 5532 // correct position 5533 this._mouseDrag(event); 5534 return true; 5535 5536 }, 5537 5538 _mouseDrag: function(event) { 5539 var i, item, itemElement, intersection, 5540 o = this.options, 5541 scrolled = false; 5542 5543 //Compute the helpers position 5544 this.position = this._generatePosition(event); 5545 this.positionAbs = this._convertPositionTo("absolute"); 5546 5547 if (!this.lastPositionAbs) { 5548 this.lastPositionAbs = this.positionAbs; 5549 } 5550 5551 //Do scrolling 5552 if (this.options.scroll) { 5553 if (this.scrollParent[0] !== this.document[0] && 5554 this.scrollParent[0].tagName !== "HTML") { 5555 5556 if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - 5557 event.pageY < o.scrollSensitivity) { 5558 this.scrollParent[0].scrollTop = 5559 scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 5560 } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 5561 this.scrollParent[0].scrollTop = 5562 scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 5563 } 5564 5565 if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - 5566 event.pageX < o.scrollSensitivity) { 5567 this.scrollParent[0].scrollLeft = scrolled = 5568 this.scrollParent[0].scrollLeft + o.scrollSpeed; 5569 } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 5570 this.scrollParent[0].scrollLeft = scrolled = 5571 this.scrollParent[0].scrollLeft - o.scrollSpeed; 5572 } 5573 5574 } else { 5575 5576 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 5577 scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); 5578 } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < 5579 o.scrollSensitivity) { 5580 scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); 5581 } 5582 5583 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 5584 scrolled = this.document.scrollLeft( 5585 this.document.scrollLeft() - o.scrollSpeed 5586 ); 5587 } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < 5588 o.scrollSensitivity) { 5589 scrolled = this.document.scrollLeft( 5590 this.document.scrollLeft() + o.scrollSpeed 5591 ); 5592 } 5593 5594 } 5595 5596 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 5597 $.ui.ddmanager.prepareOffsets(this, event); 5598 } 5599 } 5600 5601 //Regenerate the absolute position used for position checks 5602 this.positionAbs = this._convertPositionTo("absolute"); 5603 5604 //Set the helper position 5605 if (!this.options.axis || this.options.axis !== "y") { 5606 this.helper[0].style.left = this.position.left + "px"; 5607 } 5608 if (!this.options.axis || this.options.axis !== "x") { 5609 this.helper[0].style.top = this.position.top + "px"; 5610 } 5611 5612 //Rearrange 5613 for (i = this.items.length - 1; i >= 0; i--) { 5614 5615 //Cache variables and intersection, continue if no intersection 5616 item = this.items[i]; 5617 itemElement = item.item[0]; 5618 intersection = this._intersectsWithPointer(item); 5619 if (!intersection) { 5620 continue; 5621 } 5622 5623 // Only put the placeholder inside the current Container, skip all 5624 // items from other containers. This works because when moving 5625 // an item from one container to another the 5626 // currentContainer is switched before the placeholder is moved. 5627 //
vendor: 6,204 bytes, lines 5628-5807
5628 // Without this, moving items in "sub-sortables" can cause 5629 // the placeholder to jitter between the outer and inner container. 5630 if (item.instance !== this.currentContainer) { 5631 continue; 5632 } 5633 5634 // Cannot intersect with itself 5635 // no useless actions that have been done before 5636 // no action if the item moved is the parent of the item checked 5637 if (itemElement !== this.currentItem[0] && 5638 this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && 5639 !$.contains(this.placeholder[0], itemElement) && 5640 (this.options.type === "semi-dynamic" ? 5641 !$.contains(this.element[0], itemElement) : 5642 true 5643 ) 5644 ) { 5645 5646 this.direction = intersection === 1 ? "down" : "up"; 5647 5648 if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { 5649 this._rearrange(event, item); 5650 } else { 5651 break; 5652 } 5653 5654 this._trigger("change", event, this._uiHash()); 5655 break; 5656 } 5657 } 5658 5659 //Post events to containers 5660 this._contactContainers(event); 5661 5662 //Interconnect with droppables 5663 if ($.ui.ddmanager) { 5664 $.ui.ddmanager.drag(this, event); 5665 } 5666 5667 //Call callbacks 5668 this._trigger("sort", event, this._uiHash()); 5669 5670 this.lastPositionAbs = this.positionAbs; 5671 return false; 5672 5673 }, 5674 5675 _mouseStop: function(event, noPropagation) { 5676 5677 if (!event) { 5678 return; 5679 } 5680 5681 //If we are using droppables, inform the manager about the drop 5682 if ($.ui.ddmanager && !this.options.dropBehaviour) { 5683 $.ui.ddmanager.drop(this, event); 5684 } 5685 5686 if (this.options.revert) { 5687 var that = this, 5688 cur = this.placeholder.offset(), 5689 axis = this.options.axis, 5690 animation = {}; 5691 5692 if (!axis || axis === "x") { 5693 animation.left = cur.left - this.offset.parent.left - this.margins.left + 5694 (this.offsetParent[0] === this.document[0].body ? 5695 0 : 5696 this.offsetParent[0].scrollLeft 5697 ); 5698 } 5699 if (!axis || axis === "y") { 5700 animation.top = cur.top - this.offset.parent.top - this.margins.top + 5701 (this.offsetParent[0] === this.document[0].body ? 5702 0 : 5703 this.offsetParent[0].scrollTop 5704 ); 5705 } 5706 this.reverting = true; 5707 $(this.helper).animate( 5708 animation, 5709 parseInt(this.options.revert, 10) || 500, 5710 function() { 5711 that._clear(event); 5712 } 5713 ); 5714 } else { 5715 this._clear(event, noPropagation); 5716 } 5717 5718 return false; 5719 5720 }, 5721 5722 cancel: function() { 5723 5724 if (this.dragging) { 5725 5726 this._mouseUp(new $.Event("mouseup", { target: null })); 5727 5728 if (this.options.helper === "original") { 5729 this.currentItem.css(this._storedCSS); 5730 this._removeClass(this.currentItem, "ui-sortable-helper"); 5731 } else { 5732 this.currentItem.show(); 5733 } 5734 5735 //Post deactivating events to containers 5736 for (var i = this.containers.length - 1; i >= 0; i--) { 5737 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 5738 if (this.containers[i].containerCache.over) { 5739 this.containers[i]._trigger("out", null, this._uiHash(this)); 5740 this.containers[i].containerCache.over = 0; 5741 } 5742 } 5743 5744 } 5745 5746 if (this.placeholder) { 5747 5748 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 5749 // it unbinds ALL events from the original node! 5750 if (this.placeholder[0].parentNode) { 5751 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 5752 } 5753 if (this.options.helper !== "original" && this.helper && 5754 this.helper[0].parentNode) { 5755 this.helper.remove(); 5756 } 5757 5758 $.extend(this, { 5759 helper: null, 5760 dragging: false, 5761 reverting: false, 5762 _noFinalSort: null 5763 }); 5764 5765 if (this.domPosition.prev) { 5766 $(this.domPosition.prev).after(this.currentItem); 5767 } else { 5768 $(this.domPosition.parent).prepend(this.currentItem); 5769 } 5770 } 5771 5772 return this; 5773 5774 }, 5775 5776 serialize: function(o) { 5777 5778 var items = this._getItemsAsjQuery(o && o.connected), 5779 str = []; 5780 o = o || {}; 5781 5782 $(items).each(function() { 5783 var res = ($(o.item || this).attr(o.attribute || "id") || "") 5784 .match(o.expression || (/(.+)[\-=_](.+)/)); 5785 if (res) { 5786 str.push( 5787 (o.key || res[1] + "[]") + 5788 "=" + (o.key && o.expression ? res[1] : res[2])); 5789 } 5790 }); 5791 5792 if (!str.length && o.key) { 5793 str.push(o.key + "="); 5794 } 5795 5796 return str.join("&"); 5797 5798 }, 5799 5800 toArray: function(o) { 5801 5802 var items = this._getItemsAsjQuery(o && o.connected), 5803 ret = []; 5804 5805 o = o || {}; 5806 5807 items.each(function() {
vendor: 4,448 bytes, lines 5808-5911
5808 ret.push($(o.item || this).attr(o.attribute || "id") || ""); 5809 }); 5810 return ret; 5811 5812 }, 5813 5814 /* Be careful with the following core functions */ 5815 _intersectsWith: function(item) { 5816 5817 var x1 = this.positionAbs.left, 5818 x2 = x1 + this.helperProportions.width, 5819 y1 = this.positionAbs.top, 5820 y2 = y1 + this.helperProportions.height, 5821 l = item.left, 5822 r = l + item.width, 5823 t = item.top, 5824 b = t + item.height, 5825 dyClick = this.offset.click.top, 5826 dxClick = this.offset.click.left, 5827 isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && 5828 (y1 + dyClick) < b), 5829 isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && 5830 (x1 + dxClick) < r), 5831 isOverElement = isOverElementHeight && isOverElementWidth; 5832 5833 if (this.options.tolerance === "pointer" || 5834 this.options.forcePointerForContainers || 5835 (this.options.tolerance !== "pointer" && 5836 this.helperProportions[this.floating ? "width" : "height"] > 5837 item[this.floating ? "width" : "height"]) 5838 ) { 5839 return isOverElement; 5840 } else { 5841 5842 return (l < x1 + (this.helperProportions.width / 2) && // Right Half 5843 x2 - (this.helperProportions.width / 2) < r && // Left Half 5844 t < y1 + (this.helperProportions.height / 2) && // Bottom Half 5845 y2 - (this.helperProportions.height / 2) < b); // Top Half 5846 5847 } 5848 }, 5849 5850 _intersectsWithPointer: function(item) { 5851 var verticalDirection, horizontalDirection, 5852 isOverElementHeight = (this.options.axis === "x") || 5853 this._isOverAxis( 5854 this.positionAbs.top + this.offset.click.top, item.top, item.height), 5855 isOverElementWidth = (this.options.axis === "y") || 5856 this._isOverAxis( 5857 this.positionAbs.left + this.offset.click.left, item.left, item.width), 5858 isOverElement = isOverElementHeight && isOverElementWidth; 5859 5860 if (!isOverElement) { 5861 return false; 5862 } 5863 5864 verticalDirection = this._getDragVerticalDirection(); 5865 horizontalDirection = this._getDragHorizontalDirection(); 5866 5867 return this.floating ? 5868 ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1) : 5869 (verticalDirection && (verticalDirection === "down" ? 2 : 1)); 5870 5871 }, 5872 5873 _intersectsWithSides: function(item) { 5874 5875 var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + 5876 this.offset.click.top, item.top + (item.height / 2), item.height), 5877 isOverRightHalf = this._isOverAxis(this.positionAbs.left + 5878 this.offset.click.left, item.left + (item.width / 2), item.width), 5879 verticalDirection = this._getDragVerticalDirection(), 5880 horizontalDirection = this._getDragHorizontalDirection(); 5881 5882 if (this.floating && horizontalDirection) { 5883 return ((horizontalDirection === "right" && isOverRightHalf) || 5884 (horizontalDirection === "left" && !isOverRightHalf)); 5885 } else { 5886 return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || 5887 (verticalDirection === "up" && !isOverBottomHalf)); 5888 } 5889 5890 }, 5891 5892 _getDragVerticalDirection: function() { 5893 var delta = this.positionAbs.top - this.lastPositionAbs.top; 5894 return delta !== 0 && (delta > 0 ? "down" : "up"); 5895 }, 5896 5897 _getDragHorizontalDirection: function() { 5898 var delta = this.positionAbs.left - this.lastPositionAbs.left; 5899 return delta !== 0 && (delta > 0 ? "right" : "left"); 5900 }, 5901 5902 refresh: function(event) { 5903 this._refreshItems(event); 5904 this._setHandleClassName(); 5905 this.refreshPositions(); 5906 return this; 5907 }, 5908 5909 _connectWith: function() { 5910 var options = this.options; 5911 return options.connectWith.constructor === String ? [options.connectWith
vendor: 5,814 bytes, lines 5911-6067
5911] : 5912 options.connectWith; 5913 }, 5914 5915 _getItemsAsjQuery: function(connected) { 5916 5917 var i, j, cur, inst, 5918 items = [], 5919 queries = [], 5920 connectWith = this._connectWith(); 5921 5922 if (connectWith && connected) { 5923 for (i = connectWith.length - 1; i >= 0; i--) { 5924 cur = $(connectWith[i], this.document[0]); 5925 for (j = cur.length - 1; j >= 0; j--) { 5926 inst = $.data(cur[j], this.widgetFullName); 5927 if (inst && inst !== this && !inst.options.disabled) { 5928 queries.push([$.isFunction(inst.options.items) ? 5929 inst.options.items.call(inst.element) : 5930 $(inst.options.items, inst.element) 5931 .not(".ui-sortable-helper") 5932 .not(".ui-sortable-placeholder"), inst 5933 ]); 5934 } 5935 } 5936 } 5937 } 5938 5939 queries.push([$.isFunction(this.options.items) ? 5940 this.options.items 5941 .call(this.element, null, { options: this.options, item: this.currentItem }) : 5942 $(this.options.items, this.element) 5943 .not(".ui-sortable-helper") 5944 .not(".ui-sortable-placeholder"), this 5945 ]); 5946 5947 function addItems() { 5948 items.push(this); 5949 } 5950 for (i = queries.length - 1; i >= 0; i--) { 5951 queries[i][0].each(addItems); 5952 } 5953 5954 return $(items); 5955 5956 }, 5957 5958 _removeCurrentsFromItems: function() { 5959 5960 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 5961 5962 this.items = $.grep(this.items, function(item) { 5963 for (var j = 0; j < list.length; j++) { 5964 if (list[j] === item.item[0]) { 5965 return false; 5966 } 5967 } 5968 return true; 5969 }); 5970 5971 }, 5972 5973 _refreshItems: function(event) { 5974 5975 this.items = []; 5976 this.containers = [this]; 5977 5978 var i, j, cur, inst, targetData, _queries, item, queriesLength, 5979 items = this.items, 5980 queries = [ 5981 [$.isFunction(this.options.items) ? 5982 this.options.items.call(this.element[0], event, { item: this.currentItem }) : 5983 $(this.options.items, this.element), this 5984 ] 5985 ], 5986 connectWith = this._connectWith(); 5987 5988 //Shouldn't be run the first time through due to massive slow-down 5989 if (connectWith && this.ready) { 5990 for (i = connectWith.length - 1; i >= 0; i--) { 5991 cur = $(connectWith[i], this.document[0]); 5992 for (j = cur.length - 1; j >= 0; j--) { 5993 inst = $.data(cur[j], this.widgetFullName); 5994 if (inst && inst !== this && !inst.options.disabled) { 5995 queries.push([$.isFunction(inst.options.items) ? 5996 inst.options.items 5997 .call(inst.element[0], event, { item: this.currentItem }) : 5998 $(inst.options.items, inst.element), inst 5999 ]); 6000 this.containers.push(inst); 6001 } 6002 } 6003 } 6004 } 6005 6006 for (i = queries.length - 1; i >= 0; i--) { 6007 targetData = queries[i][1]; 6008 _queries = queries[i][0]; 6009 6010 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 6011 item = $(_queries[j]); 6012 6013 // Data for target checking (mouse manager) 6014 item.data(this.widgetName + "-item", targetData); 6015 6016 items.push({ 6017 item: item, 6018 instance: targetData, 6019 width: 0, 6020 height: 0, 6021 left: 0, 6022 top: 0 6023 }); 6024 } 6025 } 6026 6027 }, 6028 6029 refreshPositions: function(fast) { 6030 6031 // Determine whether items are being displayed horizontally 6032 this.floating = this.items.length ? 6033 this.options.axis === "x" || this._isFloating(this.items[0].item) : 6034 false; 6035 6036 //This has to be redone because due to the item being moved out/into the offsetParent, 6037 // the offsetParent's position will change 6038 if (this.offsetParent && this.helper) { 6039 this.offset.parent = this._getParentOffset(); 6040 } 6041 6042 var i, item, t, p; 6043 6044 for (i = this.items.length - 1; i >= 0; i--) { 6045 item = this.items[i]; 6046 6047 //We ignore calculating positions of all connected containers when we're not over them 6048 if (item.instance !== this.currentContainer && this.currentContainer && 6049 item.item[0] !== this.currentItem[0]) { 6050 continue; 6051 } 6052 6053 t = this.options.toleranceElement ? 6054 $(this.options.toleranceElement, item.item) : 6055 item.item; 6056 6057 if (!fast) { 6058 item.width = t.outerWidth(); 6059 item.height = t.outerHeight(); 6060 } 6061 6062 p = t.offset(); 6063 item.left = p.left; 6064 item.top = p.top; 6065 } 6066 6067 if (this.options.custom && this.options.custom.refreshContainers
vendor: 2,967 bytes, lines 6067-6131
6067) { 6068 this.options.custom.refreshContainers.call(this); 6069 } else { 6070 for (i = this.containers.length - 1; i >= 0; i--) { 6071 p = this.containers[i].element.offset(); 6072 this.containers[i].containerCache.left = p.left; 6073 this.containers[i].containerCache.top = p.top; 6074 this.containers[i].containerCache.width = 6075 this.containers[i].element.outerWidth(); 6076 this.containers[i].containerCache.height = 6077 this.containers[i].element.outerHeight(); 6078 } 6079 } 6080 6081 return this; 6082 }, 6083 6084 _createPlaceholder: function(that) { 6085 that = that || this; 6086 var className, 6087 o = that.options; 6088 6089 if (!o.placeholder || o.placeholder.constructor === String) { 6090 className = o.placeholder; 6091 o.placeholder = { 6092 element: function() { 6093 6094 var nodeName = that.currentItem[0].nodeName.toLowerCase(), 6095 element = $("<" + nodeName + ">", that.document[0]); 6096 6097 that._addClass(element, "ui-sortable-placeholder", 6098 className || that.currentItem[0].className) 6099 ._removeClass(element, "ui-sortable-helper"); 6100 6101 if (nodeName === "tbody") { 6102 that._createTrPlaceholder( 6103 that.currentItem.find("tr").eq(0), 6104 $("<tr>", that.document[0]).appendTo(element) 6105 ); 6106 } else if (nodeName === "tr") { 6107 that._createTrPlaceholder(that.currentItem, element); 6108 } else if (nodeName === "img") { 6109 element.attr("src", that.currentItem.attr("src")); 6110 } 6111 6112 if (!className) { 6113 element.css("visibility", "hidden"); 6114 } 6115 6116 return element; 6117 }, 6118 update: function(container, p) { 6119 6120 // 1. If a className is set as 'placeholder option, we don't force sizes - 6121 // the class is responsible for that 6122 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 6123 // class name is specified 6124 if (className && !o.forcePlaceholderSize) { 6125 return; 6126 } 6127 6128 //If the element doesn't have a actual height by itself (without styles coming 6129 // from a stylesheet), it receives the inline height from the dragged item 6130 if (!p.height()) { 6131 p.height(
vendor: 4,475 bytes, lines 6132-6237
6132 that.currentItem.innerHeight() - 6133 parseInt(that.currentItem.css("paddingTop") || 0, 10) - 6134 parseInt(that.currentItem.css("paddingBottom") || 0, 10)); 6135 } 6136 if (!p.width()) { 6137 p.width( 6138 that.currentItem.innerWidth() - 6139 parseInt(that.currentItem.css("paddingLeft") || 0, 10) - 6140 parseInt(that.currentItem.css("paddingRight") || 0, 10)); 6141 } 6142 } 6143 }; 6144 } 6145 6146 //Create the placeholder 6147 that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); 6148 6149 //Append it after the actual current item 6150 that.currentItem.after(that.placeholder); 6151 6152 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 6153 o.placeholder.update(that, that.placeholder); 6154 6155 }, 6156 6157 _createTrPlaceholder: function(sourceTr, targetTr) { 6158 var that = this; 6159 6160 sourceTr.children().each(function() { 6161 $("<td> </td>", that.document[0]) 6162 .attr("colspan", $(this).attr("colspan") || 1) 6163 .appendTo(targetTr); 6164 }); 6165 }, 6166 6167 _contactContainers: function(event) { 6168 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 6169 floating, axis, 6170 innermostContainer = null, 6171 innermostIndex = null; 6172 6173 // Get innermost container that intersects with item 6174 for (i = this.containers.length - 1; i >= 0; i--) { 6175 6176 // Never consider a container that's located within the item itself 6177 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 6178 continue; 6179 } 6180 6181 if (this._intersectsWith(this.containers[i].containerCache)) { 6182 6183 // If we've already found a container and it's more "inner" than this, then continue 6184 if (innermostContainer && 6185 $.contains( 6186 this.containers[i].element[0], 6187 innermostContainer.element[0])) { 6188 continue; 6189 } 6190 6191 innermostContainer = this.containers[i]; 6192 innermostIndex = i; 6193 6194 } else { 6195 6196 // container doesn't intersect. trigger "out" event if necessary 6197 if (this.containers[i].containerCache.over) { 6198 this.containers[i]._trigger("out", event, this._uiHash(this)); 6199 this.containers[i].containerCache.over = 0; 6200 } 6201 } 6202 6203 } 6204 6205 // If no intersecting containers found, return 6206 if (!innermostContainer) { 6207 return; 6208 } 6209 6210 // Move the item into the container if it's not there already 6211 if (this.containers.length === 1) { 6212 if (!this.containers[innermostIndex].containerCache.over) { 6213 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 6214 this.containers[innermostIndex].containerCache.over = 1; 6215 } 6216 } else { 6217 6218 // When entering a new container, we will find the item with the least distance and 6219 // append our item near it 6220 dist = 10000; 6221 itemWithLeastDistance = null; 6222 floating = innermostContainer.floating || this._isFloating(this.currentItem); 6223 posProperty = floating ? "left" : "top"; 6224 sizeProperty = floating ? "width" : "height"; 6225 axis = floating ? "pageX" : "pageY"; 6226 6227 for (j = this.items.length - 1; j >= 0; j--) { 6228 if (!$.contains( 6229 this.containers[innermostIndex].element[0], this.items[j].item[0])) { 6230 continue; 6231 } 6232 if (this.items[j].item[0] === this.currentItem[0]) { 6233 continue; 6234 } 6235 6236 cur = this.items[j].item.offset()[posProperty]; 6237 nearBottom = false;
vendor: 10,565 bytes, lines 6238-6481
6238 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 6239 nearBottom = true; 6240 } 6241 6242 if (Math.abs(event[axis] - cur) < dist) { 6243 dist = Math.abs(event[axis] - cur); 6244 itemWithLeastDistance = this.items[j]; 6245 this.direction = nearBottom ? "up" : "down"; 6246 } 6247 } 6248 6249 //Check if dropOnEmpty is enabled 6250 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 6251 return; 6252 } 6253 6254 if (this.currentContainer === this.containers[innermostIndex]) { 6255 if (!this.currentContainer.containerCache.over) { 6256 this.containers[innermostIndex]._trigger("over", event, this._uiHash()); 6257 this.currentContainer.containerCache.over = 1; 6258 } 6259 return; 6260 } 6261 6262 itemWithLeastDistance ? 6263 this._rearrange(event, itemWithLeastDistance, null, true) : 6264 this._rearrange(event, null, this.containers[innermostIndex].element, true); 6265 this._trigger("change", event, this._uiHash()); 6266 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 6267 this.currentContainer = this.containers[innermostIndex]; 6268 6269 //Update the placeholder 6270 this.options.placeholder.update(this.currentContainer, this.placeholder); 6271 6272 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 6273 this.containers[innermostIndex].containerCache.over = 1; 6274 } 6275 6276 }, 6277 6278 _createHelper: function(event) { 6279 6280 var o = this.options, 6281 helper = $.isFunction(o.helper) ? 6282 $(o.helper.apply(this.element[0], [event, this.currentItem])) : 6283 (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 6284 6285 //Add the helper to the DOM if that didn't happen already 6286 if (!helper.parents("body").length) { 6287 $(o.appendTo !== "parent" ? 6288 o.appendTo : 6289 this.currentItem[0].parentNode)[0].appendChild(helper[0]); 6290 } 6291 6292 if (helper[0] === this.currentItem[0]) { 6293 this._storedCSS = { 6294 width: this.currentItem[0].style.width, 6295 height: this.currentItem[0].style.height, 6296 position: this.currentItem.css("position"), 6297 top: this.currentItem.css("top"), 6298 left: this.currentItem.css("left") 6299 }; 6300 } 6301 6302 if (!helper[0].style.width || o.forceHelperSize) { 6303 helper.width(this.currentItem.width()); 6304 } 6305 if (!helper[0].style.height || o.forceHelperSize) { 6306 helper.height(this.currentItem.height()); 6307 } 6308 6309 return helper; 6310 6311 }, 6312 6313 _adjustOffsetFromHelper: function(obj) { 6314 if (typeof obj === "string") { 6315 obj = obj.split(" "); 6316 } 6317 if ($.isArray(obj)) { 6318 obj = { left: +obj[0], top: +obj[1] || 0 }; 6319 } 6320 if ("left" in obj) { 6321 this.offset.click.left = obj.left + this.margins.left; 6322 } 6323 if ("right" in obj) { 6324 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 6325 } 6326 if ("top" in obj) { 6327 this.offset.click.top = obj.top + this.margins.top; 6328 } 6329 if ("bottom" in obj) { 6330 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 6331 } 6332 }, 6333 6334 _getParentOffset: function() { 6335 6336 //Get the offsetParent and cache its position 6337 this.offsetParent = this.helper.offsetParent(); 6338 var po = this.offsetParent.offset(); 6339 6340 // This is a special case where we need to modify a offset calculated on start, since the 6341 // following happened: 6342 // 1. The position of the helper is absolute, so it's position is calculated based on the 6343 // next positioned parent 6344 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 6345 // the document, which means that the scroll is included in the initial calculation of the 6346 // offset of the parent, and never recalculated upon drag 6347 if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && 6348 $.contains(this.scrollParent[0], this.offsetParent[0])) { 6349 po.left += this.scrollParent.scrollLeft(); 6350 po.top += this.scrollParent.scrollTop(); 6351 } 6352 6353 // This needs to be actually done for all browsers, since pageX/pageY includes this 6354 // information with an ugly IE fix 6355 if (this.offsetParent[0] === this.document[0].body || 6356 (this.offsetParent[0].tagName && 6357 this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 6358 po = { top: 0, left: 0 }; 6359 } 6360 6361 return { 6362 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 6363 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 6364 }; 6365 6366 }, 6367 6368 _getRelativeOffset: function() { 6369 6370 if (this.cssPosition === "relative") { 6371 var p = this.currentItem.position(); 6372 return { 6373 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 6374 this.scrollParent.scrollTop(), 6375 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 6376 this.scrollParent.scrollLeft() 6377 }; 6378 } else { 6379 return { top: 0, left: 0 }; 6380 } 6381 6382 }, 6383 6384 _cacheMargins: function() { 6385 this.margins = { 6386 left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), 6387 top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) 6388 }; 6389 }, 6390 6391 _cacheHelperProportions: function() { 6392 this.helperProportions = { 6393 width: this.helper.outerWidth(), 6394 height: this.helper.outerHeight() 6395 }; 6396 }, 6397 6398 _setContainment: function() { 6399 6400 var ce, co, over, 6401 o = this.options; 6402 if (o.containment === "parent") { 6403 o.containment = this.helper[0].parentNode; 6404 } 6405 if (o.containment === "document" || o.containment === "window") { 6406 this.containment = [ 6407 0 - this.offset.relative.left - this.offset.parent.left, 6408 0 - this.offset.relative.top - this.offset.parent.top, 6409 o.containment === "document" ? 6410 this.document.width() : 6411 this.window.width() - this.helperProportions.width - this.margins.left, 6412 (o.containment === "document" ? 6413 (this.document.height() || document.body.parentNode.scrollHeight) : 6414 this.window.height() || this.document[0].body.parentNode.scrollHeight 6415 ) - this.helperProportions.height - this.margins.top 6416 ]; 6417 } 6418 6419 if (!(/^(document|window|parent)$/).test(o.containment)) { 6420 ce = $(o.containment)[0]; 6421 co = $(o.containment).offset(); 6422 over = ($(ce).css("overflow") !== "hidden"); 6423 6424 this.containment = [ 6425 co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + 6426 (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, 6427 co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + 6428 (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, 6429 co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 6430 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - 6431 (parseInt($(ce).css("paddingRight"), 10) || 0) - 6432 this.helperProportions.width - this.margins.left, 6433 co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 6434 (parseInt($(ce).css("borderTopWidth"), 10) || 0) - 6435 (parseInt($(ce).css("paddingBottom"), 10) || 0) - 6436 this.helperProportions.height - this.margins.top 6437 ]; 6438 } 6439 6440 }, 6441 6442 _convertPositionTo: function(d, pos) { 6443 6444 if (!pos) { 6445 pos = this.position; 6446 } 6447 var mod = d === "absolute" ? 1 : -1, 6448 scroll = this.cssPosition === "absolute" && 6449 !(this.scrollParent[0] !== this.document[0] && 6450 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 6451 this.offsetParent : 6452 this.scrollParent, 6453 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 6454 6455 return { 6456 top: ( 6457 6458 // The absolute mouse position 6459 pos.top + 6460 6461 // Only for relative positioned nodes: Relative offset from element to offset parent 6462 this.offset.relative.top * mod + 6463 6464 // The offsetParent's offset without borders (offset + border) 6465 this.offset.parent.top * mod - 6466 ((this.cssPosition === "fixed" ? 6467 -this.scrollParent.scrollTop() : 6468 (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod) 6469 ), 6470 left: ( 6471 6472 // The absolute mouse position 6473 pos.left + 6474 6475 // Only for relative positioned nodes: Relative offset from element to offset parent 6476 this.offset.relative.left * mod + 6477 6478 // The offsetParent's offset without borders (offset + border) 6479 this.offset.parent.left * mod - 6480 ((this.cssPosition === "fixed" ? 6481 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 5,876 bytes, lines 6482-6613
6482 scroll.scrollLeft()) * mod) 6483 ) 6484 }; 6485 6486 }, 6487 6488 _generatePosition: function(event) { 6489 6490 var top, left, 6491 o = this.options, 6492 pageX = event.pageX, 6493 pageY = event.pageY, 6494 scroll = this.cssPosition === "absolute" && 6495 !(this.scrollParent[0] !== this.document[0] && 6496 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 6497 this.offsetParent : 6498 this.scrollParent, 6499 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 6500 6501 // This is another very weird special case that only happens for relative elements: 6502 // 1. If the css position is relative 6503 // 2. and the scroll parent is the document or similar to the offset parent 6504 // we have to refresh the relative offset during the scroll so there are no jumps 6505 if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && 6506 this.scrollParent[0] !== this.offsetParent[0])) { 6507 this.offset.relative = this._getRelativeOffset(); 6508 } 6509 6510 /* 6511 * - Position constraining - 6512 * Constrain the position to a mix of grid, containment. 6513 */ 6514 6515 if (this.originalPosition) { //If we are not dragging yet, we won't check for options 6516 6517 if (this.containment) { 6518 if (event.pageX - this.offset.click.left < this.containment[0]) { 6519 pageX = this.containment[0] + this.offset.click.left; 6520 } 6521 if (event.pageY - this.offset.click.top < this.containment[1]) { 6522 pageY = this.containment[1] + this.offset.click.top; 6523 } 6524 if (event.pageX - this.offset.click.left > this.containment[2]) { 6525 pageX = this.containment[2] + this.offset.click.left; 6526 } 6527 if (event.pageY - this.offset.click.top > this.containment[3]) { 6528 pageY = this.containment[3] + this.offset.click.top; 6529 } 6530 } 6531 6532 if (o.grid) { 6533 top = this.originalPageY + Math.round((pageY - this.originalPageY) / 6534 o.grid[1]) * o.grid[1]; 6535 pageY = this.containment ? 6536 ((top - this.offset.click.top >= this.containment[1] && 6537 top - this.offset.click.top <= this.containment[3]) ? 6538 top : 6539 ((top - this.offset.click.top >= this.containment[1]) ? 6540 top - o.grid[1] : top + o.grid[1])) : 6541 top; 6542 6543 left = this.originalPageX + Math.round((pageX - this.originalPageX) / 6544 o.grid[0]) * o.grid[0]; 6545 pageX = this.containment ? 6546 ((left - this.offset.click.left >= this.containment[0] && 6547 left - this.offset.click.left <= this.containment[2]) ? 6548 left : 6549 ((left - this.offset.click.left >= this.containment[0]) ? 6550 left - o.grid[0] : left + o.grid[0])) : 6551 left; 6552 } 6553 6554 } 6555 6556 return { 6557 top: ( 6558 6559 // The absolute mouse position 6560 pageY - 6561 6562 // Click offset (relative to the element) 6563 this.offset.click.top - 6564 6565 // Only for relative positioned nodes: Relative offset from element to offset parent 6566 this.offset.relative.top - 6567 6568 // The offsetParent's offset without borders (offset + border) 6569 this.offset.parent.top + 6570 ((this.cssPosition === "fixed" ? 6571 -this.scrollParent.scrollTop() : 6572 (scrollIsRootNode ? 0 : scroll.scrollTop()))) 6573 ), 6574 left: ( 6575 6576 // The absolute mouse position 6577 pageX - 6578 6579 // Click offset (relative to the element) 6580 this.offset.click.left - 6581 6582 // Only for relative positioned nodes: Relative offset from element to offset parent 6583 this.offset.relative.left - 6584 6585 // The offsetParent's offset without borders (offset + border) 6586 this.offset.parent.left + 6587 ((this.cssPosition === "fixed" ? 6588 -this.scrollParent.scrollLeft() : 6589 scrollIsRootNode ? 0 : scroll.scrollLeft())) 6590 ) 6591 }; 6592 6593 }, 6594 6595 _rearrange: function(event, i, a, hardRefresh) { 6596 6597 a ? a[0].appendChild(this.placeholder[0]) : 6598 i.item[0].parentNode.insertBefore(this.placeholder[0], 6599 (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 6600 6601 //Various things done here to improve the performance: 6602 // 1. we create a setTimeout, that calls refreshPositions 6603 // 2. on the instance, we have a counter variable, that get's higher after every append 6604 // 3. on the local scope, we copy the counter variable, and check in the timeout, 6605 // if it's still the same 6606 // 4. this lets only the last addition to the timeout stack through 6607 this.counter = this.counter ? ++this.counter : 1; 6608 var counter = this.counter; 6609 6610 this._delay(function() { 6611 if (counter === this.counter) { 6612 6613 //Precompute after each DOM insertion, NOT on mousemove
vendor: 4,196 bytes, lines 6614-6713
6614 this.refreshPositions(!hardRefresh); 6615 } 6616 }); 6617 6618 }, 6619 6620 _clear: function(event, noPropagation) { 6621 6622 this.reverting = false; 6623 6624 // We delay all events that have to be triggered to after the point where the placeholder 6625 // has been removed and everything else normalized again 6626 var i, 6627 delayedTriggers = []; 6628 6629 // We first have to update the dom position of the actual currentItem 6630 // Note: don't do it if the current item is already removed (by a user), or it gets 6631 // reappended (see #4088) 6632 if (!this._noFinalSort && this.currentItem.parent().length) { 6633 this.placeholder.before(this.currentItem); 6634 } 6635 this._noFinalSort = null; 6636 6637 if (this.helper[0] === this.currentItem[0]) { 6638 for (i in this._storedCSS) { 6639 if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 6640 this._storedCSS[i] = ""; 6641 } 6642 } 6643 this.currentItem.css(this._storedCSS); 6644 this._removeClass(this.currentItem, "ui-sortable-helper"); 6645 } else { 6646 this.currentItem.show(); 6647 } 6648 6649 if (this.fromOutside && !noPropagation) { 6650 delayedTriggers.push(function(event) { 6651 this._trigger("receive", event, this._uiHash(this.fromOutside)); 6652 }); 6653 } 6654 if ((this.fromOutside || 6655 this.domPosition.prev !== 6656 this.currentItem.prev().not(".ui-sortable-helper")[0] || 6657 this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 6658 6659 // Trigger update callback if the DOM position has changed 6660 delayedTriggers.push(function(event) { 6661 this._trigger("update", event, this._uiHash()); 6662 }); 6663 } 6664 6665 // Check if the items Container has Changed and trigger appropriate 6666 // events. 6667 if (this !== this.currentContainer) { 6668 if (!noPropagation) { 6669 delayedTriggers.push(function(event) { 6670 this._trigger("remove", event, this._uiHash()); 6671 }); 6672 delayedTriggers.push((function(c) { 6673 return function(event) { 6674 c._trigger("receive", event, this._uiHash(this)); 6675 }; 6676 }).call(this, this.currentContainer)); 6677 delayedTriggers.push((function(c) { 6678 return function(event) { 6679 c._trigger("update", event, this._uiHash(this)); 6680 }; 6681 }).call(this, this.currentContainer)); 6682 } 6683 } 6684 6685 //Post events to containers 6686 function delayEvent(type, instance, container) { 6687 return function(event) { 6688 container._trigger(type, event, instance._uiHash(instance)); 6689 }; 6690 } 6691 for (i = this.containers.length - 1; i >= 0; i--) { 6692 if (!noPropagation) { 6693 delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])); 6694 } 6695 if (this.containers[i].containerCache.over) { 6696 delayedTriggers.push(delayEvent("out", this, this.containers[i])); 6697 this.containers[i].containerCache.over = 0; 6698 } 6699 } 6700 6701 //Do what was originally in plugins 6702 if (this.storedCursor) { 6703 this.document.find("body").css("cursor", this.storedCursor); 6704 this.storedStylesheet.remove(); 6705 } 6706 if (this._storedOpacity) { 6707 this.helper.css("opacity", this._storedOpacity); 6708 } 6709 if (this._storedZIndex) { 6710 this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 6711 } 6712 6713 this.dragging = false;
vendor: 18,931 bytes, lines 6714-7261
6714 6715 if (!noPropagation) { 6716 this._trigger("beforeStop", event, this._uiHash()); 6717 } 6718 6719 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 6720 // it unbinds ALL events from the original node! 6721 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 6722 6723 if (!this.cancelHelperRemoval) { 6724 if (this.helper[0] !== this.currentItem[0]) { 6725 this.helper.remove(); 6726 } 6727 this.helper = null; 6728 } 6729 6730 if (!noPropagation) { 6731 for (i = 0; i < delayedTriggers.length; i++) { 6732 6733 // Trigger all delayed events 6734 delayedTriggers[i].call(this, event); 6735 } 6736 this._trigger("stop", event, this._uiHash()); 6737 } 6738 6739 this.fromOutside = false; 6740 return !this.cancelHelperRemoval; 6741 6742 }, 6743 6744 _trigger: function() { 6745 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 6746 this.cancel(); 6747 } 6748 }, 6749 6750 _uiHash: function(_inst) { 6751 var inst = _inst || this; 6752 return { 6753 helper: inst.helper, 6754 placeholder: inst.placeholder || $([]), 6755 position: inst.position, 6756 originalPosition: inst.originalPosition, 6757 offset: inst.positionAbs, 6758 item: inst.currentItem, 6759 sender: _inst ? _inst.element : null 6760 }; 6761 } 6762 6763 }); 6764 6765 6766 /*! 6767 * jQuery UI Accordion 1.12.1 6768 * http://jqueryui.com 6769 * 6770 * Copyright jQuery Foundation and other contributors 6771 * Released under the MIT license. 6772 * http://jquery.org/license 6773 */ 6774 6775 //>>label: Accordion 6776 //>>group: Widgets 6777 // jscs:disable maximumLineLength 6778 //>>description: Displays collapsible content panels for presenting information in a limited amount of space. 6779 // jscs:enable maximumLineLength 6780 //>>docs: http://api.jqueryui.com/accordion/ 6781 //>>demos: http://jqueryui.com/accordion/ 6782 //>>css.structure: ../../themes/base/core.css 6783 //>>css.structure: ../../themes/base/accordion.css 6784 //>>css.theme: ../../themes/base/theme.css 6785 6786 6787 6788 var widgetsAccordion = $.widget("ui.accordion", { 6789 version: "1.12.1", 6790 options: { 6791 active: 0, 6792 animate: {}, 6793 classes: { 6794 "ui-accordion-header": "ui-corner-top", 6795 "ui-accordion-header-collapsed": "ui-corner-all", 6796 "ui-accordion-content": "ui-corner-bottom" 6797 }, 6798 collapsible: false, 6799 event: "click", 6800 header: "> li > :first-child, > :not(li):even", 6801 heightStyle: "auto", 6802 icons: { 6803 activeHeader: "ui-icon-triangle-1-s", 6804 header: "ui-icon-triangle-1-e" 6805 }, 6806 6807 // Callbacks 6808 activate: null, 6809 beforeActivate: null 6810 }, 6811 6812 hideProps: { 6813 borderTopWidth: "hide", 6814 borderBottomWidth: "hide", 6815 paddingTop: "hide", 6816 paddingBottom: "hide", 6817 height: "hide" 6818 }, 6819 6820 showProps: { 6821 borderTopWidth: "show", 6822 borderBottomWidth: "show", 6823 paddingTop: "show", 6824 paddingBottom: "show", 6825 height: "show" 6826 }, 6827 6828 _create: function() { 6829 var options = this.options; 6830 6831 this.prevShow = this.prevHide = $(); 6832 this._addClass("ui-accordion", "ui-widget ui-helper-reset"); 6833 this.element.attr("role", "tablist"); 6834 6835 // Don't allow collapsible: false and active: false / null 6836 if (!options.collapsible && (options.active === false || options.active == null)) { 6837 options.active = 0; 6838 } 6839 6840 this._processPanels(); 6841 6842 // handle negative values 6843 if (options.active < 0) { 6844 options.active += this.headers.length; 6845 } 6846 this._refresh(); 6847 }, 6848 6849 _getCreateEventData: function() { 6850 return { 6851 header: this.active, 6852 panel: !this.active.length ? $() : this.active.next() 6853 }; 6854 }, 6855 6856 _createIcons: function() { 6857 var icon, children, 6858 icons = this.options.icons; 6859 6860 if (icons) { 6861 icon = $("<span>"); 6862 this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header); 6863 icon.prependTo(this.headers); 6864 children = this.active.children(".ui-accordion-header-icon"); 6865 this._removeClass(children, icons.header) 6866 ._addClass(children, null, icons.activeHeader) 6867 ._addClass(this.headers, "ui-accordion-icons"); 6868 } 6869 }, 6870 6871 _destroyIcons: function() { 6872 this._removeClass(this.headers, "ui-accordion-icons"); 6873 this.headers.children(".ui-accordion-header-icon").remove(); 6874 }, 6875 6876 _destroy: function() { 6877 var contents; 6878 6879 // Clean up main element 6880 this.element.removeAttr("role"); 6881 6882 // Clean up headers 6883 this.headers 6884 .removeAttr("role aria-expanded aria-selected aria-controls tabIndex") 6885 .removeUniqueId(); 6886 6887 this._destroyIcons(); 6888 6889 // Clean up content panels 6890 contents = this.headers.next() 6891 .css("display", "") 6892 .removeAttr("role aria-hidden aria-labelledby") 6893 .removeUniqueId(); 6894 6895 if (this.options.heightStyle !== "content") { 6896 contents.css("height", ""); 6897 } 6898 }, 6899 6900 _setOption: function(key, value) { 6901 if (key === "active") { 6902 6903 // _activate() will handle invalid values and update this.options 6904 this._activate(value); 6905 return; 6906 } 6907 6908 if (key === "event") { 6909 if (this.options.event) { 6910 this._off(this.headers, this.options.event); 6911 } 6912 this._setupEvents(value); 6913 } 6914 6915 this._super(key, value); 6916 6917 // Setting collapsible: false while collapsed; open first panel 6918 if (key === "collapsible" && !value && this.options.active === false) { 6919 this._activate(0); 6920 } 6921 6922 if (key === "icons") { 6923 this._destroyIcons(); 6924 if (value) { 6925 this._createIcons(); 6926 } 6927 } 6928 }, 6929 6930 _setOptionDisabled: function(value) { 6931 this._super(value); 6932 6933 this.element.attr("aria-disabled", value); 6934 6935 // Support: IE8 Only 6936 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 6937 // so we need to add the disabled class to the headers and panels 6938 this._toggleClass(null, "ui-state-disabled", !!value); 6939 this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled", !!value); 6940 }, 6941 6942 _keydown: function(event) { 6943 if (event.altKey || event.ctrlKey) { 6944 return; 6945 } 6946 6947 var keyCode = $.ui.keyCode, 6948 length = this.headers.length, 6949 currentIndex = this.headers.index(event.target), 6950 toFocus = false; 6951 6952 switch (event.keyCode) { 6953 case keyCode.RIGHT: 6954 case keyCode.DOWN: 6955 toFocus = this.headers[(currentIndex + 1) % length]; 6956 break; 6957 case keyCode.LEFT: 6958 case keyCode.UP: 6959 toFocus = this.headers[(currentIndex - 1 + length) % length]; 6960 break; 6961 case keyCode.SPACE: 6962 case keyCode.ENTER: 6963 this._eventHandler(event); 6964 break; 6965 case keyCode.HOME: 6966 toFocus = this.headers[0]; 6967 break; 6968 case keyCode.END: 6969 toFocus = this.headers[length - 1]; 6970 break; 6971 } 6972 6973 if (toFocus) { 6974 $(event.target).attr("tabIndex", -1); 6975 $(toFocus).attr("tabIndex", 0); 6976 $(toFocus).trigger("focus"); 6977 event.preventDefault(); 6978 } 6979 }, 6980 6981 _panelKeyDown: function(event) { 6982 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 6983 $(event.currentTarget).prev().trigger("focus"); 6984 } 6985 }, 6986 6987 refresh: function() { 6988 var options = this.options; 6989 this._processPanels(); 6990 6991 // Was collapsed or no panel 6992 if ((options.active === false && options.collapsible === true) || 6993 !this.headers.length) { 6994 options.active = false; 6995 this.active = $(); 6996 6997 // active false only when collapsible is true 6998 } else if (options.active === false) { 6999 this._activate(0); 7000 7001 // was active, but active panel is gone 7002 } else if (this.active.length && !$.contains(this.element[0], this.active[0])) { 7003 7004 // all remaining panel are disabled 7005 if (this.headers.length === this.headers.find(".ui-state-disabled").length) { 7006 options.active = false; 7007 this.active = $(); 7008 7009 // activate previous panel 7010 } else { 7011 this._activate(Math.max(0, options.active - 1)); 7012 } 7013 7014 // was active, active panel still exists 7015 } else { 7016 7017 // make sure active index is correct 7018 options.active = this.headers.index(this.active); 7019 } 7020 7021 this._destroyIcons(); 7022 7023 this._refresh(); 7024 }, 7025 7026 _processPanels: function() { 7027 var prevHeaders = this.headers, 7028 prevPanels = this.panels; 7029 7030 this.headers = this.element.find(this.options.header); 7031 this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed", 7032 "ui-state-default"); 7033 7034 this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide(); 7035 this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content"); 7036 7037 // Avoid memory leaks (#10056) 7038 if (prevPanels) { 7039 this._off(prevHeaders.not(this.headers)); 7040 this._off(prevPanels.not(this.panels)); 7041 } 7042 }, 7043 7044 _refresh: function() { 7045 var maxHeight, 7046 options = this.options, 7047 heightStyle = options.heightStyle, 7048 parent = this.element.parent(); 7049 7050 this.active = this._findActive(options.active); 7051 this._addClass(this.active, "ui-accordion-header-active", "ui-state-active") 7052 ._removeClass(this.active, "ui-accordion-header-collapsed"); 7053 this._addClass(this.active.next(), "ui-accordion-content-active"); 7054 this.active.next().show(); 7055 7056 this.headers 7057 .attr("role", "tab") 7058 .each(function() { 7059 var header = $(this), 7060 headerId = header.uniqueId().attr("id"), 7061 panel = header.next(), 7062 panelId = panel.uniqueId().attr("id"); 7063 header.attr("aria-controls", panelId); 7064 panel.attr("aria-labelledby", headerId); 7065 }) 7066 .next() 7067 .attr("role", "tabpanel"); 7068 7069 this.headers 7070 .not(this.active) 7071 .attr({ 7072 "aria-selected": "false", 7073 "aria-expanded": "false", 7074 tabIndex: -1 7075 }) 7076 .next() 7077 .attr({ 7078 "aria-hidden": "true" 7079 }) 7080 .hide(); 7081 7082 // Make sure at least one header is in the tab order 7083 if (!this.active.length) { 7084 this.headers.eq(0).attr("tabIndex", 0); 7085 } else { 7086 this.active.attr({ 7087 "aria-selected": "true", 7088 "aria-expanded": "true", 7089 tabIndex: 0 7090 }) 7091 .next() 7092 .attr({ 7093 "aria-hidden": "false" 7094 }); 7095 } 7096 7097 this._createIcons(); 7098 7099 this._setupEvents(options.event); 7100 7101 if (heightStyle === "fill") { 7102 maxHeight = parent.height(); 7103 this.element.siblings(":visible").each(function() { 7104 var elem = $(this), 7105 position = elem.css("position"); 7106 7107 if (position === "absolute" || position === "fixed") { 7108 return; 7109 } 7110 maxHeight -= elem.outerHeight(true); 7111 }); 7112 7113 this.headers.each(function() { 7114 maxHeight -= $(this).outerHeight(true); 7115 }); 7116 7117 this.headers.next() 7118 .each(function() { 7119 $(this).height(Math.max(0, maxHeight - 7120 $(this).innerHeight() + $(this).height())); 7121 }) 7122 .css("overflow", "auto"); 7123 } else if (heightStyle === "auto") { 7124 maxHeight = 0; 7125 this.headers.next() 7126 .each(function() { 7127 var isVisible = $(this).is(":visible"); 7128 if (!isVisible) { 7129 $(this).show(); 7130 } 7131 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 7132 if (!isVisible) { 7133 $(this).hide(); 7134 } 7135 }) 7136 .height(maxHeight); 7137 } 7138 }, 7139 7140 _activate: function(index) { 7141 var active = this._findActive(index)[0]; 7142 7143 // Trying to activate the already active panel 7144 if (active === this.active[0]) { 7145 return; 7146 } 7147 7148 // Trying to collapse, simulate a click on the currently active header 7149 active = active || this.active[0]; 7150 7151 this._eventHandler({ 7152 target: active, 7153 currentTarget: active, 7154 preventDefault: $.noop 7155 }); 7156 }, 7157 7158 _findActive: function(selector) { 7159 return typeof selector === "number" ? this.headers.eq(selector) : $(); 7160 }, 7161 7162 _setupEvents: function(event) { 7163 var events = { 7164 keydown: "_keydown" 7165 }; 7166 if (event) { 7167 $.each(event.split(" "), function(index, eventName) { 7168 events[eventName] = "_eventHandler"; 7169 }); 7170 } 7171 7172 this._off(this.headers.add(this.headers.next())); 7173 this._on(this.headers, events); 7174 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 7175 this._hoverable(this.headers); 7176 this._focusable(this.headers); 7177 }, 7178 7179 _eventHandler: function(event) { 7180 var activeChildren, clickedChildren, 7181 options = this.options, 7182 active = this.active, 7183 clicked = $(event.currentTarget), 7184 clickedIsActive = clicked[0] === active[0], 7185 collapsing = clickedIsActive && options.collapsible, 7186 toShow = collapsing ? $() : clicked.next(), 7187 toHide = active.next(), 7188 eventData = { 7189 oldHeader: active, 7190 oldPanel: toHide, 7191 newHeader: collapsing ? $() : clicked, 7192 newPanel: toShow 7193 }; 7194 7195 event.preventDefault(); 7196 7197 if ( 7198 7199 // click on active header, but not collapsible 7200 (clickedIsActive && !options.collapsible) || 7201 7202 // allow canceling activation 7203 (this._trigger("beforeActivate", event, eventData) === false)) { 7204 return; 7205 } 7206 7207 options.active = collapsing ? false : this.headers.index(clicked); 7208 7209 // When the call to ._toggle() comes after the class changes 7210 // it causes a very odd bug in IE 8 (see #6720) 7211 this.active = clickedIsActive ? $() : clicked; 7212 this._toggle(eventData); 7213 7214 // Switch classes 7215 // corner classes on the previously active header stay after the animation 7216 this._removeClass(active, "ui-accordion-header-active", "ui-state-active"); 7217 if (options.icons) { 7218 activeChildren = active.children(".ui-accordion-header-icon"); 7219 this._removeClass(activeChildren, null, options.icons.activeHeader) 7220 ._addClass(activeChildren, null, options.icons.header); 7221 } 7222 7223 if (!clickedIsActive) { 7224 this._removeClass(clicked, "ui-accordion-header-collapsed") 7225 ._addClass(clicked, "ui-accordion-header-active", "ui-state-active"); 7226 if (options.icons) { 7227 clickedChildren = clicked.children(".ui-accordion-header-icon"); 7228 this._removeClass(clickedChildren, null, options.icons.header) 7229 ._addClass(clickedChildren, null, options.icons.activeHeader); 7230 } 7231 7232 this._addClass(clicked.next(), "ui-accordion-content-active"); 7233 } 7234 }, 7235 7236 _toggle: function(data) { 7237 var toShow = data.newPanel, 7238 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 7239 7240 // Handle activating a panel during the animation for another activation 7241 this.prevShow.add(this.prevHide).stop(true, true); 7242 this.prevShow = toShow; 7243 this.prevHide = toHide; 7244 7245 if (this.options.animate) { 7246 this._animate(toShow, toHide, data); 7247 } else { 7248 toHide.hide(); 7249 toShow.show(); 7250 this._toggleComplete(data); 7251 } 7252 7253 toHide.attr({ 7254 "aria-hidden": "true" 7255 }); 7256 toHide.prev().attr({ 7257 "aria-selected": "false", 7258 "aria-expanded": "false" 7259 }); 7260 7261 // if we're switching panels, remove the old header from the tab order
vendor: 5,028 bytes, lines 7262-7409
7262 // if we're opening from collapsed state, remove the previous header from the tab order 7263 // if we're collapsing, then keep the collapsing header in the tab order 7264 if (toShow.length && toHide.length) { 7265 toHide.prev().attr({ 7266 "tabIndex": -1, 7267 "aria-expanded": "false" 7268 }); 7269 } else if (toShow.length) { 7270 this.headers.filter(function() { 7271 return parseInt($(this).attr("tabIndex"), 10) === 0; 7272 }) 7273 .attr("tabIndex", -1); 7274 } 7275 7276 toShow 7277 .attr("aria-hidden", "false") 7278 .prev() 7279 .attr({ 7280 "aria-selected": "true", 7281 "aria-expanded": "true", 7282 tabIndex: 0 7283 }); 7284 }, 7285 7286 _animate: function(toShow, toHide, data) { 7287 var total, easing, duration, 7288 that = this, 7289 adjust = 0, 7290 boxSizing = toShow.css("box-sizing"), 7291 down = toShow.length && 7292 (!toHide.length || (toShow.index() < toHide.index())), 7293 animate = this.options.animate || {}, 7294 options = down && animate.down || animate, 7295 complete = function() { 7296 that._toggleComplete(data); 7297 }; 7298 7299 if (typeof options === "number") { 7300 duration = options; 7301 } 7302 if (typeof options === "string") { 7303 easing = options; 7304 } 7305 7306 // fall back from options to animation in case of partial down settings 7307 easing = easing || options.easing || animate.easing; 7308 duration = duration || options.duration || animate.duration; 7309 7310 if (!toHide.length) { 7311 return toShow.animate(this.showProps, duration, easing, complete); 7312 } 7313 if (!toShow.length) { 7314 return toHide.animate(this.hideProps, duration, easing, complete); 7315 } 7316 7317 total = toShow.show().outerHeight(); 7318 toHide.animate(this.hideProps, { 7319 duration: duration, 7320 easing: easing, 7321 step: function(now, fx) { 7322 fx.now = Math.round(now); 7323 } 7324 }); 7325 toShow 7326 .hide() 7327 .animate(this.showProps, { 7328 duration: duration, 7329 easing: easing, 7330 complete: complete, 7331 step: function(now, fx) { 7332 fx.now = Math.round(now); 7333 if (fx.prop !== "height") { 7334 if (boxSizing === "content-box") { 7335 adjust += fx.now; 7336 } 7337 } else if (that.options.heightStyle !== "content") { 7338 fx.now = Math.round(total - toHide.outerHeight() - adjust); 7339 adjust = 0; 7340 } 7341 } 7342 }); 7343 }, 7344 7345 _toggleComplete: function(data) { 7346 var toHide = data.oldPanel, 7347 prev = toHide.prev(); 7348 7349 this._removeClass(toHide, "ui-accordion-content-active"); 7350 this._removeClass(prev, "ui-accordion-header-active") 7351 ._addClass(prev, "ui-accordion-header-collapsed"); 7352 7353 // Work around for rendering bug in IE (#5421) 7354 if (toHide.length) { 7355 toHide.parent()[0].className = toHide.parent()[0].className; 7356 } 7357 this._trigger("activate", null, data); 7358 } 7359 }); 7360 7361 7362 /*! 7363 * jQuery UI Menu 1.12.1 7364 * http://jqueryui.com 7365 * 7366 * Copyright jQuery Foundation and other contributors 7367 * Released under the MIT license. 7368 * http://jquery.org/license 7369 */ 7370 7371 //>>label: Menu 7372 //>>group: Widgets 7373 //>>description: Creates nestable menus. 7374 //>>docs: http://api.jqueryui.com/menu/ 7375 //>>demos: http://jqueryui.com/menu/ 7376 //>>css.structure: ../../themes/base/core.css 7377 //>>css.structure: ../../themes/base/menu.css 7378 //>>css.theme: ../../themes/base/theme.css 7379 7380 7381 7382 var widgetsMenu = $.widget("ui.menu", { 7383 version: "1.12.1", 7384 defaultElement: "<ul>", 7385 delay: 300, 7386 options: { 7387 icons: { 7388 submenu: "ui-icon-caret-1-e" 7389 }, 7390 items: "> *", 7391 menus: "ul", 7392 position: { 7393 my: "left top", 7394 at: "right top" 7395 }, 7396 role: "menu", 7397 7398 // Callbacks 7399 blur: null, 7400 focus: null, 7401 select: null 7402 }, 7403 7404 _create: function() { 7405 this.activeMenu = this.element; 7406 7407 // Flag used to prevent firing of the click handler 7408 // as the event bubbles up through nested menus 7409 this.mouseHandled = false;
vendor: 6,912 bytes, lines 7410-7580
7410 this.element 7411 .uniqueId() 7412 .attr({ 7413 role: this.options.role, 7414 tabIndex: 0 7415 }); 7416 7417 this._addClass("ui-menu", "ui-widget ui-widget-content"); 7418 this._on({ 7419 7420 // Prevent focus from sticking to links inside menu after clicking 7421 // them (focus should always stay on UL during navigation). 7422 "mousedown .ui-menu-item": function(event) { 7423 event.preventDefault(); 7424 }, 7425 "click .ui-menu-item": function(event) { 7426 var target = $(event.target); 7427 var active = $($.ui.safeActiveElement(this.document[0])); 7428 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 7429 this.select(event); 7430 7431 // Only set the mouseHandled flag if the event will bubble, see #9469. 7432 if (!event.isPropagationStopped()) { 7433 this.mouseHandled = true; 7434 } 7435 7436 // Open submenu on click 7437 if (target.has(".ui-menu").length) { 7438 this.expand(event); 7439 } else if (!this.element.is(":focus") && 7440 active.closest(".ui-menu").length) { 7441 7442 // Redirect focus to the menu 7443 this.element.trigger("focus", [true]); 7444 7445 // If the active item is on the top level, let it stay active. 7446 // Otherwise, blur the active item since it is no longer visible. 7447 if (this.active && this.active.parents(".ui-menu").length === 1) { 7448 clearTimeout(this.timer); 7449 } 7450 } 7451 } 7452 }, 7453 "mouseenter .ui-menu-item": function(event) { 7454 7455 // Ignore mouse events while typeahead is active, see #10458. 7456 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 7457 // is over an item in the menu 7458 if (this.previousFilter) { 7459 return; 7460 } 7461 7462 var actualTarget = $(event.target).closest(".ui-menu-item"), 7463 target = $(event.currentTarget); 7464 7465 // Ignore bubbled events on parent items, see #11641 7466 if (actualTarget[0] !== target[0]) { 7467 return; 7468 } 7469 7470 // Remove ui-state-active class from siblings of the newly focused menu item 7471 // to avoid a jump caused by adjacent elements both having a class with a border 7472 this._removeClass(target.siblings().children(".ui-state-active"), 7473 null, "ui-state-active"); 7474 this.focus(event, target); 7475 }, 7476 mouseleave: "collapseAll", 7477 "mouseleave .ui-menu": "collapseAll", 7478 focus: function(event, keepActiveItem) { 7479 7480 // If there's already an active item, keep it active 7481 // If not, activate the first item 7482 var item = this.active || this.element.find(this.options.items).eq(0); 7483 7484 if (!keepActiveItem) { 7485 this.focus(event, item); 7486 } 7487 }, 7488 blur: function(event) { 7489 this._delay(function() { 7490 var notContained = !$.contains( 7491 this.element[0], 7492 $.ui.safeActiveElement(this.document[0]) 7493 ); 7494 if (notContained) { 7495 this.collapseAll(event); 7496 } 7497 }); 7498 }, 7499 keydown: "_keydown" 7500 }); 7501 7502 this.refresh(); 7503 7504 // Clicks outside of a menu collapse any open menus 7505 this._on(this.document, { 7506 click: function(event) { 7507 if (this._closeOnDocumentClick(event)) { 7508 this.collapseAll(event); 7509 } 7510 7511 // Reset the mouseHandled flag 7512 this.mouseHandled = false; 7513 } 7514 }); 7515 }, 7516 7517 _destroy: function() { 7518 var items = this.element.find(".ui-menu-item") 7519 .removeAttr("role aria-disabled"), 7520 submenus = items.children(".ui-menu-item-wrapper") 7521 .removeUniqueId() 7522 .removeAttr("tabIndex role aria-haspopup"); 7523 7524 // Destroy (sub)menus 7525 this.element 7526 .removeAttr("aria-activedescendant") 7527 .find(".ui-menu").addBack() 7528 .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " + 7529 "tabIndex") 7530 .removeUniqueId() 7531 .show(); 7532 7533 submenus.children().each(function() { 7534 var elem = $(this); 7535 if (elem.data("ui-menu-submenu-caret")) { 7536 elem.remove(); 7537 } 7538 }); 7539 }, 7540 7541 _keydown: function(event) { 7542 var match, prev, character, skip, 7543 preventDefault = true; 7544 7545 switch (event.keyCode) { 7546 case $.ui.keyCode.PAGE_UP: 7547 this.previousPage(event); 7548 break; 7549 case $.ui.keyCode.PAGE_DOWN: 7550 this.nextPage(event); 7551 break; 7552 case $.ui.keyCode.HOME: 7553 this._move("first", "first", event); 7554 break; 7555 case $.ui.keyCode.END: 7556 this._move("last", "last", event); 7557 break; 7558 case $.ui.keyCode.UP: 7559 this.previous(event); 7560 break; 7561 case $.ui.keyCode.DOWN: 7562 this.next(event); 7563 break; 7564 case $.ui.keyCode.LEFT: 7565 this.collapse(event); 7566 break; 7567 case $.ui.keyCode.RIGHT: 7568 if (this.active && !this.active.is(".ui-state-disabled")) { 7569 this.expand(event); 7570 } 7571 break; 7572 case $.ui.keyCode.ENTER: 7573 case $.ui.keyCode.SPACE: 7574 this._activate(event); 7575 break; 7576 case $.ui.keyCode.ESCAPE: 7577 this.collapse(event); 7578 break; 7579 default: 7580 preventDefault = false;
vendor: 9,272 bytes, lines 7581-7830
7581 prev = this.previousFilter || ""; 7582 skip = false; 7583 7584 // Support number pad values 7585 character = event.keyCode >= 96 && event.keyCode <= 105 ? 7586 (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode); 7587 7588 clearTimeout(this.filterTimer); 7589 7590 if (character === prev) { 7591 skip = true; 7592 } else { 7593 character = prev + character; 7594 } 7595 7596 match = this._filterMenuItems(character); 7597 match = skip && match.index(this.active.next()) !== -1 ? 7598 this.active.nextAll(".ui-menu-item") : 7599 match; 7600 7601 // If no matches on the current filter, reset to the last character pressed 7602 // to move down the menu to the first item that starts with that character 7603 if (!match.length) { 7604 character = String.fromCharCode(event.keyCode); 7605 match = this._filterMenuItems(character); 7606 } 7607 7608 if (match.length) { 7609 this.focus(event, match); 7610 this.previousFilter = character; 7611 this.filterTimer = this._delay(function() { 7612 delete this.previousFilter; 7613 }, 1000); 7614 } else { 7615 delete this.previousFilter; 7616 } 7617 } 7618 7619 if (preventDefault) { 7620 event.preventDefault(); 7621 } 7622 }, 7623 7624 _activate: function(event) { 7625 if (this.active && !this.active.is(".ui-state-disabled")) { 7626 if (this.active.children("[aria-haspopup='true']").length) { 7627 this.expand(event); 7628 } else { 7629 this.select(event); 7630 } 7631 } 7632 }, 7633 7634 refresh: function() { 7635 var menus, items, newSubmenus, newItems, newWrappers, 7636 that = this, 7637 icon = this.options.icons.submenu, 7638 submenus = this.element.find(this.options.menus); 7639 7640 this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length); 7641 7642 // Initialize nested menus 7643 newSubmenus = submenus.filter(":not(.ui-menu)") 7644 .hide() 7645 .attr({ 7646 role: this.options.role, 7647 "aria-hidden": "true", 7648 "aria-expanded": "false" 7649 }) 7650 .each(function() { 7651 var menu = $(this), 7652 item = menu.prev(), 7653 submenuCaret = $("<span>").data("ui-menu-submenu-caret", true); 7654 7655 that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon); 7656 item 7657 .attr("aria-haspopup", "true") 7658 .prepend(submenuCaret); 7659 menu.attr("aria-labelledby", item.attr("id")); 7660 }); 7661 7662 this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front"); 7663 7664 menus = submenus.add(this.element); 7665 items = menus.find(this.options.items); 7666 7667 // Initialize menu-items containing spaces and/or dashes only as dividers 7668 items.not(".ui-menu-item").each(function() { 7669 var item = $(this); 7670 if (that._isDivider(item)) { 7671 that._addClass(item, "ui-menu-divider", "ui-widget-content"); 7672 } 7673 }); 7674 7675 // Don't refresh list items that are already adapted 7676 newItems = items.not(".ui-menu-item, .ui-menu-divider"); 7677 newWrappers = newItems.children() 7678 .not(".ui-menu") 7679 .uniqueId() 7680 .attr({ 7681 tabIndex: -1, 7682 role: this._itemRole() 7683 }); 7684 this._addClass(newItems, "ui-menu-item") 7685 ._addClass(newWrappers, "ui-menu-item-wrapper"); 7686 7687 // Add aria-disabled attribute to any disabled menu item 7688 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 7689 7690 // If the active item has been removed, blur the menu 7691 if (this.active && !$.contains(this.element[0], this.active[0])) { 7692 this.blur(); 7693 } 7694 }, 7695 7696 _itemRole: function() { 7697 return { 7698 menu: "menuitem", 7699 listbox: "option" 7700 }[this.options.role]; 7701 }, 7702 7703 _setOption: function(key, value) { 7704 if (key === "icons") { 7705 var icons = this.element.find(".ui-menu-icon"); 7706 this._removeClass(icons, null, this.options.icons.submenu) 7707 ._addClass(icons, null, value.submenu); 7708 } 7709 this._super(key, value); 7710 }, 7711 7712 _setOptionDisabled: function(value) { 7713 this._super(value); 7714 7715 this.element.attr("aria-disabled", String(value)); 7716 this._toggleClass(null, "ui-state-disabled", !!value); 7717 }, 7718 7719 focus: function(event, item) { 7720 var nested, focused, activeParent; 7721 this.blur(event, event && event.type === "focus"); 7722 7723 this._scrollIntoView(item); 7724 7725 this.active = item.first(); 7726 7727 focused = this.active.children(".ui-menu-item-wrapper"); 7728 this._addClass(focused, null, "ui-state-active"); 7729 7730 // Only update aria-activedescendant if there's a role 7731 // otherwise we assume focus is managed elsewhere 7732 if (this.options.role) { 7733 this.element.attr("aria-activedescendant", focused.attr("id")); 7734 } 7735 7736 // Highlight active parent menu item, if any 7737 activeParent = this.active 7738 .parent() 7739 .closest(".ui-menu-item") 7740 .children(".ui-menu-item-wrapper"); 7741 this._addClass(activeParent, null, "ui-state-active"); 7742 7743 if (event && event.type === "keydown") { 7744 this._close(); 7745 } else { 7746 this.timer = this._delay(function() { 7747 this._close(); 7748 }, this.delay); 7749 } 7750 7751 nested = item.children(".ui-menu"); 7752 if (nested.length && event && (/^mouse/.test(event.type))) { 7753 this._startOpening(nested); 7754 } 7755 this.activeMenu = item.parent(); 7756 7757 this._trigger("focus", event, { item: item }); 7758 }, 7759 7760 _scrollIntoView: function(item) { 7761 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 7762 if (this._hasScroll()) { 7763 borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 7764 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 7765 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 7766 scroll = this.activeMenu.scrollTop(); 7767 elementHeight = this.activeMenu.height(); 7768 itemHeight = item.outerHeight(); 7769 7770 if (offset < 0) { 7771 this.activeMenu.scrollTop(scroll + offset); 7772 } else if (offset + itemHeight > elementHeight) { 7773 this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight); 7774 } 7775 } 7776 }, 7777 7778 blur: function(event, fromFocus) { 7779 if (!fromFocus) { 7780 clearTimeout(this.timer); 7781 } 7782 7783 if (!this.active) { 7784 return; 7785 } 7786 7787 this._removeClass(this.active.children(".ui-menu-item-wrapper"), 7788 null, "ui-state-active"); 7789 7790 this._trigger("blur", event, { item: this.active }); 7791 this.active = null; 7792 }, 7793 7794 _startOpening: function(submenu) { 7795 clearTimeout(this.timer); 7796 7797 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 7798 // shift in the submenu position when mousing over the caret icon 7799 if (submenu.attr("aria-hidden") !== "true") { 7800 return; 7801 } 7802 7803 this.timer = this._delay(function() { 7804 this._close(); 7805 this._open(submenu); 7806 }, this.delay); 7807 }, 7808 7809 _open: function(submenu) { 7810 var position = $.extend({ 7811 of: this.active 7812 }, this.options.position); 7813 7814 clearTimeout(this.timer); 7815 this.element.find(".ui-menu").not(submenu.parents(".ui-menu")) 7816 .hide() 7817 .attr("aria-hidden", "true"); 7818 7819 submenu 7820 .show() 7821 .removeAttr("aria-hidden") 7822 .attr("aria-expanded", "true") 7823 .position(position); 7824 }, 7825 7826 collapseAll: function(event, all) { 7827 clearTimeout(this.timer); 7828 this.timer = this._delay(function() { 7829 7830 // If we were passed an event, look for the submenu that c
vendor: 33,977 bytes, lines 7830-8772
7830ontains the event 7831 var currentMenu = all ? this.element : 7832 $(event && event.target).closest(this.element.find(".ui-menu")); 7833 7834 // If we found no valid submenu ancestor, use the main menu to close all 7835 // sub menus anyway 7836 if (!currentMenu.length) { 7837 currentMenu = this.element; 7838 } 7839 7840 this._close(currentMenu); 7841 7842 this.blur(event); 7843 7844 // Work around active item staying active after menu is blurred 7845 this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active"); 7846 7847 this.activeMenu = currentMenu; 7848 }, this.delay); 7849 }, 7850 7851 // With no arguments, closes the currently active menu - if nothing is active 7852 // it closes all menus. If passed an argument, it will search for menus BELOW 7853 _close: function(startMenu) { 7854 if (!startMenu) { 7855 startMenu = this.active ? this.active.parent() : this.element; 7856 } 7857 7858 startMenu.find(".ui-menu") 7859 .hide() 7860 .attr("aria-hidden", "true") 7861 .attr("aria-expanded", "false"); 7862 }, 7863 7864 _closeOnDocumentClick: function(event) { 7865 return !$(event.target).closest(".ui-menu").length; 7866 }, 7867 7868 _isDivider: function(item) { 7869 7870 // Match hyphen, em dash, en dash 7871 return !/[^\-\u2014\u2013\s]/.test(item.text()); 7872 }, 7873 7874 collapse: function(event) { 7875 var newItem = this.active && 7876 this.active.parent().closest(".ui-menu-item", this.element); 7877 if (newItem && newItem.length) { 7878 this._close(); 7879 this.focus(event, newItem); 7880 } 7881 }, 7882 7883 expand: function(event) { 7884 var newItem = this.active && 7885 this.active 7886 .children(".ui-menu ") 7887 .find(this.options.items) 7888 .first(); 7889 7890 if (newItem && newItem.length) { 7891 this._open(newItem.parent()); 7892 7893 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 7894 this._delay(function() { 7895 this.focus(event, newItem); 7896 }); 7897 } 7898 }, 7899 7900 next: function(event) { 7901 this._move("next", "first", event); 7902 }, 7903 7904 previous: function(event) { 7905 this._move("prev", "last", event); 7906 }, 7907 7908 isFirstItem: function() { 7909 return this.active && !this.active.prevAll(".ui-menu-item").length; 7910 }, 7911 7912 isLastItem: function() { 7913 return this.active && !this.active.nextAll(".ui-menu-item").length; 7914 }, 7915 7916 _move: function(direction, filter, event) { 7917 var next; 7918 if (this.active) { 7919 if (direction === "first" || direction === "last") { 7920 next = this.active[direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item") 7921 .eq(-1); 7922 } else { 7923 next = this.active[direction + "All"](".ui-menu-item") 7924 .eq(0); 7925 } 7926 } 7927 if (!next || !next.length || !this.active) { 7928 next = this.activeMenu.find(this.options.items)[filter](); 7929 } 7930 7931 this.focus(event, next); 7932 }, 7933 7934 nextPage: function(event) { 7935 var item, base, height; 7936 7937 if (!this.active) { 7938 this.next(event); 7939 return; 7940 } 7941 if (this.isLastItem()) { 7942 return; 7943 } 7944 if (this._hasScroll()) { 7945 base = this.active.offset().top; 7946 height = this.element.height(); 7947 this.active.nextAll(".ui-menu-item").each(function() { 7948 item = $(this); 7949 return item.offset().top - base - height < 0; 7950 }); 7951 7952 this.focus(event, item); 7953 } else { 7954 this.focus(event, this.activeMenu.find(this.options.items)[!this.active ? "first" : "last"]()); 7955 } 7956 }, 7957 7958 previousPage: function(event) { 7959 var item, base, height; 7960 if (!this.active) { 7961 this.next(event); 7962 return; 7963 } 7964 if (this.isFirstItem()) { 7965 return; 7966 } 7967 if (this._hasScroll()) { 7968 base = this.active.offset().top; 7969 height = this.element.height(); 7970 this.active.prevAll(".ui-menu-item").each(function() { 7971 item = $(this); 7972 return item.offset().top - base + height > 0; 7973 }); 7974 7975 this.focus(event, item); 7976 } else { 7977 this.focus(event, this.activeMenu.find(this.options.items).first()); 7978 } 7979 }, 7980 7981 _hasScroll: function() { 7982 return this.element.outerHeight() < this.element.prop("scrollHeight"); 7983 }, 7984 7985 select: function(event) { 7986 7987 // TODO: It should never be possible to not have an active item at this 7988 // point, but the tests don't trigger mouseenter before click. 7989 this.active = this.active || $(event.target).closest(".ui-menu-item"); 7990 var ui = { item: this.active }; 7991 if (!this.active.has(".ui-menu").length) { 7992 this.collapseAll(event, true); 7993 } 7994 this._trigger("select", event, ui); 7995 }, 7996 7997 _filterMenuItems: function(character) { 7998 var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), 7999 regex = new RegExp("^" + escapedCharacter, "i"); 8000 8001 return this.activeMenu 8002 .find(this.options.items) 8003 8004 // Only match on items, not dividers or other content (#10571) 8005 .filter(".ui-menu-item") 8006 .filter(function() { 8007 return regex.test( 8008 $.trim($(this).children(".ui-menu-item-wrapper").text())); 8009 }); 8010 } 8011 }); 8012 8013 8014 /*! 8015 * jQuery UI Autocomplete 1.12.1 8016 * http://jqueryui.com 8017 * 8018 * Copyright jQuery Foundation and other contributors 8019 * Released under the MIT license. 8020 * http://jquery.org/license 8021 */ 8022 8023 //>>label: Autocomplete 8024 //>>group: Widgets 8025 //>>description: Lists suggested words as the user is typing. 8026 //>>docs: http://api.jqueryui.com/autocomplete/ 8027 //>>demos: http://jqueryui.com/autocomplete/ 8028 //>>css.structure: ../../themes/base/core.css 8029 //>>css.structure: ../../themes/base/autocomplete.css 8030 //>>css.theme: ../../themes/base/theme.css 8031 8032 8033 8034 $.widget("ui.autocomplete", { 8035 version: "1.12.1", 8036 defaultElement: "<input>", 8037 options: { 8038 appendTo: null, 8039 autoFocus: false, 8040 delay: 300, 8041 minLength: 1, 8042 position: { 8043 my: "left top", 8044 at: "left bottom", 8045 collision: "none" 8046 }, 8047 source: null, 8048 8049 // Callbacks 8050 change: null, 8051 close: null, 8052 focus: null, 8053 open: null, 8054 response: null, 8055 search: null, 8056 select: null 8057 }, 8058 8059 requestIndex: 0, 8060 pending: 0, 8061 8062 _create: function() { 8063 8064 // Some browsers only repeat keydown events, not keypress events, 8065 // so we use the suppressKeyPress flag to determine if we've already 8066 // handled the keydown event. #7269 8067 // Unfortunately the code for & in keypress is the same as the up arrow, 8068 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 8069 // events when we know the keydown event was used to modify the 8070 // search term. #7799 8071 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 8072 nodeName = this.element[0].nodeName.toLowerCase(), 8073 isTextarea = nodeName === "textarea", 8074 isInput = nodeName === "input"; 8075 8076 // Textareas are always multi-line 8077 // Inputs are always single-line, even if inside a contentEditable element 8078 // IE also treats inputs as contentEditable 8079 // All other element types are determined by whether or not they're contentEditable 8080 this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element); 8081 8082 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 8083 this.isNewMenu = true; 8084 8085 this._addClass("ui-autocomplete-input"); 8086 this.element.attr("autocomplete", "off"); 8087 8088 this._on(this.element, { 8089 keydown: function(event) { 8090 if (this.element.prop("readOnly")) { 8091 suppressKeyPress = true; 8092 suppressInput = true; 8093 suppressKeyPressRepeat = true; 8094 return; 8095 } 8096 8097 suppressKeyPress = false; 8098 suppressInput = false; 8099 suppressKeyPressRepeat = false; 8100 var keyCode = $.ui.keyCode; 8101 switch (event.keyCode) { 8102 case keyCode.PAGE_UP: 8103 suppressKeyPress = true; 8104 this._move("previousPage", event); 8105 break; 8106 case keyCode.PAGE_DOWN: 8107 suppressKeyPress = true; 8108 this._move("nextPage", event); 8109 break; 8110 case keyCode.UP: 8111 suppressKeyPress = true; 8112 this._keyEvent("previous", event); 8113 break; 8114 case keyCode.DOWN: 8115 suppressKeyPress = true; 8116 this._keyEvent("next", event); 8117 break; 8118 case keyCode.ENTER: 8119 8120 // when menu is open and has focus 8121 if (this.menu.active) { 8122 8123 // #6055 - Opera still allows the keypress to occur 8124 // which causes forms to submit 8125 suppressKeyPress = true; 8126 event.preventDefault(); 8127 this.menu.select(event); 8128 } 8129 break; 8130 case keyCode.TAB: 8131 if (this.menu.active) { 8132 this.menu.select(event); 8133 } 8134 break; 8135 case keyCode.ESCAPE: 8136 if (this.menu.element.is(":visible")) { 8137 if (!this.isMultiLine) { 8138 this._value(this.term); 8139 } 8140 this.close(event); 8141 8142 // Different browsers have different default behavior for escape 8143 // Single press can mean undo or clear 8144 // Double press in IE means clear the whole form 8145 event.preventDefault(); 8146 } 8147 break; 8148 default: 8149 suppressKeyPressRepeat = true; 8150 8151 // search timeout should be triggered before the input value is changed 8152 this._searchTimeout(event); 8153 break; 8154 } 8155 }, 8156 keypress: function(event) { 8157 if (suppressKeyPress) { 8158 suppressKeyPress = false; 8159 if (!this.isMultiLine || this.menu.element.is(":visible")) { 8160 event.preventDefault(); 8161 } 8162 return; 8163 } 8164 if (suppressKeyPressRepeat) { 8165 return; 8166 } 8167 8168 // Replicate some key handlers to allow them to repeat in Firefox and Opera 8169 var keyCode = $.ui.keyCode; 8170 switch (event.keyCode) { 8171 case keyCode.PAGE_UP: 8172 this._move("previousPage", event); 8173 break; 8174 case keyCode.PAGE_DOWN: 8175 this._move("nextPage", event); 8176 break; 8177 case keyCode.UP: 8178 this._keyEvent("previous", event); 8179 break; 8180 case keyCode.DOWN: 8181 this._keyEvent("next", event); 8182 break; 8183 } 8184 }, 8185 input: function(event) { 8186 if (suppressInput) { 8187 suppressInput = false; 8188 event.preventDefault(); 8189 return; 8190 } 8191 this._searchTimeout(event); 8192 }, 8193 focus: function() { 8194 this.selectedItem = null; 8195 this.previous = this._value(); 8196 }, 8197 blur: function(event) { 8198 if (this.cancelBlur) { 8199 delete this.cancelBlur; 8200 return; 8201 } 8202 8203 clearTimeout(this.searching); 8204 this.close(event); 8205 this._change(event); 8206 } 8207 }); 8208 8209 this._initSource(); 8210 this.menu = $("<ul>") 8211 .appendTo(this._appendTo()) 8212 .menu({ 8213 8214 // disable ARIA support, the live region takes care of that 8215 role: null 8216 }) 8217 .hide() 8218 .menu("instance"); 8219 8220 this._addClass(this.menu.element, "ui-autocomplete", "ui-front"); 8221 this._on(this.menu.element, { 8222 mousedown: function(event) { 8223 8224 // prevent moving focus out of the text field 8225 event.preventDefault(); 8226 8227 // IE doesn't prevent moving focus even with event.preventDefault() 8228 // so we set a flag to know when we should ignore the blur event 8229 this.cancelBlur = true; 8230 this._delay(function() { 8231 delete this.cancelBlur; 8232 8233 // Support: IE 8 only 8234 // Right clicking a menu item or selecting text from the menu items will 8235 // result in focus moving out of the input. However, we've already received 8236 // and ignored the blur event because of the cancelBlur flag set above. So 8237 // we restore focus to ensure that the menu closes properly based on the user's 8238 // next actions. 8239 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 8240 this.element.trigger("focus"); 8241 } 8242 }); 8243 }, 8244 menufocus: function(event, ui) { 8245 var label, item; 8246 8247 // support: Firefox 8248 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 8249 if (this.isNewMenu) { 8250 this.isNewMenu = false; 8251 if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) { 8252 this.menu.blur(); 8253 8254 this.document.one("mousemove", function() { 8255 $(event.target).trigger(event.originalEvent); 8256 }); 8257 8258 return; 8259 } 8260 } 8261 8262 item = ui.item.data("ui-autocomplete-item"); 8263 if (false !== this._trigger("focus", event, { item: item })) { 8264 8265 // use value to match what will end up in the input, if it was a key event 8266 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 8267 this._value(item.value); 8268 } 8269 } 8270 8271 // Announce the value in the liveRegion 8272 label = ui.item.attr("aria-label") || item.value; 8273 if (label && $.trim(label).length) { 8274 this.liveRegion.children().hide(); 8275 $("<div>").text(label).appendTo(this.liveRegion); 8276 } 8277 }, 8278 menuselect: function(event, ui) { 8279 var item = ui.item.data("ui-autocomplete-item"), 8280 previous = this.previous; 8281 8282 // Only trigger when focus was lost (click on menu) 8283 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 8284 this.element.trigger("focus"); 8285 this.previous = previous; 8286 8287 // #6109 - IE triggers two focus events and the second 8288 // is asynchronous, so we need to reset the previous 8289 // term synchronously and asynchronously :-( 8290 this._delay(function() { 8291 this.previous = previous; 8292 this.selectedItem = item; 8293 }); 8294 } 8295 8296 if (false !== this._trigger("select", event, { item: item })) { 8297 this._value(item.value); 8298 } 8299 8300 // reset the term after the select event 8301 // this allows custom select handling to work properly 8302 this.term = this._value(); 8303 8304 this.close(event); 8305 this.selectedItem = item; 8306 } 8307 }); 8308 8309 this.liveRegion = $("<div>", { 8310 role: "status", 8311 "aria-live": "assertive", 8312 "aria-relevant": "additions" 8313 }) 8314 .appendTo(this.document[0].body); 8315 8316 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 8317 8318 // Turning off autocomplete prevents the browser from remembering the 8319 // value when navigating through history, so we re-enable autocomplete 8320 // if the page is unloaded before the widget is destroyed. #7790 8321 this._on(this.window, { 8322 beforeunload: function() { 8323 this.element.removeAttr("autocomplete"); 8324 } 8325 }); 8326 }, 8327 8328 _destroy: function() { 8329 clearTimeout(this.searching); 8330 this.element.removeAttr("autocomplete"); 8331 this.menu.element.remove(); 8332 this.liveRegion.remove(); 8333 }, 8334 8335 _setOption: function(key, value) { 8336 this._super(key, value); 8337 if (key === "source") { 8338 this._initSource(); 8339 } 8340 if (key === "appendTo") { 8341 this.menu.element.appendTo(this._appendTo()); 8342 } 8343 if (key === "disabled" && value && this.xhr) { 8344 this.xhr.abort(); 8345 } 8346 }, 8347 8348 _isEventTargetInWidget: function(event) { 8349 var menuElement = this.menu.element[0]; 8350 8351 return event.target === this.element[0] || 8352 event.target === menuElement || 8353 $.contains(menuElement, event.target); 8354 }, 8355 8356 _closeOnClickOutside: function(event) { 8357 if (!this._isEventTargetInWidget(event)) { 8358 this.close(); 8359 } 8360 }, 8361 8362 _appendTo: function() { 8363 var element = this.options.appendTo; 8364 8365 if (element) { 8366 element = element.jquery || element.nodeType ? 8367 $(element) : 8368 this.document.find(element).eq(0); 8369 } 8370 8371 if (!element || !element[0]) { 8372 element = this.element.closest(".ui-front, dialog"); 8373 } 8374 8375 if (!element.length) { 8376 element = this.document[0].body; 8377 } 8378 8379 return element; 8380 }, 8381 8382 _initSource: function() { 8383 var array, url, 8384 that = this; 8385 if ($.isArray(this.options.source)) { 8386 array = this.options.source; 8387 this.source = function(request, response) { 8388 response($.ui.autocomplete.filter(array, request.term)); 8389 }; 8390 } else if (typeof this.options.source === "string") { 8391 url = this.options.source; 8392 this.source = function(request, response) { 8393 if (that.xhr) { 8394 that.xhr.abort(); 8395 } 8396 that.xhr = $.ajax({ 8397 url: url, 8398 data: request, 8399 dataType: "json", 8400 success: function(data) { 8401 response(data); 8402 }, 8403 error: function() { 8404 response([]); 8405 } 8406 }); 8407 }; 8408 } else { 8409 this.source = this.options.source; 8410 } 8411 }, 8412 8413 _searchTimeout: function(event) { 8414 clearTimeout(this.searching); 8415 this.searching = this._delay(function() { 8416 8417 // Search if the value has changed, or if the user retypes the same value (see #7434) 8418 var equalValues = this.term === this._value(), 8419 menuVisible = this.menu.element.is(":visible"), 8420 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 8421 8422 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 8423 this.selectedItem = null; 8424 this.search(null, event); 8425 } 8426 }, this.options.delay); 8427 }, 8428 8429 search: function(value, event) { 8430 value = value != null ? value : this._value(); 8431 8432 // Always save the actual value, not the one passed as an argument 8433 this.term = this._value(); 8434 8435 if (value.length < this.options.minLength) { 8436 return this.close(event); 8437 } 8438 8439 if (this._trigger("search", event) === false) { 8440 return; 8441 } 8442 8443 return this._search(value); 8444 }, 8445 8446 _search: function(value) { 8447 this.pending++; 8448 this._addClass("ui-autocomplete-loading"); 8449 this.cancelSearch = false; 8450 8451 this.source({ term: value }, this._response()); 8452 }, 8453 8454 _response: function() { 8455 var index = ++this.requestIndex; 8456 8457 return $.proxy(function(content) { 8458 if (index === this.requestIndex) { 8459 this.__response(content); 8460 } 8461 8462 this.pending--; 8463 if (!this.pending) { 8464 this._removeClass("ui-autocomplete-loading"); 8465 } 8466 }, this); 8467 }, 8468 8469 __response: function(content) { 8470 if (content) { 8471 content = this._normalize(content); 8472 } 8473 this._trigger("response", null, { content: content }); 8474 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 8475 this._suggest(content); 8476 this._trigger("open"); 8477 } else { 8478 8479 // use ._close() instead of .close() so we don't cancel future searches 8480 this._close(); 8481 } 8482 }, 8483 8484 close: function(event) { 8485 this.cancelSearch = true; 8486 this._close(event); 8487 }, 8488 8489 _close: function(event) { 8490 8491 // Remove the handler that closes the menu on outside clicks 8492 this._off(this.document, "mousedown"); 8493 8494 if (this.menu.element.is(":visible")) { 8495 this.menu.element.hide(); 8496 this.menu.blur(); 8497 this.isNewMenu = true; 8498 this._trigger("close", event); 8499 } 8500 }, 8501 8502 _change: function(event) { 8503 if (this.previous !== this._value()) { 8504 this._trigger("change", event, { item: this.selectedItem }); 8505 } 8506 }, 8507 8508 _normalize: function(items) { 8509 8510 // assume all items have the right format when the first item is complete 8511 if (items.length && items[0].label && items[0].value) { 8512 return items; 8513 } 8514 return $.map(items, function(item) { 8515 if (typeof item === "string") { 8516 return { 8517 label: item, 8518 value: item 8519 }; 8520 } 8521 return $.extend({}, item, { 8522 label: item.label || item.value, 8523 value: item.value || item.label 8524 }); 8525 }); 8526 }, 8527 8528 _suggest: function(items) { 8529 var ul = this.menu.element.empty(); 8530 this._renderMenu(ul, items); 8531 this.isNewMenu = true; 8532 this.menu.refresh(); 8533 8534 // Size and position menu 8535 ul.show(); 8536 this._resizeMenu(); 8537 ul.position($.extend({ 8538 of: this.element 8539 }, this.options.position)); 8540 8541 if (this.options.autoFocus) { 8542 this.menu.next(); 8543 } 8544 8545 // Listen for interactions outside of the widget (#6642) 8546 this._on(this.document, { 8547 mousedown: "_closeOnClickOutside" 8548 }); 8549 }, 8550 8551 _resizeMenu: function() { 8552 var ul = this.menu.element; 8553 ul.outerWidth(Math.max( 8554 8555 // Firefox wraps long text (possibly a rounding bug) 8556 // so we add 1px to avoid the wrapping (#7513) 8557 ul.width("").outerWidth() + 1, 8558 this.element.outerWidth() 8559 )); 8560 }, 8561 8562 _renderMenu: function(ul, items) { 8563 var that = this; 8564 $.each(items, function(index, item) { 8565 that._renderItemData(ul, item); 8566 }); 8567 }, 8568 8569 _renderItemData: function(ul, item) { 8570 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 8571 }, 8572 8573 _renderItem: function(ul, item) { 8574 return $("<li>") 8575 .append($("<div>").text(item.label)) 8576 .appendTo(ul); 8577 }, 8578 8579 _move: function(direction, event) { 8580 if (!this.menu.element.is(":visible")) { 8581 this.search(null, event); 8582 return; 8583 } 8584 if (this.menu.isFirstItem() && /^previous/.test(direction) || 8585 this.menu.isLastItem() && /^next/.test(direction)) { 8586 8587 if (!this.isMultiLine) { 8588 this._value(this.term); 8589 } 8590 8591 this.menu.blur(); 8592 return; 8593 } 8594 this.menu[direction](event); 8595 }, 8596 8597 widget: function() { 8598 return this.menu.element; 8599 }, 8600 8601 _value: function() { 8602 return this.valueMethod.apply(this.element, arguments); 8603 }, 8604 8605 _keyEvent: function(keyEvent, event) { 8606 if (!this.isMultiLine || this.menu.element.is(":visible")) { 8607 this._move(keyEvent, event); 8608 8609 // Prevents moving cursor to beginning/end of the text field in some browsers 8610 event.preventDefault(); 8611 } 8612 }, 8613 8614 // Support: Chrome <=50 8615 // We should be able to just use this.element.prop( "isContentEditable" ) 8616 // but hidden elements always report false in Chrome. 8617 // https://code.google.com/p/chromium/issues/detail?id=313082 8618 _isContentEditable: function(element) { 8619 if (!element.length) { 8620 return false; 8621 } 8622 8623 var editable = element.prop("contentEditable"); 8624 8625 if (editable === "inherit") { 8626 return this._isContentEditable(element.parent()); 8627 } 8628 8629 return editable === "true"; 8630 } 8631 }); 8632 8633 $.extend($.ui.autocomplete, { 8634 escapeRegex: function(value) { 8635 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 8636 }, 8637 filter: function(array, term) { 8638 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 8639 return $.grep(array, function(value) { 8640 return matcher.test(value.label || value.value || value); 8641 }); 8642 } 8643 }); 8644 8645 // Live region extension, adding a `messages` option 8646 // NOTE: This is an experimental API. We are still investigating 8647 // a full solution for string manipulation and internationalization. 8648 $.widget("ui.autocomplete", $.ui.autocomplete, { 8649 options: { 8650 messages: { 8651 noResults: "No search results.", 8652 results: function(amount) { 8653 return amount + (amount > 1 ? " results are" : " result is") + 8654 " available, use up and down arrow keys to navigate."; 8655 } 8656 } 8657 }, 8658 8659 __response: function(content) { 8660 var message; 8661 this._superApply(arguments); 8662 if (this.options.disabled || this.cancelSearch) { 8663 return; 8664 } 8665 if (content && content.length) { 8666 message = this.options.messages.results(content.length); 8667 } else { 8668 message = this.options.messages.noResults; 8669 } 8670 this.liveRegion.children().hide(); 8671 $("<div>").text(message).appendTo(this.liveRegion); 8672 } 8673 }); 8674 8675 var widgetsAutocomplete = $.ui.autocomplete; 8676 8677 8678 /*! 8679 * jQuery UI Controlgroup 1.12.1 8680 * http://jqueryui.com 8681 * 8682 * Copyright jQuery Foundation and other contributors 8683 * Released under the MIT license. 8684 * http://jquery.org/license 8685 */ 8686 8687 //>>label: Controlgroup 8688 //>>group: Widgets 8689 //>>description: Visually groups form control widgets 8690 //>>docs: http://api.jqueryui.com/controlgroup/ 8691 //>>demos: http://jqueryui.com/controlgroup/ 8692 //>>css.structure: ../../themes/base/core.css 8693 //>>css.structure: ../../themes/base/controlgroup.css 8694 //>>css.theme: ../../themes/base/theme.css 8695 8696 8697 var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 8698 8699 var widgetsControlgroup = $.widget("ui.controlgroup", { 8700 version: "1.12.1", 8701 defaultElement: "<div>", 8702 options: { 8703 direction: "horizontal", 8704 disabled: null, 8705 onlyVisible: true, 8706 items: { 8707 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 8708 "controlgroupLabel": ".ui-controlgroup-label", 8709 "checkboxradio": "input[type='checkbox'], input[type='radio']", 8710 "selectmenu": "select", 8711 "spinner": ".ui-spinner-input" 8712 } 8713 }, 8714 8715 _create: function() { 8716 this._enhance(); 8717 }, 8718 8719 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 8720 _enhance: function() { 8721 this.element.attr("role", "toolbar"); 8722 this.refresh(); 8723 }, 8724 8725 _destroy: function() { 8726 this._callChildMethod("destroy"); 8727 this.childWidgets.removeData("ui-controlgroup-data"); 8728 this.element.removeAttr("role"); 8729 if (this.options.items.controlgroupLabel) { 8730 this.element 8731 .find(this.options.items.controlgroupLabel) 8732 .find(".ui-controlgroup-label-contents") 8733 .contents().unwrap(); 8734 } 8735 }, 8736 8737 _initWidgets: function() { 8738 var that = this, 8739 childWidgets = []; 8740 8741 // First we iterate over each of the items options 8742 $.each(this.options.items, function(widget, selector) { 8743 var labels; 8744 var options = {}; 8745 8746 // Make sure the widget has a selector set 8747 if (!selector) { 8748 return; 8749 } 8750 8751 if (widget === "controlgroupLabel") { 8752 labels = that.element.find(selector); 8753 labels.each(function() { 8754 var element = $(this); 8755 8756 if (element.children(".ui-controlgroup-label-contents").length) { 8757 return; 8758 } 8759 element.contents() 8760 .wrapAll("<span class='ui-controlgroup-label-contents'></span>"); 8761 }); 8762 that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default"); 8763 childWidgets = childWidgets.concat(labels.get()); 8764 return; 8765 } 8766 8767 // Make sure the widget actually exists 8768 if (!$.fn[widget]) { 8769 return; 8770 } 8771 8772 // We assume everything is in the middle to start be
vendor: 5,160 bytes, lines 8772-8896
8772cause we can't determine 8773 // first / last elements until all enhancments are done. 8774 if (that["_" + widget + "Options"]) { 8775 options = that["_" + widget + "Options"]("middle"); 8776 } else { 8777 options = { classes: {} }; 8778 } 8779 8780 // Find instances of this widget inside controlgroup and init them 8781 that.element 8782 .find(selector) 8783 .each(function() { 8784 var element = $(this); 8785 var instance = element[widget]("instance"); 8786 8787 // We need to clone the default options for this type of widget to avoid 8788 // polluting the variable options which has a wider scope than a single widget. 8789 var instanceOptions = $.widget.extend({}, options); 8790 8791 // If the button is the child of a spinner ignore it 8792 // TODO: Find a more generic solution 8793 if (widget === "button" && element.parent(".ui-spinner").length) { 8794 return; 8795 } 8796 8797 // Create the widget if it doesn't exist 8798 if (!instance) { 8799 instance = element[widget]()[widget]("instance"); 8800 } 8801 if (instance) { 8802 instanceOptions.classes = 8803 that._resolveClassesValues(instanceOptions.classes, instance); 8804 } 8805 element[widget](instanceOptions); 8806 8807 // Store an instance of the controlgroup to be able to reference 8808 // from the outermost element for changing options and refresh 8809 var widgetElement = element[widget]("widget"); 8810 $.data(widgetElement[0], "ui-controlgroup-data", 8811 instance ? instance : element[widget]("instance")); 8812 8813 childWidgets.push(widgetElement[0]); 8814 }); 8815 }); 8816 8817 this.childWidgets = $($.unique(childWidgets)); 8818 this._addClass(this.childWidgets, "ui-controlgroup-item"); 8819 }, 8820 8821 _callChildMethod: function(method) { 8822 this.childWidgets.each(function() { 8823 var element = $(this), 8824 data = element.data("ui-controlgroup-data"); 8825 if (data && data[method]) { 8826 data[method](); 8827 } 8828 }); 8829 }, 8830 8831 _updateCornerClass: function(element, position) { 8832 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 8833 var add = this._buildSimpleOptions(position, "label").classes.label; 8834 8835 this._removeClass(element, null, remove); 8836 this._addClass(element, null, add); 8837 }, 8838 8839 _buildSimpleOptions: function(position, key) { 8840 var direction = this.options.direction === "vertical"; 8841 var result = { 8842 classes: {} 8843 }; 8844 result.classes[key] = { 8845 "middle": "", 8846 "first": "ui-corner-" + (direction ? "top" : "left"), 8847 "last": "ui-corner-" + (direction ? "bottom" : "right"), 8848 "only": "ui-corner-all" 8849 }[position]; 8850 8851 return result; 8852 }, 8853 8854 _spinnerOptions: function(position) { 8855 var options = this._buildSimpleOptions(position, "ui-spinner"); 8856 8857 options.classes["ui-spinner-up"] = ""; 8858 options.classes["ui-spinner-down"] = ""; 8859 8860 return options; 8861 }, 8862 8863 _buttonOptions: function(position) { 8864 return this._buildSimpleOptions(position, "ui-button"); 8865 }, 8866 8867 _checkboxradioOptions: function(position) { 8868 return this._buildSimpleOptions(position, "ui-checkboxradio-label"); 8869 }, 8870 8871 _selectmenuOptions: function(position) { 8872 var direction = this.options.direction === "vertical"; 8873 return { 8874 width: direction ? "auto" : false, 8875 classes: { 8876 middle: { 8877 "ui-selectmenu-button-open": "", 8878 "ui-selectmenu-button-closed": "" 8879 }, 8880 first: { 8881 "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"), 8882 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left") 8883 }, 8884 last: { 8885 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 8886 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right") 8887 }, 8888 only: { 8889 "ui-selectmenu-button-open": "ui-corner-top", 8890 "ui-selectmenu-button-closed": "ui-corner-all" 8891 } 8892 8893 }[position] 8894 }; 8895 }, 8896
vendor: 9,783 bytes, lines 8897-9175
8897 _resolveClassesValues: function(classes, instance) { 8898 var result = {}; 8899 $.each(classes, function(key) { 8900 var current = instance.options.classes[key] || ""; 8901 current = $.trim(current.replace(controlgroupCornerRegex, "")); 8902 result[key] = (current + " " + classes[key]).replace(/\s+/g, " "); 8903 }); 8904 return result; 8905 }, 8906 8907 _setOption: function(key, value) { 8908 if (key === "direction") { 8909 this._removeClass("ui-controlgroup-" + this.options.direction); 8910 } 8911 8912 this._super(key, value); 8913 if (key === "disabled") { 8914 this._callChildMethod(value ? "disable" : "enable"); 8915 return; 8916 } 8917 8918 this.refresh(); 8919 }, 8920 8921 refresh: function() { 8922 var children, 8923 that = this; 8924 8925 this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction); 8926 8927 if (this.options.direction === "horizontal") { 8928 this._addClass(null, "ui-helper-clearfix"); 8929 } 8930 this._initWidgets(); 8931 8932 children = this.childWidgets; 8933 8934 // We filter here because we need to track all childWidgets not just the visible ones 8935 if (this.options.onlyVisible) { 8936 children = children.filter(":visible"); 8937 } 8938 8939 if (children.length) { 8940 8941 // We do this last because we need to make sure all enhancment is done 8942 // before determining first and last 8943 $.each(["first", "last"], function(index, value) { 8944 var instance = children[value]().data("ui-controlgroup-data"); 8945 8946 if (instance && that["_" + instance.widgetName + "Options"]) { 8947 var options = that["_" + instance.widgetName + "Options"]( 8948 children.length === 1 ? "only" : value 8949 ); 8950 options.classes = that._resolveClassesValues(options.classes, instance); 8951 instance.element[instance.widgetName](options); 8952 } else { 8953 that._updateCornerClass(children[value](), value); 8954 } 8955 }); 8956 8957 // Finally call the refresh method on each of the child widgets. 8958 this._callChildMethod("refresh"); 8959 } 8960 } 8961 }); 8962 8963 /*! 8964 * jQuery UI Checkboxradio 1.12.1 8965 * http://jqueryui.com 8966 * 8967 * Copyright jQuery Foundation and other contributors 8968 * Released under the MIT license. 8969 * http://jquery.org/license 8970 */ 8971 8972 //>>label: Checkboxradio 8973 //>>group: Widgets 8974 //>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 8975 //>>docs: http://api.jqueryui.com/checkboxradio/ 8976 //>>demos: http://jqueryui.com/checkboxradio/ 8977 //>>css.structure: ../../themes/base/core.css 8978 //>>css.structure: ../../themes/base/button.css 8979 //>>css.structure: ../../themes/base/checkboxradio.css 8980 //>>css.theme: ../../themes/base/theme.css 8981 8982 8983 8984 $.widget("ui.checkboxradio", [$.ui.formResetMixin, { 8985 version: "1.12.1", 8986 options: { 8987 disabled: null, 8988 label: null, 8989 icon: true, 8990 classes: { 8991 "ui-checkboxradio-label": "ui-corner-all", 8992 "ui-checkboxradio-icon": "ui-corner-all" 8993 } 8994 }, 8995 8996 _getCreateOptions: function() { 8997 var disabled, labels; 8998 var that = this; 8999 var options = this._super() || {}; 9000 9001 // We read the type here, because it makes more sense to throw a element type error first, 9002 // rather then the error for lack of a label. Often if its the wrong type, it 9003 // won't have a label (e.g. calling on a div, btn, etc) 9004 this._readType(); 9005 9006 labels = this.element.labels(); 9007 9008 // If there are multiple labels, use the last one 9009 this.label = $(labels[labels.length - 1]); 9010 if (!this.label.length) { 9011 $.error("No label found for checkboxradio widget"); 9012 } 9013 9014 this.originalLabel = ""; 9015 9016 // We need to get the label text but this may also need to make sure it does not contain the 9017 // input itself. 9018 this.label.contents().not(this.element[0]).each(function() { 9019 9020 // The label contents could be text, html, or a mix. We concat each element to get a 9021 // string representation of the label, without the input as part of it. 9022 that.originalLabel += this.nodeType === 3 ? $(this).text() : this.outerHTML; 9023 }); 9024 9025 // Set the label option if we found label text 9026 if (this.originalLabel) { 9027 options.label = this.originalLabel; 9028 } 9029 9030 disabled = this.element[0].disabled; 9031 if (disabled != null) { 9032 options.disabled = disabled; 9033 } 9034 return options; 9035 }, 9036 9037 _create: function() { 9038 var checked = this.element[0].checked; 9039 9040 this._bindFormResetHandler(); 9041 9042 if (this.options.disabled == null) { 9043 this.options.disabled = this.element[0].disabled; 9044 } 9045 9046 this._setOption("disabled", this.options.disabled); 9047 this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible"); 9048 this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget"); 9049 9050 if (this.type === "radio") { 9051 this._addClass(this.label, "ui-checkboxradio-radio-label"); 9052 } 9053 9054 if (this.options.label && this.options.label !== this.originalLabel) { 9055 this._updateLabel(); 9056 } else if (this.originalLabel) { 9057 this.options.label = this.originalLabel; 9058 } 9059 9060 this._enhance(); 9061 9062 if (checked) { 9063 this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active"); 9064 if (this.icon) { 9065 this._addClass(this.icon, null, "ui-state-hover"); 9066 } 9067 } 9068 9069 this._on({ 9070 change: "_toggleClasses", 9071 focus: function() { 9072 this._addClass(this.label, null, "ui-state-focus ui-visual-focus"); 9073 }, 9074 blur: function() { 9075 this._removeClass(this.label, null, "ui-state-focus ui-visual-focus"); 9076 } 9077 }); 9078 }, 9079 9080 _readType: function() { 9081 var nodeName = this.element[0].nodeName.toLowerCase(); 9082 this.type = this.element[0].type; 9083 if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) { 9084 $.error("Can't create checkboxradio on element.nodeName=" + nodeName + 9085 " and element.type=" + this.type); 9086 } 9087 }, 9088 9089 // Support jQuery Mobile enhanced option 9090 _enhance: function() { 9091 this._updateIcon(this.element[0].checked); 9092 }, 9093 9094 widget: function() { 9095 return this.label; 9096 }, 9097 9098 _getRadioGroup: function() { 9099 var group; 9100 var name = this.element[0].name; 9101 var nameSelector = "input[name='" + $.ui.escapeSelector(name) + "']"; 9102 9103 if (!name) { 9104 return $([]); 9105 } 9106 9107 if (this.form.length) { 9108 group = $(this.form[0].elements).filter(nameSelector); 9109 } else { 9110 9111 // Not inside a form, check all inputs that also are not inside a form 9112 group = $(nameSelector).filter(function() { 9113 return $(this).form().length === 0; 9114 }); 9115 } 9116 9117 return group.not(this.element); 9118 }, 9119 9120 _toggleClasses: function() { 9121 var checked = this.element[0].checked; 9122 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 9123 9124 if (this.options.icon && this.type === "checkbox") { 9125 this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked) 9126 ._toggleClass(this.icon, null, "ui-icon-blank", !checked); 9127 } 9128 9129 if (this.type === "radio") { 9130 this._getRadioGroup() 9131 .each(function() { 9132 var instance = $(this).checkboxradio("instance"); 9133 9134 if (instance) { 9135 instance._removeClass(instance.label, 9136 "ui-checkboxradio-checked", "ui-state-active"); 9137 } 9138 }); 9139 } 9140 }, 9141 9142 _destroy: function() { 9143 this._unbindFormResetHandler(); 9144 9145 if (this.icon) { 9146 this.icon.remove(); 9147 this.iconSpace.remove(); 9148 } 9149 }, 9150 9151 _setOption: function(key, value) { 9152 9153 // We don't allow the value to be set to nothing 9154 if (key === "label" && !value) { 9155 return; 9156 } 9157 9158 this._super(key, value); 9159 9160 if (key === "disabled") { 9161 this._toggleClass(this.label, null, "ui-state-disabled", value); 9162 this.element[0].disabled = value; 9163 9164 // Don't refresh when setting disabled 9165 return; 9166 } 9167 this.refresh(); 9168 }, 9169 9170 _updateIcon: function(checked) { 9171 var toAdd = "ui-icon ui-icon-background "; 9172 9173 if (this.options.icon) { 9174 if (!this.icon) { 9175 this.icon = $("<span>");
vendor: 7,663 bytes, lines 9176-9393
9176 this.iconSpace = $("<span> </span>"); 9177 this._addClass(this.iconSpace, "ui-checkboxradio-icon-space"); 9178 } 9179 9180 if (this.type === "checkbox") { 9181 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 9182 this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check"); 9183 } else { 9184 toAdd += "ui-icon-blank"; 9185 } 9186 this._addClass(this.icon, "ui-checkboxradio-icon", toAdd); 9187 if (!checked) { 9188 this._removeClass(this.icon, null, "ui-icon-check ui-state-checked"); 9189 } 9190 this.icon.prependTo(this.label).after(this.iconSpace); 9191 } else if (this.icon !== undefined) { 9192 this.icon.remove(); 9193 this.iconSpace.remove(); 9194 delete this.icon; 9195 } 9196 }, 9197 9198 _updateLabel: function() { 9199 9200 // Remove the contents of the label ( minus the icon, icon space, and input ) 9201 var contents = this.label.contents().not(this.element[0]); 9202 if (this.icon) { 9203 contents = contents.not(this.icon[0]); 9204 } 9205 if (this.iconSpace) { 9206 contents = contents.not(this.iconSpace[0]); 9207 } 9208 contents.remove(); 9209 9210 this.label.append(this.options.label); 9211 }, 9212 9213 refresh: function() { 9214 var checked = this.element[0].checked, 9215 isDisabled = this.element[0].disabled; 9216 9217 this._updateIcon(checked); 9218 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 9219 if (this.options.label !== null) { 9220 this._updateLabel(); 9221 } 9222 9223 if (isDisabled !== this.options.disabled) { 9224 this._setOptions({ "disabled": isDisabled }); 9225 } 9226 } 9227 9228 }]); 9229 9230 var widgetsCheckboxradio = $.ui.checkboxradio; 9231 9232 9233 /*! 9234 * jQuery UI Button 1.12.1 9235 * http://jqueryui.com 9236 * 9237 * Copyright jQuery Foundation and other contributors 9238 * Released under the MIT license. 9239 * http://jquery.org/license 9240 */ 9241 9242 //>>label: Button 9243 //>>group: Widgets 9244 //>>description: Enhances a form with themeable buttons. 9245 //>>docs: http://api.jqueryui.com/button/ 9246 //>>demos: http://jqueryui.com/button/ 9247 //>>css.structure: ../../themes/base/core.css 9248 //>>css.structure: ../../themes/base/button.css 9249 //>>css.theme: ../../themes/base/theme.css 9250 9251 9252 9253 $.widget("ui.button", { 9254 version: "1.12.1", 9255 defaultElement: "<button>", 9256 options: { 9257 classes: { 9258 "ui-button": "ui-corner-all" 9259 }, 9260 disabled: null, 9261 icon: null, 9262 iconPosition: "beginning", 9263 label: null, 9264 showLabel: true 9265 }, 9266 9267 _getCreateOptions: function() { 9268 var disabled, 9269 9270 // This is to support cases like in jQuery Mobile where the base widget does have 9271 // an implementation of _getCreateOptions 9272 options = this._super() || {}; 9273 9274 this.isInput = this.element.is("input"); 9275 9276 disabled = this.element[0].disabled; 9277 if (disabled != null) { 9278 options.disabled = disabled; 9279 } 9280 9281 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 9282 if (this.originalLabel) { 9283 options.label = this.originalLabel; 9284 } 9285 9286 return options; 9287 }, 9288 9289 _create: function() { 9290 if (!this.option.showLabel & !this.options.icon) { 9291 this.options.showLabel = true; 9292 } 9293 9294 // We have to check the option again here even though we did in _getCreateOptions, 9295 // because null may have been passed on init which would override what was set in 9296 // _getCreateOptions 9297 if (this.options.disabled == null) { 9298 this.options.disabled = this.element[0].disabled || false; 9299 } 9300 9301 this.hasTitle = !!this.element.attr("title"); 9302 9303 // Check to see if the label needs to be set or if its already correct 9304 if (this.options.label && this.options.label !== this.originalLabel) { 9305 if (this.isInput) { 9306 this.element.val(this.options.label); 9307 } else { 9308 this.element.html(this.options.label); 9309 } 9310 } 9311 this._addClass("ui-button", "ui-widget"); 9312 this._setOption("disabled", this.options.disabled); 9313 this._enhance(); 9314 9315 if (this.element.is("a")) { 9316 this._on({ 9317 "keyup": function(event) { 9318 if (event.keyCode === $.ui.keyCode.SPACE) { 9319 event.preventDefault(); 9320 9321 // Support: PhantomJS <= 1.9, IE 8 Only 9322 // If a native click is available use it so we actually cause navigation 9323 // otherwise just trigger a click event 9324 if (this.element[0].click) { 9325 this.element[0].click(); 9326 } else { 9327 this.element.trigger("click"); 9328 } 9329 } 9330 } 9331 }); 9332 } 9333 }, 9334 9335 _enhance: function() { 9336 if (!this.element.is("button")) { 9337 this.element.attr("role", "button"); 9338 } 9339 9340 if (this.options.icon) { 9341 this._updateIcon("icon", this.options.icon); 9342 this._updateTooltip(); 9343 } 9344 }, 9345 9346 _updateTooltip: function() { 9347 this.title = this.element.attr("title"); 9348 9349 if (!this.options.showLabel && !this.title) { 9350 this.element.attr("title", this.options.label); 9351 } 9352 }, 9353 9354 _updateIcon: function(option, value) { 9355 var icon = option !== "iconPosition", 9356 position = icon ? this.options.iconPosition : value, 9357 displayBlock = position === "top" || position === "bottom"; 9358 9359 // Create icon 9360 if (!this.icon) { 9361 this.icon = $("<span>"); 9362 9363 this._addClass(this.icon, "ui-button-icon", "ui-icon"); 9364 9365 if (!this.options.showLabel) { 9366 this._addClass("ui-button-icon-only"); 9367 } 9368 } else if (icon) { 9369 9370 // If we are updating the icon remove the old icon class 9371 this._removeClass(this.icon, null, this.options.icon); 9372 } 9373 9374 // If we are updating the icon add the new icon class 9375 if (icon) { 9376 this._addClass(this.icon, null, value); 9377 } 9378 9379 this._attachIcon(position); 9380 9381 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 9382 // the iconSpace if there is one. 9383 if (displayBlock) { 9384 this._addClass(this.icon, null, "ui-widget-icon-block"); 9385 if (this.iconSpace) { 9386 this.iconSpace.remove(); 9387 } 9388 } else { 9389 9390 // Position is beginning or end so remove the ui-widget-icon-block class and add the 9391 // space if it does not exist 9392 if (!this.iconSpace) { 9393 this.iconSpace = $("<span> </span>");
vendor: 11,226 bytes, lines 9394-9674
9394 this._addClass(this.iconSpace, "ui-button-icon-space"); 9395 } 9396 this._removeClass(this.icon, null, "ui-wiget-icon-block"); 9397 this._attachIconSpace(position); 9398 } 9399 }, 9400 9401 _destroy: function() { 9402 this.element.removeAttr("role"); 9403 9404 if (this.icon) { 9405 this.icon.remove(); 9406 } 9407 if (this.iconSpace) { 9408 this.iconSpace.remove(); 9409 } 9410 if (!this.hasTitle) { 9411 this.element.removeAttr("title"); 9412 } 9413 }, 9414 9415 _attachIconSpace: function(iconPosition) { 9416 this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace); 9417 }, 9418 9419 _attachIcon: function(iconPosition) { 9420 this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon); 9421 }, 9422 9423 _setOptions: function(options) { 9424 var newShowLabel = options.showLabel === undefined ? 9425 this.options.showLabel : 9426 options.showLabel, 9427 newIcon = options.icon === undefined ? this.options.icon : options.icon; 9428 9429 if (!newShowLabel && !newIcon) { 9430 options.showLabel = true; 9431 } 9432 this._super(options); 9433 }, 9434 9435 _setOption: function(key, value) { 9436 if (key === "icon") { 9437 if (value) { 9438 this._updateIcon(key, value); 9439 } else if (this.icon) { 9440 this.icon.remove(); 9441 if (this.iconSpace) { 9442 this.iconSpace.remove(); 9443 } 9444 } 9445 } 9446 9447 if (key === "iconPosition") { 9448 this._updateIcon(key, value); 9449 } 9450 9451 // Make sure we can't end up with a button that has neither text nor icon 9452 if (key === "showLabel") { 9453 this._toggleClass("ui-button-icon-only", null, !value); 9454 this._updateTooltip(); 9455 } 9456 9457 if (key === "label") { 9458 if (this.isInput) { 9459 this.element.val(value); 9460 } else { 9461 9462 // If there is an icon, append it, else nothing then append the value 9463 // this avoids removal of the icon when setting label text 9464 this.element.html(value); 9465 if (this.icon) { 9466 this._attachIcon(this.options.iconPosition); 9467 this._attachIconSpace(this.options.iconPosition); 9468 } 9469 } 9470 } 9471 9472 this._super(key, value); 9473 9474 if (key === "disabled") { 9475 this._toggleClass(null, "ui-state-disabled", value); 9476 this.element[0].disabled = value; 9477 if (value) { 9478 this.element.blur(); 9479 } 9480 } 9481 }, 9482 9483 refresh: function() { 9484 9485 // Make sure to only check disabled if its an element that supports this otherwise 9486 // check for the disabled class to determine state 9487 var isDisabled = this.element.is("input, button") ? 9488 this.element[0].disabled : this.element.hasClass("ui-button-disabled"); 9489 9490 if (isDisabled !== this.options.disabled) { 9491 this._setOptions({ disabled: isDisabled }); 9492 } 9493 9494 this._updateTooltip(); 9495 } 9496 }); 9497 9498 // DEPRECATED 9499 if ($.uiBackCompat !== false) { 9500 9501 // Text and Icons options 9502 $.widget("ui.button", $.ui.button, { 9503 options: { 9504 text: true, 9505 icons: { 9506 primary: null, 9507 secondary: null 9508 } 9509 }, 9510 9511 _create: function() { 9512 if (this.options.showLabel && !this.options.text) { 9513 this.options.showLabel = this.options.text; 9514 } 9515 if (!this.options.showLabel && this.options.text) { 9516 this.options.text = this.options.showLabel; 9517 } 9518 if (!this.options.icon && (this.options.icons.primary || 9519 this.options.icons.secondary)) { 9520 if (this.options.icons.primary) { 9521 this.options.icon = this.options.icons.primary; 9522 } else { 9523 this.options.icon = this.options.icons.secondary; 9524 this.options.iconPosition = "end"; 9525 } 9526 } else if (this.options.icon) { 9527 this.options.icons.primary = this.options.icon; 9528 } 9529 this._super(); 9530 }, 9531 9532 _setOption: function(key, value) { 9533 if (key === "text") { 9534 this._super("showLabel", value); 9535 return; 9536 } 9537 if (key === "showLabel") { 9538 this.options.text = value; 9539 } 9540 if (key === "icon") { 9541 this.options.icons.primary = value; 9542 } 9543 if (key === "icons") { 9544 if (value.primary) { 9545 this._super("icon", value.primary); 9546 this._super("iconPosition", "beginning"); 9547 } else if (value.secondary) { 9548 this._super("icon", value.secondary); 9549 this._super("iconPosition", "end"); 9550 } 9551 } 9552 this._superApply(arguments); 9553 } 9554 }); 9555 9556 $.fn.button = (function(orig) { 9557 return function() { 9558 if (!this.length || (this.length && this[0].tagName !== "INPUT") || 9559 (this.length && this[0].tagName === "INPUT" && ( 9560 this.attr("type") !== "checkbox" && this.attr("type") !== "radio" 9561 ))) { 9562 return orig.apply(this, arguments); 9563 } 9564 if (!$.ui.checkboxradio) { 9565 $.error("Checkboxradio widget missing"); 9566 } 9567 if (arguments.length === 0) { 9568 return this.checkboxradio({ 9569 "icon": false 9570 }); 9571 } 9572 return this.checkboxradio.apply(this, arguments); 9573 }; 9574 })($.fn.button); 9575 9576 $.fn.buttonset = function() { 9577 if (!$.ui.controlgroup) { 9578 $.error("Controlgroup widget missing"); 9579 } 9580 if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) { 9581 return this.controlgroup.apply(this, [arguments[0], "items.button", arguments[2]]); 9582 } 9583 if (arguments[0] === "option" && arguments[1] === "items") { 9584 return this.controlgroup.apply(this, [arguments[0], "items.button"]); 9585 } 9586 if (typeof arguments[0] === "object" && arguments[0].items) { 9587 arguments[0].items = { 9588 button: arguments[0].items 9589 }; 9590 } 9591 return this.controlgroup.apply(this, arguments); 9592 }; 9593 } 9594 9595 var widgetsButton = $.ui.button; 9596 9597 9598 // jscs:disable maximumLineLength 9599 /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ 9600 /*! 9601 * jQuery UI Datepicker 1.12.1 9602 * http://jqueryui.com 9603 * 9604 * Copyright jQuery Foundation and other contributors 9605 * Released under the MIT license. 9606 * http://jquery.org/license 9607 */ 9608 9609 //>>label: Datepicker 9610 //>>group: Widgets 9611 //>>description: Displays a calendar from an input or inline for selecting dates. 9612 //>>docs: http://api.jqueryui.com/datepicker/ 9613 //>>demos: http://jqueryui.com/datepicker/ 9614 //>>css.structure: ../../themes/base/core.css 9615 //>>css.structure: ../../themes/base/datepicker.css 9616 //>>css.theme: ../../themes/base/theme.css 9617 9618 9619 9620 $.extend($.ui, { datepicker: { version: "1.12.1" } }); 9621 9622 var datepicker_instActive; 9623 9624 function datepicker_getZindex(elem) { 9625 var position, value; 9626 while (elem.length && elem[0] !== document) { 9627 9628 // Ignore z-index if position is set to a value where z-index is ignored by the browser 9629 // This makes behavior of this function consistent across browsers 9630 // WebKit always returns auto if the element is positioned 9631 position = elem.css("position"); 9632 if (position === "absolute" || position === "relative" || position === "fixed") { 9633 9634 // IE returns 0 when zIndex is not specified 9635 // other browsers return a string 9636 // we ignore the case of nested elements with an explicit value of 0 9637 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 9638 value = parseInt(elem.css("zIndex"), 10); 9639 if (!isNaN(value) && value !== 0) { 9640 return value; 9641 } 9642 } 9643 elem = elem.parent(); 9644 } 9645 9646 return 0; 9647 } 9648 /* Date picker manager. 9649 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 9650 Settings for (groups of) date pickers are maintained in an instance object, 9651 allowing multiple different settings on the same page. */ 9652 9653 function Datepicker() { 9654 this._curInst = null; // The current instance in use 9655 this._keyEvent = false; // If the last event was a key event 9656 this._disabledInputs = []; // List of date picker inputs that have been disabled 9657 this._datepickerShowing = false; // True if the popup picker is showing , false if not 9658 this._inDialog = false; // True if showing within a "dialog", false if not 9659 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 9660 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 9661 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 9662 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 9663 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 9664 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 9665 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 9666 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 9667 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 9668 this.regional = []; // Available regional settings, indexed by language code 9669 this.regional[""] = { // Default regional settings 9670 closeText: "Done", // Display text for close link 9671 prevText: "Prev", // Display text for previous month link 9672 nextText: "Next", // Display text for next month link 9673 currentText: "Today", // Display text for current month link 9674 monthNames: ["January", "February", "March", "April", "May", "June",
vendor: 8,136 bytes, lines 9675-9805
9675 "July", "August", "September", "October", "November", "December" 9676 ], // Names of months for drop-down and formatting 9677 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting 9678 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting 9679 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 9680 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 9681 weekHeader: "Wk", // Column header for week of the year 9682 dateFormat: "mm/dd/yy", // See format options on parseDate 9683 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 9684 isRTL: false, // True if right-to-left language, false if left-to-right 9685 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 9686 yearSuffix: "" // Additional text to append to the year in the month headers 9687 }; 9688 this._defaults = { // Global defaults for all the date picker instances 9689 showOn: "focus", // "focus" for popup on focus, 9690 // "button" for trigger button, or "both" for either 9691 showAnim: "fadeIn", // Name of jQuery animation for popup 9692 showOptions: {}, // Options for enhanced animations 9693 defaultDate: null, // Used when field is blank: actual date, 9694 // +/-number for offset from today, null for today 9695 appendText: "", // Display text following the input box, e.g. showing the format 9696 buttonText: "...", // Text for trigger button 9697 buttonImage: "", // URL for trigger button image 9698 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 9699 hideIfNoPrevNext: false, // True to hide next/previous month links 9700 // if not applicable, false to just disable them 9701 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 9702 gotoCurrent: false, // True if today link goes back to current selection instead 9703 changeMonth: false, // True if month can be selected directly, false if only prev/next 9704 changeYear: false, // True if year can be selected directly, false if only prev/next 9705 yearRange: "c-10:c+10", // Range of years to display in drop-down, 9706 // either relative to today's year (-nn:+nn), relative to currently displayed year 9707 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 9708 showOtherMonths: false, // True to show dates in other months, false to leave blank 9709 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 9710 showWeek: false, // True to show week of the year, false to not show it 9711 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 9712 // takes a Date and returns the number of the week for it 9713 shortYearCutoff: "+10", // Short year values < this are in the current century, 9714 // > this are in the previous century, 9715 // string value starting with "+" for current year + value 9716 minDate: null, // The earliest selectable date, or null for no limit 9717 maxDate: null, // The latest selectable date, or null for no limit 9718 duration: "fast", // Duration of display/closure 9719 beforeShowDay: null, // Function that takes a date and returns an array with 9720 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 9721 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 9722 beforeShow: null, // Function that takes an input field and 9723 // returns a set of custom settings for the date picker 9724 onSelect: null, // Define a callback function when a date is selected 9725 onChangeMonthYear: null, // Define a callback function when the month or year is changed 9726 onClose: null, // Define a callback function when the datepicker is closed 9727 numberOfMonths: 1, // Number of months to show at a time 9728 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 9729 stepMonths: 1, // Number of months to step back/forward 9730 stepBigMonths: 12, // Number of months to step back/forward for the big links 9731 altField: "", // Selector for an alternate field to store selected dates into 9732 altFormat: "", // The date format to use for the alternate field 9733 constrainInput: true, // The input is constrained by the current date format 9734 showButtonPanel: false, // True to show button panel, false to not show it 9735 autoSize: false, // True to size the input for the date format, false to leave as is 9736 disabled: false // The initial disabled state 9737 }; 9738 $.extend(this._defaults, this.regional[""]); 9739 this.regional.en = $.extend(true, {}, this.regional[""]); 9740 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 9741 this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); 9742 } 9743 9744 $.extend(Datepicker.prototype, { 9745 /* Class name added to elements to indicate already configured with a date picker. */ 9746 markerClassName: "hasDatepicker", 9747 9748 //Keep track of the maximum number of rows displayed (see #7043) 9749 maxRows: 4, 9750 9751 // TODO rename to "widget" when switching to widget factory 9752 _widgetDatepicker: function() { 9753 return this.dpDiv; 9754 }, 9755 9756 /* Override the default settings for all instances of the date picker. 9757 * @param settings object - the new settings to use as defaults (anonymous object) 9758 * @return the manager object 9759 */ 9760 setDefaults: function(settings) { 9761 datepicker_extendRemove(this._defaults, settings || {}); 9762 return this; 9763 }, 9764 9765 /* Attach the date picker to a jQuery selection. 9766 * @param target element - the target input field or division or span 9767 * @param settings object - the new settings to use for this date picker instance (anonymous) 9768 */ 9769 _attachDatepicker: function(target, settings) { 9770 var nodeName, inline, inst; 9771 nodeName = target.nodeName.toLowerCase(); 9772 inline = (nodeName === "div" || nodeName === "span"); 9773 if (!target.id) { 9774 this.uuid += 1; 9775 target.id = "dp" + this.uuid; 9776 } 9777 inst = this._newInst($(target), inline); 9778 inst.settings = $.extend({}, settings || {}); 9779 if (nodeName === "input") { 9780 this._connectDatepicker(target, inst); 9781 } else if (inline) { 9782 this._inlineDatepicker(target, inst); 9783 } 9784 }, 9785 9786 /* Create a new instance object. */ 9787 _newInst: function(target, inline) { 9788 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 9789 return { 9790 id: id, 9791 input: target, // associated target 9792 selectedDay: 0, 9793 selectedMonth: 0, 9794 selectedYear: 0, // current selection 9795 drawMonth: 0, 9796 drawYear: 0, // month being drawn 9797 inline: inline, // is datepicker inline or not 9798 dpDiv: (!inline ? this.dpDiv : // presentation div 9799 datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))) 9800 }; 9801 }, 9802 9803 /* Attach the date picker to an input field. */ 9804 _connectDatepicker: function(target, inst) { 9805 var input = $(target);
vendor: 1,051 bytes, lines 9806-9832
9806 inst.append = $([]); 9807 inst.trigger = $([]); 9808 if (input.hasClass(this.markerClassName)) { 9809 return; 9810 } 9811 this._attachments(input, inst); 9812 input.addClass(this.markerClassName).on("keydown", this._doKeyDown). 9813 on("keypress", this._doKeyPress).on("keyup", this._doKeyUp); 9814 this._autoSize(inst); 9815 $.data(target, "datepicker", inst); 9816 9817 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 9818 if (inst.settings.disabled) { 9819 this._disableDatepicker(target); 9820 } 9821 }, 9822 9823 /* Make attachments based on settings. */ 9824 _attachments: function(input, inst) { 9825 var showOn, buttonText, buttonImage, 9826 appendText = this._get(inst, "appendText"), 9827 isRTL = this._get(inst, "isRTL"); 9828 9829 if (inst.append) { 9830 inst.append.remove(); 9831 } 9832 if (appendText) {
vendor: 4,215 bytes, lines 9833-9919
9833 inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); 9834 input[isRTL ? "before" : "after"](inst.append); 9835 } 9836 9837 input.off("focus", this._showDatepicker); 9838 9839 if (inst.trigger) { 9840 inst.trigger.remove(); 9841 } 9842 9843 showOn = this._get(inst, "showOn"); 9844 if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field 9845 input.on("focus", this._showDatepicker); 9846 } 9847 if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked 9848 buttonText = this._get(inst, "buttonText"); 9849 buttonImage = this._get(inst, "buttonImage"); 9850 inst.trigger = $(this._get(inst, "buttonImageOnly") ? 9851 $("<img/>").addClass(this._triggerClass).attr({ src: buttonImage, alt: buttonText, title: buttonText }) : 9852 $("<button type='button'></button>").addClass(this._triggerClass).html(!buttonImage ? buttonText : $("<img/>").attr({ src: buttonImage, alt: buttonText, title: buttonText }))); 9853 input[isRTL ? "before" : "after"](inst.trigger); 9854 inst.trigger.on("click", function() { 9855 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { 9856 $.datepicker._hideDatepicker(); 9857 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { 9858 $.datepicker._hideDatepicker(); 9859 $.datepicker._showDatepicker(input[0]); 9860 } else { 9861 $.datepicker._showDatepicker(input[0]); 9862 } 9863 return false; 9864 }); 9865 } 9866 }, 9867 9868 /* Apply the maximum length for the date format. */ 9869 _autoSize: function(inst) { 9870 if (this._get(inst, "autoSize") && !inst.inline) { 9871 var findMax, max, maxI, i, 9872 date = new Date(2009, 12 - 1, 20), // Ensure double digits 9873 dateFormat = this._get(inst, "dateFormat"); 9874 9875 if (dateFormat.match(/[DM]/)) { 9876 findMax = function(names) { 9877 max = 0; 9878 maxI = 0; 9879 for (i = 0; i < names.length; i++) { 9880 if (names[i].length > max) { 9881 max = names[i].length; 9882 maxI = i; 9883 } 9884 } 9885 return maxI; 9886 }; 9887 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 9888 "monthNames" : "monthNamesShort")))); 9889 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 9890 "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); 9891 } 9892 inst.input.attr("size", this._formatDate(inst, date).length); 9893 } 9894 }, 9895 9896 /* Attach an inline date picker to a div. */ 9897 _inlineDatepicker: function(target, inst) { 9898 var divSpan = $(target); 9899 if (divSpan.hasClass(this.markerClassName)) { 9900 return; 9901 } 9902 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 9903 $.data(target, "datepicker", inst); 9904 this._setDate(inst, this._getDefaultDate(inst), true); 9905 this._updateDatepicker(inst); 9906 this._updateAlternate(inst); 9907 9908 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 9909 if (inst.settings.disabled) { 9910 this._disableDatepicker(target); 9911 } 9912 9913 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 9914 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 9915 inst.dpDiv.css("display", "block"); 9916 }, 9917 9918 /* Pop-up the date picker in a "dialog" box. 9919 * @param input element - ignored
vendor: 3,182 bytes, lines 9920-9984
9920 * @param date string or Date - the initial date to display 9921 * @param onSelect function - the function to call when a date is selected 9922 * @param settings object - update the dialog date picker instance's settings (anonymous object) 9923 * @param pos int[2] - coordinates for the dialog's position within the screen or 9924 * event - with x/y coordinates or 9925 * leave empty for default (screen centre) 9926 * @return the manager object 9927 */ 9928 _dialogDatepicker: function(input, date, onSelect, settings, pos) { 9929 var id, browserWidth, browserHeight, scrollX, scrollY, 9930 inst = this._dialogInst; // internal instance 9931 9932 if (!inst) { 9933 this.uuid += 1; 9934 id = "dp" + this.uuid; 9935 this._dialogInput = $("<input type='text' id='" + id + 9936 "' style='position: absolute; top: -100px; width: 0px;'/>"); 9937 this._dialogInput.on("keydown", this._doKeyDown); 9938 $("body").append(this._dialogInput); 9939 inst = this._dialogInst = this._newInst(this._dialogInput, false); 9940 inst.settings = {}; 9941 $.data(this._dialogInput[0], "datepicker", inst); 9942 } 9943 datepicker_extendRemove(inst.settings, settings || {}); 9944 date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); 9945 this._dialogInput.val(date); 9946 9947 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 9948 if (!this._pos) { 9949 browserWidth = document.documentElement.clientWidth; 9950 browserHeight = document.documentElement.clientHeight; 9951 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 9952 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 9953 this._pos = // should use actual width/height below 9954 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 9955 } 9956 9957 // Move input on screen for focus, but hidden behind dialog 9958 this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); 9959 inst.settings.onSelect = onSelect; 9960 this._inDialog = true; 9961 this.dpDiv.addClass(this._dialogClass); 9962 this._showDatepicker(this._dialogInput[0]); 9963 if ($.blockUI) { 9964 $.blockUI(this.dpDiv); 9965 } 9966 $.data(this._dialogInput[0], "datepicker", inst); 9967 return this; 9968 }, 9969 9970 /* Detach a datepicker from its control. 9971 * @param target element - the target input field or division or span 9972 */ 9973 _destroyDatepicker: function(target) { 9974 var nodeName, 9975 $target = $(target), 9976 inst = $.data(target, "datepicker"); 9977 9978 if (!$target.hasClass(this.markerClassName)) { 9979 return; 9980 } 9981 9982 nodeName = target.nodeName.toLowerCase(); 9983 $.removeData(target, "datepicker"); 9984 if (nodeName === "input") {
vendor: 4,262 bytes, lines 9985-10086
9985 inst.append.remove(); 9986 inst.trigger.remove(); 9987 $target.removeClass(this.markerClassName). 9988 off("focus", this._showDatepicker). 9989 off("keydown", this._doKeyDown). 9990 off("keypress", this._doKeyPress). 9991 off("keyup", this._doKeyUp); 9992 } else if (nodeName === "div" || nodeName === "span") { 9993 $target.removeClass(this.markerClassName).empty(); 9994 } 9995 9996 if (datepicker_instActive === inst) { 9997 datepicker_instActive = null; 9998 } 9999 }, 10000 10001 /* Enable the date picker to a jQuery selection. 10002 * @param target element - the target input field or division or span 10003 */ 10004 _enableDatepicker: function(target) { 10005 var nodeName, inline, 10006 $target = $(target), 10007 inst = $.data(target, "datepicker"); 10008 10009 if (!$target.hasClass(this.markerClassName)) { 10010 return; 10011 } 10012 10013 nodeName = target.nodeName.toLowerCase(); 10014 if (nodeName === "input") { 10015 target.disabled = false; 10016 inst.trigger.filter("button"). 10017 each(function() { this.disabled = false; }).end(). 10018 filter("img").css({ opacity: "1.0", cursor: "" }); 10019 } else if (nodeName === "div" || nodeName === "span") { 10020 inline = $target.children("." + this._inlineClass); 10021 inline.children().removeClass("ui-state-disabled"); 10022 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 10023 prop("disabled", false); 10024 } 10025 this._disabledInputs = $.map(this._disabledInputs, 10026 function(value) { return (value === target ? null : value); }); // delete entry 10027 }, 10028 10029 /* Disable the date picker to a jQuery selection. 10030 * @param target element - the target input field or division or span 10031 */ 10032 _disableDatepicker: function(target) { 10033 var nodeName, inline, 10034 $target = $(target), 10035 inst = $.data(target, "datepicker"); 10036 10037 if (!$target.hasClass(this.markerClassName)) { 10038 return; 10039 } 10040 10041 nodeName = target.nodeName.toLowerCase(); 10042 if (nodeName === "input") { 10043 target.disabled = true; 10044 inst.trigger.filter("button"). 10045 each(function() { this.disabled = true; }).end(). 10046 filter("img").css({ opacity: "0.5", cursor: "default" }); 10047 } else if (nodeName === "div" || nodeName === "span") { 10048 inline = $target.children("." + this._inlineClass); 10049 inline.children().addClass("ui-state-disabled"); 10050 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 10051 prop("disabled", true); 10052 } 10053 this._disabledInputs = $.map(this._disabledInputs, 10054 function(value) { return (value === target ? null : value); }); // delete entry 10055 this._disabledInputs[this._disabledInputs.length] = target; 10056 }, 10057 10058 /* Is the first field in a jQuery collection disabled as a datepicker? 10059 * @param target element - the target input field or division or span 10060 * @return boolean - true if disabled, false if enabled 10061 */ 10062 _isDisabledDatepicker: function(target) { 10063 if (!target) { 10064 return false; 10065 } 10066 for (var i = 0; i < this._disabledInputs.length; i++) { 10067 if (this._disabledInputs[i] === target) { 10068 return true; 10069 } 10070 } 10071 return false; 10072 }, 10073 10074 /* Retrieve the instance data for the target control. 10075 * @param target element - the target input field or division or span 10076 * @return object - the associated instance data 10077 * @throws error if a jQuery problem getting data 10078 */ 10079 _getInst: function(target) { 10080 try { 10081 return $.data(target, "datepicker"); 10082 } catch (err) { 10083 throw "Missing instance data for this datepicker"; 10084 } 10085 }, 10086
vendor: 15,298 bytes, lines 10087-10434
10087 /* Update or retrieve the settings for a date picker attached to an input field or division. 10088 * @param target element - the target input field or division or span 10089 * @param name object - the new settings to update or 10090 * string - the name of the setting to change or retrieve, 10091 * when retrieving also "all" for all instance settings or 10092 * "defaults" for all global defaults 10093 * @param value any - the new value for the setting 10094 * (omit if above is an object or to retrieve a value) 10095 */ 10096 _optionDatepicker: function(target, name, value) { 10097 var settings, date, minDate, maxDate, 10098 inst = this._getInst(target); 10099 10100 if (arguments.length === 2 && typeof name === "string") { 10101 return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : 10102 (inst ? (name === "all" ? $.extend({}, inst.settings) : 10103 this._get(inst, name)) : null)); 10104 } 10105 10106 settings = name || {}; 10107 if (typeof name === "string") { 10108 settings = {}; 10109 settings[name] = value; 10110 } 10111 10112 if (inst) { 10113 if (this._curInst === inst) { 10114 this._hideDatepicker(); 10115 } 10116 10117 date = this._getDateDatepicker(target, true); 10118 minDate = this._getMinMaxDate(inst, "min"); 10119 maxDate = this._getMinMaxDate(inst, "max"); 10120 datepicker_extendRemove(inst.settings, settings); 10121 10122 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 10123 if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { 10124 inst.settings.minDate = this._formatDate(inst, minDate); 10125 } 10126 if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { 10127 inst.settings.maxDate = this._formatDate(inst, maxDate); 10128 } 10129 if ("disabled" in settings) { 10130 if (settings.disabled) { 10131 this._disableDatepicker(target); 10132 } else { 10133 this._enableDatepicker(target); 10134 } 10135 } 10136 this._attachments($(target), inst); 10137 this._autoSize(inst); 10138 this._setDate(inst, date); 10139 this._updateAlternate(inst); 10140 this._updateDatepicker(inst); 10141 } 10142 }, 10143 10144 // Change method deprecated 10145 _changeDatepicker: function(target, name, value) { 10146 this._optionDatepicker(target, name, value); 10147 }, 10148 10149 /* Redraw the date picker attached to an input field or division. 10150 * @param target element - the target input field or division or span 10151 */ 10152 _refreshDatepicker: function(target) { 10153 var inst = this._getInst(target); 10154 if (inst) { 10155 this._updateDatepicker(inst); 10156 } 10157 }, 10158 10159 /* Set the dates for a jQuery selection. 10160 * @param target element - the target input field or division or span 10161 * @param date Date - the new date 10162 */ 10163 _setDateDatepicker: function(target, date) { 10164 var inst = this._getInst(target); 10165 if (inst) { 10166 this._setDate(inst, date); 10167 this._updateDatepicker(inst); 10168 this._updateAlternate(inst); 10169 } 10170 }, 10171 10172 /* Get the date(s) for the first entry in a jQuery selection. 10173 * @param target element - the target input field or division or span 10174 * @param noDefault boolean - true if no default date is to be used 10175 * @return Date - the current date 10176 */ 10177 _getDateDatepicker: function(target, noDefault) { 10178 var inst = this._getInst(target); 10179 if (inst && !inst.inline) { 10180 this._setDateFromField(inst, noDefault); 10181 } 10182 return (inst ? this._getDate(inst) : null); 10183 }, 10184 10185 /* Handle keystrokes. */ 10186 _doKeyDown: function(event) { 10187 var onSelect, dateStr, sel, 10188 inst = $.datepicker._getInst(event.target), 10189 handled = true, 10190 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 10191 10192 inst._keyEvent = true; 10193 if ($.datepicker._datepickerShowing) { 10194 switch (event.keyCode) { 10195 case 9: 10196 $.datepicker._hideDatepicker(); 10197 handled = false; 10198 break; // hide on tab out 10199 case 13: 10200 sel = $("td." + $.datepicker._dayOverClass + ":not(." + 10201 $.datepicker._currentClass + ")", inst.dpDiv); 10202 if (sel[0]) { 10203 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 10204 } 10205 10206 onSelect = $.datepicker._get(inst, "onSelect"); 10207 if (onSelect) { 10208 dateStr = $.datepicker._formatDate(inst); 10209 10210 // Trigger custom callback 10211 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 10212 } else { 10213 $.datepicker._hideDatepicker(); 10214 } 10215 10216 return false; // don't submit the form 10217 case 27: 10218 $.datepicker._hideDatepicker(); 10219 break; // hide on escape 10220 case 33: 10221 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10222 -$.datepicker._get(inst, "stepBigMonths") : 10223 -$.datepicker._get(inst, "stepMonths")), "M"); 10224 break; // previous month/year on page up/+ ctrl 10225 case 34: 10226 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10227 +$.datepicker._get(inst, "stepBigMonths") : 10228 +$.datepicker._get(inst, "stepMonths")), "M"); 10229 break; // next month/year on page down/+ ctrl 10230 case 35: 10231 if (event.ctrlKey || event.metaKey) { 10232 $.datepicker._clearDate(event.target); 10233 } 10234 handled = event.ctrlKey || event.metaKey; 10235 break; // clear on ctrl or command +end 10236 case 36: 10237 if (event.ctrlKey || event.metaKey) { 10238 $.datepicker._gotoToday(event.target); 10239 } 10240 handled = event.ctrlKey || event.metaKey; 10241 break; // current on ctrl or command +home 10242 case 37: 10243 if (event.ctrlKey || event.metaKey) { 10244 $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); 10245 } 10246 handled = event.ctrlKey || event.metaKey; 10247 10248 // -1 day on ctrl or command +left 10249 if (event.originalEvent.altKey) { 10250 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10251 -$.datepicker._get(inst, "stepBigMonths") : 10252 -$.datepicker._get(inst, "stepMonths")), "M"); 10253 } 10254 10255 // next month/year on alt +left on Mac 10256 break; 10257 case 38: 10258 if (event.ctrlKey || event.metaKey) { 10259 $.datepicker._adjustDate(event.target, -7, "D"); 10260 } 10261 handled = event.ctrlKey || event.metaKey; 10262 break; // -1 week on ctrl or command +up 10263 case 39: 10264 if (event.ctrlKey || event.metaKey) { 10265 $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); 10266 } 10267 handled = event.ctrlKey || event.metaKey; 10268 10269 // +1 day on ctrl or command +right 10270 if (event.originalEvent.altKey) { 10271 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10272 +$.datepicker._get(inst, "stepBigMonths") : 10273 +$.datepicker._get(inst, "stepMonths")), "M"); 10274 } 10275 10276 // next month/year on alt +right 10277 break; 10278 case 40: 10279 if (event.ctrlKey || event.metaKey) { 10280 $.datepicker._adjustDate(event.target, +7, "D"); 10281 } 10282 handled = event.ctrlKey || event.metaKey; 10283 break; // +1 week on ctrl or command +down 10284 default: 10285 handled = false; 10286 } 10287 } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home 10288 $.datepicker._showDatepicker(this); 10289 } else { 10290 handled = false; 10291 } 10292 10293 if (handled) { 10294 event.preventDefault(); 10295 event.stopPropagation(); 10296 } 10297 }, 10298 10299 /* Filter entered characters - based on date format. */ 10300 _doKeyPress: function(event) { 10301 var chars, chr, 10302 inst = $.datepicker._getInst(event.target); 10303 10304 if ($.datepicker._get(inst, "constrainInput")) { 10305 chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); 10306 chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); 10307 return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); 10308 } 10309 }, 10310 10311 /* Synchronise manual entry and field/alternate field. */ 10312 _doKeyUp: function(event) { 10313 var date, 10314 inst = $.datepicker._getInst(event.target); 10315 10316 if (inst.input.val() !== inst.lastVal) { 10317 try { 10318 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 10319 (inst.input ? inst.input.val() : null), 10320 $.datepicker._getFormatConfig(inst)); 10321 10322 if (date) { // only if valid 10323 $.datepicker._setDateFromField(inst); 10324 $.datepicker._updateAlternate(inst); 10325 $.datepicker._updateDatepicker(inst); 10326 } 10327 } catch (err) {} 10328 } 10329 return true; 10330 }, 10331 10332 /* Pop-up the date picker for a given input field. 10333 * If false returned from beforeShow event handler do not show. 10334 * @param input element - the input field attached to the date picker or 10335 * event - if triggered by focus 10336 */ 10337 _showDatepicker: function(input) { 10338 input = input.target || input; 10339 if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger 10340 input = $("input", input.parentNode)[0]; 10341 } 10342 10343 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here 10344 return; 10345 } 10346 10347 var inst, beforeShow, beforeShowSettings, isFixed, 10348 offset, showAnim, duration; 10349 10350 inst = $.datepicker._getInst(input); 10351 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 10352 $.datepicker._curInst.dpDiv.stop(true, true); 10353 if (inst && $.datepicker._datepickerShowing) { 10354 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 10355 } 10356 } 10357 10358 beforeShow = $.datepicker._get(inst, "beforeShow"); 10359 beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 10360 if (beforeShowSettings === false) { 10361 return; 10362 } 10363 datepicker_extendRemove(inst.settings, beforeShowSettings); 10364 10365 inst.lastVal = null; 10366 $.datepicker._lastInput = input; 10367 $.datepicker._setDateFromField(inst); 10368 10369 if ($.datepicker._inDialog) { // hide cursor 10370 input.value = ""; 10371 } 10372 if (!$.datepicker._pos) { // position below input 10373 $.datepicker._pos = $.datepicker._findPos(input); 10374 $.datepicker._pos[1] += input.offsetHeight; // add the height 10375 } 10376 10377 isFixed = false; 10378 $(input).parents().each(function() { 10379 isFixed |= $(this).css("position") === "fixed"; 10380 return !isFixed; 10381 }); 10382 10383 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 10384 $.datepicker._pos = null; 10385 10386 //to avoid flashes on Firefox 10387 inst.dpDiv.empty(); 10388 10389 // determine sizing offscreen 10390 inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); 10391 $.datepicker._updateDatepicker(inst); 10392 10393 // fix width for dynamic number of date pickers 10394 // and adjust position before showing 10395 offset = $.datepicker._checkOffset(inst, offset, isFixed); 10396 inst.dpDiv.css({ 10397 position: ($.datepicker._inDialog && $.blockUI ? 10398 "static" : (isFixed ? "fixed" : "absolute")), 10399 display: "none", 10400 left: offset.left + "px", 10401 top: offset.top + "px" 10402 }); 10403 10404 if (!inst.inline) { 10405 showAnim = $.datepicker._get(inst, "showAnim"); 10406 duration = $.datepicker._get(inst, "duration"); 10407 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 10408 $.datepicker._datepickerShowing = true; 10409 10410 if ($.effects && $.effects.effect[showAnim]) { 10411 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); 10412 } else { 10413 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 10414 } 10415 10416 if ($.datepicker._shouldFocusInput(inst)) { 10417 inst.input.trigger("focus"); 10418 } 10419 10420 $.datepicker._curInst = inst; 10421 } 10422 }, 10423 10424 /* Generate the date picker content. */ 10425 _updateDatepicker: function(inst) { 10426 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 10427 datepicker_instActive = inst; // for delegate hover events 10428 inst.dpDiv.empty().append(this._generateHTML(inst)); 10429 this._attachHandlers(inst); 10430 10431 var origyearshtml, 10432 numMonths = this._getNumberOfMonths(inst), 10433 cols = numMonths[1], 10434 width = 17,
vendor: 9,309 bytes, lines 10435-10652
10435 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"); 10436 10437 if (activeCell.length > 0) { 10438 datepicker_handleMouseover.apply(activeCell.get(0)); 10439 } 10440 10441 inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); 10442 if (cols > 1) { 10443 inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); 10444 } 10445 inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + 10446 "Class"]("ui-datepicker-multi"); 10447 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + 10448 "Class"]("ui-datepicker-rtl"); 10449 10450 if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) { 10451 inst.input.trigger("focus"); 10452 } 10453 10454 // Deffered render of the years select (to avoid flashes on Firefox) 10455 if (inst.yearshtml) { 10456 origyearshtml = inst.yearshtml; 10457 setTimeout(function() { 10458 10459 //assure that inst.yearshtml didn't change. 10460 if (origyearshtml === inst.yearshtml && inst.yearshtml) { 10461 inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); 10462 } 10463 origyearshtml = inst.yearshtml = null; 10464 }, 0); 10465 } 10466 }, 10467 10468 // #6694 - don't focus the input if it's already focused 10469 // this breaks the change event in IE 10470 // Support: IE and jQuery <1.9 10471 _shouldFocusInput: function(inst) { 10472 return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus"); 10473 }, 10474 10475 /* Check positioning to remain on screen. */ 10476 _checkOffset: function(inst, offset, isFixed) { 10477 var dpWidth = inst.dpDiv.outerWidth(), 10478 dpHeight = inst.dpDiv.outerHeight(), 10479 inputWidth = inst.input ? inst.input.outerWidth() : 0, 10480 inputHeight = inst.input ? inst.input.outerHeight() : 0, 10481 viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), 10482 viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 10483 10484 offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); 10485 offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; 10486 offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 10487 10488 // Now check if datepicker is showing outside window viewport - move to a better place if so. 10489 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 10490 Math.abs(offset.left + dpWidth - viewWidth) : 0); 10491 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 10492 Math.abs(dpHeight + inputHeight) : 0); 10493 10494 return offset; 10495 }, 10496 10497 /* Find an object's position on the screen. */ 10498 _findPos: function(obj) { 10499 var position, 10500 inst = this._getInst(obj), 10501 isRTL = this._get(inst, "isRTL"); 10502 10503 while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { 10504 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 10505 } 10506 10507 position = $(obj).offset(); 10508 return [position.left, position.top]; 10509 }, 10510 10511 /* Hide the date picker from view. 10512 * @param input element - the input field attached to the date picker 10513 */ 10514 _hideDatepicker: function(input) { 10515 var showAnim, duration, postProcess, onClose, 10516 inst = this._curInst; 10517 10518 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 10519 return; 10520 } 10521 10522 if (this._datepickerShowing) { 10523 showAnim = this._get(inst, "showAnim"); 10524 duration = this._get(inst, "duration"); 10525 postProcess = function() { 10526 $.datepicker._tidyDialog(inst); 10527 }; 10528 10529 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 10530 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 10531 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); 10532 } else { 10533 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : 10534 (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); 10535 } 10536 10537 if (!showAnim) { 10538 postProcess(); 10539 } 10540 this._datepickerShowing = false; 10541 10542 onClose = this._get(inst, "onClose"); 10543 if (onClose) { 10544 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); 10545 } 10546 10547 this._lastInput = null; 10548 if (this._inDialog) { 10549 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); 10550 if ($.blockUI) { 10551 $.unblockUI(); 10552 $("body").append(this.dpDiv); 10553 } 10554 } 10555 this._inDialog = false; 10556 } 10557 }, 10558 10559 /* Tidy up after a dialog display. */ 10560 _tidyDialog: function(inst) { 10561 inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar"); 10562 }, 10563 10564 /* Close date picker if clicked elsewhere. */ 10565 _checkExternalClick: function(event) { 10566 if (!$.datepicker._curInst) { 10567 return; 10568 } 10569 10570 var $target = $(event.target), 10571 inst = $.datepicker._getInst($target[0]); 10572 10573 if ((($target[0].id !== $.datepicker._mainDivId && 10574 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 10575 !$target.hasClass($.datepicker.markerClassName) && 10576 !$target.closest("." + $.datepicker._triggerClass).length && 10577 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || 10578 ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) { 10579 $.datepicker._hideDatepicker(); 10580 } 10581 }, 10582 10583 /* Adjust one of the date sub-fields. */ 10584 _adjustDate: function(id, offset, period) { 10585 var target = $(id), 10586 inst = this._getInst(target[0]); 10587 10588 if (this._isDisabledDatepicker(target[0])) { 10589 return; 10590 } 10591 this._adjustInstDate(inst, offset + 10592 (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning 10593 period); 10594 this._updateDatepicker(inst); 10595 }, 10596 10597 /* Action for current link. */ 10598 _gotoToday: function(id) { 10599 var date, 10600 target = $(id), 10601 inst = this._getInst(target[0]); 10602 10603 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 10604 inst.selectedDay = inst.currentDay; 10605 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 10606 inst.drawYear = inst.selectedYear = inst.currentYear; 10607 } else { 10608 date = new Date(); 10609 inst.selectedDay = date.getDate(); 10610 inst.drawMonth = inst.selectedMonth = date.getMonth(); 10611 inst.drawYear = inst.selectedYear = date.getFullYear(); 10612 } 10613 this._notifyChange(inst); 10614 this._adjustDate(target); 10615 }, 10616 10617 /* Action for selecting a new month/year. */ 10618 _selectMonthYear: function(id, select, period) { 10619 var target = $(id), 10620 inst = this._getInst(target[0]); 10621 10622 inst["selected" + (period === "M" ? "Month" : "Year")] = 10623 inst["draw" + (period === "M" ? "Month" : "Year")] = 10624 parseInt(select.options[select.selectedIndex].value, 10); 10625 10626 this._notifyChange(inst); 10627 this._adjustDate(target); 10628 }, 10629 10630 /* Action for selecting a day. */ 10631 _selectDay: function(id, month, year, td) { 10632 var inst, 10633 target = $(id); 10634 10635 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 10636 return; 10637 } 10638 10639 inst = this._getInst(target[0]); 10640 inst.selectedDay = inst.currentDay = $("a", td).html(); 10641 inst.selectedMonth = inst.currentMonth = month; 10642 inst.selectedYear = inst.currentYear = year; 10643 this._selectDate(id, this._formatDate(inst, 10644 inst.currentDay, inst.currentMonth, inst.currentYear)); 10645 }, 10646 10647 /* Erase the input field and hide the date picker. */ 10648 _clearDate: function(id) { 10649 var target = $(id); 10650 this._selectDate(target, ""); 10651 }, 10652
vendor: 4,235 bytes, lines 10653-10749
10653 /* Update the input field with the selected date. */ 10654 _selectDate: function(id, dateStr) { 10655 var onSelect, 10656 target = $(id), 10657 inst = this._getInst(target[0]); 10658 10659 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 10660 if (inst.input) { 10661 inst.input.val(dateStr); 10662 } 10663 this._updateAlternate(inst); 10664 10665 onSelect = this._get(inst, "onSelect"); 10666 if (onSelect) { 10667 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 10668 } else if (inst.input) { 10669 inst.input.trigger("change"); // fire the change event 10670 } 10671 10672 if (inst.inline) { 10673 this._updateDatepicker(inst); 10674 } else { 10675 this._hideDatepicker(); 10676 this._lastInput = inst.input[0]; 10677 if (typeof(inst.input[0]) !== "object") { 10678 inst.input.trigger("focus"); // restore focus 10679 } 10680 this._lastInput = null; 10681 } 10682 }, 10683 10684 /* Update any alternate field to synchronise with the main field. */ 10685 _updateAlternate: function(inst) { 10686 var altFormat, date, dateStr, 10687 altField = this._get(inst, "altField"); 10688 10689 if (altField) { // update alternate field too 10690 altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 10691 date = this._getDate(inst); 10692 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 10693 $(altField).val(dateStr); 10694 } 10695 }, 10696 10697 /* Set as beforeShowDay function to prevent selection of weekends. 10698 * @param date Date - the date to customise 10699 * @return [boolean, string] - is this date selectable?, what is its CSS class? 10700 */ 10701 noWeekends: function(date) { 10702 var day = date.getDay(); 10703 return [(day > 0 && day < 6), ""]; 10704 }, 10705 10706 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 10707 * @param date Date - the date to get the week for 10708 * @return number - the number of the week within the year that contains this date 10709 */ 10710 iso8601Week: function(date) { 10711 var time, 10712 checkDate = new Date(date.getTime()); 10713 10714 // Find Thursday of this week starting on Monday 10715 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 10716 10717 time = checkDate.getTime(); 10718 checkDate.setMonth(0); // Compare with Jan 1 10719 checkDate.setDate(1); 10720 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 10721 }, 10722 10723 /* Parse a string value into a date object. 10724 * See formatDate below for the possible formats. 10725 * 10726 * @param format string - the expected format of the date 10727 * @param value string - the date in the above format 10728 * @param settings Object - attributes include: 10729 * shortYearCutoff number - the cutoff year for determining the century (optional) 10730 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10731 * dayNames string[7] - names of the days from Sunday (optional) 10732 * monthNamesShort string[12] - abbreviated names of the months (optional) 10733 * monthNames string[12] - names of the months (optional) 10734 * @return Date - the extracted date value or null if value is blank 10735 */ 10736 parseDate: function(format, value, settings) { 10737 if (format == null || value == null) { 10738 throw "Invalid arguments"; 10739 } 10740 10741 value = (typeof value === "object" ? value.toString() : value + ""); 10742 if (value === "") { 10743 return null; 10744 } 10745 10746 var iFormat, dim, extra, 10747 iValue = 0, 10748 shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, 10749 shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 21,128 bytes, lines 10749-11236
10749: 10750 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), 10751 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 10752 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 10753 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 10754 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 10755 year = -1, 10756 month = -1, 10757 day = -1, 10758 doy = -1, 10759 literal = false, 10760 date, 10761 10762 // Check whether a format character is doubled 10763 lookAhead = function(match) { 10764 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 10765 if (matches) { 10766 iFormat++; 10767 } 10768 return matches; 10769 }, 10770 10771 // Extract a number from the string value 10772 getNumber = function(match) { 10773 var isDoubled = lookAhead(match), 10774 size = (match === "@" ? 14 : (match === "!" ? 20 : 10775 (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), 10776 minSize = (match === "y" ? size : 1), 10777 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 10778 num = value.substring(iValue).match(digits); 10779 if (!num) { 10780 throw "Missing number at position " + iValue; 10781 } 10782 iValue += num[0].length; 10783 return parseInt(num[0], 10); 10784 }, 10785 10786 // Extract a name from the string value and convert to an index 10787 getName = function(match, shortNames, longNames) { 10788 var index = -1, 10789 names = $.map(lookAhead(match) ? longNames : shortNames, function(v, k) { 10790 return [ 10791 [k, v] 10792 ]; 10793 }).sort(function(a, b) { 10794 return -(a[1].length - b[1].length); 10795 }); 10796 10797 $.each(names, function(i, pair) { 10798 var name = pair[1]; 10799 if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { 10800 index = pair[0]; 10801 iValue += name.length; 10802 return false; 10803 } 10804 }); 10805 if (index !== -1) { 10806 return index + 1; 10807 } else { 10808 throw "Unknown name at position " + iValue; 10809 } 10810 }, 10811 10812 // Confirm that a literal character matches the string value 10813 checkLiteral = function() { 10814 if (value.charAt(iValue) !== format.charAt(iFormat)) { 10815 throw "Unexpected literal at position " + iValue; 10816 } 10817 iValue++; 10818 }; 10819 10820 for (iFormat = 0; iFormat < format.length; iFormat++) { 10821 if (literal) { 10822 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 10823 literal = false; 10824 } else { 10825 checkLiteral(); 10826 } 10827 } else { 10828 switch (format.charAt(iFormat)) { 10829 case "d": 10830 day = getNumber("d"); 10831 break; 10832 case "D": 10833 getName("D", dayNamesShort, dayNames); 10834 break; 10835 case "o": 10836 doy = getNumber("o"); 10837 break; 10838 case "m": 10839 month = getNumber("m"); 10840 break; 10841 case "M": 10842 month = getName("M", monthNamesShort, monthNames); 10843 break; 10844 case "y": 10845 year = getNumber("y"); 10846 break; 10847 case "@": 10848 date = new Date(getNumber("@")); 10849 year = date.getFullYear(); 10850 month = date.getMonth() + 1; 10851 day = date.getDate(); 10852 break; 10853 case "!": 10854 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 10855 year = date.getFullYear(); 10856 month = date.getMonth() + 1; 10857 day = date.getDate(); 10858 break; 10859 case "'": 10860 if (lookAhead("'")) { 10861 checkLiteral(); 10862 } else { 10863 literal = true; 10864 } 10865 break; 10866 default: 10867 checkLiteral(); 10868 } 10869 } 10870 } 10871 10872 if (iValue < value.length) { 10873 extra = value.substr(iValue); 10874 if (!/^\s+/.test(extra)) { 10875 throw "Extra/unparsed characters found in date: " + extra; 10876 } 10877 } 10878 10879 if (year === -1) { 10880 year = new Date().getFullYear(); 10881 } else if (year < 100) { 10882 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 10883 (year <= shortYearCutoff ? 0 : -100); 10884 } 10885 10886 if (doy > -1) { 10887 month = 1; 10888 day = doy; 10889 do { 10890 dim = this._getDaysInMonth(year, month - 1); 10891 if (day <= dim) { 10892 break; 10893 } 10894 month++; 10895 day -= dim; 10896 } while (true); 10897 } 10898 10899 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 10900 if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { 10901 throw "Invalid date"; // E.g. 31/02/00 10902 } 10903 return date; 10904 }, 10905 10906 /* Standard date formats. */ 10907 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 10908 COOKIE: "D, dd M yy", 10909 ISO_8601: "yy-mm-dd", 10910 RFC_822: "D, d M y", 10911 RFC_850: "DD, dd-M-y", 10912 RFC_1036: "D, d M y", 10913 RFC_1123: "D, d M yy", 10914 RFC_2822: "D, d M yy", 10915 RSS: "D, d M y", // RFC 822 10916 TICKS: "!", 10917 TIMESTAMP: "@", 10918 W3C: "yy-mm-dd", // ISO 8601 10919 10920 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 10921 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 10922 10923 /* Format a date object into a string value. 10924 * The format can be combinations of the following: 10925 * d - day of month (no leading zero) 10926 * dd - day of month (two digit) 10927 * o - day of year (no leading zeros) 10928 * oo - day of year (three digit) 10929 * D - day name short 10930 * DD - day name long 10931 * m - month of year (no leading zero) 10932 * mm - month of year (two digit) 10933 * M - month name short 10934 * MM - month name long 10935 * y - year (two digit) 10936 * yy - year (four digit) 10937 * @ - Unix timestamp (ms since 01/01/1970) 10938 * ! - Windows ticks (100ns since 01/01/0001) 10939 * "..." - literal text 10940 * '' - single quote 10941 * 10942 * @param format string - the desired format of the date 10943 * @param date Date - the date value to format 10944 * @param settings Object - attributes include: 10945 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10946 * dayNames string[7] - names of the days from Sunday (optional) 10947 * monthNamesShort string[12] - abbreviated names of the months (optional) 10948 * monthNames string[12] - names of the months (optional) 10949 * @return string - the date in the above format 10950 */ 10951 formatDate: function(format, date, settings) { 10952 if (!date) { 10953 return ""; 10954 } 10955 10956 var iFormat, 10957 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 10958 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 10959 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 10960 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 10961 10962 // Check whether a format character is doubled 10963 lookAhead = function(match) { 10964 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 10965 if (matches) { 10966 iFormat++; 10967 } 10968 return matches; 10969 }, 10970 10971 // Format a number, with leading zero if necessary 10972 formatNumber = function(match, value, len) { 10973 var num = "" + value; 10974 if (lookAhead(match)) { 10975 while (num.length < len) { 10976 num = "0" + num; 10977 } 10978 } 10979 return num; 10980 }, 10981 10982 // Format a name, short or long as requested 10983 formatName = function(match, value, shortNames, longNames) { 10984 return (lookAhead(match) ? longNames[value] : shortNames[value]); 10985 }, 10986 output = "", 10987 literal = false; 10988 10989 if (date) { 10990 for (iFormat = 0; iFormat < format.length; iFormat++) { 10991 if (literal) { 10992 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 10993 literal = false; 10994 } else { 10995 output += format.charAt(iFormat); 10996 } 10997 } else { 10998 switch (format.charAt(iFormat)) { 10999 case "d": 11000 output += formatNumber("d", date.getDate(), 2); 11001 break; 11002 case "D": 11003 output += formatName("D", date.getDay(), dayNamesShort, dayNames); 11004 break; 11005 case "o": 11006 output += formatNumber("o", 11007 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 11008 break; 11009 case "m": 11010 output += formatNumber("m", date.getMonth() + 1, 2); 11011 break; 11012 case "M": 11013 output += formatName("M", date.getMonth(), monthNamesShort, monthNames); 11014 break; 11015 case "y": 11016 output += (lookAhead("y") ? date.getFullYear() : 11017 (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100); 11018 break; 11019 case "@": 11020 output += date.getTime(); 11021 break; 11022 case "!": 11023 output += date.getTime() * 10000 + this._ticksTo1970; 11024 break; 11025 case "'": 11026 if (lookAhead("'")) { 11027 output += "'"; 11028 } else { 11029 literal = true; 11030 } 11031 break; 11032 default: 11033 output += format.charAt(iFormat); 11034 } 11035 } 11036 } 11037 } 11038 return output; 11039 }, 11040 11041 /* Extract all possible characters from the date format. */ 11042 _possibleChars: function(format) { 11043 var iFormat, 11044 chars = "", 11045 literal = false, 11046 11047 // Check whether a format character is doubled 11048 lookAhead = function(match) { 11049 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 11050 if (matches) { 11051 iFormat++; 11052 } 11053 return matches; 11054 }; 11055 11056 for (iFormat = 0; iFormat < format.length; iFormat++) { 11057 if (literal) { 11058 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 11059 literal = false; 11060 } else { 11061 chars += format.charAt(iFormat); 11062 } 11063 } else { 11064 switch (format.charAt(iFormat)) { 11065 case "d": 11066 case "m": 11067 case "y": 11068 case "@": 11069 chars += "0123456789"; 11070 break; 11071 case "D": 11072 case "M": 11073 return null; // Accept anything 11074 case "'": 11075 if (lookAhead("'")) { 11076 chars += "'"; 11077 } else { 11078 literal = true; 11079 } 11080 break; 11081 default: 11082 chars += format.charAt(iFormat); 11083 } 11084 } 11085 } 11086 return chars; 11087 }, 11088 11089 /* Get a setting value, defaulting if necessary. */ 11090 _get: function(inst, name) { 11091 return inst.settings[name] !== undefined ? 11092 inst.settings[name] : this._defaults[name]; 11093 }, 11094 11095 /* Parse existing date and initialise date picker. */ 11096 _setDateFromField: function(inst, noDefault) { 11097 if (inst.input.val() === inst.lastVal) { 11098 return; 11099 } 11100 11101 var dateFormat = this._get(inst, "dateFormat"), 11102 dates = inst.lastVal = inst.input ? inst.input.val() : null, 11103 defaultDate = this._getDefaultDate(inst), 11104 date = defaultDate, 11105 settings = this._getFormatConfig(inst); 11106 11107 try { 11108 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 11109 } catch (event) { 11110 dates = (noDefault ? "" : dates); 11111 } 11112 inst.selectedDay = date.getDate(); 11113 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11114 inst.drawYear = inst.selectedYear = date.getFullYear(); 11115 inst.currentDay = (dates ? date.getDate() : 0); 11116 inst.currentMonth = (dates ? date.getMonth() : 0); 11117 inst.currentYear = (dates ? date.getFullYear() : 0); 11118 this._adjustInstDate(inst); 11119 }, 11120 11121 /* Retrieve the default date shown on opening. */ 11122 _getDefaultDate: function(inst) { 11123 return this._restrictMinMax(inst, 11124 this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); 11125 }, 11126 11127 /* A date may be specified as an exact value or a relative one. */ 11128 _determineDate: function(inst, date, defaultDate) { 11129 var offsetNumeric = function(offset) { 11130 var date = new Date(); 11131 date.setDate(date.getDate() + offset); 11132 return date; 11133 }, 11134 offsetString = function(offset) { 11135 try { 11136 return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 11137 offset, $.datepicker._getFormatConfig(inst)); 11138 } catch (e) { 11139 11140 // Ignore 11141 } 11142 11143 var date = (offset.toLowerCase().match(/^c/) ? 11144 $.datepicker._getDate(inst) : null) || new Date(), 11145 year = date.getFullYear(), 11146 month = date.getMonth(), 11147 day = date.getDate(), 11148 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 11149 matches = pattern.exec(offset); 11150 11151 while (matches) { 11152 switch (matches[2] || "d") { 11153 case "d": 11154 case "D": 11155 day += parseInt(matches[1], 10); 11156 break; 11157 case "w": 11158 case "W": 11159 day += parseInt(matches[1], 10) * 7; 11160 break; 11161 case "m": 11162 case "M": 11163 month += parseInt(matches[1], 10); 11164 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 11165 break; 11166 case "y": 11167 case "Y": 11168 year += parseInt(matches[1], 10); 11169 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 11170 break; 11171 } 11172 matches = pattern.exec(offset); 11173 } 11174 return new Date(year, month, day); 11175 }, 11176 newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : 11177 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 11178 11179 newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); 11180 if (newDate) { 11181 newDate.setHours(0); 11182 newDate.setMinutes(0); 11183 newDate.setSeconds(0); 11184 newDate.setMilliseconds(0); 11185 } 11186 return this._daylightSavingAdjust(newDate); 11187 }, 11188 11189 /* Handle switch to/from daylight saving. 11190 * Hours may be non-zero on daylight saving cut-over: 11191 * > 12 when midnight changeover, but then cannot generate 11192 * midnight datetime, so jump to 1AM, otherwise reset. 11193 * @param date (Date) the date to check 11194 * @return (Date) the corrected date 11195 */ 11196 _daylightSavingAdjust: function(date) { 11197 if (!date) { 11198 return null; 11199 } 11200 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 11201 return date; 11202 }, 11203 11204 /* Set the date(s) directly. */ 11205 _setDate: function(inst, date, noChange) { 11206 var clear = !date, 11207 origMonth = inst.selectedMonth, 11208 origYear = inst.selectedYear, 11209 newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 11210 11211 inst.selectedDay = inst.currentDay = newDate.getDate(); 11212 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 11213 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 11214 if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { 11215 this._notifyChange(inst); 11216 } 11217 this._adjustInstDate(inst); 11218 if (inst.input) { 11219 inst.input.val(clear ? "" : this._formatDate(inst)); 11220 } 11221 }, 11222 11223 /* Retrieve the date(s) directly. */ 11224 _getDate: function(inst) { 11225 var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : 11226 this._daylightSavingAdjust(new Date( 11227 inst.currentYear, inst.currentMonth, inst.currentDay))); 11228 return startDate; 11229 }, 11230 11231 /* Attach the onxxx handlers. These are declared statically so 11232 * they work with static code transformers like Caja. 11233 */ 11234 _attachHandlers: function(inst) { 11235 var stepMonths = this._get(inst, "stepMonths"), 11236 id = "#" + inst.id.replace(/\\\\/g, "\\");
vendor: 7,929 bytes, lines 11237-11371
11237 inst.dpDiv.find("[data-handler]").map(function() { 11238 var handler = { 11239 prev: function() { 11240 $.datepicker._adjustDate(id, -stepMonths, "M"); 11241 }, 11242 next: function() { 11243 $.datepicker._adjustDate(id, +stepMonths, "M"); 11244 }, 11245 hide: function() { 11246 $.datepicker._hideDatepicker(); 11247 }, 11248 today: function() { 11249 $.datepicker._gotoToday(id); 11250 }, 11251 selectDay: function() { 11252 $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); 11253 return false; 11254 }, 11255 selectMonth: function() { 11256 $.datepicker._selectMonthYear(id, this, "M"); 11257 return false; 11258 }, 11259 selectYear: function() { 11260 $.datepicker._selectMonthYear(id, this, "Y"); 11261 return false; 11262 } 11263 }; 11264 $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); 11265 }); 11266 }, 11267 11268 /* Generate the HTML for the current state of the date picker. */ 11269 _generateHTML: function(inst) { 11270 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 11271 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 11272 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 11273 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 11274 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 11275 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 11276 tempDate = new Date(), 11277 today = this._daylightSavingAdjust( 11278 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time 11279 isRTL = this._get(inst, "isRTL"), 11280 showButtonPanel = this._get(inst, "showButtonPanel"), 11281 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 11282 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 11283 numMonths = this._getNumberOfMonths(inst), 11284 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 11285 stepMonths = this._get(inst, "stepMonths"), 11286 isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), 11287 currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 11288 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), 11289 minDate = this._getMinMaxDate(inst, "min"), 11290 maxDate = this._getMinMaxDate(inst, "max"), 11291 drawMonth = inst.drawMonth - showCurrentAtPos, 11292 drawYear = inst.drawYear; 11293 11294 if (drawMonth < 0) { 11295 drawMonth += 12; 11296 drawYear--; 11297 } 11298 if (maxDate) { 11299 maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 11300 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 11301 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 11302 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 11303 drawMonth--; 11304 if (drawMonth < 0) { 11305 drawMonth = 11; 11306 drawYear--; 11307 } 11308 } 11309 } 11310 inst.drawMonth = drawMonth; 11311 inst.drawYear = drawYear; 11312 11313 prevText = this._get(inst, "prevText"); 11314 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 11315 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 11316 this._getFormatConfig(inst))); 11317 11318 prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? 11319 "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + 11320 " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" : 11321 (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>")); 11322 11323 nextText = this._get(inst, "nextText"); 11324 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 11325 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 11326 this._getFormatConfig(inst))); 11327 11328 next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? 11329 "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + 11330 " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" : 11331 (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>")); 11332 11333 currentText = this._get(inst, "currentText"); 11334 gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); 11335 currentText = (!navigationAsDateFormat ? currentText : 11336 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 11337 11338 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'>" + 11339 this._get(inst, "closeText") + "</button>" : ""); 11340 11341 buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") + 11342 (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'" + 11343 ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; 11344 11345 firstDay = parseInt(this._get(inst, "firstDay"), 10); 11346 firstDay = (isNaN(firstDay) ? 0 : firstDay); 11347 11348 showWeek = this._get(inst, "showWeek"); 11349 dayNames = this._get(inst, "dayNames"); 11350 dayNamesMin = this._get(inst, "dayNamesMin"); 11351 monthNames = this._get(inst, "monthNames"); 11352 monthNamesShort = this._get(inst, "monthNamesShort"); 11353 beforeShowDay = this._get(inst, "beforeShowDay"); 11354 showOtherMonths = this._get(inst, "showOtherMonths"); 11355 selectOtherMonths = this._get(inst, "selectOtherMonths"); 11356 defaultDate = this._getDefaultDate(inst); 11357 html = ""; 11358 11359 for (row = 0; row < numMonths[0]; row++) { 11360 group = ""; 11361 this.maxRows = 4; 11362 for (col = 0; col < numMonths[1]; col++) { 11363 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 11364 cornerClass = " ui-corner-all"; 11365 calender = ""; 11366 if (isMultiMonth) { 11367 calender += "<div class='ui-datepicker-group"; 11368 if (numMonths[1] > 1) { 11369 switch (col) { 11370 case 0: 11371 calender += " ui-datepicker-group-first";
vendor: 6,904 bytes, lines 11372-11456
11372 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); 11373 break; 11374 case numMonths[1] - 1: 11375 calender += " ui-datepicker-group-last"; 11376 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); 11377 break; 11378 default: 11379 calender += " ui-datepicker-group-middle"; 11380 cornerClass = ""; 11381 break; 11382 } 11383 } 11384 calender += "'>"; 11385 } 11386 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 11387 (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + 11388 (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + 11389 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 11390 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 11391 "</div><table class='ui-datepicker-calendar'><thead>" + 11392 "<tr>"; 11393 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); 11394 for (dow = 0; dow < 7; dow++) { // days of the week 11395 day = (dow + firstDay) % 7; 11396 thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + 11397 "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; 11398 } 11399 calender += thead + "</tr></thead><tbody>"; 11400 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 11401 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { 11402 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 11403 } 11404 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 11405 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 11406 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 11407 this.maxRows = numRows; 11408 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 11409 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows 11410 calender += "<tr>"; 11411 tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 11412 this._get(inst, "calculateWeek")(printDate) + "</td>"); 11413 for (dow = 0; dow < 7; dow++) { // create date picker days 11414 daySettings = (beforeShowDay ? 11415 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); 11416 otherMonth = (printDate.getMonth() !== drawMonth); 11417 unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 11418 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 11419 tbody += "<td class='" + 11420 ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends 11421 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 11422 ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key 11423 (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? 11424 11425 // or defaultDate is current printedDate and defaultDate is selectedDate 11426 " " + this._dayOverClass : "") + // highlight selected day 11427 (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days 11428 (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates 11429 (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day 11430 (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) 11431 ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title 11432 (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions 11433 (otherMonth && !showOtherMonths ? " " : // display for other months 11434 (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 11435 (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + 11436 (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day 11437 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 11438 "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date 11439 printDate.setDate(printDate.getDate() + 1); 11440 printDate = this._daylightSavingAdjust(printDate); 11441 } 11442 calender += tbody + "</tr>"; 11443 } 11444 drawMonth++; 11445 if (drawMonth > 11) { 11446 drawMonth = 0; 11447 drawYear++; 11448 } 11449 calender += "</tbody></table>" + (isMultiMonth ? "</div>" + 11450 ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); 11451 group += calender; 11452 } 11453 html += group; 11454 } 11455 html += buttonPanel; 11456 inst._keyEvent = false;
vendor: 4,701 bytes, lines 11457-11550
11457 return html; 11458 }, 11459 11460 /* Generate the month and year header. */ 11461 _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, 11462 secondary, monthNames, monthNamesShort) { 11463 11464 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 11465 changeMonth = this._get(inst, "changeMonth"), 11466 changeYear = this._get(inst, "changeYear"), 11467 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 11468 html = "<div class='ui-datepicker-title'>", 11469 monthHtml = ""; 11470 11471 // Month selection 11472 if (secondary || !changeMonth) { 11473 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; 11474 } else { 11475 inMinYear = (minDate && minDate.getFullYear() === drawYear); 11476 inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); 11477 monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; 11478 for (month = 0; month < 12; month++) { 11479 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { 11480 monthHtml += "<option value='" + month + "'" + 11481 (month === drawMonth ? " selected='selected'" : "") + 11482 ">" + monthNamesShort[month] + "</option>"; 11483 } 11484 } 11485 monthHtml += "</select>"; 11486 } 11487 11488 if (!showMonthAfterYear) { 11489 html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); 11490 } 11491 11492 // Year selection 11493 if (!inst.yearshtml) { 11494 inst.yearshtml = ""; 11495 if (secondary || !changeYear) { 11496 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 11497 } else { 11498 11499 // determine range of years to display 11500 years = this._get(inst, "yearRange").split(":"); 11501 thisYear = new Date().getFullYear(); 11502 determineYear = function(value) { 11503 var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : 11504 (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : 11505 parseInt(value, 10))); 11506 return (isNaN(year) ? thisYear : year); 11507 }; 11508 year = determineYear(years[0]); 11509 endYear = Math.max(year, determineYear(years[1] || "")); 11510 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 11511 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 11512 inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; 11513 for (; year <= endYear; year++) { 11514 inst.yearshtml += "<option value='" + year + "'" + 11515 (year === drawYear ? " selected='selected'" : "") + 11516 ">" + year + "</option>"; 11517 } 11518 inst.yearshtml += "</select>"; 11519 11520 html += inst.yearshtml; 11521 inst.yearshtml = null; 11522 } 11523 } 11524 11525 html += this._get(inst, "yearSuffix"); 11526 if (showMonthAfterYear) { 11527 html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; 11528 } 11529 html += "</div>"; // Close datepicker_header 11530 return html; 11531 }, 11532 11533 /* Adjust one of the date sub-fields. */ 11534 _adjustInstDate: function(inst, offset, period) { 11535 var year = inst.selectedYear + (period === "Y" ? offset : 0), 11536 month = inst.selectedMonth + (period === "M" ? offset : 0), 11537 day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), 11538 date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); 11539 11540 inst.selectedDay = date.getDate(); 11541 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11542 inst.drawYear = inst.selectedYear = date.getFullYear(); 11543 if (period === "M" || period === "Y") { 11544 this._notifyChange(inst); 11545 } 11546 }, 11547 11548 /* Ensure a date is within any min/max bounds. */ 11549 _restrictMinMax: function(inst, date) { 11550 var minDate = this._getMinMaxDate(inst, "min"),
vendor: 42,047 bytes, lines 11551-12736
11551 maxDate = this._getMinMaxDate(inst, "max"), 11552 newDate = (minDate && date < minDate ? minDate : date); 11553 return (maxDate && newDate > maxDate ? maxDate : newDate); 11554 }, 11555 11556 /* Notify change of month/year. */ 11557 _notifyChange: function(inst) { 11558 var onChange = this._get(inst, "onChangeMonthYear"); 11559 if (onChange) { 11560 onChange.apply((inst.input ? inst.input[0] : null), [inst.selectedYear, inst.selectedMonth + 1, inst]); 11561 } 11562 }, 11563 11564 /* Determine the number of months to show. */ 11565 _getNumberOfMonths: function(inst) { 11566 var numMonths = this._get(inst, "numberOfMonths"); 11567 return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); 11568 }, 11569 11570 /* Determine the current maximum date - ensure no time components are set. */ 11571 _getMinMaxDate: function(inst, minMax) { 11572 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 11573 }, 11574 11575 /* Find the number of days in a given month. */ 11576 _getDaysInMonth: function(year, month) { 11577 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 11578 }, 11579 11580 /* Find the day of the week of the first of a month. */ 11581 _getFirstDayOfMonth: function(year, month) { 11582 return new Date(year, month, 1).getDay(); 11583 }, 11584 11585 /* Determines if we should allow a "next/prev" month display change. */ 11586 _canAdjustMonth: function(inst, offset, curYear, curMonth) { 11587 var numMonths = this._getNumberOfMonths(inst), 11588 date = this._daylightSavingAdjust(new Date(curYear, 11589 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 11590 11591 if (offset < 0) { 11592 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 11593 } 11594 return this._isInRange(inst, date); 11595 }, 11596 11597 /* Is the given date in the accepted range? */ 11598 _isInRange: function(inst, date) { 11599 var yearSplit, currentYear, 11600 minDate = this._getMinMaxDate(inst, "min"), 11601 maxDate = this._getMinMaxDate(inst, "max"), 11602 minYear = null, 11603 maxYear = null, 11604 years = this._get(inst, "yearRange"); 11605 if (years) { 11606 yearSplit = years.split(":"); 11607 currentYear = new Date().getFullYear(); 11608 minYear = parseInt(yearSplit[0], 10); 11609 maxYear = parseInt(yearSplit[1], 10); 11610 if (yearSplit[0].match(/[+\-].*/)) { 11611 minYear += currentYear; 11612 } 11613 if (yearSplit[1].match(/[+\-].*/)) { 11614 maxYear += currentYear; 11615 } 11616 } 11617 11618 return ((!minDate || date.getTime() >= minDate.getTime()) && 11619 (!maxDate || date.getTime() <= maxDate.getTime()) && 11620 (!minYear || date.getFullYear() >= minYear) && 11621 (!maxYear || date.getFullYear() <= maxYear)); 11622 }, 11623 11624 /* Provide the configuration settings for formatting/parsing. */ 11625 _getFormatConfig: function(inst) { 11626 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 11627 shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : 11628 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 11629 return { 11630 shortYearCutoff: shortYearCutoff, 11631 dayNamesShort: this._get(inst, "dayNamesShort"), 11632 dayNames: this._get(inst, "dayNames"), 11633 monthNamesShort: this._get(inst, "monthNamesShort"), 11634 monthNames: this._get(inst, "monthNames") 11635 }; 11636 }, 11637 11638 /* Format the given date for display. */ 11639 _formatDate: function(inst, day, month, year) { 11640 if (!day) { 11641 inst.currentDay = inst.selectedDay; 11642 inst.currentMonth = inst.selectedMonth; 11643 inst.currentYear = inst.selectedYear; 11644 } 11645 var date = (day ? (typeof day === "object" ? day : 11646 this._daylightSavingAdjust(new Date(year, month, day))) : 11647 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 11648 return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); 11649 } 11650 }); 11651 11652 /* 11653 * Bind hover events for datepicker elements. 11654 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 11655 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 11656 */ 11657 function datepicker_bindHover(dpDiv) { 11658 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 11659 return dpDiv.on("mouseout", selector, function() { 11660 $(this).removeClass("ui-state-hover"); 11661 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 11662 $(this).removeClass("ui-datepicker-prev-hover"); 11663 } 11664 if (this.className.indexOf("ui-datepicker-next") !== -1) { 11665 $(this).removeClass("ui-datepicker-next-hover"); 11666 } 11667 }) 11668 .on("mouseover", selector, datepicker_handleMouseover); 11669 } 11670 11671 function datepicker_handleMouseover() { 11672 if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { 11673 $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 11674 $(this).addClass("ui-state-hover"); 11675 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 11676 $(this).addClass("ui-datepicker-prev-hover"); 11677 } 11678 if (this.className.indexOf("ui-datepicker-next") !== -1) { 11679 $(this).addClass("ui-datepicker-next-hover"); 11680 } 11681 } 11682 } 11683 11684 /* jQuery extend now ignores nulls! */ 11685 function datepicker_extendRemove(target, props) { 11686 $.extend(target, props); 11687 for (var name in props) { 11688 if (props[name] == null) { 11689 target[name] = props[name]; 11690 } 11691 } 11692 return target; 11693 } 11694 11695 /* Invoke the datepicker functionality. 11696 @param options string - a command, optionally followed by additional parameters or 11697 Object - settings for attaching new datepicker functionality 11698 @return jQuery object */ 11699 $.fn.datepicker = function(options) { 11700 11701 /* Verify an empty collection wasn't passed - Fixes #6976 */ 11702 if (!this.length) { 11703 return this; 11704 } 11705 11706 /* Initialise the date picker. */ 11707 if (!$.datepicker.initialized) { 11708 $(document).on("mousedown", $.datepicker._checkExternalClick); 11709 $.datepicker.initialized = true; 11710 } 11711 11712 /* Append datepicker main container to body if not exist. */ 11713 if ($("#" + $.datepicker._mainDivId).length === 0) { 11714 $("body").append($.datepicker.dpDiv); 11715 } 11716 11717 var otherArgs = Array.prototype.slice.call(arguments, 1); 11718 if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { 11719 return $.datepicker["_" + options + "Datepicker"]. 11720 apply($.datepicker, [this[0]].concat(otherArgs)); 11721 } 11722 if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { 11723 return $.datepicker["_" + options + "Datepicker"]. 11724 apply($.datepicker, [this[0]].concat(otherArgs)); 11725 } 11726 return this.each(function() { 11727 typeof options === "string" ? 11728 $.datepicker["_" + options + "Datepicker"]. 11729 apply($.datepicker, [this].concat(otherArgs)): 11730 $.datepicker._attachDatepicker(this, options); 11731 }); 11732 }; 11733 11734 $.datepicker = new Datepicker(); // singleton instance 11735 $.datepicker.initialized = false; 11736 $.datepicker.uuid = new Date().getTime(); 11737 $.datepicker.version = "1.12.1"; 11738 11739 var widgetsDatepicker = $.datepicker; 11740 11741 11742 /*! 11743 * jQuery UI Dialog 1.12.1 11744 * http://jqueryui.com 11745 * 11746 * Copyright jQuery Foundation and other contributors 11747 * Released under the MIT license. 11748 * http://jquery.org/license 11749 */ 11750 11751 //>>label: Dialog 11752 //>>group: Widgets 11753 //>>description: Displays customizable dialog windows. 11754 //>>docs: http://api.jqueryui.com/dialog/ 11755 //>>demos: http://jqueryui.com/dialog/ 11756 //>>css.structure: ../../themes/base/core.css 11757 //>>css.structure: ../../themes/base/dialog.css 11758 //>>css.theme: ../../themes/base/theme.css 11759 11760 11761 11762 $.widget("ui.dialog", { 11763 version: "1.12.1", 11764 options: { 11765 appendTo: "body", 11766 autoOpen: true, 11767 buttons: [], 11768 classes: { 11769 "ui-dialog": "ui-corner-all", 11770 "ui-dialog-titlebar": "ui-corner-all" 11771 }, 11772 closeOnEscape: true, 11773 closeText: "Close", 11774 draggable: true, 11775 hide: null, 11776 height: "auto", 11777 maxHeight: null, 11778 maxWidth: null, 11779 minHeight: 150, 11780 minWidth: 150, 11781 modal: false, 11782 position: { 11783 my: "center", 11784 at: "center", 11785 of: window, 11786 collision: "fit", 11787 11788 // Ensure the titlebar is always visible 11789 using: function(pos) { 11790 var topOffset = $(this).css(pos).offset().top; 11791 if (topOffset < 0) { 11792 $(this).css("top", pos.top - topOffset); 11793 } 11794 } 11795 }, 11796 resizable: true, 11797 show: null, 11798 title: null, 11799 width: 300, 11800 11801 // Callbacks 11802 beforeClose: null, 11803 close: null, 11804 drag: null, 11805 dragStart: null, 11806 dragStop: null, 11807 focus: null, 11808 open: null, 11809 resize: null, 11810 resizeStart: null, 11811 resizeStop: null 11812 }, 11813 11814 sizeRelatedOptions: { 11815 buttons: true, 11816 height: true, 11817 maxHeight: true, 11818 maxWidth: true, 11819 minHeight: true, 11820 minWidth: true, 11821 width: true 11822 }, 11823 11824 resizableRelatedOptions: { 11825 maxHeight: true, 11826 maxWidth: true, 11827 minHeight: true, 11828 minWidth: true 11829 }, 11830 11831 _create: function() { 11832 this.originalCss = { 11833 display: this.element[0].style.display, 11834 width: this.element[0].style.width, 11835 minHeight: this.element[0].style.minHeight, 11836 maxHeight: this.element[0].style.maxHeight, 11837 height: this.element[0].style.height 11838 }; 11839 this.originalPosition = { 11840 parent: this.element.parent(), 11841 index: this.element.parent().children().index(this.element) 11842 }; 11843 this.originalTitle = this.element.attr("title"); 11844 if (this.options.title == null && this.originalTitle != null) { 11845 this.options.title = this.originalTitle; 11846 } 11847 11848 // Dialogs can't be disabled 11849 if (this.options.disabled) { 11850 this.options.disabled = false; 11851 } 11852 11853 this._createWrapper(); 11854 11855 this.element 11856 .show() 11857 .removeAttr("title") 11858 .appendTo(this.uiDialog); 11859 11860 this._addClass("ui-dialog-content", "ui-widget-content"); 11861 11862 this._createTitlebar(); 11863 this._createButtonPane(); 11864 11865 if (this.options.draggable && $.fn.draggable) { 11866 this._makeDraggable(); 11867 } 11868 if (this.options.resizable && $.fn.resizable) { 11869 this._makeResizable(); 11870 } 11871 11872 this._isOpen = false; 11873 11874 this._trackFocus(); 11875 }, 11876 11877 _init: function() { 11878 if (this.options.autoOpen) { 11879 this.open(); 11880 } 11881 }, 11882 11883 _appendTo: function() { 11884 var element = this.options.appendTo; 11885 if (element && (element.jquery || element.nodeType)) { 11886 return $(element); 11887 } 11888 return this.document.find(element || "body").eq(0); 11889 }, 11890 11891 _destroy: function() { 11892 var next, 11893 originalPosition = this.originalPosition; 11894 11895 this._untrackInstance(); 11896 this._destroyOverlay(); 11897 11898 this.element 11899 .removeUniqueId() 11900 .css(this.originalCss) 11901 11902 // Without detaching first, the following becomes really slow 11903 .detach(); 11904 11905 this.uiDialog.remove(); 11906 11907 if (this.originalTitle) { 11908 this.element.attr("title", this.originalTitle); 11909 } 11910 11911 next = originalPosition.parent.children().eq(originalPosition.index); 11912 11913 // Don't try to place the dialog next to itself (#8613) 11914 if (next.length && next[0] !== this.element[0]) { 11915 next.before(this.element); 11916 } else { 11917 originalPosition.parent.append(this.element); 11918 } 11919 }, 11920 11921 widget: function() { 11922 return this.uiDialog; 11923 }, 11924 11925 disable: $.noop, 11926 enable: $.noop, 11927 11928 close: function(event) { 11929 var that = this; 11930 11931 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 11932 return; 11933 } 11934 11935 this._isOpen = false; 11936 this._focusedElement = null; 11937 this._destroyOverlay(); 11938 this._untrackInstance(); 11939 11940 if (!this.opener.filter(":focusable").trigger("focus").length) { 11941 11942 // Hiding a focused element doesn't trigger blur in WebKit 11943 // so in case we have nothing to focus on, explicitly blur the active element 11944 // https://bugs.webkit.org/show_bug.cgi?id=47182 11945 $.ui.safeBlur($.ui.safeActiveElement(this.document[0])); 11946 } 11947 11948 this._hide(this.uiDialog, this.options.hide, function() { 11949 that._trigger("close", event); 11950 }); 11951 }, 11952 11953 isOpen: function() { 11954 return this._isOpen; 11955 }, 11956 11957 moveToTop: function() { 11958 this._moveToTop(); 11959 }, 11960 11961 _moveToTop: function(event, silent) { 11962 var moved = false, 11963 zIndices = this.uiDialog.siblings(".ui-front:visible").map(function() { 11964 return +$(this).css("z-index"); 11965 }).get(), 11966 zIndexMax = Math.max.apply(null, zIndices); 11967 11968 if (zIndexMax >= +this.uiDialog.css("z-index")) { 11969 this.uiDialog.css("z-index", zIndexMax + 1); 11970 moved = true; 11971 } 11972 11973 if (moved && !silent) { 11974 this._trigger("focus", event); 11975 } 11976 return moved; 11977 }, 11978 11979 open: function() { 11980 var that = this; 11981 if (this._isOpen) { 11982 if (this._moveToTop()) { 11983 this._focusTabbable(); 11984 } 11985 return; 11986 } 11987 11988 this._isOpen = true; 11989 this.opener = $($.ui.safeActiveElement(this.document[0])); 11990 11991 this._size(); 11992 this._position(); 11993 this._createOverlay(); 11994 this._moveToTop(null, true); 11995 11996 // Ensure the overlay is moved to the top with the dialog, but only when 11997 // opening. The overlay shouldn't move after the dialog is open so that 11998 // modeless dialogs opened after the modal dialog stack properly. 11999 if (this.overlay) { 12000 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 12001 } 12002 12003 this._show(this.uiDialog, this.options.show, function() { 12004 that._focusTabbable(); 12005 that._trigger("focus"); 12006 }); 12007 12008 // Track the dialog immediately upon openening in case a focus event 12009 // somehow occurs outside of the dialog before an element inside the 12010 // dialog is focused (#10152) 12011 this._makeFocusTarget(); 12012 12013 this._trigger("open"); 12014 }, 12015 12016 _focusTabbable: function() { 12017 12018 // Set focus to the first match: 12019 // 1. An element that was focused previously 12020 // 2. First element inside the dialog matching [autofocus] 12021 // 3. Tabbable element inside the content element 12022 // 4. Tabbable element inside the buttonpane 12023 // 5. The close button 12024 // 6. The dialog itself 12025 var hasFocus = this._focusedElement; 12026 if (!hasFocus) { 12027 hasFocus = this.element.find("[autofocus]"); 12028 } 12029 if (!hasFocus.length) { 12030 hasFocus = this.element.find(":tabbable"); 12031 } 12032 if (!hasFocus.length) { 12033 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 12034 } 12035 if (!hasFocus.length) { 12036 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 12037 } 12038 if (!hasFocus.length) { 12039 hasFocus = this.uiDialog; 12040 } 12041 hasFocus.eq(0).trigger("focus"); 12042 }, 12043 12044 _keepFocus: function(event) { 12045 function checkFocus() { 12046 var activeElement = $.ui.safeActiveElement(this.document[0]), 12047 isActive = this.uiDialog[0] === activeElement || 12048 $.contains(this.uiDialog[0], activeElement); 12049 if (!isActive) { 12050 this._focusTabbable(); 12051 } 12052 } 12053 event.preventDefault(); 12054 checkFocus.call(this); 12055 12056 // support: IE 12057 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 12058 // so we check again later 12059 this._delay(checkFocus); 12060 }, 12061 12062 _createWrapper: function() { 12063 this.uiDialog = $("<div>") 12064 .hide() 12065 .attr({ 12066 12067 // Setting tabIndex makes the div focusable 12068 tabIndex: -1, 12069 role: "dialog" 12070 }) 12071 .appendTo(this._appendTo()); 12072 12073 this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front"); 12074 this._on(this.uiDialog, { 12075 keydown: function(event) { 12076 if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12077 event.keyCode === $.ui.keyCode.ESCAPE) { 12078 event.preventDefault(); 12079 this.close(event); 12080 return; 12081 } 12082 12083 // Prevent tabbing out of dialogs 12084 if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) { 12085 return; 12086 } 12087 var tabbables = this.uiDialog.find(":tabbable"), 12088 first = tabbables.filter(":first"), 12089 last = tabbables.filter(":last"); 12090 12091 if ((event.target === last[0] || event.target === this.uiDialog[0]) && 12092 !event.shiftKey) { 12093 this._delay(function() { 12094 first.trigger("focus"); 12095 }); 12096 event.preventDefault(); 12097 } else if ((event.target === first[0] || 12098 event.target === this.uiDialog[0]) && event.shiftKey) { 12099 this._delay(function() { 12100 last.trigger("focus"); 12101 }); 12102 event.preventDefault(); 12103 } 12104 }, 12105 mousedown: function(event) { 12106 if (this._moveToTop(event)) { 12107 this._focusTabbable(); 12108 } 12109 } 12110 }); 12111 12112 // We assume that any existing aria-describedby attribute means 12113 // that the dialog content is marked up properly 12114 // otherwise we brute force the content as the description 12115 if (!this.element.find("[aria-describedby]").length) { 12116 this.uiDialog.attr({ 12117 "aria-describedby": this.element.uniqueId().attr("id") 12118 }); 12119 } 12120 }, 12121 12122 _createTitlebar: function() { 12123 var uiDialogTitle; 12124 12125 this.uiDialogTitlebar = $("<div>"); 12126 this._addClass(this.uiDialogTitlebar, 12127 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix"); 12128 this._on(this.uiDialogTitlebar, { 12129 mousedown: function(event) { 12130 12131 // Don't prevent click on close button (#8838) 12132 // Focusing a dialog that is partially scrolled out of view 12133 // causes the browser to scroll it into view, preventing the click event 12134 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 12135 12136 // Dialog isn't getting focus when dragging (#8063) 12137 this.uiDialog.trigger("focus"); 12138 } 12139 } 12140 }); 12141 12142 // Support: IE 12143 // Use type="button" to prevent enter keypresses in textboxes from closing the 12144 // dialog in IE (#9312) 12145 this.uiDialogTitlebarClose = $("<button type='button'></button>") 12146 .button({ 12147 label: $("<a>").text(this.options.closeText).html(), 12148 icon: "ui-icon-closethick", 12149 showLabel: false 12150 }) 12151 .appendTo(this.uiDialogTitlebar); 12152 12153 this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close"); 12154 this._on(this.uiDialogTitlebarClose, { 12155 click: function(event) { 12156 event.preventDefault(); 12157 this.close(event); 12158 } 12159 }); 12160 12161 uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar); 12162 this._addClass(uiDialogTitle, "ui-dialog-title"); 12163 this._title(uiDialogTitle); 12164 12165 this.uiDialogTitlebar.prependTo(this.uiDialog); 12166 12167 this.uiDialog.attr({ 12168 "aria-labelledby": uiDialogTitle.attr("id") 12169 }); 12170 }, 12171 12172 _title: function(title) { 12173 if (this.options.title) { 12174 title.text(this.options.title); 12175 } else { 12176 title.html(" "); 12177 } 12178 }, 12179 12180 _createButtonPane: function() { 12181 this.uiDialogButtonPane = $("<div>"); 12182 this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane", 12183 "ui-widget-content ui-helper-clearfix"); 12184 12185 this.uiButtonSet = $("<div>") 12186 .appendTo(this.uiDialogButtonPane); 12187 this._addClass(this.uiButtonSet, "ui-dialog-buttonset"); 12188 12189 this._createButtons(); 12190 }, 12191 12192 _createButtons: function() { 12193 var that = this, 12194 buttons = this.options.buttons; 12195 12196 // If we already have a button pane, remove it 12197 this.uiDialogButtonPane.remove(); 12198 this.uiButtonSet.empty(); 12199 12200 if ($.isEmptyObject(buttons) || ($.isArray(buttons) && !buttons.length)) { 12201 this._removeClass(this.uiDialog, "ui-dialog-buttons"); 12202 return; 12203 } 12204 12205 $.each(buttons, function(name, props) { 12206 var click, buttonOptions; 12207 props = $.isFunction(props) ? { click: props, text: name } : 12208 props; 12209 12210 // Default to a non-submitting button 12211 props = $.extend({ type: "button" }, props); 12212 12213 // Change the context for the click callback to be the main element 12214 click = props.click; 12215 buttonOptions = { 12216 icon: props.icon, 12217 iconPosition: props.iconPosition, 12218 showLabel: props.showLabel, 12219 12220 // Deprecated options 12221 icons: props.icons, 12222 text: props.text 12223 }; 12224 12225 delete props.click; 12226 delete props.icon; 12227 delete props.iconPosition; 12228 delete props.showLabel; 12229 12230 // Deprecated options 12231 delete props.icons; 12232 if (typeof props.text === "boolean") { 12233 delete props.text; 12234 } 12235 12236 $("<button></button>", props) 12237 .button(buttonOptions) 12238 .appendTo(that.uiButtonSet) 12239 .on("click", function() { 12240 click.apply(that.element[0], arguments); 12241 }); 12242 }); 12243 this._addClass(this.uiDialog, "ui-dialog-buttons"); 12244 this.uiDialogButtonPane.appendTo(this.uiDialog); 12245 }, 12246 12247 _makeDraggable: function() { 12248 var that = this, 12249 options = this.options; 12250 12251 function filteredUi(ui) { 12252 return { 12253 position: ui.position, 12254 offset: ui.offset 12255 }; 12256 } 12257 12258 this.uiDialog.draggable({ 12259 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12260 handle: ".ui-dialog-titlebar", 12261 containment: "document", 12262 start: function(event, ui) { 12263 that._addClass($(this), "ui-dialog-dragging"); 12264 that._blockFrames(); 12265 that._trigger("dragStart", event, filteredUi(ui)); 12266 }, 12267 drag: function(event, ui) { 12268 that._trigger("drag", event, filteredUi(ui)); 12269 }, 12270 stop: function(event, ui) { 12271 var left = ui.offset.left - that.document.scrollLeft(), 12272 top = ui.offset.top - that.document.scrollTop(); 12273 12274 options.position = { 12275 my: "left top", 12276 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12277 "top" + (top >= 0 ? "+" : "") + top, 12278 of: that.window 12279 }; 12280 that._removeClass($(this), "ui-dialog-dragging"); 12281 that._unblockFrames(); 12282 that._trigger("dragStop", event, filteredUi(ui)); 12283 } 12284 }); 12285 }, 12286 12287 _makeResizable: function() { 12288 var that = this, 12289 options = this.options, 12290 handles = options.resizable, 12291 12292 // .ui-resizable has position: relative defined in the stylesheet 12293 // but dialogs have to use absolute or fixed positioning 12294 position = this.uiDialog.css("position"), 12295 resizeHandles = typeof handles === "string" ? 12296 handles : 12297 "n,e,s,w,se,sw,ne,nw"; 12298 12299 function filteredUi(ui) { 12300 return { 12301 originalPosition: ui.originalPosition, 12302 originalSize: ui.originalSize, 12303 position: ui.position, 12304 size: ui.size 12305 }; 12306 } 12307 12308 this.uiDialog.resizable({ 12309 cancel: ".ui-dialog-content", 12310 containment: "document", 12311 alsoResize: this.element, 12312 maxWidth: options.maxWidth, 12313 maxHeight: options.maxHeight, 12314 minWidth: options.minWidth, 12315 minHeight: this._minHeight(), 12316 handles: resizeHandles, 12317 start: function(event, ui) { 12318 that._addClass($(this), "ui-dialog-resizing"); 12319 that._blockFrames(); 12320 that._trigger("resizeStart", event, filteredUi(ui)); 12321 }, 12322 resize: function(event, ui) { 12323 that._trigger("resize", event, filteredUi(ui)); 12324 }, 12325 stop: function(event, ui) { 12326 var offset = that.uiDialog.offset(), 12327 left = offset.left - that.document.scrollLeft(), 12328 top = offset.top - that.document.scrollTop(); 12329 12330 options.height = that.uiDialog.height(); 12331 options.width = that.uiDialog.width(); 12332 options.position = { 12333 my: "left top", 12334 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12335 "top" + (top >= 0 ? "+" : "") + top, 12336 of: that.window 12337 }; 12338 that._removeClass($(this), "ui-dialog-resizing"); 12339 that._unblockFrames(); 12340 that._trigger("resizeStop", event, filteredUi(ui)); 12341 } 12342 }) 12343 .css("position", position); 12344 }, 12345 12346 _trackFocus: function() { 12347 this._on(this.widget(), { 12348 focusin: function(event) { 12349 this._makeFocusTarget(); 12350 this._focusedElement = $(event.target); 12351 } 12352 }); 12353 }, 12354 12355 _makeFocusTarget: function() { 12356 this._untrackInstance(); 12357 this._trackingInstances().unshift(this); 12358 }, 12359 12360 _untrackInstance: function() { 12361 var instances = this._trackingInstances(), 12362 exists = $.inArray(this, instances); 12363 if (exists !== -1) { 12364 instances.splice(exists, 1); 12365 } 12366 }, 12367 12368 _trackingInstances: function() { 12369 var instances = this.document.data("ui-dialog-instances"); 12370 if (!instances) { 12371 instances = []; 12372 this.document.data("ui-dialog-instances", instances); 12373 } 12374 return instances; 12375 }, 12376 12377 _minHeight: function() { 12378 var options = this.options; 12379 12380 return options.height === "auto" ? 12381 options.minHeight : 12382 Math.min(options.minHeight, options.height); 12383 }, 12384 12385 _position: function() { 12386 12387 // Need to show the dialog to get the actual offset in the position plugin 12388 var isVisible = this.uiDialog.is(":visible"); 12389 if (!isVisible) { 12390 this.uiDialog.show(); 12391 } 12392 this.uiDialog.position(this.options.position); 12393 if (!isVisible) { 12394 this.uiDialog.hide(); 12395 } 12396 }, 12397 12398 _setOptions: function(options) { 12399 var that = this, 12400 resize = false, 12401 resizableOptions = {}; 12402 12403 $.each(options, function(key, value) { 12404 that._setOption(key, value); 12405 12406 if (key in that.sizeRelatedOptions) { 12407 resize = true; 12408 } 12409 if (key in that.resizableRelatedOptions) { 12410 resizableOptions[key] = value; 12411 } 12412 }); 12413 12414 if (resize) { 12415 this._size(); 12416 this._position(); 12417 } 12418 if (this.uiDialog.is(":data(ui-resizable)")) { 12419 this.uiDialog.resizable("option", resizableOptions); 12420 } 12421 }, 12422 12423 _setOption: function(key, value) { 12424 var isDraggable, isResizable, 12425 uiDialog = this.uiDialog; 12426 12427 if (key === "disabled") { 12428 return; 12429 } 12430 12431 this._super(key, value); 12432 12433 if (key === "appendTo") { 12434 this.uiDialog.appendTo(this._appendTo()); 12435 } 12436 12437 if (key === "buttons") { 12438 this._createButtons(); 12439 } 12440 12441 if (key === "closeText") { 12442 this.uiDialogTitlebarClose.button({ 12443 12444 // Ensure that we always pass a string 12445 label: $("<a>").text("" + this.options.closeText).html() 12446 }); 12447 } 12448 12449 if (key === "draggable") { 12450 isDraggable = uiDialog.is(":data(ui-draggable)"); 12451 if (isDraggable && !value) { 12452 uiDialog.draggable("destroy"); 12453 } 12454 12455 if (!isDraggable && value) { 12456 this._makeDraggable(); 12457 } 12458 } 12459 12460 if (key === "position") { 12461 this._position(); 12462 } 12463 12464 if (key === "resizable") { 12465 12466 // currently resizable, becoming non-resizable 12467 isResizable = uiDialog.is(":data(ui-resizable)"); 12468 if (isResizable && !value) { 12469 uiDialog.resizable("destroy"); 12470 } 12471 12472 // Currently resizable, changing handles 12473 if (isResizable && typeof value === "string") { 12474 uiDialog.resizable("option", "handles", value); 12475 } 12476 12477 // Currently non-resizable, becoming resizable 12478 if (!isResizable && value !== false) { 12479 this._makeResizable(); 12480 } 12481 } 12482 12483 if (key === "title") { 12484 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 12485 } 12486 }, 12487 12488 _size: function() { 12489 12490 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12491 // divs will both have width and height set, so we need to reset them 12492 var nonContentHeight, minContentHeight, maxContentHeight, 12493 options = this.options; 12494 12495 // Reset content sizing 12496 this.element.show().css({ 12497 width: "auto", 12498 minHeight: 0, 12499 maxHeight: "none", 12500 height: 0 12501 }); 12502 12503 if (options.minWidth > options.width) { 12504 options.width = options.minWidth; 12505 } 12506 12507 // Reset wrapper sizing 12508 // determine the height of all the non-content elements 12509 nonContentHeight = this.uiDialog.css({ 12510 height: "auto", 12511 width: options.width 12512 }) 12513 .outerHeight(); 12514 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 12515 maxContentHeight = typeof options.maxHeight === "number" ? 12516 Math.max(0, options.maxHeight - nonContentHeight) : 12517 "none"; 12518 12519 if (options.height === "auto") { 12520 this.element.css({ 12521 minHeight: minContentHeight, 12522 maxHeight: maxContentHeight, 12523 height: "auto" 12524 }); 12525 } else { 12526 this.element.height(Math.max(0, options.height - nonContentHeight)); 12527 } 12528 12529 if (this.uiDialog.is(":data(ui-resizable)")) { 12530 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 12531 } 12532 }, 12533 12534 _blockFrames: function() { 12535 this.iframeBlocks = this.document.find("iframe").map(function() { 12536 var iframe = $(this); 12537 12538 return $("<div>") 12539 .css({ 12540 position: "absolute", 12541 width: iframe.outerWidth(), 12542 height: iframe.outerHeight() 12543 }) 12544 .appendTo(iframe.parent()) 12545 .offset(iframe.offset())[0]; 12546 }); 12547 }, 12548 12549 _unblockFrames: function() { 12550 if (this.iframeBlocks) { 12551 this.iframeBlocks.remove(); 12552 delete this.iframeBlocks; 12553 } 12554 }, 12555 12556 _allowInteraction: function(event) { 12557 if ($(event.target).closest(".ui-dialog").length) { 12558 return true; 12559 } 12560 12561 // TODO: Remove hack when datepicker implements 12562 // the .ui-front logic (#8989) 12563 return !!$(event.target).closest(".ui-datepicker").length; 12564 }, 12565 12566 _createOverlay: function() { 12567 if (!this.options.modal) { 12568 return; 12569 } 12570 12571 // We use a delay in case the overlay is created from an 12572 // event that we're going to be cancelling (#2804) 12573 var isOpening = true; 12574 this._delay(function() { 12575 isOpening = false; 12576 }); 12577 12578 if (!this.document.data("ui-dialog-overlays")) { 12579 12580 // Prevent use of anchors and inputs 12581 // Using _on() for an event handler shared across many instances is 12582 // safe because the dialogs stack and must be closed in reverse order 12583 this._on(this.document, { 12584 focusin: function(event) { 12585 if (isOpening) { 12586 return; 12587 } 12588 12589 if (!this._allowInteraction(event)) { 12590 event.preventDefault(); 12591 this._trackingInstances()[0]._focusTabbable(); 12592 } 12593 } 12594 }); 12595 } 12596 12597 this.overlay = $("<div>") 12598 .appendTo(this._appendTo()); 12599 12600 this._addClass(this.overlay, null, "ui-widget-overlay ui-front"); 12601 this._on(this.overlay, { 12602 mousedown: "_keepFocus" 12603 }); 12604 this.document.data("ui-dialog-overlays", 12605 (this.document.data("ui-dialog-overlays") || 0) + 1); 12606 }, 12607 12608 _destroyOverlay: function() { 12609 if (!this.options.modal) { 12610 return; 12611 } 12612 12613 if (this.overlay) { 12614 var overlays = this.document.data("ui-dialog-overlays") - 1; 12615 12616 if (!overlays) { 12617 this._off(this.document, "focusin"); 12618 this.document.removeData("ui-dialog-overlays"); 12619 } else { 12620 this.document.data("ui-dialog-overlays", overlays); 12621 } 12622 12623 this.overlay.remove(); 12624 this.overlay = null; 12625 } 12626 } 12627 }); 12628 12629 // DEPRECATED 12630 // TODO: switch return back to widget declaration at top of file when this is removed 12631 if ($.uiBackCompat !== false) { 12632 12633 // Backcompat for dialogClass option 12634 $.widget("ui.dialog", $.ui.dialog, { 12635 options: { 12636 dialogClass: "" 12637 }, 12638 _createWrapper: function() { 12639 this._super(); 12640 this.uiDialog.addClass(this.options.dialogClass); 12641 }, 12642 _setOption: function(key, value) { 12643 if (key === "dialogClass") { 12644 this.uiDialog 12645 .removeClass(this.options.dialogClass) 12646 .addClass(value); 12647 } 12648 this._superApply(arguments); 12649 } 12650 }); 12651 } 12652 12653 var widgetsDialog = $.ui.dialog; 12654 12655 12656 /*! 12657 * jQuery UI Progressbar 1.12.1 12658 * http://jqueryui.com 12659 * 12660 * Copyright jQuery Foundation and other contributors 12661 * Released under the MIT license. 12662 * http://jquery.org/license 12663 */ 12664 12665 //>>label: Progressbar 12666 //>>group: Widgets 12667 // jscs:disable maximumLineLength 12668 //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 12669 // jscs:enable maximumLineLength 12670 //>>docs: http://api.jqueryui.com/progressbar/ 12671 //>>demos: http://jqueryui.com/progressbar/ 12672 //>>css.structure: ../../themes/base/core.css 12673 //>>css.structure: ../../themes/base/progressbar.css 12674 //>>css.theme: ../../themes/base/theme.css 12675 12676 12677 12678 var widgetsProgressbar = $.widget("ui.progressbar", { 12679 version: "1.12.1", 12680 options: { 12681 classes: { 12682 "ui-progressbar": "ui-corner-all", 12683 "ui-progressbar-value": "ui-corner-left", 12684 "ui-progressbar-complete": "ui-corner-right" 12685 }, 12686 max: 100, 12687 value: 0, 12688 12689 change: null, 12690 complete: null 12691 }, 12692 12693 min: 0, 12694 12695 _create: function() { 12696 12697 // Constrain initial value 12698 this.oldValue = this.options.value = this._constrainedValue(); 12699 12700 this.element.attr({ 12701 12702 // Only set static values; aria-valuenow and aria-valuemax are 12703 // set inside _refreshValue() 12704 role: "progressbar", 12705 "aria-valuemin": this.min 12706 }); 12707 this._addClass("ui-progressbar", "ui-widget ui-widget-content"); 12708 12709 this.valueDiv = $("<div>").appendTo(this.element); 12710 this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header"); 12711 this._refreshValue(); 12712 }, 12713 12714 _destroy: function() { 12715 this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"); 12716 12717 this.valueDiv.remove(); 12718 }, 12719 12720 value: function(newValue) { 12721 if (newValue === undefined) { 12722 return this.options.value; 12723 } 12724 12725 this.options.value = this._constrainedValue(newValue); 12726 this._refreshValue(); 12727 }, 12728 12729 _constrainedValue: function(newValue) { 12730 if (newValue === undefined) { 12731 newValue = this.options.value; 12732 } 12733 12734 this.indeterminate = newValue === false; 12735 12736 // Sanitize value
vendor: 4,650 bytes, lines 12737-12882
12737 if (typeof newValue !== "number") { 12738 newValue = 0; 12739 } 12740 12741 return this.indeterminate ? false : 12742 Math.min(this.options.max, Math.max(this.min, newValue)); 12743 }, 12744 12745 _setOptions: function(options) { 12746 12747 // Ensure "value" option is set after other values (like max) 12748 var value = options.value; 12749 delete options.value; 12750 12751 this._super(options); 12752 12753 this.options.value = this._constrainedValue(value); 12754 this._refreshValue(); 12755 }, 12756 12757 _setOption: function(key, value) { 12758 if (key === "max") { 12759 12760 // Don't allow a max less than min 12761 value = Math.max(this.min, value); 12762 } 12763 this._super(key, value); 12764 }, 12765 12766 _setOptionDisabled: function(value) { 12767 this._super(value); 12768 12769 this.element.attr("aria-disabled", value); 12770 this._toggleClass(null, "ui-state-disabled", !!value); 12771 }, 12772 12773 _percentage: function() { 12774 return this.indeterminate ? 12775 100 : 12776 100 * (this.options.value - this.min) / (this.options.max - this.min); 12777 }, 12778 12779 _refreshValue: function() { 12780 var value = this.options.value, 12781 percentage = this._percentage(); 12782 12783 this.valueDiv 12784 .toggle(this.indeterminate || value > this.min) 12785 .width(percentage.toFixed(0) + "%"); 12786 12787 this 12788 ._toggleClass(this.valueDiv, "ui-progressbar-complete", null, 12789 value === this.options.max) 12790 ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate); 12791 12792 if (this.indeterminate) { 12793 this.element.removeAttr("aria-valuenow"); 12794 if (!this.overlayDiv) { 12795 this.overlayDiv = $("<div>").appendTo(this.valueDiv); 12796 this._addClass(this.overlayDiv, "ui-progressbar-overlay"); 12797 } 12798 } else { 12799 this.element.attr({ 12800 "aria-valuemax": this.options.max, 12801 "aria-valuenow": value 12802 }); 12803 if (this.overlayDiv) { 12804 this.overlayDiv.remove(); 12805 this.overlayDiv = null; 12806 } 12807 } 12808 12809 if (this.oldValue !== value) { 12810 this.oldValue = value; 12811 this._trigger("change"); 12812 } 12813 if (value === this.options.max) { 12814 this._trigger("complete"); 12815 } 12816 } 12817 }); 12818 12819 12820 /*! 12821 * jQuery UI Selectmenu 1.12.1 12822 * http://jqueryui.com 12823 * 12824 * Copyright jQuery Foundation and other contributors 12825 * Released under the MIT license. 12826 * http://jquery.org/license 12827 */ 12828 12829 //>>label: Selectmenu 12830 //>>group: Widgets 12831 // jscs:disable maximumLineLength 12832 //>>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. 12833 // jscs:enable maximumLineLength 12834 //>>docs: http://api.jqueryui.com/selectmenu/ 12835 //>>demos: http://jqueryui.com/selectmenu/ 12836 //>>css.structure: ../../themes/base/core.css 12837 //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 12838 //>>css.theme: ../../themes/base/theme.css 12839 12840 12841 12842 var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, { 12843 version: "1.12.1", 12844 defaultElement: "<select>", 12845 options: { 12846 appendTo: null, 12847 classes: { 12848 "ui-selectmenu-button-open": "ui-corner-top", 12849 "ui-selectmenu-button-closed": "ui-corner-all" 12850 }, 12851 disabled: null, 12852 icons: { 12853 button: "ui-icon-triangle-1-s" 12854 }, 12855 position: { 12856 my: "left top", 12857 at: "left bottom", 12858 collision: "none" 12859 }, 12860 width: false, 12861 12862 // Callbacks 12863 change: null, 12864 close: null, 12865 focus: null, 12866 open: null, 12867 select: null 12868 }, 12869 12870 _create: function() { 12871 var selectmenuId = this.element.uniqueId().attr("id"); 12872 this.ids = { 12873 element: selectmenuId, 12874 button: selectmenuId + "-button", 12875 menu: selectmenuId + "-menu" 12876 }; 12877 12878 this._drawButton(); 12879 this._drawMenu(); 12880 this._bindFormResetHandler(); 12881 12882 this._rendered = false;
vendor: 4,358 bytes, lines 12883-12997
12883 this.menuItems = $(); 12884 }, 12885 12886 _drawButton: function() { 12887 var icon, 12888 that = this, 12889 item = this._parseOption( 12890 this.element.find("option:selected"), 12891 this.element[0].selectedIndex 12892 ); 12893 12894 // Associate existing label with the new button 12895 this.labels = this.element.labels().attr("for", this.ids.button); 12896 this._on(this.labels, { 12897 click: function(event) { 12898 this.button.focus(); 12899 event.preventDefault(); 12900 } 12901 }); 12902 12903 // Hide original select element 12904 this.element.hide(); 12905 12906 // Create button 12907 this.button = $("<span>", { 12908 tabindex: this.options.disabled ? -1 : 0, 12909 id: this.ids.button, 12910 role: "combobox", 12911 "aria-expanded": "false", 12912 "aria-autocomplete": "list", 12913 "aria-owns": this.ids.menu, 12914 "aria-haspopup": "true", 12915 title: this.element.attr("title") 12916 }) 12917 .insertAfter(this.element); 12918 12919 this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 12920 "ui-button ui-widget"); 12921 12922 icon = $("<span>").appendTo(this.button); 12923 this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button); 12924 this.buttonItem = this._renderButtonItem(item) 12925 .appendTo(this.button); 12926 12927 if (this.options.width !== false) { 12928 this._resizeButton(); 12929 } 12930 12931 this._on(this.button, this._buttonEvents); 12932 this.button.one("focusin", function() { 12933 12934 // Delay rendering the menu items until the button receives focus. 12935 // The menu may have already been rendered via a programmatic open. 12936 if (!that._rendered) { 12937 that._refreshMenu(); 12938 } 12939 }); 12940 }, 12941 12942 _drawMenu: function() { 12943 var that = this; 12944 12945 // Create menu 12946 this.menu = $("<ul>", { 12947 "aria-hidden": "true", 12948 "aria-labelledby": this.ids.button, 12949 id: this.ids.menu 12950 }); 12951 12952 // Wrap menu 12953 this.menuWrap = $("<div>").append(this.menu); 12954 this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front"); 12955 this.menuWrap.appendTo(this._appendTo()); 12956 12957 // Initialize menu widget 12958 this.menuInstance = this.menu 12959 .menu({ 12960 classes: { 12961 "ui-menu": "ui-corner-bottom" 12962 }, 12963 role: "listbox", 12964 select: function(event, ui) { 12965 event.preventDefault(); 12966 12967 // Support: IE8 12968 // If the item was selected via a click, the text selection 12969 // will be destroyed in IE 12970 that._setSelection(); 12971 12972 that._select(ui.item.data("ui-selectmenu-item"), event); 12973 }, 12974 focus: function(event, ui) { 12975 var item = ui.item.data("ui-selectmenu-item"); 12976 12977 // Prevent inital focus from firing and check if its a newly focused item 12978 if (that.focusIndex != null && item.index !== that.focusIndex) { 12979 that._trigger("focus", event, { item: item }); 12980 if (!that.isOpen) { 12981 that._select(item, event); 12982 } 12983 } 12984 that.focusIndex = item.index; 12985 12986 that.button.attr("aria-activedescendant", 12987 that.menuItems.eq(item.index).attr("id")); 12988 } 12989 }) 12990 .menu("instance"); 12991 12992 // Don't close the menu on mouseleave 12993 this.menuInstance._off(this.menu, "mouseleave"); 12994 12995 // Cancel the menu's collapseAll on document click 12996 this.menuInstance._closeOnDocumentClick = function() { 12997 return false;
vendor: 7,847 bytes, lines 12998-13261
12998 }; 12999 13000 // Selects often contain empty items, but never contain dividers 13001 this.menuInstance._isDivider = function() { 13002 return false; 13003 }; 13004 }, 13005 13006 refresh: function() { 13007 this._refreshMenu(); 13008 this.buttonItem.replaceWith( 13009 this.buttonItem = this._renderButtonItem( 13010 13011 // Fall back to an empty object in case there are no options 13012 this._getSelectedItem().data("ui-selectmenu-item") || {} 13013 ) 13014 ); 13015 if (this.options.width === null) { 13016 this._resizeButton(); 13017 } 13018 }, 13019 13020 _refreshMenu: function() { 13021 var item, 13022 options = this.element.find("option"); 13023 13024 this.menu.empty(); 13025 13026 this._parseOptions(options); 13027 this._renderMenu(this.menu, this.items); 13028 13029 this.menuInstance.refresh(); 13030 this.menuItems = this.menu.find("li") 13031 .not(".ui-selectmenu-optgroup") 13032 .find(".ui-menu-item-wrapper"); 13033 13034 this._rendered = true; 13035 13036 if (!options.length) { 13037 return; 13038 } 13039 13040 item = this._getSelectedItem(); 13041 13042 // Update the menu to have the correct item focused 13043 this.menuInstance.focus(null, item); 13044 this._setAria(item.data("ui-selectmenu-item")); 13045 13046 // Set disabled state 13047 this._setOption("disabled", this.element.prop("disabled")); 13048 }, 13049 13050 open: function(event) { 13051 if (this.options.disabled) { 13052 return; 13053 } 13054 13055 // If this is the first time the menu is being opened, render the items 13056 if (!this._rendered) { 13057 this._refreshMenu(); 13058 } else { 13059 13060 // Menu clears focus on close, reset focus to selected item 13061 this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active"); 13062 this.menuInstance.focus(null, this._getSelectedItem()); 13063 } 13064 13065 // If there are no options, don't open the menu 13066 if (!this.menuItems.length) { 13067 return; 13068 } 13069 13070 this.isOpen = true; 13071 this._toggleAttr(); 13072 this._resizeMenu(); 13073 this._position(); 13074 13075 this._on(this.document, this._documentClick); 13076 13077 this._trigger("open", event); 13078 }, 13079 13080 _position: function() { 13081 this.menuWrap.position($.extend({ of: this.button }, this.options.position)); 13082 }, 13083 13084 close: function(event) { 13085 if (!this.isOpen) { 13086 return; 13087 } 13088 13089 this.isOpen = false; 13090 this._toggleAttr(); 13091 13092 this.range = null; 13093 this._off(this.document); 13094 13095 this._trigger("close", event); 13096 }, 13097 13098 widget: function() { 13099 return this.button; 13100 }, 13101 13102 menuWidget: function() { 13103 return this.menu; 13104 }, 13105 13106 _renderButtonItem: function(item) { 13107 var buttonItem = $("<span>"); 13108 13109 this._setText(buttonItem, item.label); 13110 this._addClass(buttonItem, "ui-selectmenu-text"); 13111 13112 return buttonItem; 13113 }, 13114 13115 _renderMenu: function(ul, items) { 13116 var that = this, 13117 currentOptgroup = ""; 13118 13119 $.each(items, function(index, item) { 13120 var li; 13121 13122 if (item.optgroup !== currentOptgroup) { 13123 li = $("<li>", { 13124 text: item.optgroup 13125 }); 13126 that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" + 13127 (item.element.parent("optgroup").prop("disabled") ? 13128 " ui-state-disabled" : 13129 "")); 13130 13131 li.appendTo(ul); 13132 13133 currentOptgroup = item.optgroup; 13134 } 13135 13136 that._renderItemData(ul, item); 13137 }); 13138 }, 13139 13140 _renderItemData: function(ul, item) { 13141 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 13142 }, 13143 13144 _renderItem: function(ul, item) { 13145 var li = $("<li>"), 13146 wrapper = $("<div>", { 13147 title: item.element.attr("title") 13148 }); 13149 13150 if (item.disabled) { 13151 this._addClass(li, null, "ui-state-disabled"); 13152 } 13153 this._setText(wrapper, item.label); 13154 13155 return li.append(wrapper).appendTo(ul); 13156 }, 13157 13158 _setText: function(element, value) { 13159 if (value) { 13160 element.text(value); 13161 } else { 13162 element.html(" "); 13163 } 13164 }, 13165 13166 _move: function(direction, event) { 13167 var item, next, 13168 filter = ".ui-menu-item"; 13169 13170 if (this.isOpen) { 13171 item = this.menuItems.eq(this.focusIndex).parent("li"); 13172 } else { 13173 item = this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13174 filter += ":not(.ui-state-disabled)"; 13175 } 13176 13177 if (direction === "first" || direction === "last") { 13178 next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 13179 } else { 13180 next = item[direction + "All"](filter).eq(0); 13181 } 13182 13183 if (next.length) { 13184 this.menuInstance.focus(event, next); 13185 } 13186 }, 13187 13188 _getSelectedItem: function() { 13189 return this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13190 }, 13191 13192 _toggle: function(event) { 13193 this[this.isOpen ? "close" : "open"](event); 13194 }, 13195 13196 _setSelection: function() { 13197 var selection; 13198 13199 if (!this.range) { 13200 return; 13201 } 13202 13203 if (window.getSelection) { 13204 selection = window.getSelection(); 13205 selection.removeAllRanges(); 13206 selection.addRange(this.range); 13207 13208 // Support: IE8 13209 } else { 13210 this.range.select(); 13211 } 13212 13213 // Support: IE 13214 // Setting the text selection kills the button focus in IE, but 13215 // restoring the focus doesn't kill the selection. 13216 this.button.focus(); 13217 }, 13218 13219 _documentClick: { 13220 mousedown: function(event) { 13221 if (!this.isOpen) { 13222 return; 13223 } 13224 13225 if (!$(event.target).closest(".ui-selectmenu-menu, #" + 13226 $.ui.escapeSelector(this.ids.button)).length) { 13227 this.close(event); 13228 } 13229 } 13230 }, 13231 13232 _buttonEvents: { 13233 13234 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 13235 mousedown: function() { 13236 var selection; 13237 13238 if (window.getSelection) { 13239 selection = window.getSelection(); 13240 if (selection.rangeCount) { 13241 this.range = selection.getRangeAt(0); 13242 } 13243 13244 // Support: IE8 13245 } else { 13246 this.range = document.selection.createRange(); 13247 } 13248 }, 13249 13250 click: function(event) { 13251 this._setSelection(); 13252 this._toggle(event); 13253 }, 13254 13255 keydown: function(event) { 13256 var preventDefault = true; 13257 switch (event.keyCode) { 13258 case $.ui.keyCode.TAB: 13259 case $.ui.keyCode.ESCAPE: 13260 this.close(event); 13261 preventDefault = false;
vendor: 6,086 bytes, lines 13262-13437
13262 break; 13263 case $.ui.keyCode.ENTER: 13264 if (this.isOpen) { 13265 this._selectFocusedItem(event); 13266 } 13267 break; 13268 case $.ui.keyCode.UP: 13269 if (event.altKey) { 13270 this._toggle(event); 13271 } else { 13272 this._move("prev", event); 13273 } 13274 break; 13275 case $.ui.keyCode.DOWN: 13276 if (event.altKey) { 13277 this._toggle(event); 13278 } else { 13279 this._move("next", event); 13280 } 13281 break; 13282 case $.ui.keyCode.SPACE: 13283 if (this.isOpen) { 13284 this._selectFocusedItem(event); 13285 } else { 13286 this._toggle(event); 13287 } 13288 break; 13289 case $.ui.keyCode.LEFT: 13290 this._move("prev", event); 13291 break; 13292 case $.ui.keyCode.RIGHT: 13293 this._move("next", event); 13294 break; 13295 case $.ui.keyCode.HOME: 13296 case $.ui.keyCode.PAGE_UP: 13297 this._move("first", event); 13298 break; 13299 case $.ui.keyCode.END: 13300 case $.ui.keyCode.PAGE_DOWN: 13301 this._move("last", event); 13302 break; 13303 default: 13304 this.menu.trigger(event); 13305 preventDefault = false; 13306 } 13307 13308 if (preventDefault) { 13309 event.preventDefault(); 13310 } 13311 } 13312 }, 13313 13314 _selectFocusedItem: function(event) { 13315 var item = this.menuItems.eq(this.focusIndex).parent("li"); 13316 if (!item.hasClass("ui-state-disabled")) { 13317 this._select(item.data("ui-selectmenu-item"), event); 13318 } 13319 }, 13320 13321 _select: function(item, event) { 13322 var oldIndex = this.element[0].selectedIndex; 13323 13324 // Change native select element 13325 this.element[0].selectedIndex = item.index; 13326 this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item)); 13327 this._setAria(item); 13328 this._trigger("select", event, { item: item }); 13329 13330 if (item.index !== oldIndex) { 13331 this._trigger("change", event, { item: item }); 13332 } 13333 13334 this.close(event); 13335 }, 13336 13337 _setAria: function(item) { 13338 var id = this.menuItems.eq(item.index).attr("id"); 13339 13340 this.button.attr({ 13341 "aria-labelledby": id, 13342 "aria-activedescendant": id 13343 }); 13344 this.menu.attr("aria-activedescendant", id); 13345 }, 13346 13347 _setOption: function(key, value) { 13348 if (key === "icons") { 13349 var icon = this.button.find("span.ui-icon"); 13350 this._removeClass(icon, null, this.options.icons.button) 13351 ._addClass(icon, null, value.button); 13352 } 13353 13354 this._super(key, value); 13355 13356 if (key === "appendTo") { 13357 this.menuWrap.appendTo(this._appendTo()); 13358 } 13359 13360 if (key === "width") { 13361 this._resizeButton(); 13362 } 13363 }, 13364 13365 _setOptionDisabled: function(value) { 13366 this._super(value); 13367 13368 this.menuInstance.option("disabled", value); 13369 this.button.attr("aria-disabled", value); 13370 this._toggleClass(this.button, null, "ui-state-disabled", value); 13371 13372 this.element.prop("disabled", value); 13373 if (value) { 13374 this.button.attr("tabindex", -1); 13375 this.close(); 13376 } else { 13377 this.button.attr("tabindex", 0); 13378 } 13379 }, 13380 13381 _appendTo: function() { 13382 var element = this.options.appendTo; 13383 13384 if (element) { 13385 element = element.jquery || element.nodeType ? 13386 $(element) : 13387 this.document.find(element).eq(0); 13388 } 13389 13390 if (!element || !element[0]) { 13391 element = this.element.closest(".ui-front, dialog"); 13392 } 13393 13394 if (!element.length) { 13395 element = this.document[0].body; 13396 } 13397 13398 return element; 13399 }, 13400 13401 _toggleAttr: function() { 13402 this.button.attr("aria-expanded", this.isOpen); 13403 13404 // We can't use two _toggleClass() calls here, because we need to make sure 13405 // we always remove classes first and add them second, otherwise if both classes have the 13406 // same theme class, it will be removed after we add it. 13407 this._removeClass(this.button, "ui-selectmenu-button-" + 13408 (this.isOpen ? "closed" : "open")) 13409 ._addClass(this.button, "ui-selectmenu-button-" + 13410 (this.isOpen ? "open" : "closed")) 13411 ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen); 13412 13413 this.menu.attr("aria-hidden", !this.isOpen); 13414 }, 13415 13416 _resizeButton: function() { 13417 var width = this.options.width; 13418 13419 // For `width: false`, just remove inline style and stop 13420 if (width === false) { 13421 this.button.css("width", ""); 13422 return; 13423 } 13424 13425 // For `width: null`, match the width of the original element 13426 if (width === null) { 13427 width = this.element.show().outerWidth(); 13428 this.element.hide(); 13429 } 13430 13431 this.button.outerWidth(width); 13432 }, 13433 13434 _resizeMenu: function() { 13435 this.menu.outerWidth(Math.max( 13436 this.button.outerWidth(), 13437
vendor: 8,852 bytes, lines 13438-13694
13438 // Support: IE10 13439 // IE10 wraps long text (possibly a rounding bug) 13440 // so we add 1px to avoid the wrapping 13441 this.menu.width("").outerWidth() + 1 13442 )); 13443 }, 13444 13445 _getCreateOptions: function() { 13446 var options = this._super(); 13447 13448 options.disabled = this.element.prop("disabled"); 13449 13450 return options; 13451 }, 13452 13453 _parseOptions: function(options) { 13454 var that = this, 13455 data = []; 13456 options.each(function(index, item) { 13457 data.push(that._parseOption($(item), index)); 13458 }); 13459 this.items = data; 13460 }, 13461 13462 _parseOption: function(option, index) { 13463 var optgroup = option.parent("optgroup"); 13464 13465 return { 13466 element: option, 13467 index: index, 13468 value: option.val(), 13469 label: option.text(), 13470 optgroup: optgroup.attr("label") || "", 13471 disabled: optgroup.prop("disabled") || option.prop("disabled") 13472 }; 13473 }, 13474 13475 _destroy: function() { 13476 this._unbindFormResetHandler(); 13477 this.menuWrap.remove(); 13478 this.button.remove(); 13479 this.element.show(); 13480 this.element.removeUniqueId(); 13481 this.labels.attr("for", this.ids.element); 13482 } 13483 }]); 13484 13485 13486 /*! 13487 * jQuery UI Spinner 1.12.1 13488 * http://jqueryui.com 13489 * 13490 * Copyright jQuery Foundation and other contributors 13491 * Released under the MIT license. 13492 * http://jquery.org/license 13493 */ 13494 13495 //>>label: Spinner 13496 //>>group: Widgets 13497 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. 13498 //>>docs: http://api.jqueryui.com/spinner/ 13499 //>>demos: http://jqueryui.com/spinner/ 13500 //>>css.structure: ../../themes/base/core.css 13501 //>>css.structure: ../../themes/base/spinner.css 13502 //>>css.theme: ../../themes/base/theme.css 13503 13504 13505 13506 function spinnerModifer(fn) { 13507 return function() { 13508 var previous = this.element.val(); 13509 fn.apply(this, arguments); 13510 this._refresh(); 13511 if (previous !== this.element.val()) { 13512 this._trigger("change"); 13513 } 13514 }; 13515 } 13516 13517 $.widget("ui.spinner", { 13518 version: "1.12.1", 13519 defaultElement: "<input>", 13520 widgetEventPrefix: "spin", 13521 options: { 13522 classes: { 13523 "ui-spinner": "ui-corner-all", 13524 "ui-spinner-down": "ui-corner-br", 13525 "ui-spinner-up": "ui-corner-tr" 13526 }, 13527 culture: null, 13528 icons: { 13529 down: "ui-icon-triangle-1-s", 13530 up: "ui-icon-triangle-1-n" 13531 }, 13532 incremental: true, 13533 max: null, 13534 min: null, 13535 numberFormat: null, 13536 page: 10, 13537 step: 1, 13538 13539 change: null, 13540 spin: null, 13541 start: null, 13542 stop: null 13543 }, 13544 13545 _create: function() { 13546 13547 // handle string values that need to be parsed 13548 this._setOption("max", this.options.max); 13549 this._setOption("min", this.options.min); 13550 this._setOption("step", this.options.step); 13551 13552 // Only format if there is a value, prevents the field from being marked 13553 // as invalid in Firefox, see #9573. 13554 if (this.value() !== "") { 13555 13556 // Format the value, but don't constrain. 13557 this._value(this.element.val(), true); 13558 } 13559 13560 this._draw(); 13561 this._on(this._events); 13562 this._refresh(); 13563 13564 // Turning off autocomplete prevents the browser from remembering the 13565 // value when navigating through history, so we re-enable autocomplete 13566 // if the page is unloaded before the widget is destroyed. #7790 13567 this._on(this.window, { 13568 beforeunload: function() { 13569 this.element.removeAttr("autocomplete"); 13570 } 13571 }); 13572 }, 13573 13574 _getCreateOptions: function() { 13575 var options = this._super(); 13576 var element = this.element; 13577 13578 $.each(["min", "max", "step"], function(i, option) { 13579 var value = element.attr(option); 13580 if (value != null && value.length) { 13581 options[option] = value; 13582 } 13583 }); 13584 13585 return options; 13586 }, 13587 13588 _events: { 13589 keydown: function(event) { 13590 if (this._start(event) && this._keydown(event)) { 13591 event.preventDefault(); 13592 } 13593 }, 13594 keyup: "_stop", 13595 focus: function() { 13596 this.previous = this.element.val(); 13597 }, 13598 blur: function(event) { 13599 if (this.cancelBlur) { 13600 delete this.cancelBlur; 13601 return; 13602 } 13603 13604 this._stop(); 13605 this._refresh(); 13606 if (this.previous !== this.element.val()) { 13607 this._trigger("change", event); 13608 } 13609 }, 13610 mousewheel: function(event, delta) { 13611 if (!delta) { 13612 return; 13613 } 13614 if (!this.spinning && !this._start(event)) { 13615 return false; 13616 } 13617 13618 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 13619 clearTimeout(this.mousewheelTimer); 13620 this.mousewheelTimer = this._delay(function() { 13621 if (this.spinning) { 13622 this._stop(event); 13623 } 13624 }, 100); 13625 event.preventDefault(); 13626 }, 13627 "mousedown .ui-spinner-button": function(event) { 13628 var previous; 13629 13630 // We never want the buttons to have focus; whenever the user is 13631 // interacting with the spinner, the focus should be on the input. 13632 // If the input is focused then this.previous is properly set from 13633 // when the input first received focus. If the input is not focused 13634 // then we need to set this.previous based on the value before spinning. 13635 previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ? 13636 this.previous : this.element.val(); 13637 13638 function checkFocus() { 13639 var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]); 13640 if (!isActive) { 13641 this.element.trigger("focus"); 13642 this.previous = previous; 13643 13644 // support: IE 13645 // IE sets focus asynchronously, so we need to check if focus 13646 // moved off of the input because the user clicked on the button. 13647 this._delay(function() { 13648 this.previous = previous; 13649 }); 13650 } 13651 } 13652 13653 // Ensure focus is on (or stays on) the text field 13654 event.preventDefault(); 13655 checkFocus.call(this); 13656 13657 // Support: IE 13658 // IE doesn't prevent moving focus even with event.preventDefault() 13659 // so we set a flag to know when we should ignore the blur event 13660 // and check (again) if focus moved off of the input. 13661 this.cancelBlur = true; 13662 this._delay(function() { 13663 delete this.cancelBlur; 13664 checkFocus.call(this); 13665 }); 13666 13667 if (this._start(event) === false) { 13668 return; 13669 } 13670 13671 this._repeat(null, $(event.currentTarget) 13672 .hasClass("ui-spinner-up") ? 1 : -1, event); 13673 }, 13674 "mouseup .ui-spinner-button": "_stop", 13675 "mouseenter .ui-spinner-button": function(event) { 13676 13677 // button will add ui-state-active if mouse was down while mouseleave and kept down 13678 if (!$(event.currentTarget).hasClass("ui-state-active")) { 13679 return; 13680 } 13681 13682 if (this._start(event) === false) { 13683 return false; 13684 } 13685 this._repeat(null, $(event.currentTarget) 13686 .hasClass("ui-spinner-up") ? 1 : -1, event); 13687 }, 13688 13689 // TODO: do we really want to consider this a stop? 13690 // shouldn't we just stop the repeater and wait until mouseup before 13691 // we trigger the stop event? 13692 "mouseleave .ui-spinner-button": "_stop" 13693 }, 13694
vendor: 5,691 bytes, lines 13695-13871
13695 // Support mobile enhanced option and make backcompat more sane 13696 _enhance: function() { 13697 this.uiSpinner = this.element 13698 .attr("autocomplete", "off") 13699 .wrap("<span>") 13700 .parent() 13701 13702 // Add buttons 13703 .append( 13704 "<a></a><a></a>" 13705 ); 13706 }, 13707 13708 _draw: function() { 13709 this._enhance(); 13710 13711 this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content"); 13712 this._addClass("ui-spinner-input"); 13713 13714 this.element.attr("role", "spinbutton"); 13715 13716 // Button bindings 13717 this.buttons = this.uiSpinner.children("a") 13718 .attr("tabIndex", -1) 13719 .attr("aria-hidden", true) 13720 .button({ 13721 classes: { 13722 "ui-button": "" 13723 } 13724 }); 13725 13726 // TODO: Right now button does not support classes this is already updated in button PR 13727 this._removeClass(this.buttons, "ui-corner-all"); 13728 13729 this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"); 13730 this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"); 13731 this.buttons.first().button({ 13732 "icon": this.options.icons.up, 13733 "showLabel": false 13734 }); 13735 this.buttons.last().button({ 13736 "icon": this.options.icons.down, 13737 "showLabel": false 13738 }); 13739 13740 // IE 6 doesn't understand height: 50% for the buttons 13741 // unless the wrapper has an explicit height 13742 if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && 13743 this.uiSpinner.height() > 0) { 13744 this.uiSpinner.height(this.uiSpinner.height()); 13745 } 13746 }, 13747 13748 _keydown: function(event) { 13749 var options = this.options, 13750 keyCode = $.ui.keyCode; 13751 13752 switch (event.keyCode) { 13753 case keyCode.UP: 13754 this._repeat(null, 1, event); 13755 return true; 13756 case keyCode.DOWN: 13757 this._repeat(null, -1, event); 13758 return true; 13759 case keyCode.PAGE_UP: 13760 this._repeat(null, options.page, event); 13761 return true; 13762 case keyCode.PAGE_DOWN: 13763 this._repeat(null, -options.page, event); 13764 return true; 13765 } 13766 13767 return false; 13768 }, 13769 13770 _start: function(event) { 13771 if (!this.spinning && this._trigger("start", event) === false) { 13772 return false; 13773 } 13774 13775 if (!this.counter) { 13776 this.counter = 1; 13777 } 13778 this.spinning = true; 13779 return true; 13780 }, 13781 13782 _repeat: function(i, steps, event) { 13783 i = i || 500; 13784 13785 clearTimeout(this.timer); 13786 this.timer = this._delay(function() { 13787 this._repeat(40, steps, event); 13788 }, i); 13789 13790 this._spin(steps * this.options.step, event); 13791 }, 13792 13793 _spin: function(step, event) { 13794 var value = this.value() || 0; 13795 13796 if (!this.counter) { 13797 this.counter = 1; 13798 } 13799 13800 value = this._adjustValue(value + step * this._increment(this.counter)); 13801 13802 if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) { 13803 this._value(value); 13804 this.counter++; 13805 } 13806 }, 13807 13808 _increment: function(i) { 13809 var incremental = this.options.incremental; 13810 13811 if (incremental) { 13812 return $.isFunction(incremental) ? 13813 incremental(i) : 13814 Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1); 13815 } 13816 13817 return 1; 13818 }, 13819 13820 _precision: function() { 13821 var precision = this._precisionOf(this.options.step); 13822 if (this.options.min !== null) { 13823 precision = Math.max(precision, this._precisionOf(this.options.min)); 13824 } 13825 return precision; 13826 }, 13827 13828 _precisionOf: function(num) { 13829 var str = num.toString(), 13830 decimal = str.indexOf("."); 13831 return decimal === -1 ? 0 : str.length - decimal - 1; 13832 }, 13833 13834 _adjustValue: function(value) { 13835 var base, aboveMin, 13836 options = this.options; 13837 13838 // Make sure we're at a valid step 13839 // - find out where we are relative to the base (min or 0) 13840 base = options.min !== null ? options.min : 0; 13841 aboveMin = value - base; 13842 13843 // - round to the nearest step 13844 aboveMin = Math.round(aboveMin / options.step) * options.step; 13845 13846 // - rounding is based on 0, so adjust back to our base 13847 value = base + aboveMin; 13848 13849 // Fix precision from bad JS floating point math 13850 value = parseFloat(value.toFixed(this._precision())); 13851 13852 // Clamp the value 13853 if (options.max !== null && value > options.max) { 13854 return options.max; 13855 } 13856 if (options.min !== null && value < options.min) { 13857 return options.min; 13858 } 13859 13860 return value; 13861 }, 13862 13863 _stop: function(event) { 13864 if (!this.spinning) { 13865 return; 13866 } 13867 13868 clearTimeout(this.timer); 13869 clearTimeout(this.mousewheelTimer); 13870 this.counter = 0; 13871 this.spinning = false;
vendor: 16,115 bytes, lines 13872-14358
13872 this._trigger("stop", event); 13873 }, 13874 13875 _setOption: function(key, value) { 13876 var prevValue, first, last; 13877 13878 if (key === "culture" || key === "numberFormat") { 13879 prevValue = this._parse(this.element.val()); 13880 this.options[key] = value; 13881 this.element.val(this._format(prevValue)); 13882 return; 13883 } 13884 13885 if (key === "max" || key === "min" || key === "step") { 13886 if (typeof value === "string") { 13887 value = this._parse(value); 13888 } 13889 } 13890 if (key === "icons") { 13891 first = this.buttons.first().find(".ui-icon"); 13892 this._removeClass(first, null, this.options.icons.up); 13893 this._addClass(first, null, value.up); 13894 last = this.buttons.last().find(".ui-icon"); 13895 this._removeClass(last, null, this.options.icons.down); 13896 this._addClass(last, null, value.down); 13897 } 13898 13899 this._super(key, value); 13900 }, 13901 13902 _setOptionDisabled: function(value) { 13903 this._super(value); 13904 13905 this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value); 13906 this.element.prop("disabled", !!value); 13907 this.buttons.button(value ? "disable" : "enable"); 13908 }, 13909 13910 _setOptions: spinnerModifer(function(options) { 13911 this._super(options); 13912 }), 13913 13914 _parse: function(val) { 13915 if (typeof val === "string" && val !== "") { 13916 val = window.Globalize && this.options.numberFormat ? 13917 Globalize.parseFloat(val, 10, this.options.culture) : +val; 13918 } 13919 return val === "" || isNaN(val) ? null : val; 13920 }, 13921 13922 _format: function(value) { 13923 if (value === "") { 13924 return ""; 13925 } 13926 return window.Globalize && this.options.numberFormat ? 13927 Globalize.format(value, this.options.numberFormat, this.options.culture) : 13928 value; 13929 }, 13930 13931 _refresh: function() { 13932 this.element.attr({ 13933 "aria-valuemin": this.options.min, 13934 "aria-valuemax": this.options.max, 13935 13936 // TODO: what should we do with values that can't be parsed? 13937 "aria-valuenow": this._parse(this.element.val()) 13938 }); 13939 }, 13940 13941 isValid: function() { 13942 var value = this.value(); 13943 13944 // Null is invalid 13945 if (value === null) { 13946 return false; 13947 } 13948 13949 // If value gets adjusted, it's invalid 13950 return value === this._adjustValue(value); 13951 }, 13952 13953 // Update the value without triggering change 13954 _value: function(value, allowAny) { 13955 var parsed; 13956 if (value !== "") { 13957 parsed = this._parse(value); 13958 if (parsed !== null) { 13959 if (!allowAny) { 13960 parsed = this._adjustValue(parsed); 13961 } 13962 value = this._format(parsed); 13963 } 13964 } 13965 this.element.val(value); 13966 this._refresh(); 13967 }, 13968 13969 _destroy: function() { 13970 this.element 13971 .prop("disabled", false) 13972 .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"); 13973 13974 this.uiSpinner.replaceWith(this.element); 13975 }, 13976 13977 stepUp: spinnerModifer(function(steps) { 13978 this._stepUp(steps); 13979 }), 13980 _stepUp: function(steps) { 13981 if (this._start()) { 13982 this._spin((steps || 1) * this.options.step); 13983 this._stop(); 13984 } 13985 }, 13986 13987 stepDown: spinnerModifer(function(steps) { 13988 this._stepDown(steps); 13989 }), 13990 _stepDown: function(steps) { 13991 if (this._start()) { 13992 this._spin((steps || 1) * -this.options.step); 13993 this._stop(); 13994 } 13995 }, 13996 13997 pageUp: spinnerModifer(function(pages) { 13998 this._stepUp((pages || 1) * this.options.page); 13999 }), 14000 14001 pageDown: spinnerModifer(function(pages) { 14002 this._stepDown((pages || 1) * this.options.page); 14003 }), 14004 14005 value: function(newVal) { 14006 if (!arguments.length) { 14007 return this._parse(this.element.val()); 14008 } 14009 spinnerModifer(this._value).call(this, newVal); 14010 }, 14011 14012 widget: function() { 14013 return this.uiSpinner; 14014 } 14015 }); 14016 14017 // DEPRECATED 14018 // TODO: switch return back to widget declaration at top of file when this is removed 14019 if ($.uiBackCompat !== false) { 14020 14021 // Backcompat for spinner html extension points 14022 $.widget("ui.spinner", $.ui.spinner, { 14023 _enhance: function() { 14024 this.uiSpinner = this.element 14025 .attr("autocomplete", "off") 14026 .wrap(this._uiSpinnerHtml()) 14027 .parent() 14028 14029 // Add buttons 14030 .append(this._buttonHtml()); 14031 }, 14032 _uiSpinnerHtml: function() { 14033 return "<span>"; 14034 }, 14035 14036 _buttonHtml: function() { 14037 return "<a></a><a></a>"; 14038 } 14039 }); 14040 } 14041 14042 var widgetsSpinner = $.ui.spinner; 14043 14044 14045 /*! 14046 * jQuery UI Tabs 1.12.1 14047 * http://jqueryui.com 14048 * 14049 * Copyright jQuery Foundation and other contributors 14050 * Released under the MIT license. 14051 * http://jquery.org/license 14052 */ 14053 14054 //>>label: Tabs 14055 //>>group: Widgets 14056 //>>description: Transforms a set of container elements into a tab structure. 14057 //>>docs: http://api.jqueryui.com/tabs/ 14058 //>>demos: http://jqueryui.com/tabs/ 14059 //>>css.structure: ../../themes/base/core.css 14060 //>>css.structure: ../../themes/base/tabs.css 14061 //>>css.theme: ../../themes/base/theme.css 14062 14063 14064 14065 $.widget("ui.tabs", { 14066 version: "1.12.1", 14067 delay: 300, 14068 options: { 14069 active: null, 14070 classes: { 14071 "ui-tabs": "ui-corner-all", 14072 "ui-tabs-nav": "ui-corner-all", 14073 "ui-tabs-panel": "ui-corner-bottom", 14074 "ui-tabs-tab": "ui-corner-top" 14075 }, 14076 collapsible: false, 14077 event: "click", 14078 heightStyle: "content", 14079 hide: null, 14080 show: null, 14081 14082 // Callbacks 14083 activate: null, 14084 beforeActivate: null, 14085 beforeLoad: null, 14086 load: null 14087 }, 14088 14089 _isLocal: (function() { 14090 var rhash = /#.*$/; 14091 14092 return function(anchor) { 14093 var anchorUrl, locationUrl; 14094 14095 anchorUrl = anchor.href.replace(rhash, ""); 14096 locationUrl = location.href.replace(rhash, ""); 14097 14098 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 14099 try { 14100 anchorUrl = decodeURIComponent(anchorUrl); 14101 } catch (error) {} 14102 try { 14103 locationUrl = decodeURIComponent(locationUrl); 14104 } catch (error) {} 14105 14106 return anchor.hash.length > 1 && anchorUrl === locationUrl; 14107 }; 14108 })(), 14109 14110 _create: function() { 14111 var that = this, 14112 options = this.options; 14113 14114 this.running = false; 14115 14116 this._addClass("ui-tabs", "ui-widget ui-widget-content"); 14117 this._toggleClass("ui-tabs-collapsible", null, options.collapsible); 14118 14119 this._processTabs(); 14120 options.active = this._initialActive(); 14121 14122 // Take disabling tabs via class attribute from HTML 14123 // into account and update option properly. 14124 if ($.isArray(options.disabled)) { 14125 options.disabled = $.unique(options.disabled.concat( 14126 $.map(this.tabs.filter(".ui-state-disabled"), function(li) { 14127 return that.tabs.index(li); 14128 }) 14129 )).sort(); 14130 } 14131 14132 // Check for length avoids error when initializing empty list 14133 if (this.options.active !== false && this.anchors.length) { 14134 this.active = this._findActive(options.active); 14135 } else { 14136 this.active = $(); 14137 } 14138 14139 this._refresh(); 14140 14141 if (this.active.length) { 14142 this.load(options.active); 14143 } 14144 }, 14145 14146 _initialActive: function() { 14147 var active = this.options.active, 14148 collapsible = this.options.collapsible, 14149 locationHash = location.hash.substring(1); 14150 14151 if (active === null) { 14152 14153 // check the fragment identifier in the URL 14154 if (locationHash) { 14155 this.tabs.each(function(i, tab) { 14156 if ($(tab).attr("aria-controls") === locationHash) { 14157 active = i; 14158 return false; 14159 } 14160 }); 14161 } 14162 14163 // Check for a tab marked active via a class 14164 if (active === null) { 14165 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 14166 } 14167 14168 // No active tab, set to false 14169 if (active === null || active === -1) { 14170 active = this.tabs.length ? 0 : false; 14171 } 14172 } 14173 14174 // Handle numbers: negative, out of range 14175 if (active !== false) { 14176 active = this.tabs.index(this.tabs.eq(active)); 14177 if (active === -1) { 14178 active = collapsible ? false : 0; 14179 } 14180 } 14181 14182 // Don't allow collapsible: false and active: false 14183 if (!collapsible && active === false && this.anchors.length) { 14184 active = 0; 14185 } 14186 14187 return active; 14188 }, 14189 14190 _getCreateEventData: function() { 14191 return { 14192 tab: this.active, 14193 panel: !this.active.length ? $() : this._getPanelForTab(this.active) 14194 }; 14195 }, 14196 14197 _tabKeydown: function(event) { 14198 var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"), 14199 selectedIndex = this.tabs.index(focusedTab), 14200 goingForward = true; 14201 14202 if (this._handlePageNav(event)) { 14203 return; 14204 } 14205 14206 switch (event.keyCode) { 14207 case $.ui.keyCode.RIGHT: 14208 case $.ui.keyCode.DOWN: 14209 selectedIndex++; 14210 break; 14211 case $.ui.keyCode.UP: 14212 case $.ui.keyCode.LEFT: 14213 goingForward = false; 14214 selectedIndex--; 14215 break; 14216 case $.ui.keyCode.END: 14217 selectedIndex = this.anchors.length - 1; 14218 break; 14219 case $.ui.keyCode.HOME: 14220 selectedIndex = 0; 14221 break; 14222 case $.ui.keyCode.SPACE: 14223 14224 // Activate only, no collapsing 14225 event.preventDefault(); 14226 clearTimeout(this.activating); 14227 this._activate(selectedIndex); 14228 return; 14229 case $.ui.keyCode.ENTER: 14230 14231 // Toggle (cancel delayed activation, allow collapsing) 14232 event.preventDefault(); 14233 clearTimeout(this.activating); 14234 14235 // Determine if we should collapse or activate 14236 this._activate(selectedIndex === this.options.active ? false : selectedIndex); 14237 return; 14238 default: 14239 return; 14240 } 14241 14242 // Focus the appropriate tab, based on which key was pressed 14243 event.preventDefault(); 14244 clearTimeout(this.activating); 14245 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 14246 14247 // Navigating with control/command key will prevent automatic activation 14248 if (!event.ctrlKey && !event.metaKey) { 14249 14250 // Update aria-selected immediately so that AT think the tab is already selected. 14251 // Otherwise AT may confuse the user by stating that they need to activate the tab, 14252 // but the tab will already be activated by the time the announcement finishes. 14253 focusedTab.attr("aria-selected", "false"); 14254 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 14255 14256 this.activating = this._delay(function() { 14257 this.option("active", selectedIndex); 14258 }, this.delay); 14259 } 14260 }, 14261 14262 _panelKeydown: function(event) { 14263 if (this._handlePageNav(event)) { 14264 return; 14265 } 14266 14267 // Ctrl+up moves focus to the current tab 14268 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 14269 event.preventDefault(); 14270 this.active.trigger("focus"); 14271 } 14272 }, 14273 14274 // Alt+page up/down moves focus to the previous/next tab (and activates) 14275 _handlePageNav: function(event) { 14276 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 14277 this._activate(this._focusNextTab(this.options.active - 1, false)); 14278 return true; 14279 } 14280 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 14281 this._activate(this._focusNextTab(this.options.active + 1, true)); 14282 return true; 14283 } 14284 }, 14285 14286 _findNextTab: function(index, goingForward) { 14287 var lastTabIndex = this.tabs.length - 1; 14288 14289 function constrain() { 14290 if (index > lastTabIndex) { 14291 index = 0; 14292 } 14293 if (index < 0) { 14294 index = lastTabIndex; 14295 } 14296 return index; 14297 } 14298 14299 while ($.inArray(constrain(), this.options.disabled) !== -1) { 14300 index = goingForward ? index + 1 : index - 1; 14301 } 14302 14303 return index; 14304 }, 14305 14306 _focusNextTab: function(index, goingForward) { 14307 index = this._findNextTab(index, goingForward); 14308 this.tabs.eq(index).trigger("focus"); 14309 return index; 14310 }, 14311 14312 _setOption: function(key, value) { 14313 if (key === "active") { 14314 14315 // _activate() will handle invalid values and update this.options 14316 this._activate(value); 14317 return; 14318 } 14319 14320 this._super(key, value); 14321 14322 if (key === "collapsible") { 14323 this._toggleClass("ui-tabs-collapsible", null, value); 14324 14325 // Setting collapsible: false while collapsed; open first panel 14326 if (!value && this.options.active === false) { 14327 this._activate(0); 14328 } 14329 } 14330 14331 if (key === "event") { 14332 this._setupEvents(value); 14333 } 14334 14335 if (key === "heightStyle") { 14336 this._setupHeightStyle(value); 14337 } 14338 }, 14339 14340 _sanitizeSelector: function(hash) { 14341 return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : ""; 14342 }, 14343 14344 refresh: function() { 14345 var options = this.options, 14346 lis = this.tablist.children(":has(a[href])"); 14347 14348 // Get disabled tabs from class attribute from HTML 14349 // this will get converted to a boolean if needed in _refresh() 14350 options.disabled = $.map(lis.filter(".ui-state-disabled"), function(tab) { 14351 return lis.index(tab); 14352 }); 14353 14354 this._processTabs(); 14355 14356 // Was collapsed or no tabs 14357 if (options.active === false || !this.anchors.length) { 14358 options.active = false;
vendor: 4,127 bytes, lines 14359-14470
14359 this.active = $(); 14360 14361 // was active, but active tab is gone 14362 } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) { 14363 14364 // all remaining tabs are disabled 14365 if (this.tabs.length === options.disabled.length) { 14366 options.active = false; 14367 this.active = $(); 14368 14369 // activate previous tab 14370 } else { 14371 this._activate(this._findNextTab(Math.max(0, options.active - 1), false)); 14372 } 14373 14374 // was active, active tab still exists 14375 } else { 14376 14377 // make sure active index is correct 14378 options.active = this.tabs.index(this.active); 14379 } 14380 14381 this._refresh(); 14382 }, 14383 14384 _refresh: function() { 14385 this._setOptionDisabled(this.options.disabled); 14386 this._setupEvents(this.options.event); 14387 this._setupHeightStyle(this.options.heightStyle); 14388 14389 this.tabs.not(this.active).attr({ 14390 "aria-selected": "false", 14391 "aria-expanded": "false", 14392 tabIndex: -1 14393 }); 14394 this.panels.not(this._getPanelForTab(this.active)) 14395 .hide() 14396 .attr({ 14397 "aria-hidden": "true" 14398 }); 14399 14400 // Make sure one tab is in the tab order 14401 if (!this.active.length) { 14402 this.tabs.eq(0).attr("tabIndex", 0); 14403 } else { 14404 this.active 14405 .attr({ 14406 "aria-selected": "true", 14407 "aria-expanded": "true", 14408 tabIndex: 0 14409 }); 14410 this._addClass(this.active, "ui-tabs-active", "ui-state-active"); 14411 this._getPanelForTab(this.active) 14412 .show() 14413 .attr({ 14414 "aria-hidden": "false" 14415 }); 14416 } 14417 }, 14418 14419 _processTabs: function() { 14420 var that = this, 14421 prevTabs = this.tabs, 14422 prevAnchors = this.anchors, 14423 prevPanels = this.panels; 14424 14425 this.tablist = this._getList().attr("role", "tablist"); 14426 this._addClass(this.tablist, "ui-tabs-nav", 14427 "ui-helper-reset ui-helper-clearfix ui-widget-header"); 14428 14429 // Prevent users from focusing disabled tabs via click 14430 this.tablist 14431 .on("mousedown" + this.eventNamespace, "> li", function(event) { 14432 if ($(this).is(".ui-state-disabled")) { 14433 event.preventDefault(); 14434 } 14435 }) 14436 14437 // Support: IE <9 14438 // Preventing the default action in mousedown doesn't prevent IE 14439 // from focusing the element, so if the anchor gets focused, blur. 14440 // We don't have to worry about focusing the previously focused 14441 // element since clicking on a non-focusable element should focus 14442 // the body anyway. 14443 .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function() { 14444 if ($(this).closest("li").is(".ui-state-disabled")) { 14445 this.blur(); 14446 } 14447 }); 14448 14449 this.tabs = this.tablist.find("> li:has(a[href])") 14450 .attr({ 14451 role: "tab", 14452 tabIndex: -1 14453 }); 14454 this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"); 14455 14456 this.anchors = this.tabs.map(function() { 14457 return $("a", this)[0]; 14458 }) 14459 .attr({ 14460 role: "presentation", 14461 tabIndex: -1 14462 }); 14463 this._addClass(this.anchors, "ui-tabs-anchor"); 14464 14465 this.panels = $(); 14466 14467 this.anchors.each(function(i, anchor) { 14468 var selector, panel, panelId, 14469 anchorId = $(anchor).uniqueId().attr("id"), 14470 tab = $(anchor).closest("li"),
vendor: 7,522 bytes, lines 14471-14678
14471 originalAriaControls = tab.attr("aria-controls"); 14472 14473 // Inline tab 14474 if (that._isLocal(anchor)) { 14475 selector = anchor.hash; 14476 panelId = selector.substring(1); 14477 panel = that.element.find(that._sanitizeSelector(selector)); 14478 14479 // remote tab 14480 } else { 14481 14482 // If the tab doesn't already have aria-controls, 14483 // generate an id by using a throw-away element 14484 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 14485 selector = "#" + panelId; 14486 panel = that.element.find(selector); 14487 if (!panel.length) { 14488 panel = that._createPanel(panelId); 14489 panel.insertAfter(that.panels[i - 1] || that.tablist); 14490 } 14491 panel.attr("aria-live", "polite"); 14492 } 14493 14494 if (panel.length) { 14495 that.panels = that.panels.add(panel); 14496 } 14497 if (originalAriaControls) { 14498 tab.data("ui-tabs-aria-controls", originalAriaControls); 14499 } 14500 tab.attr({ 14501 "aria-controls": panelId, 14502 "aria-labelledby": anchorId 14503 }); 14504 panel.attr("aria-labelledby", anchorId); 14505 }); 14506 14507 this.panels.attr("role", "tabpanel"); 14508 this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"); 14509 14510 // Avoid memory leaks (#10056) 14511 if (prevTabs) { 14512 this._off(prevTabs.not(this.tabs)); 14513 this._off(prevAnchors.not(this.anchors)); 14514 this._off(prevPanels.not(this.panels)); 14515 } 14516 }, 14517 14518 // Allow overriding how to find the list for rare usage scenarios (#7715) 14519 _getList: function() { 14520 return this.tablist || this.element.find("ol, ul").eq(0); 14521 }, 14522 14523 _createPanel: function(id) { 14524 return $("<div>") 14525 .attr("id", id) 14526 .data("ui-tabs-destroy", true); 14527 }, 14528 14529 _setOptionDisabled: function(disabled) { 14530 var currentItem, li, i; 14531 14532 if ($.isArray(disabled)) { 14533 if (!disabled.length) { 14534 disabled = false; 14535 } else if (disabled.length === this.anchors.length) { 14536 disabled = true; 14537 } 14538 } 14539 14540 // Disable tabs 14541 for (i = 0; 14542 (li = this.tabs[i]); i++) { 14543 currentItem = $(li); 14544 if (disabled === true || $.inArray(i, disabled) !== -1) { 14545 currentItem.attr("aria-disabled", "true"); 14546 this._addClass(currentItem, null, "ui-state-disabled"); 14547 } else { 14548 currentItem.removeAttr("aria-disabled"); 14549 this._removeClass(currentItem, null, "ui-state-disabled"); 14550 } 14551 } 14552 14553 this.options.disabled = disabled; 14554 14555 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, 14556 disabled === true); 14557 }, 14558 14559 _setupEvents: function(event) { 14560 var events = {}; 14561 if (event) { 14562 $.each(event.split(" "), function(index, eventName) { 14563 events[eventName] = "_eventHandler"; 14564 }); 14565 } 14566 14567 this._off(this.anchors.add(this.tabs).add(this.panels)); 14568 14569 // Always prevent the default action, even when disabled 14570 this._on(true, this.anchors, { 14571 click: function(event) { 14572 event.preventDefault(); 14573 } 14574 }); 14575 this._on(this.anchors, events); 14576 this._on(this.tabs, { keydown: "_tabKeydown" }); 14577 this._on(this.panels, { keydown: "_panelKeydown" }); 14578 14579 this._focusable(this.tabs); 14580 this._hoverable(this.tabs); 14581 }, 14582 14583 _setupHeightStyle: function(heightStyle) { 14584 var maxHeight, 14585 parent = this.element.parent(); 14586 14587 if (heightStyle === "fill") { 14588 maxHeight = parent.height(); 14589 maxHeight -= this.element.outerHeight() - this.element.height(); 14590 14591 this.element.siblings(":visible").each(function() { 14592 var elem = $(this), 14593 position = elem.css("position"); 14594 14595 if (position === "absolute" || position === "fixed") { 14596 return; 14597 } 14598 maxHeight -= elem.outerHeight(true); 14599 }); 14600 14601 this.element.children().not(this.panels).each(function() { 14602 maxHeight -= $(this).outerHeight(true); 14603 }); 14604 14605 this.panels.each(function() { 14606 $(this).height(Math.max(0, maxHeight - 14607 $(this).innerHeight() + $(this).height())); 14608 }) 14609 .css("overflow", "auto"); 14610 } else if (heightStyle === "auto") { 14611 maxHeight = 0; 14612 this.panels.each(function() { 14613 maxHeight = Math.max(maxHeight, $(this).height("").height()); 14614 }).height(maxHeight); 14615 } 14616 }, 14617 14618 _eventHandler: function(event) { 14619 var options = this.options, 14620 active = this.active, 14621 anchor = $(event.currentTarget), 14622 tab = anchor.closest("li"), 14623 clickedIsActive = tab[0] === active[0], 14624 collapsing = clickedIsActive && options.collapsible, 14625 toShow = collapsing ? $() : this._getPanelForTab(tab), 14626 toHide = !active.length ? $() : this._getPanelForTab(active), 14627 eventData = { 14628 oldTab: active, 14629 oldPanel: toHide, 14630 newTab: collapsing ? $() : tab, 14631 newPanel: toShow 14632 }; 14633 14634 event.preventDefault(); 14635 14636 if (tab.hasClass("ui-state-disabled") || 14637 14638 // tab is already loading 14639 tab.hasClass("ui-tabs-loading") || 14640 14641 // can't switch durning an animation 14642 this.running || 14643 14644 // click on active header, but not collapsible 14645 (clickedIsActive && !options.collapsible) || 14646 14647 // allow canceling activation 14648 (this._trigger("beforeActivate", event, eventData) === false)) { 14649 return; 14650 } 14651 14652 options.active = collapsing ? false : this.tabs.index(tab); 14653 14654 this.active = clickedIsActive ? $() : tab; 14655 if (this.xhr) { 14656 this.xhr.abort(); 14657 } 14658 14659 if (!toHide.length && !toShow.length) { 14660 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 14661 } 14662 14663 if (toShow.length) { 14664 this.load(this.tabs.index(tab), event); 14665 } 14666 this._toggle(event, eventData); 14667 }, 14668 14669 // Handles show/hide for selecting tabs 14670 _toggle: function(event, eventData) { 14671 var that = this, 14672 toShow = eventData.newPanel, 14673 toHide = eventData.oldPanel; 14674 14675 this.running = true; 14676 14677 function complete() { 14678 that.running = false;
vendor: 29,086 bytes, lines 14679-15504
14679 that._trigger("activate", event, eventData); 14680 } 14681 14682 function show() { 14683 that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active"); 14684 14685 if (toShow.length && that.options.show) { 14686 that._show(toShow, that.options.show, complete); 14687 } else { 14688 toShow.show(); 14689 complete(); 14690 } 14691 } 14692 14693 // Start out by hiding, then showing, then completing 14694 if (toHide.length && this.options.hide) { 14695 this._hide(toHide, this.options.hide, function() { 14696 that._removeClass(eventData.oldTab.closest("li"), 14697 "ui-tabs-active", "ui-state-active"); 14698 show(); 14699 }); 14700 } else { 14701 this._removeClass(eventData.oldTab.closest("li"), 14702 "ui-tabs-active", "ui-state-active"); 14703 toHide.hide(); 14704 show(); 14705 } 14706 14707 toHide.attr("aria-hidden", "true"); 14708 eventData.oldTab.attr({ 14709 "aria-selected": "false", 14710 "aria-expanded": "false" 14711 }); 14712 14713 // If we're switching tabs, remove the old tab from the tab order. 14714 // If we're opening from collapsed state, remove the previous tab from the tab order. 14715 // If we're collapsing, then keep the collapsing tab in the tab order. 14716 if (toShow.length && toHide.length) { 14717 eventData.oldTab.attr("tabIndex", -1); 14718 } else if (toShow.length) { 14719 this.tabs.filter(function() { 14720 return $(this).attr("tabIndex") === 0; 14721 }) 14722 .attr("tabIndex", -1); 14723 } 14724 14725 toShow.attr("aria-hidden", "false"); 14726 eventData.newTab.attr({ 14727 "aria-selected": "true", 14728 "aria-expanded": "true", 14729 tabIndex: 0 14730 }); 14731 }, 14732 14733 _activate: function(index) { 14734 var anchor, 14735 active = this._findActive(index); 14736 14737 // Trying to activate the already active panel 14738 if (active[0] === this.active[0]) { 14739 return; 14740 } 14741 14742 // Trying to collapse, simulate a click on the current active header 14743 if (!active.length) { 14744 active = this.active; 14745 } 14746 14747 anchor = active.find(".ui-tabs-anchor")[0]; 14748 this._eventHandler({ 14749 target: anchor, 14750 currentTarget: anchor, 14751 preventDefault: $.noop 14752 }); 14753 }, 14754 14755 _findActive: function(index) { 14756 return index === false ? $() : this.tabs.eq(index); 14757 }, 14758 14759 _getIndex: function(index) { 14760 14761 // meta-function to give users option to provide a href string instead of a numerical index. 14762 if (typeof index === "string") { 14763 index = this.anchors.index(this.anchors.filter("[href$='" + 14764 $.ui.escapeSelector(index) + "']")); 14765 } 14766 14767 return index; 14768 }, 14769 14770 _destroy: function() { 14771 if (this.xhr) { 14772 this.xhr.abort(); 14773 } 14774 14775 this.tablist 14776 .removeAttr("role") 14777 .off(this.eventNamespace); 14778 14779 this.anchors 14780 .removeAttr("role tabIndex") 14781 .removeUniqueId(); 14782 14783 this.tabs.add(this.panels).each(function() { 14784 if ($.data(this, "ui-tabs-destroy")) { 14785 $(this).remove(); 14786 } else { 14787 $(this).removeAttr("role tabIndex " + 14788 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded"); 14789 } 14790 }); 14791 14792 this.tabs.each(function() { 14793 var li = $(this), 14794 prev = li.data("ui-tabs-aria-controls"); 14795 if (prev) { 14796 li 14797 .attr("aria-controls", prev) 14798 .removeData("ui-tabs-aria-controls"); 14799 } else { 14800 li.removeAttr("aria-controls"); 14801 } 14802 }); 14803 14804 this.panels.show(); 14805 14806 if (this.options.heightStyle !== "content") { 14807 this.panels.css("height", ""); 14808 } 14809 }, 14810 14811 enable: function(index) { 14812 var disabled = this.options.disabled; 14813 if (disabled === false) { 14814 return; 14815 } 14816 14817 if (index === undefined) { 14818 disabled = false; 14819 } else { 14820 index = this._getIndex(index); 14821 if ($.isArray(disabled)) { 14822 disabled = $.map(disabled, function(num) { 14823 return num !== index ? num : null; 14824 }); 14825 } else { 14826 disabled = $.map(this.tabs, function(li, num) { 14827 return num !== index ? num : null; 14828 }); 14829 } 14830 } 14831 this._setOptionDisabled(disabled); 14832 }, 14833 14834 disable: function(index) { 14835 var disabled = this.options.disabled; 14836 if (disabled === true) { 14837 return; 14838 } 14839 14840 if (index === undefined) { 14841 disabled = true; 14842 } else { 14843 index = this._getIndex(index); 14844 if ($.inArray(index, disabled) !== -1) { 14845 return; 14846 } 14847 if ($.isArray(disabled)) { 14848 disabled = $.merge([index], disabled).sort(); 14849 } else { 14850 disabled = [index]; 14851 } 14852 } 14853 this._setOptionDisabled(disabled); 14854 }, 14855 14856 load: function(index, event) { 14857 index = this._getIndex(index); 14858 var that = this, 14859 tab = this.tabs.eq(index), 14860 anchor = tab.find(".ui-tabs-anchor"), 14861 panel = this._getPanelForTab(tab), 14862 eventData = { 14863 tab: tab, 14864 panel: panel 14865 }, 14866 complete = function(jqXHR, status) { 14867 if (status === "abort") { 14868 that.panels.stop(false, true); 14869 } 14870 14871 that._removeClass(tab, "ui-tabs-loading"); 14872 panel.removeAttr("aria-busy"); 14873 14874 if (jqXHR === that.xhr) { 14875 delete that.xhr; 14876 } 14877 }; 14878 14879 // Not remote 14880 if (this._isLocal(anchor[0])) { 14881 return; 14882 } 14883 14884 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 14885 14886 // Support: jQuery <1.8 14887 // jQuery <1.8 returns false if the request is canceled in beforeSend, 14888 // but as of 1.8, $.ajax() always returns a jqXHR object. 14889 if (this.xhr && this.xhr.statusText !== "canceled") { 14890 this._addClass(tab, "ui-tabs-loading"); 14891 panel.attr("aria-busy", "true"); 14892 14893 this.xhr 14894 .done(function(response, status, jqXHR) { 14895 14896 // support: jQuery <1.8 14897 // http://bugs.jquery.com/ticket/11778 14898 setTimeout(function() { 14899 panel.html(response); 14900 that._trigger("load", event, eventData); 14901 14902 complete(jqXHR, status); 14903 }, 1); 14904 }) 14905 .fail(function(jqXHR, status) { 14906 14907 // support: jQuery <1.8 14908 // http://bugs.jquery.com/ticket/11778 14909 setTimeout(function() { 14910 complete(jqXHR, status); 14911 }, 1); 14912 }); 14913 } 14914 }, 14915 14916 _ajaxSettings: function(anchor, event, eventData) { 14917 var that = this; 14918 return { 14919 14920 // Support: IE <11 only 14921 // Strip any hash that exists to prevent errors with the Ajax request 14922 url: anchor.attr("href").replace(/#.*$/, ""), 14923 beforeSend: function(jqXHR, settings) { 14924 return that._trigger("beforeLoad", event, 14925 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData)); 14926 } 14927 }; 14928 }, 14929 14930 _getPanelForTab: function(tab) { 14931 var id = $(tab).attr("aria-controls"); 14932 return this.element.find(this._sanitizeSelector("#" + id)); 14933 } 14934 }); 14935 14936 // DEPRECATED 14937 // TODO: Switch return back to widget declaration at top of file when this is removed 14938 if ($.uiBackCompat !== false) { 14939 14940 // Backcompat for ui-tab class (now ui-tabs-tab) 14941 $.widget("ui.tabs", $.ui.tabs, { 14942 _processTabs: function() { 14943 this._superApply(arguments); 14944 this._addClass(this.tabs, "ui-tab"); 14945 } 14946 }); 14947 } 14948 14949 var widgetsTabs = $.ui.tabs; 14950 14951 14952 /*! 14953 * jQuery UI Tooltip 1.12.1 14954 * http://jqueryui.com 14955 * 14956 * Copyright jQuery Foundation and other contributors 14957 * Released under the MIT license. 14958 * http://jquery.org/license 14959 */ 14960 14961 //>>label: Tooltip 14962 //>>group: Widgets 14963 //>>description: Shows additional information for any element on hover or focus. 14964 //>>docs: http://api.jqueryui.com/tooltip/ 14965 //>>demos: http://jqueryui.com/tooltip/ 14966 //>>css.structure: ../../themes/base/core.css 14967 //>>css.structure: ../../themes/base/tooltip.css 14968 //>>css.theme: ../../themes/base/theme.css 14969 14970 14971 14972 $.widget("ui.tooltip", { 14973 version: "1.12.1", 14974 options: { 14975 classes: { 14976 "ui-tooltip": "ui-corner-all ui-widget-shadow" 14977 }, 14978 content: function() { 14979 14980 // support: IE<9, Opera in jQuery <1.7 14981 // .text() can't accept undefined, so coerce to a string 14982 var title = $(this).attr("title") || ""; 14983 14984 // Escape title, since we're going from an attribute to raw HTML 14985 return $("<a>").text(title).html(); 14986 }, 14987 hide: true, 14988 14989 // Disabled elements have inconsistent behavior across browsers (#8661) 14990 items: "[title]:not([disabled])", 14991 position: { 14992 my: "left top+15", 14993 at: "left bottom", 14994 collision: "flipfit flip" 14995 }, 14996 show: true, 14997 track: false, 14998 14999 // Callbacks 15000 close: null, 15001 open: null 15002 }, 15003 15004 _addDescribedBy: function(elem, id) { 15005 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 15006 describedby.push(id); 15007 elem 15008 .data("ui-tooltip-id", id) 15009 .attr("aria-describedby", $.trim(describedby.join(" "))); 15010 }, 15011 15012 _removeDescribedBy: function(elem) { 15013 var id = elem.data("ui-tooltip-id"), 15014 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 15015 index = $.inArray(id, describedby); 15016 15017 if (index !== -1) { 15018 describedby.splice(index, 1); 15019 } 15020 15021 elem.removeData("ui-tooltip-id"); 15022 describedby = $.trim(describedby.join(" ")); 15023 if (describedby) { 15024 elem.attr("aria-describedby", describedby); 15025 } else { 15026 elem.removeAttr("aria-describedby"); 15027 } 15028 }, 15029 15030 _create: function() { 15031 this._on({ 15032 mouseover: "open", 15033 focusin: "open" 15034 }); 15035 15036 // IDs of generated tooltips, needed for destroy 15037 this.tooltips = {}; 15038 15039 // IDs of parent tooltips where we removed the title attribute 15040 this.parents = {}; 15041 15042 // Append the aria-live region so tooltips announce correctly 15043 this.liveRegion = $("<div>") 15044 .attr({ 15045 role: "log", 15046 "aria-live": "assertive", 15047 "aria-relevant": "additions" 15048 }) 15049 .appendTo(this.document[0].body); 15050 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 15051 15052 this.disabledTitles = $([]); 15053 }, 15054 15055 _setOption: function(key, value) { 15056 var that = this; 15057 15058 this._super(key, value); 15059 15060 if (key === "content") { 15061 $.each(this.tooltips, function(id, tooltipData) { 15062 that._updateContent(tooltipData.element); 15063 }); 15064 } 15065 }, 15066 15067 _setOptionDisabled: function(value) { 15068 this[value ? "_disable" : "_enable"](); 15069 }, 15070 15071 _disable: function() { 15072 var that = this; 15073 15074 // Close open tooltips 15075 $.each(this.tooltips, function(id, tooltipData) { 15076 var event = $.Event("blur"); 15077 event.target = event.currentTarget = tooltipData.element[0]; 15078 that.close(event, true); 15079 }); 15080 15081 // Remove title attributes to prevent native tooltips 15082 this.disabledTitles = this.disabledTitles.add( 15083 this.element.find(this.options.items).addBack() 15084 .filter(function() { 15085 var element = $(this); 15086 if (element.is("[title]")) { 15087 return element 15088 .data("ui-tooltip-title", element.attr("title")) 15089 .removeAttr("title"); 15090 } 15091 }) 15092 ); 15093 }, 15094 15095 _enable: function() { 15096 15097 // restore title attributes 15098 this.disabledTitles.each(function() { 15099 var element = $(this); 15100 if (element.data("ui-tooltip-title")) { 15101 element.attr("title", element.data("ui-tooltip-title")); 15102 } 15103 }); 15104 this.disabledTitles = $([]); 15105 }, 15106 15107 open: function(event) { 15108 var that = this, 15109 target = $(event ? event.target : this.element) 15110 15111 // we need closest here due to mouseover bubbling, 15112 // but always pointing at the same event target 15113 .closest(this.options.items); 15114 15115 // No element to show a tooltip for or the tooltip is already open 15116 if (!target.length || target.data("ui-tooltip-id")) { 15117 return; 15118 } 15119 15120 if (target.attr("title")) { 15121 target.data("ui-tooltip-title", target.attr("title")); 15122 } 15123 15124 target.data("ui-tooltip-open", true); 15125 15126 // Kill parent tooltips, custom or native, for hover 15127 if (event && event.type === "mouseover") { 15128 target.parents().each(function() { 15129 var parent = $(this), 15130 blurEvent; 15131 if (parent.data("ui-tooltip-open")) { 15132 blurEvent = $.Event("blur"); 15133 blurEvent.target = blurEvent.currentTarget = this; 15134 that.close(blurEvent, true); 15135 } 15136 if (parent.attr("title")) { 15137 parent.uniqueId(); 15138 that.parents[this.id] = { 15139 element: this, 15140 title: parent.attr("title") 15141 }; 15142 parent.attr("title", ""); 15143 } 15144 }); 15145 } 15146 15147 this._registerCloseHandlers(event, target); 15148 this._updateContent(target, event); 15149 }, 15150 15151 _updateContent: function(target, event) { 15152 var content, 15153 contentOption = this.options.content, 15154 that = this, 15155 eventType = event ? event.type : null; 15156 15157 if (typeof contentOption === "string" || contentOption.nodeType || 15158 contentOption.jquery) { 15159 return this._open(event, target, contentOption); 15160 } 15161 15162 content = contentOption.call(target[0], function(response) { 15163 15164 // IE may instantly serve a cached response for ajax requests 15165 // delay this call to _open so the other call to _open runs first 15166 that._delay(function() { 15167 15168 // Ignore async response if tooltip was closed already 15169 if (!target.data("ui-tooltip-open")) { 15170 return; 15171 } 15172 15173 // JQuery creates a special event for focusin when it doesn't 15174 // exist natively. To improve performance, the native event 15175 // object is reused and the type is changed. Therefore, we can't 15176 // rely on the type being correct after the event finished 15177 // bubbling, so we set it back to the previous value. (#8740) 15178 if (event) { 15179 event.type = eventType; 15180 } 15181 this._open(event, target, response); 15182 }); 15183 }); 15184 if (content) { 15185 this._open(event, target, content); 15186 } 15187 }, 15188 15189 _open: function(event, target, content) { 15190 var tooltipData, tooltip, delayedShow, a11yContent, 15191 positionOption = $.extend({}, this.options.position); 15192 15193 if (!content) { 15194 return; 15195 } 15196 15197 // Content can be updated multiple times. If the tooltip already 15198 // exists, then just update the content and bail. 15199 tooltipData = this._find(target); 15200 if (tooltipData) { 15201 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 15202 return; 15203 } 15204 15205 // If we have a title, clear it to prevent the native tooltip 15206 // we have to check first to avoid defining a title if none exists 15207 // (we don't want to cause an element to start matching [title]) 15208 // 15209 // We use removeAttr only for key events, to allow IE to export the correct 15210 // accessible attributes. For mouse events, set to empty string to avoid 15211 // native tooltip showing up (happens only when removing inside mouseover). 15212 if (target.is("[title]")) { 15213 if (event && event.type === "mouseover") { 15214 target.attr("title", ""); 15215 } else { 15216 target.removeAttr("title"); 15217 } 15218 } 15219 15220 tooltipData = this._tooltip(target); 15221 tooltip = tooltipData.tooltip; 15222 this._addDescribedBy(target, tooltip.attr("id")); 15223 tooltip.find(".ui-tooltip-content").html(content); 15224 15225 // Support: Voiceover on OS X, JAWS on IE <= 9 15226 // JAWS announces deletions even when aria-relevant="additions" 15227 // Voiceover will sometimes re-read the entire log region's contents from the beginning 15228 this.liveRegion.children().hide(); 15229 a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html()); 15230 a11yContent.removeAttr("name").find("[name]").removeAttr("name"); 15231 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 15232 a11yContent.appendTo(this.liveRegion); 15233 15234 function position(event) { 15235 positionOption.of = event; 15236 if (tooltip.is(":hidden")) { 15237 return; 15238 } 15239 tooltip.position(positionOption); 15240 } 15241 if (this.options.track && event && /^mouse/.test(event.type)) { 15242 this._on(this.document, { 15243 mousemove: position 15244 }); 15245 15246 // trigger once to override element-relative positioning 15247 position(event); 15248 } else { 15249 tooltip.position($.extend({ 15250 of: target 15251 }, this.options.position)); 15252 } 15253 15254 tooltip.hide(); 15255 15256 this._show(tooltip, this.options.show); 15257 15258 // Handle tracking tooltips that are shown with a delay (#8644). As soon 15259 // as the tooltip is visible, position the tooltip using the most recent 15260 // event. 15261 // Adds the check to add the timers only when both delay and track options are set (#14682) 15262 if (this.options.track && this.options.show && this.options.show.delay) { 15263 delayedShow = this.delayedShow = setInterval(function() { 15264 if (tooltip.is(":visible")) { 15265 position(positionOption.of); 15266 clearInterval(delayedShow); 15267 } 15268 }, $.fx.interval); 15269 } 15270 15271 this._trigger("open", event, { tooltip: tooltip }); 15272 }, 15273 15274 _registerCloseHandlers: function(event, target) { 15275 var events = { 15276 keyup: function(event) { 15277 if (event.keyCode === $.ui.keyCode.ESCAPE) { 15278 var fakeEvent = $.Event(event); 15279 fakeEvent.currentTarget = target[0]; 15280 this.close(fakeEvent, true); 15281 } 15282 } 15283 }; 15284 15285 // Only bind remove handler for delegated targets. Non-delegated 15286 // tooltips will handle this in destroy. 15287 if (target[0] !== this.element[0]) { 15288 events.remove = function() { 15289 this._removeTooltip(this._find(target).tooltip); 15290 }; 15291 } 15292 15293 if (!event || event.type === "mouseover") { 15294 events.mouseleave = "close"; 15295 } 15296 if (!event || event.type === "focusin") { 15297 events.focusout = "close"; 15298 } 15299 this._on(true, target, events); 15300 }, 15301 15302 close: function(event) { 15303 var tooltip, 15304 that = this, 15305 target = $(event ? event.currentTarget : this.element), 15306 tooltipData = this._find(target); 15307 15308 // The tooltip may already be closed 15309 if (!tooltipData) { 15310 15311 // We set ui-tooltip-open immediately upon open (in open()), but only set the 15312 // additional data once there's actually content to show (in _open()). So even if the 15313 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 15314 // the period between open() and _open(). 15315 target.removeData("ui-tooltip-open"); 15316 return; 15317 } 15318 15319 tooltip = tooltipData.tooltip; 15320 15321 // Disabling closes the tooltip, so we need to track when we're closing 15322 // to avoid an infinite loop in case the tooltip becomes disabled on close 15323 if (tooltipData.closing) { 15324 return; 15325 } 15326 15327 // Clear the interval for delayed tracking tooltips 15328 clearInterval(this.delayedShow); 15329 15330 // Only set title if we had one before (see comment in _open()) 15331 // If the title attribute has changed since open(), don't restore 15332 if (target.data("ui-tooltip-title") && !target.attr("title")) { 15333 target.attr("title", target.data("ui-tooltip-title")); 15334 } 15335 15336 this._removeDescribedBy(target); 15337 15338 tooltipData.hiding = true; 15339 tooltip.stop(true); 15340 this._hide(tooltip, this.options.hide, function() { 15341 that._removeTooltip($(this)); 15342 }); 15343 15344 target.removeData("ui-tooltip-open"); 15345 this._off(target, "mouseleave focusout keyup"); 15346 15347 // Remove 'remove' binding only on delegated targets 15348 if (target[0] !== this.element[0]) { 15349 this._off(target, "remove"); 15350 } 15351 this._off(this.document, "mousemove"); 15352 15353 if (event && event.type === "mouseleave") { 15354 $.each(this.parents, function(id, parent) { 15355 $(parent.element).attr("title", parent.title); 15356 delete that.parents[id]; 15357 }); 15358 } 15359 15360 tooltipData.closing = true; 15361 this._trigger("close", event, { tooltip: tooltip }); 15362 if (!tooltipData.hiding) { 15363 tooltipData.closing = false; 15364 } 15365 }, 15366 15367 _tooltip: function(element) { 15368 var tooltip = $("<div>").attr("role", "tooltip"), 15369 content = $("<div>").appendTo(tooltip), 15370 id = tooltip.uniqueId().attr("id"); 15371 15372 this._addClass(content, "ui-tooltip-content"); 15373 this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content"); 15374 15375 tooltip.appendTo(this._appendTo(element)); 15376 15377 return this.tooltips[id] = { 15378 element: element, 15379 tooltip: tooltip 15380 }; 15381 }, 15382 15383 _find: function(target) { 15384 var id = target.data("ui-tooltip-id"); 15385 return id ? this.tooltips[id] : null; 15386 }, 15387 15388 _removeTooltip: function(tooltip) { 15389 tooltip.remove(); 15390 delete this.tooltips[tooltip.attr("id")]; 15391 }, 15392 15393 _appendTo: function(target) { 15394 var element = target.closest(".ui-front, dialog"); 15395 15396 if (!element.length) { 15397 element = this.document[0].body; 15398 } 15399 15400 return element; 15401 }, 15402 15403 _destroy: function() { 15404 var that = this; 15405 15406 // Close open tooltips 15407 $.each(this.tooltips, function(id, tooltipData) { 15408 15409 // Delegate to close method to handle common cleanup 15410 var event = $.Event("blur"), 15411 element = tooltipData.element; 15412 event.target = event.currentTarget = element[0]; 15413 that.close(event, true); 15414 15415 // Remove immediately; destroying an open tooltip doesn't use the 15416 // hide animation 15417 $("#" + id).remove(); 15418 15419 // Restore the title 15420 if (element.data("ui-tooltip-title")) { 15421 15422 // If the title attribute has changed since open(), don't restore 15423 if (!element.attr("title")) { 15424 element.attr("title", element.data("ui-tooltip-title")); 15425 } 15426 element.removeData("ui-tooltip-title"); 15427 } 15428 }); 15429 this.liveRegion.remove(); 15430 } 15431 }); 15432 15433 // DEPRECATED 15434 // TODO: Switch return back to widget declaration at top of file when this is removed 15435 if ($.uiBackCompat !== false) { 15436 15437 // Backcompat for tooltipClass option 15438 $.widget("ui.tooltip", $.ui.tooltip, { 15439 options: { 15440 tooltipClass: null 15441 }, 15442 _tooltip: function() { 15443 var tooltipData = this._superApply(arguments); 15444 if (this.options.tooltipClass) { 15445 tooltipData.tooltip.addClass(this.options.tooltipClass); 15446 } 15447 return tooltipData; 15448 } 15449 }); 15450 } 15451 15452 var widgetsTooltip = $.ui.tooltip; 15453 15454 15455 /*! 15456 * jQuery UI Effects 1.12.1 15457 * http://jqueryui.com 15458 * 15459 * Copyright jQuery Foundation and other contributors 15460 * Released under the MIT license. 15461 * http://jquery.org/license 15462 */ 15463 15464 //>>label: Effects Core 15465 //>>group: Effects 15466 // jscs:disable maximumLineLength 15467 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 15468 // jscs:enable maximumLineLength 15469 //>>docs: http://api.jqueryui.com/category/effects-core/ 15470 //>>demos: http://jqueryui.com/effect/ 15471 15472 15473 15474 var dataSpace = "ui-effects-", 15475 dataSpaceStyle = "ui-effects-style", 15476 dataSpaceAnimated = "ui-effects-animated", 15477 15478 // Create a local jQuery because jQuery Color relies on it and the 15479 // global may not exist with AMD and a custom build (#10199) 15480 jQuery = $; 15481 15482 $.effects = { 15483 effect: {} 15484 }; 15485 15486 /*! 15487 * jQuery Color Animations v2.1.2 15488 * https://github.com/jquery/jquery-color 15489 * 15490 * Copyright 2014 jQuery Foundation and other contributors 15491 * Released under the MIT license. 15492 * http://jquery.org/license 15493 * 15494 * Date: Wed Jan 16 08:47:09 2013 -0600 15495 */ 15496 (function(jQuery, undefined) { 15497 15498 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 15499 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 15500 15501 // Plusequals test for += 100 -= 100 15502 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 15503 15504 // A set of RE's that can match strings and generate color tuples.
vendor: 26,642 bytes, lines 15505-16237
15505 stringParsers = [{ 15506 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 15507 parse: function(execResult) { 15508 return [ 15509 execResult[1], 15510 execResult[2], 15511 execResult[3], 15512 execResult[4] 15513 ]; 15514 } 15515 }, { 15516 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 15517 parse: function(execResult) { 15518 return [ 15519 execResult[1] * 2.55, 15520 execResult[2] * 2.55, 15521 execResult[3] * 2.55, 15522 execResult[4] 15523 ]; 15524 } 15525 }, { 15526 15527 // This regex ignores A-F because it's compared against an already lowercased string 15528 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, 15529 parse: function(execResult) { 15530 return [ 15531 parseInt(execResult[1], 16), 15532 parseInt(execResult[2], 16), 15533 parseInt(execResult[3], 16) 15534 ]; 15535 } 15536 }, { 15537 15538 // This regex ignores A-F because it's compared against an already lowercased string 15539 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, 15540 parse: function(execResult) { 15541 return [ 15542 parseInt(execResult[1] + execResult[1], 16), 15543 parseInt(execResult[2] + execResult[2], 16), 15544 parseInt(execResult[3] + execResult[3], 16) 15545 ]; 15546 } 15547 }, { 15548 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 15549 space: "hsla", 15550 parse: function(execResult) { 15551 return [ 15552 execResult[1], 15553 execResult[2] / 100, 15554 execResult[3] / 100, 15555 execResult[4] 15556 ]; 15557 } 15558 }], 15559 15560 // JQuery.Color( ) 15561 color = jQuery.Color = function(color, green, blue, alpha) { 15562 return new jQuery.Color.fn.parse(color, green, blue, alpha); 15563 }, 15564 spaces = { 15565 rgba: { 15566 props: { 15567 red: { 15568 idx: 0, 15569 type: "byte" 15570 }, 15571 green: { 15572 idx: 1, 15573 type: "byte" 15574 }, 15575 blue: { 15576 idx: 2, 15577 type: "byte" 15578 } 15579 } 15580 }, 15581 15582 hsla: { 15583 props: { 15584 hue: { 15585 idx: 0, 15586 type: "degrees" 15587 }, 15588 saturation: { 15589 idx: 1, 15590 type: "percent" 15591 }, 15592 lightness: { 15593 idx: 2, 15594 type: "percent" 15595 } 15596 } 15597 } 15598 }, 15599 propTypes = { 15600 "byte": { 15601 floor: true, 15602 max: 255 15603 }, 15604 "percent": { 15605 max: 1 15606 }, 15607 "degrees": { 15608 mod: 360, 15609 floor: true 15610 } 15611 }, 15612 support = color.support = {}, 15613 15614 // Element for support tests 15615 supportElem = jQuery("<p>")[0], 15616 15617 // Colors = jQuery.Color.names 15618 colors, 15619 15620 // Local aliases of functions called often 15621 each = jQuery.each; 15622 15623 // Determine rgba support immediately 15624 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 15625 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 15626 15627 // Define cache name and alpha properties 15628 // for rgba and hsla spaces 15629 each(spaces, function(spaceName, space) { 15630 space.cache = "_" + spaceName; 15631 space.props.alpha = { 15632 idx: 3, 15633 type: "percent", 15634 def: 1 15635 }; 15636 }); 15637 15638 function clamp(value, prop, allowEmpty) { 15639 var type = propTypes[prop.type] || {}; 15640 15641 if (value == null) { 15642 return (allowEmpty || !prop.def) ? null : prop.def; 15643 } 15644 15645 // ~~ is an short way of doing floor for positive numbers 15646 value = type.floor ? ~~value : parseFloat(value); 15647 15648 // IE will pass in empty strings as value for alpha, 15649 // which will hit this case 15650 if (isNaN(value)) { 15651 return prop.def; 15652 } 15653 15654 if (type.mod) { 15655 15656 // We add mod before modding to make sure that negatives values 15657 // get converted properly: -10 -> 350 15658 return (value + type.mod) % type.mod; 15659 } 15660 15661 // For now all property types without mod have min and max 15662 return 0 > value ? 0 : type.max < value ? type.max : value; 15663 } 15664 15665 function stringParse(string) { 15666 var inst = color(), 15667 rgba = inst._rgba = []; 15668 15669 string = string.toLowerCase(); 15670 15671 each(stringParsers, function(i, parser) { 15672 var parsed, 15673 match = parser.re.exec(string), 15674 values = match && parser.parse(match), 15675 spaceName = parser.space || "rgba"; 15676 15677 if (values) { 15678 parsed = inst[spaceName](values); 15679 15680 // If this was an rgba parse the assignment might happen twice 15681 // oh well.... 15682 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 15683 rgba = inst._rgba = parsed._rgba; 15684 15685 // Exit each( stringParsers ) here because we matched 15686 return false; 15687 } 15688 }); 15689 15690 // Found a stringParser that handled it 15691 if (rgba.length) { 15692 15693 // If this came from a parsed string, force "transparent" when alpha is 0 15694 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 15695 if (rgba.join() === "0,0,0,0") { 15696 jQuery.extend(rgba, colors.transparent); 15697 } 15698 return inst; 15699 } 15700 15701 // Named colors 15702 return colors[string]; 15703 } 15704 15705 color.fn = jQuery.extend(color.prototype, { 15706 parse: function(red, green, blue, alpha) { 15707 if (red === undefined) { 15708 this._rgba = [null, null, null, null]; 15709 return this; 15710 } 15711 if (red.jquery || red.nodeType) { 15712 red = jQuery(red).css(green); 15713 green = undefined; 15714 } 15715 15716 var inst = this, 15717 type = jQuery.type(red), 15718 rgba = this._rgba = []; 15719 15720 // More than 1 argument specified - assume ( red, green, blue, alpha ) 15721 if (green !== undefined) { 15722 red = [red, green, blue, alpha]; 15723 type = "array"; 15724 } 15725 15726 if (type === "string") { 15727 return this.parse(stringParse(red) || colors._default); 15728 } 15729 15730 if (type === "array") { 15731 each(spaces.rgba.props, function(key, prop) { 15732 rgba[prop.idx] = clamp(red[prop.idx], prop); 15733 }); 15734 return this; 15735 } 15736 15737 if (type === "object") { 15738 if (red instanceof color) { 15739 each(spaces, function(spaceName, space) { 15740 if (red[space.cache]) { 15741 inst[space.cache] = red[space.cache].slice(); 15742 } 15743 }); 15744 } else { 15745 each(spaces, function(spaceName, space) { 15746 var cache = space.cache; 15747 each(space.props, function(key, prop) { 15748 15749 // If the cache doesn't exist, and we know how to convert 15750 if (!inst[cache] && space.to) { 15751 15752 // If the value was null, we don't need to copy it 15753 // if the key was alpha, we don't need to copy it either 15754 if (key === "alpha" || red[key] == null) { 15755 return; 15756 } 15757 inst[cache] = space.to(inst._rgba); 15758 } 15759 15760 // This is the only case where we allow nulls for ALL properties. 15761 // call clamp with alwaysAllowEmpty 15762 inst[cache][prop.idx] = clamp(red[key], prop, true); 15763 }); 15764 15765 // Everything defined but alpha? 15766 if (inst[cache] && 15767 jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) { 15768 15769 // Use the default of 1 15770 inst[cache][3] = 1; 15771 if (space.from) { 15772 inst._rgba = space.from(inst[cache]); 15773 } 15774 } 15775 }); 15776 } 15777 return this; 15778 } 15779 }, 15780 is: function(compare) { 15781 var is = color(compare), 15782 same = true, 15783 inst = this; 15784 15785 each(spaces, function(_, space) { 15786 var localCache, 15787 isCache = is[space.cache]; 15788 if (isCache) { 15789 localCache = inst[space.cache] || space.to && space.to(inst._rgba) || []; 15790 each(space.props, function(_, prop) { 15791 if (isCache[prop.idx] != null) { 15792 same = (isCache[prop.idx] === localCache[prop.idx]); 15793 return same; 15794 } 15795 }); 15796 } 15797 return same; 15798 }); 15799 return same; 15800 }, 15801 _space: function() { 15802 var used = [], 15803 inst = this; 15804 each(spaces, function(spaceName, space) { 15805 if (inst[space.cache]) { 15806 used.push(spaceName); 15807 } 15808 }); 15809 return used.pop(); 15810 }, 15811 transition: function(other, distance) { 15812 var end = color(other), 15813 spaceName = end._space(), 15814 space = spaces[spaceName], 15815 startColor = this.alpha() === 0 ? color("transparent") : this, 15816 start = startColor[space.cache] || space.to(startColor._rgba), 15817 result = start.slice(); 15818 15819 end = end[space.cache]; 15820 each(space.props, function(key, prop) { 15821 var index = prop.idx, 15822 startValue = start[index], 15823 endValue = end[index], 15824 type = propTypes[prop.type] || {}; 15825 15826 // If null, don't override start value 15827 if (endValue === null) { 15828 return; 15829 } 15830 15831 // If null - use end 15832 if (startValue === null) { 15833 result[index] = endValue; 15834 } else { 15835 if (type.mod) { 15836 if (endValue - startValue > type.mod / 2) { 15837 startValue += type.mod; 15838 } else if (startValue - endValue > type.mod / 2) { 15839 startValue -= type.mod; 15840 } 15841 } 15842 result[index] = clamp((endValue - startValue) * distance + startValue, prop); 15843 } 15844 }); 15845 return this[spaceName](result); 15846 }, 15847 blend: function(opaque) { 15848 15849 // If we are already opaque - return ourself 15850 if (this._rgba[3] === 1) { 15851 return this; 15852 } 15853 15854 var rgb = this._rgba.slice(), 15855 a = rgb.pop(), 15856 blend = color(opaque)._rgba; 15857 15858 return color(jQuery.map(rgb, function(v, i) { 15859 return (1 - a) * blend[i] + a * v; 15860 })); 15861 }, 15862 toRgbaString: function() { 15863 var prefix = "rgba(", 15864 rgba = jQuery.map(this._rgba, function(v, i) { 15865 return v == null ? (i > 2 ? 1 : 0) : v; 15866 }); 15867 15868 if (rgba[3] === 1) { 15869 rgba.pop(); 15870 prefix = "rgb("; 15871 } 15872 15873 return prefix + rgba.join() + ")"; 15874 }, 15875 toHslaString: function() { 15876 var prefix = "hsla(", 15877 hsla = jQuery.map(this.hsla(), function(v, i) { 15878 if (v == null) { 15879 v = i > 2 ? 1 : 0; 15880 } 15881 15882 // Catch 1 and 2 15883 if (i && i < 3) { 15884 v = Math.round(v * 100) + "%"; 15885 } 15886 return v; 15887 }); 15888 15889 if (hsla[3] === 1) { 15890 hsla.pop(); 15891 prefix = "hsl("; 15892 } 15893 return prefix + hsla.join() + ")"; 15894 }, 15895 toHexString: function(includeAlpha) { 15896 var rgba = this._rgba.slice(), 15897 alpha = rgba.pop(); 15898 15899 if (includeAlpha) { 15900 rgba.push(~~(alpha * 255)); 15901 } 15902 15903 return "#" + jQuery.map(rgba, function(v) { 15904 15905 // Default to 0 when nulls exist 15906 v = (v || 0).toString(16); 15907 return v.length === 1 ? "0" + v : v; 15908 }).join(""); 15909 }, 15910 toString: function() { 15911 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 15912 } 15913 }); 15914 color.fn.parse.prototype = color.fn; 15915 15916 // Hsla conversions adapted from: 15917 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 15918 15919 function hue2rgb(p, q, h) { 15920 h = (h + 1) % 1; 15921 if (h * 6 < 1) { 15922 return p + (q - p) * h * 6; 15923 } 15924 if (h * 2 < 1) { 15925 return q; 15926 } 15927 if (h * 3 < 2) { 15928 return p + (q - p) * ((2 / 3) - h) * 6; 15929 } 15930 return p; 15931 } 15932 15933 spaces.hsla.to = function(rgba) { 15934 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 15935 return [null, null, null, rgba[3]]; 15936 } 15937 var r = rgba[0] / 255, 15938 g = rgba[1] / 255, 15939 b = rgba[2] / 255, 15940 a = rgba[3], 15941 max = Math.max(r, g, b), 15942 min = Math.min(r, g, b), 15943 diff = max - min, 15944 add = max + min, 15945 l = add * 0.5, 15946 h, s; 15947 15948 if (min === max) { 15949 h = 0; 15950 } else if (r === max) { 15951 h = (60 * (g - b) / diff) + 360; 15952 } else if (g === max) { 15953 h = (60 * (b - r) / diff) + 120; 15954 } else { 15955 h = (60 * (r - g) / diff) + 240; 15956 } 15957 15958 // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 15959 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 15960 if (diff === 0) { 15961 s = 0; 15962 } else if (l <= 0.5) { 15963 s = diff / add; 15964 } else { 15965 s = diff / (2 - add); 15966 } 15967 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 15968 }; 15969 15970 spaces.hsla.from = function(hsla) { 15971 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 15972 return [null, null, null, hsla[3]]; 15973 } 15974 var h = hsla[0] / 360, 15975 s = hsla[1], 15976 l = hsla[2], 15977 a = hsla[3], 15978 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 15979 p = 2 * l - q; 15980 15981 return [ 15982 Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), 15983 Math.round(hue2rgb(p, q, h) * 255), 15984 Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), 15985 a 15986 ]; 15987 }; 15988 15989 each(spaces, function(spaceName, space) { 15990 var props = space.props, 15991 cache = space.cache, 15992 to = space.to, 15993 from = space.from; 15994 15995 // Makes rgba() and hsla() 15996 color.fn[spaceName] = function(value) { 15997 15998 // Generate a cache for this space if it doesn't exist 15999 if (to && !this[cache]) { 16000 this[cache] = to(this._rgba); 16001 } 16002 if (value === undefined) { 16003 return this[cache].slice(); 16004 } 16005 16006 var ret, 16007 type = jQuery.type(value), 16008 arr = (type === "array" || type === "object") ? value : arguments, 16009 local = this[cache].slice(); 16010 16011 each(props, function(key, prop) { 16012 var val = arr[type === "object" ? key : prop.idx]; 16013 if (val == null) { 16014 val = local[prop.idx]; 16015 } 16016 local[prop.idx] = clamp(val, prop); 16017 }); 16018 16019 if (from) { 16020 ret = color(from(local)); 16021 ret[cache] = local; 16022 return ret; 16023 } else { 16024 return color(local); 16025 } 16026 }; 16027 16028 // Makes red() green() blue() alpha() hue() saturation() lightness() 16029 each(props, function(key, prop) { 16030 16031 // Alpha is included in more than one space 16032 if (color.fn[key]) { 16033 return; 16034 } 16035 color.fn[key] = function(value) { 16036 var vtype = jQuery.type(value), 16037 fn = (key === "alpha" ? (this._hsla ? "hsla" : "rgba") : spaceName), 16038 local = this[fn](), 16039 cur = local[prop.idx], 16040 match; 16041 16042 if (vtype === "undefined") { 16043 return cur; 16044 } 16045 16046 if (vtype === "function") { 16047 value = value.call(this, cur); 16048 vtype = jQuery.type(value); 16049 } 16050 if (value == null && prop.empty) { 16051 return this; 16052 } 16053 if (vtype === "string") { 16054 match = rplusequals.exec(value); 16055 if (match) { 16056 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 16057 } 16058 } 16059 local[prop.idx] = value; 16060 return this[fn](local); 16061 }; 16062 }); 16063 }); 16064 16065 // Add cssHook and .fx.step function for each named hook. 16066 // accept a space separated string of properties 16067 color.hook = function(hook) { 16068 var hooks = hook.split(" "); 16069 each(hooks, function(i, hook) { 16070 jQuery.cssHooks[hook] = { 16071 set: function(elem, value) { 16072 var parsed, curElem, 16073 backgroundColor = ""; 16074 16075 if (value !== "transparent" && (jQuery.type(value) !== "string" || 16076 (parsed = stringParse(value)))) { 16077 value = color(parsed || value); 16078 if (!support.rgba && value._rgba[3] !== 1) { 16079 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 16080 while ( 16081 (backgroundColor === "" || backgroundColor === "transparent") && 16082 curElem && curElem.style 16083 ) { 16084 try { 16085 backgroundColor = jQuery.css(curElem, "backgroundColor"); 16086 curElem = curElem.parentNode; 16087 } catch (e) {} 16088 } 16089 16090 value = value.blend(backgroundColor && backgroundColor !== "transparent" ? 16091 backgroundColor : 16092 "_default"); 16093 } 16094 16095 value = value.toRgbaString(); 16096 } 16097 try { 16098 elem.style[hook] = value; 16099 } catch (e) { 16100 16101 // Wrapped to prevent IE from throwing errors on "invalid" values like 16102 // 'auto' or 'inherit' 16103 } 16104 } 16105 }; 16106 jQuery.fx.step[hook] = function(fx) { 16107 if (!fx.colorInit) { 16108 fx.start = color(fx.elem, hook); 16109 fx.end = color(fx.end); 16110 fx.colorInit = true; 16111 } 16112 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 16113 }; 16114 }); 16115 16116 }; 16117 16118 color.hook(stepHooks); 16119 16120 jQuery.cssHooks.borderColor = { 16121 expand: function(value) { 16122 var expanded = {}; 16123 16124 each(["Top", "Right", "Bottom", "Left"], function(i, part) { 16125 expanded["border" + part + "Color"] = value; 16126 }); 16127 return expanded; 16128 } 16129 }; 16130 16131 // Basic color names only. 16132 // Usage of any of the other color names requires adding yourself or including 16133 // jquery.color.svg-names.js. 16134 colors = jQuery.Color.names = { 16135 16136 // 4.1. Basic color keywords 16137 aqua: "#00ffff", 16138 black: "#000000", 16139 blue: "#0000ff", 16140 fuchsia: "#ff00ff", 16141 gray: "#808080", 16142 green: "#008000", 16143 lime: "#00ff00", 16144 maroon: "#800000", 16145 navy: "#000080", 16146 olive: "#808000", 16147 purple: "#800080", 16148 red: "#ff0000", 16149 silver: "#c0c0c0", 16150 teal: "#008080", 16151 white: "#ffffff", 16152 yellow: "#ffff00", 16153 16154 // 4.2.3. "transparent" color keyword 16155 transparent: [null, null, null, 0], 16156 16157 _default: "#ffffff" 16158 }; 16159 16160 })(jQuery); 16161 16162 /******************************************************************************/ 16163 /****************************** CLASS ANIMATIONS ******************************/ 16164 /******************************************************************************/ 16165 (function() { 16166 16167 var classAnimationActions = ["add", "remove", "toggle"], 16168 shorthandStyles = { 16169 border: 1, 16170 borderBottom: 1, 16171 borderColor: 1, 16172 borderLeft: 1, 16173 borderRight: 1, 16174 borderTop: 1, 16175 borderWidth: 1, 16176 margin: 1, 16177 padding: 1 16178 }; 16179 16180 $.each( 16181 ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], 16182 function(_, prop) { 16183 $.fx.step[prop] = function(fx) { 16184 if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) { 16185 jQuery.style(fx.elem, prop, fx.end); 16186 fx.setAttr = true; 16187 } 16188 }; 16189 } 16190 ); 16191 16192 function getElementStyles(elem) { 16193 var key, len, 16194 style = elem.ownerDocument.defaultView ? 16195 elem.ownerDocument.defaultView.getComputedStyle(elem, null) : 16196 elem.currentStyle, 16197 styles = {}; 16198 16199 if (style && style.length && style[0] && style[style[0]]) { 16200 len = style.length; 16201 while (len--) { 16202 key = style[len]; 16203 if (typeof style[key] === "string") { 16204 styles[$.camelCase(key)] = style[key]; 16205 } 16206 } 16207 16208 // Support: Opera, IE <9 16209 } else { 16210 for (key in style) { 16211 if (typeof style[key] === "string") { 16212 styles[key] = style[key]; 16213 } 16214 } 16215 } 16216 16217 return styles; 16218 } 16219 16220 function styleDifference(oldStyle, newStyle) { 16221 var diff = {}, 16222 name, value; 16223 16224 for (name in newStyle) { 16225 value = newStyle[name]; 16226 if (oldStyle[name] !== value) { 16227 if (!shorthandStyles[name]) { 16228 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 16229 diff[name] = value; 16230 } 16231 } 16232 } 16233 } 16234 16235 return diff; 16236 } 16237
vendor: 8,353 bytes, lines 16238-16446
16238 // Support: jQuery <1.8 16239 if (!$.fn.addBack) { 16240 $.fn.addBack = function(selector) { 16241 return this.add(selector == null ? 16242 this.prevObject : this.prevObject.filter(selector) 16243 ); 16244 }; 16245 } 16246 16247 $.effects.animateClass = function(value, duration, easing, callback) { 16248 var o = $.speed(duration, easing, callback); 16249 16250 return this.queue(function() { 16251 var animated = $(this), 16252 baseClass = animated.attr("class") || "", 16253 applyClassChange, 16254 allAnimations = o.children ? animated.find("*").addBack() : animated; 16255 16256 // Map the animated objects to store the original styles. 16257 allAnimations = allAnimations.map(function() { 16258 var el = $(this); 16259 return { 16260 el: el, 16261 start: getElementStyles(this) 16262 }; 16263 }); 16264 16265 // Apply class change 16266 applyClassChange = function() { 16267 $.each(classAnimationActions, function(i, action) { 16268 if (value[action]) { 16269 animated[action + "Class"](value[action]); 16270 } 16271 }); 16272 }; 16273 applyClassChange(); 16274 16275 // Map all animated objects again - calculate new styles and diff 16276 allAnimations = allAnimations.map(function() { 16277 this.end = getElementStyles(this.el[0]); 16278 this.diff = styleDifference(this.start, this.end); 16279 return this; 16280 }); 16281 16282 // Apply original class 16283 animated.attr("class", baseClass); 16284 16285 // Map all animated objects again - this time collecting a promise 16286 allAnimations = allAnimations.map(function() { 16287 var styleInfo = this, 16288 dfd = $.Deferred(), 16289 opts = $.extend({}, o, { 16290 queue: false, 16291 complete: function() { 16292 dfd.resolve(styleInfo); 16293 } 16294 }); 16295 16296 this.el.animate(this.diff, opts); 16297 return dfd.promise(); 16298 }); 16299 16300 // Once all animations have completed: 16301 $.when.apply($, allAnimations.get()).done(function() { 16302 16303 // Set the final class 16304 applyClassChange(); 16305 16306 // For each animated element, 16307 // clear all css properties that were animated 16308 $.each(arguments, function() { 16309 var el = this.el; 16310 $.each(this.diff, function(key) { 16311 el.css(key, ""); 16312 }); 16313 }); 16314 16315 // This is guarnteed to be there if you use jQuery.speed() 16316 // it also handles dequeuing the next anim... 16317 o.complete.call(animated[0]); 16318 }); 16319 }); 16320 }; 16321 16322 $.fn.extend({ 16323 addClass: (function(orig) { 16324 return function(classNames, speed, easing, callback) { 16325 return speed ? 16326 $.effects.animateClass.call(this, { add: classNames }, speed, easing, callback) : 16327 orig.apply(this, arguments); 16328 }; 16329 })($.fn.addClass), 16330 16331 removeClass: (function(orig) { 16332 return function(classNames, speed, easing, callback) { 16333 return arguments.length > 1 ? 16334 $.effects.animateClass.call(this, { remove: classNames }, speed, easing, callback) : 16335 orig.apply(this, arguments); 16336 }; 16337 })($.fn.removeClass), 16338 16339 toggleClass: (function(orig) { 16340 return function(classNames, force, speed, easing, callback) { 16341 if (typeof force === "boolean" || force === undefined) { 16342 if (!speed) { 16343 16344 // Without speed parameter 16345 return orig.apply(this, arguments); 16346 } else { 16347 return $.effects.animateClass.call(this, 16348 (force ? { add: classNames } : { remove: classNames }), 16349 speed, easing, callback); 16350 } 16351 } else { 16352 16353 // Without force parameter 16354 return $.effects.animateClass.call(this, { toggle: classNames }, force, speed, easing); 16355 } 16356 }; 16357 })($.fn.toggleClass), 16358 16359 switchClass: function(remove, add, speed, easing, callback) { 16360 return $.effects.animateClass.call(this, { 16361 add: add, 16362 remove: remove 16363 }, speed, easing, callback); 16364 } 16365 }); 16366 16367 })(); 16368 16369 /******************************************************************************/ 16370 /*********************************** EFFECTS **********************************/ 16371 /******************************************************************************/ 16372 16373 (function() { 16374 16375 if ($.expr && $.expr.filters && $.expr.filters.animated) { 16376 $.expr.filters.animated = (function(orig) { 16377 return function(elem) { 16378 return !!$(elem).data(dataSpaceAnimated) || orig(elem); 16379 }; 16380 })($.expr.filters.animated); 16381 } 16382 16383 if ($.uiBackCompat !== false) { 16384 $.extend($.effects, { 16385 16386 // Saves a set of properties in a data storage 16387 save: function(element, set) { 16388 var i = 0, 16389 length = set.length; 16390 for (; i < length; i++) { 16391 if (set[i] !== null) { 16392 element.data(dataSpace + set[i], element[0].style[set[i]]); 16393 } 16394 } 16395 }, 16396 16397 // Restores a set of previously saved properties from a data storage 16398 restore: function(element, set) { 16399 var val, i = 0, 16400 length = set.length; 16401 for (; i < length; i++) { 16402 if (set[i] !== null) { 16403 val = element.data(dataSpace + set[i]); 16404 element.css(set[i], val); 16405 } 16406 } 16407 }, 16408 16409 setMode: function(el, mode) { 16410 if (mode === "toggle") { 16411 mode = el.is(":hidden") ? "show" : "hide"; 16412 } 16413 return mode; 16414 }, 16415 16416 // Wraps the element around a wrapper that copies position properties 16417 createWrapper: function(element) { 16418 16419 // If the element is already wrapped, return it 16420 if (element.parent().is(".ui-effects-wrapper")) { 16421 return element.parent(); 16422 } 16423 16424 // Wrap the element 16425 var props = { 16426 width: element.outerWidth(true), 16427 height: element.outerHeight(true), 16428 "float": element.css("float") 16429 }, 16430 wrapper = $("<div></div>") 16431 .addClass("ui-effects-wrapper") 16432 .css({ 16433 fontSize: "100%", 16434 background: "transparent", 16435 border: "none", 16436 margin: 0, 16437 padding: 0 16438 }), 16439 16440 // Store the size in case width/height are defined in % - Fixes #5245 16441 size = { 16442 width: element.width(), 16443 height: element.height() 16444 }, 16445 active = document.activeElement; 16446
vendor: 5,838 bytes, lines 16447-16607
16447 // Support: Firefox 16448 // Firefox incorrectly exposes anonymous content 16449 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 16450 try { 16451 active.id; 16452 } catch (e) { 16453 active = document.body; 16454 } 16455 16456 element.wrap(wrapper); 16457 16458 // Fixes #7595 - Elements lose focus when wrapped. 16459 if (element[0] === active || $.contains(element[0], active)) { 16460 $(active).trigger("focus"); 16461 } 16462 16463 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 16464 // lose the reference to the wrapped element 16465 wrapper = element.parent(); 16466 16467 // Transfer positioning properties to the wrapper 16468 if (element.css("position") === "static") { 16469 wrapper.css({ position: "relative" }); 16470 element.css({ position: "relative" }); 16471 } else { 16472 $.extend(props, { 16473 position: element.css("position"), 16474 zIndex: element.css("z-index") 16475 }); 16476 $.each(["top", "left", "bottom", "right"], function(i, pos) { 16477 props[pos] = element.css(pos); 16478 if (isNaN(parseInt(props[pos], 10))) { 16479 props[pos] = "auto"; 16480 } 16481 }); 16482 element.css({ 16483 position: "relative", 16484 top: 0, 16485 left: 0, 16486 right: "auto", 16487 bottom: "auto" 16488 }); 16489 } 16490 element.css(size); 16491 16492 return wrapper.css(props).show(); 16493 }, 16494 16495 removeWrapper: function(element) { 16496 var active = document.activeElement; 16497 16498 if (element.parent().is(".ui-effects-wrapper")) { 16499 element.parent().replaceWith(element); 16500 16501 // Fixes #7595 - Elements lose focus when wrapped. 16502 if (element[0] === active || $.contains(element[0], active)) { 16503 $(active).trigger("focus"); 16504 } 16505 } 16506 16507 return element; 16508 } 16509 }); 16510 } 16511 16512 $.extend($.effects, { 16513 version: "1.12.1", 16514 16515 define: function(name, mode, effect) { 16516 if (!effect) { 16517 effect = mode; 16518 mode = "effect"; 16519 } 16520 16521 $.effects.effect[name] = effect; 16522 $.effects.effect[name].mode = mode; 16523 16524 return effect; 16525 }, 16526 16527 scaledDimensions: function(element, percent, direction) { 16528 if (percent === 0) { 16529 return { 16530 height: 0, 16531 width: 0, 16532 outerHeight: 0, 16533 outerWidth: 0 16534 }; 16535 } 16536 16537 var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1, 16538 y = direction !== "vertical" ? ((percent || 100) / 100) : 1; 16539 16540 return { 16541 height: element.height() * y, 16542 width: element.width() * x, 16543 outerHeight: element.outerHeight() * y, 16544 outerWidth: element.outerWidth() * x 16545 }; 16546 16547 }, 16548 16549 clipToBox: function(animation) { 16550 return { 16551 width: animation.clip.right - animation.clip.left, 16552 height: animation.clip.bottom - animation.clip.top, 16553 left: animation.clip.left, 16554 top: animation.clip.top 16555 }; 16556 }, 16557 16558 // Injects recently queued functions to be first in line (after "inprogress") 16559 unshift: function(element, queueLength, count) { 16560 var queue = element.queue(); 16561 16562 if (queueLength > 1) { 16563 queue.splice.apply(queue, [1, 0].concat(queue.splice(queueLength, count))); 16564 } 16565 element.dequeue(); 16566 }, 16567 16568 saveStyle: function(element) { 16569 element.data(dataSpaceStyle, element[0].style.cssText); 16570 }, 16571 16572 restoreStyle: function(element) { 16573 element[0].style.cssText = element.data(dataSpaceStyle) || ""; 16574 element.removeData(dataSpaceStyle); 16575 }, 16576 16577 mode: function(element, mode) { 16578 var hidden = element.is(":hidden"); 16579 16580 if (mode === "toggle") { 16581 mode = hidden ? "show" : "hide"; 16582 } 16583 if (hidden ? mode === "hide" : mode === "show") { 16584 mode = "none"; 16585 } 16586 return mode; 16587 }, 16588 16589 // Translates a [top,left] array into a baseline value 16590 getBaseline: function(origin, original) { 16591 var y, x; 16592 16593 switch (origin[0]) { 16594 case "top": 16595 y = 0; 16596 break; 16597 case "middle": 16598 y = 0.5; 16599 break; 16600 case "bottom": 16601 y = 1; 16602 break; 16603 default: 16604 y = origin[0] / original.height; 16605 } 16606 16607 switch (origin[1]) {
vendor: 26,538 bytes, lines 16608-17364
16608 case "left": 16609 x = 0; 16610 break; 16611 case "center": 16612 x = 0.5; 16613 break; 16614 case "right": 16615 x = 1; 16616 break; 16617 default: 16618 x = origin[1] / original.width; 16619 } 16620 16621 return { 16622 x: x, 16623 y: y 16624 }; 16625 }, 16626 16627 // Creates a placeholder element so that the original element can be made absolute 16628 createPlaceholder: function(element) { 16629 var placeholder, 16630 cssPosition = element.css("position"), 16631 position = element.position(); 16632 16633 // Lock in margins first to account for form elements, which 16634 // will change margin if you explicitly set height 16635 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 16636 // Support: Safari 16637 element.css({ 16638 marginTop: element.css("marginTop"), 16639 marginBottom: element.css("marginBottom"), 16640 marginLeft: element.css("marginLeft"), 16641 marginRight: element.css("marginRight") 16642 }) 16643 .outerWidth(element.outerWidth()) 16644 .outerHeight(element.outerHeight()); 16645 16646 if (/^(static|relative)/.test(cssPosition)) { 16647 cssPosition = "absolute"; 16648 16649 placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({ 16650 16651 // Convert inline to inline block to account for inline elements 16652 // that turn to inline block based on content (like img) 16653 display: /^(inline|ruby)/.test(element.css("display")) ? 16654 "inline-block" : "block", 16655 visibility: "hidden", 16656 16657 // Margins need to be set to account for margin collapse 16658 marginTop: element.css("marginTop"), 16659 marginBottom: element.css("marginBottom"), 16660 marginLeft: element.css("marginLeft"), 16661 marginRight: element.css("marginRight"), 16662 "float": element.css("float") 16663 }) 16664 .outerWidth(element.outerWidth()) 16665 .outerHeight(element.outerHeight()) 16666 .addClass("ui-effects-placeholder"); 16667 16668 element.data(dataSpace + "placeholder", placeholder); 16669 } 16670 16671 element.css({ 16672 position: cssPosition, 16673 left: position.left, 16674 top: position.top 16675 }); 16676 16677 return placeholder; 16678 }, 16679 16680 removePlaceholder: function(element) { 16681 var dataKey = dataSpace + "placeholder", 16682 placeholder = element.data(dataKey); 16683 16684 if (placeholder) { 16685 placeholder.remove(); 16686 element.removeData(dataKey); 16687 } 16688 }, 16689 16690 // Removes a placeholder if it exists and restores 16691 // properties that were modified during placeholder creation 16692 cleanUp: function(element) { 16693 $.effects.restoreStyle(element); 16694 $.effects.removePlaceholder(element); 16695 }, 16696 16697 setTransition: function(element, list, factor, value) { 16698 value = value || {}; 16699 $.each(list, function(i, x) { 16700 var unit = element.cssUnit(x); 16701 if (unit[0] > 0) { 16702 value[x] = unit[0] * factor + unit[1]; 16703 } 16704 }); 16705 return value; 16706 } 16707 }); 16708 16709 // Return an effect options object for the given parameters: 16710 function _normalizeArguments(effect, options, speed, callback) { 16711 16712 // Allow passing all options as the first parameter 16713 if ($.isPlainObject(effect)) { 16714 options = effect; 16715 effect = effect.effect; 16716 } 16717 16718 // Convert to an object 16719 effect = { effect: effect }; 16720 16721 // Catch (effect, null, ...) 16722 if (options == null) { 16723 options = {}; 16724 } 16725 16726 // Catch (effect, callback) 16727 if ($.isFunction(options)) { 16728 callback = options; 16729 speed = null; 16730 options = {}; 16731 } 16732 16733 // Catch (effect, speed, ?) 16734 if (typeof options === "number" || $.fx.speeds[options]) { 16735 callback = speed; 16736 speed = options; 16737 options = {}; 16738 } 16739 16740 // Catch (effect, options, callback) 16741 if ($.isFunction(speed)) { 16742 callback = speed; 16743 speed = null; 16744 } 16745 16746 // Add options to effect 16747 if (options) { 16748 $.extend(effect, options); 16749 } 16750 16751 speed = speed || options.duration; 16752 effect.duration = $.fx.off ? 0 : 16753 typeof speed === "number" ? speed : 16754 speed in $.fx.speeds ? $.fx.speeds[speed] : 16755 $.fx.speeds._default; 16756 16757 effect.complete = callback || options.complete; 16758 16759 return effect; 16760 } 16761 16762 function standardAnimationOption(option) { 16763 16764 // Valid standard speeds (nothing, number, named speed) 16765 if (!option || typeof option === "number" || $.fx.speeds[option]) { 16766 return true; 16767 } 16768 16769 // Invalid strings - treat as "normal" speed 16770 if (typeof option === "string" && !$.effects.effect[option]) { 16771 return true; 16772 } 16773 16774 // Complete callback 16775 if ($.isFunction(option)) { 16776 return true; 16777 } 16778 16779 // Options hash (but not naming an effect) 16780 if (typeof option === "object" && !option.effect) { 16781 return true; 16782 } 16783 16784 // Didn't match any standard API 16785 return false; 16786 } 16787 16788 $.fn.extend({ 16789 effect: function( /* effect, options, speed, callback */ ) { 16790 var args = _normalizeArguments.apply(this, arguments), 16791 effectMethod = $.effects.effect[args.effect], 16792 defaultMode = effectMethod.mode, 16793 queue = args.queue, 16794 queueName = queue || "fx", 16795 complete = args.complete, 16796 mode = args.mode, 16797 modes = [], 16798 prefilter = function(next) { 16799 var el = $(this), 16800 normalizedMode = $.effects.mode(el, mode) || defaultMode; 16801 16802 // Sentinel for duck-punching the :animated psuedo-selector 16803 el.data(dataSpaceAnimated, true); 16804 16805 // Save effect mode for later use, 16806 // we can't just call $.effects.mode again later, 16807 // as the .show() below destroys the initial state 16808 modes.push(normalizedMode); 16809 16810 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13 16811 if (defaultMode && (normalizedMode === "show" || 16812 (normalizedMode === defaultMode && normalizedMode === "hide"))) { 16813 el.show(); 16814 } 16815 16816 if (!defaultMode || normalizedMode !== "none") { 16817 $.effects.saveStyle(el); 16818 } 16819 16820 if ($.isFunction(next)) { 16821 next(); 16822 } 16823 }; 16824 16825 if ($.fx.off || !effectMethod) { 16826 16827 // Delegate to the original method (e.g., .show()) if possible 16828 if (mode) { 16829 return this[mode](args.duration, complete); 16830 } else { 16831 return this.each(function() { 16832 if (complete) { 16833 complete.call(this); 16834 } 16835 }); 16836 } 16837 } 16838 16839 function run(next) { 16840 var elem = $(this); 16841 16842 function cleanup() { 16843 elem.removeData(dataSpaceAnimated); 16844 16845 $.effects.cleanUp(elem); 16846 16847 if (args.mode === "hide") { 16848 elem.hide(); 16849 } 16850 16851 done(); 16852 } 16853 16854 function done() { 16855 if ($.isFunction(complete)) { 16856 complete.call(elem[0]); 16857 } 16858 16859 if ($.isFunction(next)) { 16860 next(); 16861 } 16862 } 16863 16864 // Override mode option on a per element basis, 16865 // as toggle can be either show or hide depending on element state 16866 args.mode = modes.shift(); 16867 16868 if ($.uiBackCompat !== false && !defaultMode) { 16869 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 16870 16871 // Call the core method to track "olddisplay" properly 16872 elem[mode](); 16873 done(); 16874 } else { 16875 effectMethod.call(elem[0], args, done); 16876 } 16877 } else { 16878 if (args.mode === "none") { 16879 16880 // Call the core method to track "olddisplay" properly 16881 elem[mode](); 16882 done(); 16883 } else { 16884 effectMethod.call(elem[0], args, cleanup); 16885 } 16886 } 16887 } 16888 16889 // Run prefilter on all elements first to ensure that 16890 // any showing or hiding happens before placeholder creation, 16891 // which ensures that any layout changes are correctly captured. 16892 return queue === false ? 16893 this.each(prefilter).each(run) : 16894 this.queue(queueName, prefilter).queue(queueName, run); 16895 }, 16896 16897 show: (function(orig) { 16898 return function(option) { 16899 if (standardAnimationOption(option)) { 16900 return orig.apply(this, arguments); 16901 } else { 16902 var args = _normalizeArguments.apply(this, arguments); 16903 args.mode = "show"; 16904 return this.effect.call(this, args); 16905 } 16906 }; 16907 })($.fn.show), 16908 16909 hide: (function(orig) { 16910 return function(option) { 16911 if (standardAnimationOption(option)) { 16912 return orig.apply(this, arguments); 16913 } else { 16914 var args = _normalizeArguments.apply(this, arguments); 16915 args.mode = "hide"; 16916 return this.effect.call(this, args); 16917 } 16918 }; 16919 })($.fn.hide), 16920 16921 toggle: (function(orig) { 16922 return function(option) { 16923 if (standardAnimationOption(option) || typeof option === "boolean") { 16924 return orig.apply(this, arguments); 16925 } else { 16926 var args = _normalizeArguments.apply(this, arguments); 16927 args.mode = "toggle"; 16928 return this.effect.call(this, args); 16929 } 16930 }; 16931 })($.fn.toggle), 16932 16933 cssUnit: function(key) { 16934 var style = this.css(key), 16935 val = []; 16936 16937 $.each(["em", "px", "%", "pt"], function(i, unit) { 16938 if (style.indexOf(unit) > 0) { 16939 val = [parseFloat(style), unit]; 16940 } 16941 }); 16942 return val; 16943 }, 16944 16945 cssClip: function(clipObj) { 16946 if (clipObj) { 16947 return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 16948 clipObj.bottom + "px " + clipObj.left + "px)"); 16949 } 16950 return parseClip(this.css("clip"), this); 16951 }, 16952 16953 transfer: function(options, done) { 16954 var element = $(this), 16955 target = $(options.to), 16956 targetFixed = target.css("position") === "fixed", 16957 body = $("body"), 16958 fixTop = targetFixed ? body.scrollTop() : 0, 16959 fixLeft = targetFixed ? body.scrollLeft() : 0, 16960 endPosition = target.offset(), 16961 animation = { 16962 top: endPosition.top - fixTop, 16963 left: endPosition.left - fixLeft, 16964 height: target.innerHeight(), 16965 width: target.innerWidth() 16966 }, 16967 startPosition = element.offset(), 16968 transfer = $("<div class='ui-effects-transfer'></div>") 16969 .appendTo("body") 16970 .addClass(options.className) 16971 .css({ 16972 top: startPosition.top - fixTop, 16973 left: startPosition.left - fixLeft, 16974 height: element.innerHeight(), 16975 width: element.innerWidth(), 16976 position: targetFixed ? "fixed" : "absolute" 16977 }) 16978 .animate(animation, options.duration, options.easing, function() { 16979 transfer.remove(); 16980 if ($.isFunction(done)) { 16981 done(); 16982 } 16983 }); 16984 } 16985 }); 16986 16987 function parseClip(str, element) { 16988 var outerWidth = element.outerWidth(), 16989 outerHeight = element.outerHeight(), 16990 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)\)$/, 16991 values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0]; 16992 16993 return { 16994 top: parseFloat(values[1]) || 0, 16995 right: values[2] === "auto" ? outerWidth : parseFloat(values[2]), 16996 bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]), 16997 left: parseFloat(values[4]) || 0 16998 }; 16999 } 17000 17001 $.fx.step.clip = function(fx) { 17002 if (!fx.clipInit) { 17003 fx.start = $(fx.elem).cssClip(); 17004 if (typeof fx.end === "string") { 17005 fx.end = parseClip(fx.end, fx.elem); 17006 } 17007 fx.clipInit = true; 17008 } 17009 17010 $(fx.elem).cssClip({ 17011 top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top, 17012 right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right, 17013 bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom, 17014 left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left 17015 }); 17016 }; 17017 17018 })(); 17019 17020 /******************************************************************************/ 17021 /*********************************** EASING ***********************************/ 17022 /******************************************************************************/ 17023 17024 (function() { 17025 17026 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 17027 17028 var baseEasings = {}; 17029 17030 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function(i, name) { 17031 baseEasings[name] = function(p) { 17032 return Math.pow(p, i + 2); 17033 }; 17034 }); 17035 17036 $.extend(baseEasings, { 17037 Sine: function(p) { 17038 return 1 - Math.cos(p * Math.PI / 2); 17039 }, 17040 Circ: function(p) { 17041 return 1 - Math.sqrt(1 - p * p); 17042 }, 17043 Elastic: function(p) { 17044 return p === 0 || p === 1 ? p : 17045 -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); 17046 }, 17047 Back: function(p) { 17048 return p * p * (3 * p - 2); 17049 }, 17050 Bounce: function(p) { 17051 var pow2, 17052 bounce = 4; 17053 17054 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {} 17055 return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); 17056 } 17057 }); 17058 17059 $.each(baseEasings, function(name, easeIn) { 17060 $.easing["easeIn" + name] = easeIn; 17061 $.easing["easeOut" + name] = function(p) { 17062 return 1 - easeIn(1 - p); 17063 }; 17064 $.easing["easeInOut" + name] = function(p) { 17065 return p < 0.5 ? 17066 easeIn(p * 2) / 2 : 17067 1 - easeIn(p * -2 + 2) / 2; 17068 }; 17069 }); 17070 17071 })(); 17072 17073 var effect = $.effects; 17074 17075 17076 /*! 17077 * jQuery UI Effects Blind 1.12.1 17078 * http://jqueryui.com 17079 * 17080 * Copyright jQuery Foundation and other contributors 17081 * Released under the MIT license. 17082 * http://jquery.org/license 17083 */ 17084 17085 //>>label: Blind Effect 17086 //>>group: Effects 17087 //>>description: Blinds the element. 17088 //>>docs: http://api.jqueryui.com/blind-effect/ 17089 //>>demos: http://jqueryui.com/effect/ 17090 17091 17092 17093 var effectsEffectBlind = $.effects.define("blind", "hide", function(options, done) { 17094 var map = { 17095 up: ["bottom", "top"], 17096 vertical: ["bottom", "top"], 17097 down: ["top", "bottom"], 17098 left: ["right", "left"], 17099 horizontal: ["right", "left"], 17100 right: ["left", "right"] 17101 }, 17102 element = $(this), 17103 direction = options.direction || "up", 17104 start = element.cssClip(), 17105 animate = { clip: $.extend({}, start) }, 17106 placeholder = $.effects.createPlaceholder(element); 17107 17108 animate.clip[map[direction][0]] = animate.clip[map[direction][1]]; 17109 17110 if (options.mode === "show") { 17111 element.cssClip(animate.clip); 17112 if (placeholder) { 17113 placeholder.css($.effects.clipToBox(animate)); 17114 } 17115 17116 animate.clip = start; 17117 } 17118 17119 if (placeholder) { 17120 placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing); 17121 } 17122 17123 element.animate(animate, { 17124 queue: false, 17125 duration: options.duration, 17126 easing: options.easing, 17127 complete: done 17128 }); 17129 }); 17130 17131 17132 /*! 17133 * jQuery UI Effects Bounce 1.12.1 17134 * http://jqueryui.com 17135 * 17136 * Copyright jQuery Foundation and other contributors 17137 * Released under the MIT license. 17138 * http://jquery.org/license 17139 */ 17140 17141 //>>label: Bounce Effect 17142 //>>group: Effects 17143 //>>description: Bounces an element horizontally or vertically n times. 17144 //>>docs: http://api.jqueryui.com/bounce-effect/ 17145 //>>demos: http://jqueryui.com/effect/ 17146 17147 17148 17149 var effectsEffectBounce = $.effects.define("bounce", function(options, done) { 17150 var upAnim, downAnim, refValue, 17151 element = $(this), 17152 17153 // Defaults: 17154 mode = options.mode, 17155 hide = mode === "hide", 17156 show = mode === "show", 17157 direction = options.direction || "up", 17158 distance = options.distance, 17159 times = options.times || 5, 17160 17161 // Number of internal animations 17162 anims = times * 2 + (show || hide ? 1 : 0), 17163 speed = options.duration / anims, 17164 easing = options.easing, 17165 17166 // Utility: 17167 ref = (direction === "up" || direction === "down") ? "top" : "left", 17168 motion = (direction === "up" || direction === "left"), 17169 i = 0, 17170 17171 queuelen = element.queue().length; 17172 17173 $.effects.createPlaceholder(element); 17174 17175 refValue = element.css(ref); 17176 17177 // Default distance for the BIGGEST bounce is the outer Distance / 3 17178 if (!distance) { 17179 distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 17180 } 17181 17182 if (show) { 17183 downAnim = { opacity: 1 }; 17184 downAnim[ref] = refValue; 17185 17186 // If we are showing, force opacity 0 and set the initial position 17187 // then do the "first" animation 17188 element 17189 .css("opacity", 0) 17190 .css(ref, motion ? -distance * 2 : distance * 2) 17191 .animate(downAnim, speed, easing); 17192 } 17193 17194 // Start at the smallest distance if we are hiding 17195 if (hide) { 17196 distance = distance / Math.pow(2, times - 1); 17197 } 17198 17199 downAnim = {}; 17200 downAnim[ref] = refValue; 17201 17202 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 17203 for (; i < times; i++) { 17204 upAnim = {}; 17205 upAnim[ref] = (motion ? "-=" : "+=") + distance; 17206 17207 element 17208 .animate(upAnim, speed, easing) 17209 .animate(downAnim, speed, easing); 17210 17211 distance = hide ? distance * 2 : distance / 2; 17212 } 17213 17214 // Last Bounce when Hiding 17215 if (hide) { 17216 upAnim = { opacity: 0 }; 17217 upAnim[ref] = (motion ? "-=" : "+=") + distance; 17218 17219 element.animate(upAnim, speed, easing); 17220 } 17221 17222 element.queue(done); 17223 17224 $.effects.unshift(element, queuelen, anims + 1); 17225 }); 17226 17227 17228 /*! 17229 * jQuery UI Effects Clip 1.12.1 17230 * http://jqueryui.com 17231 * 17232 * Copyright jQuery Foundation and other contributors 17233 * Released under the MIT license. 17234 * http://jquery.org/license 17235 */ 17236 17237 //>>label: Clip Effect 17238 //>>group: Effects 17239 //>>description: Clips the element on and off like an old TV. 17240 //>>docs: http://api.jqueryui.com/clip-effect/ 17241 //>>demos: http://jqueryui.com/effect/ 17242 17243 17244 17245 var effectsEffectClip = $.effects.define("clip", "hide", function(options, done) { 17246 var start, 17247 animate = {}, 17248 element = $(this), 17249 direction = options.direction || "vertical", 17250 both = direction === "both", 17251 horizontal = both || direction === "horizontal", 17252 vertical = both || direction === "vertical"; 17253 17254 start = element.cssClip(); 17255 animate.clip = { 17256 top: vertical ? (start.bottom - start.top) / 2 : start.top, 17257 right: horizontal ? (start.right - start.left) / 2 : start.right, 17258 bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom, 17259 left: horizontal ? (start.right - start.left) / 2 : start.left 17260 }; 17261 17262 $.effects.createPlaceholder(element); 17263 17264 if (options.mode === "show") { 17265 element.cssClip(animate.clip); 17266 animate.clip = start; 17267 } 17268 17269 element.animate(animate, { 17270 queue: false, 17271 duration: options.duration, 17272 easing: options.easing, 17273 complete: done 17274 }); 17275 17276 }); 17277 17278 17279 /*! 17280 * jQuery UI Effects Drop 1.12.1 17281 * http://jqueryui.com 17282 * 17283 * Copyright jQuery Foundation and other contributors 17284 * Released under the MIT license. 17285 * http://jquery.org/license 17286 */ 17287 17288 //>>label: Drop Effect 17289 //>>group: Effects 17290 //>>description: Moves an element in one direction and hides it at the same time. 17291 //>>docs: http://api.jqueryui.com/drop-effect/ 17292 //>>demos: http://jqueryui.com/effect/ 17293 17294 17295 17296 var effectsEffectDrop = $.effects.define("drop", "hide", function(options, done) { 17297 17298 var distance, 17299 element = $(this), 17300 mode = options.mode, 17301 show = mode === "show", 17302 direction = options.direction || "left", 17303 ref = (direction === "up" || direction === "down") ? "top" : "left", 17304 motion = (direction === "up" || direction === "left") ? "-=" : "+=", 17305 oppositeMotion = (motion === "+=") ? "-=" : "+=", 17306 animation = { 17307 opacity: 0 17308 }; 17309 17310 $.effects.createPlaceholder(element); 17311 17312 distance = options.distance || 17313 element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 17314 17315 animation[ref] = motion + distance; 17316 17317 if (show) { 17318 element.css(animation); 17319 17320 animation[ref] = oppositeMotion + distance; 17321 animation.opacity = 1; 17322 } 17323 17324 // Animate 17325 element.animate(animation, { 17326 queue: false, 17327 duration: options.duration, 17328 easing: options.easing, 17329 complete: done 17330 }); 17331 }); 17332 17333 17334 /*! 17335 * jQuery UI Effects Explode 1.12.1 17336 * http://jqueryui.com 17337 * 17338 * Copyright jQuery Foundation and other contributors 17339 * Released under the MIT license. 17340 * http://jquery.org/license 17341 */ 17342 17343 //>>label: Explode Effect 17344 //>>group: Effects 17345 // jscs:disable maximumLineLength 17346 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 17347 // jscs:enable maximumLineLength 17348 //>>docs: http://api.jqueryui.com/explode-effect/ 17349 //>>demos: http://jqueryui.com/effect/ 17350 17351 17352 17353 var effectsEffectExplode = $.effects.define("explode", "hide", function(options, done) { 17354 17355 var i, j, left, top, mx, my, 17356 rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, 17357 cells = rows, 17358 element = $(this), 17359 mode = options.mode, 17360 show = mode === "show", 17361 17362 // Show and then visibility:hidden the element before calculating offset 17363 offset = element.show().css("visibility", "hidden").offset(), 17364
vendor: 6,989 bytes, lines 17365-17591
17365 // Width and height of a piece 17366 width = Math.ceil(element.outerWidth() / cells), 17367 height = Math.ceil(element.outerHeight() / rows), 17368 pieces = []; 17369 17370 // Children animate complete: 17371 function childComplete() { 17372 pieces.push(this); 17373 if (pieces.length === rows * cells) { 17374 animComplete(); 17375 } 17376 } 17377 17378 // Clone the element for each row and cell. 17379 for (i = 0; i < rows; i++) { // ===> 17380 top = offset.top + i * height; 17381 my = i - (rows - 1) / 2; 17382 17383 for (j = 0; j < cells; j++) { // ||| 17384 left = offset.left + j * width; 17385 mx = j - (cells - 1) / 2; 17386 17387 // Create a clone of the now hidden main element that will be absolute positioned 17388 // within a wrapper div off the -left and -top equal to size of our pieces 17389 element 17390 .clone() 17391 .appendTo("body") 17392 .wrap("<div></div>") 17393 .css({ 17394 position: "absolute", 17395 visibility: "visible", 17396 left: -j * width, 17397 top: -i * height 17398 }) 17399 17400 // Select the wrapper - make it overflow: hidden and absolute positioned based on 17401 // where the original was located +left and +top equal to the size of pieces 17402 .parent() 17403 .addClass("ui-effects-explode") 17404 .css({ 17405 position: "absolute", 17406 overflow: "hidden", 17407 width: width, 17408 height: height, 17409 left: left + (show ? mx * width : 0), 17410 top: top + (show ? my * height : 0), 17411 opacity: show ? 0 : 1 17412 }) 17413 .animate({ 17414 left: left + (show ? 0 : mx * width), 17415 top: top + (show ? 0 : my * height), 17416 opacity: show ? 1 : 0 17417 }, options.duration || 500, options.easing, childComplete); 17418 } 17419 } 17420 17421 function animComplete() { 17422 element.css({ 17423 visibility: "visible" 17424 }); 17425 $(pieces).remove(); 17426 done(); 17427 } 17428 }); 17429 17430 17431 /*! 17432 * jQuery UI Effects Fade 1.12.1 17433 * http://jqueryui.com 17434 * 17435 * Copyright jQuery Foundation and other contributors 17436 * Released under the MIT license. 17437 * http://jquery.org/license 17438 */ 17439 17440 //>>label: Fade Effect 17441 //>>group: Effects 17442 //>>description: Fades the element. 17443 //>>docs: http://api.jqueryui.com/fade-effect/ 17444 //>>demos: http://jqueryui.com/effect/ 17445 17446 17447 17448 var effectsEffectFade = $.effects.define("fade", "toggle", function(options, done) { 17449 var show = options.mode === "show"; 17450 17451 $(this) 17452 .css("opacity", show ? 0 : 1) 17453 .animate({ 17454 opacity: show ? 1 : 0 17455 }, { 17456 queue: false, 17457 duration: options.duration, 17458 easing: options.easing, 17459 complete: done 17460 }); 17461 }); 17462 17463 17464 /*! 17465 * jQuery UI Effects Fold 1.12.1 17466 * http://jqueryui.com 17467 * 17468 * Copyright jQuery Foundation and other contributors 17469 * Released under the MIT license. 17470 * http://jquery.org/license 17471 */ 17472 17473 //>>label: Fold Effect 17474 //>>group: Effects 17475 //>>description: Folds an element first horizontally and then vertically. 17476 //>>docs: http://api.jqueryui.com/fold-effect/ 17477 //>>demos: http://jqueryui.com/effect/ 17478 17479 17480 17481 var effectsEffectFold = $.effects.define("fold", "hide", function(options, done) { 17482 17483 // Create element 17484 var element = $(this), 17485 mode = options.mode, 17486 show = mode === "show", 17487 hide = mode === "hide", 17488 size = options.size || 15, 17489 percent = /([0-9]+)%/.exec(size), 17490 horizFirst = !!options.horizFirst, 17491 ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"], 17492 duration = options.duration / 2, 17493 17494 placeholder = $.effects.createPlaceholder(element), 17495 17496 start = element.cssClip(), 17497 animation1 = { clip: $.extend({}, start) }, 17498 animation2 = { clip: $.extend({}, start) }, 17499 17500 distance = [start[ref[0]], start[ref[1]]], 17501 17502 queuelen = element.queue().length; 17503 17504 if (percent) { 17505 size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1]; 17506 } 17507 animation1.clip[ref[0]] = size; 17508 animation2.clip[ref[0]] = size; 17509 animation2.clip[ref[1]] = 0; 17510 17511 if (show) { 17512 element.cssClip(animation2.clip); 17513 if (placeholder) { 17514 placeholder.css($.effects.clipToBox(animation2)); 17515 } 17516 17517 animation2.clip = start; 17518 } 17519 17520 // Animate 17521 element 17522 .queue(function(next) { 17523 if (placeholder) { 17524 placeholder 17525 .animate($.effects.clipToBox(animation1), duration, options.easing) 17526 .animate($.effects.clipToBox(animation2), duration, options.easing); 17527 } 17528 17529 next(); 17530 }) 17531 .animate(animation1, duration, options.easing) 17532 .animate(animation2, duration, options.easing) 17533 .queue(done); 17534 17535 $.effects.unshift(element, queuelen, 4); 17536 }); 17537 17538 17539 /*! 17540 * jQuery UI Effects Highlight 1.12.1 17541 * http://jqueryui.com 17542 * 17543 * Copyright jQuery Foundation and other contributors 17544 * Released under the MIT license. 17545 * http://jquery.org/license 17546 */ 17547 17548 //>>label: Highlight Effect 17549 //>>group: Effects 17550 //>>description: Highlights the background of an element in a defined color for a custom duration. 17551 //>>docs: http://api.jqueryui.com/highlight-effect/ 17552 //>>demos: http://jqueryui.com/effect/ 17553 17554 17555 17556 var effectsEffectHighlight = $.effects.define("highlight", "show", function(options, done) { 17557 var element = $(this), 17558 animation = { 17559 backgroundColor: element.css("backgroundColor") 17560 }; 17561 17562 if (options.mode === "hide") { 17563 animation.opacity = 0; 17564 } 17565 17566 $.effects.saveStyle(element); 17567 17568 element 17569 .css({ 17570 backgroundImage: "none", 17571 backgroundColor: options.color || "#ffff99" 17572 }) 17573 .animate(animation, { 17574 queue: false, 17575 duration: options.duration, 17576 easing: options.easing, 17577 complete: done 17578 }); 17579 }); 17580 17581 17582 /*! 17583 * jQuery UI Effects Size 1.12.1 17584 * http://jqueryui.com 17585 * 17586 * Copyright jQuery Foundation and other contributors 17587 * Released under the MIT license. 17588 * http://jquery.org/license 17589 */ 17590 17591 //>>
vendor: 5,174 bytes, lines 17591-17718
17591label: Size Effect 17592 //>>group: Effects 17593 //>>description: Resize an element to a specified width and height. 17594 //>>docs: http://api.jqueryui.com/size-effect/ 17595 //>>demos: http://jqueryui.com/effect/ 17596 17597 17598 17599 var effectsEffectSize = $.effects.define("size", function(options, done) { 17600 17601 // Create element 17602 var baseline, factor, temp, 17603 element = $(this), 17604 17605 // Copy for children 17606 cProps = ["fontSize"], 17607 vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 17608 hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"], 17609 17610 // Set options 17611 mode = options.mode, 17612 restore = mode !== "effect", 17613 scale = options.scale || "both", 17614 origin = options.origin || ["middle", "center"], 17615 position = element.css("position"), 17616 pos = element.position(), 17617 original = $.effects.scaledDimensions(element), 17618 from = options.from || original, 17619 to = options.to || $.effects.scaledDimensions(element, 0); 17620 17621 $.effects.createPlaceholder(element); 17622 17623 if (mode === "show") { 17624 temp = from; 17625 from = to; 17626 to = temp; 17627 } 17628 17629 // Set scaling factor 17630 factor = { 17631 from: { 17632 y: from.height / original.height, 17633 x: from.width / original.width 17634 }, 17635 to: { 17636 y: to.height / original.height, 17637 x: to.width / original.width 17638 } 17639 }; 17640 17641 // Scale the css box 17642 if (scale === "box" || scale === "both") { 17643 17644 // Vertical props scaling 17645 if (factor.from.y !== factor.to.y) { 17646 from = $.effects.setTransition(element, vProps, factor.from.y, from); 17647 to = $.effects.setTransition(element, vProps, factor.to.y, to); 17648 } 17649 17650 // Horizontal props scaling 17651 if (factor.from.x !== factor.to.x) { 17652 from = $.effects.setTransition(element, hProps, factor.from.x, from); 17653 to = $.effects.setTransition(element, hProps, factor.to.x, to); 17654 } 17655 } 17656 17657 // Scale the content 17658 if (scale === "content" || scale === "both") { 17659 17660 // Vertical props scaling 17661 if (factor.from.y !== factor.to.y) { 17662 from = $.effects.setTransition(element, cProps, factor.from.y, from); 17663 to = $.effects.setTransition(element, cProps, factor.to.y, to); 17664 } 17665 } 17666 17667 // Adjust the position properties based on the provided origin points 17668 if (origin) { 17669 baseline = $.effects.getBaseline(origin, original); 17670 from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top; 17671 from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left; 17672 to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top; 17673 to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left; 17674 } 17675 element.css(from); 17676 17677 // Animate the children if desired 17678 if (scale === "content" || scale === "both") { 17679 17680 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 17681 hProps = hProps.concat(["marginLeft", "marginRight"]); 17682 17683 // Only animate children with width attributes specified 17684 // TODO: is this right? should we include anything with css width specified as well 17685 element.find("*[width]").each(function() { 17686 var child = $(this), 17687 childOriginal = $.effects.scaledDimensions(child), 17688 childFrom = { 17689 height: childOriginal.height * factor.from.y, 17690 width: childOriginal.width * factor.from.x, 17691 outerHeight: childOriginal.outerHeight * factor.from.y, 17692 outerWidth: childOriginal.outerWidth * factor.from.x 17693 }, 17694 childTo = { 17695 height: childOriginal.height * factor.to.y, 17696 width: childOriginal.width * factor.to.x, 17697 outerHeight: childOriginal.height * factor.to.y, 17698 outerWidth: childOriginal.width * factor.to.x 17699 }; 17700 17701 // Vertical props scaling 17702 if (factor.from.y !== factor.to.y) { 17703 childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom); 17704 childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo); 17705 } 17706 17707 // Horizontal props scaling 17708 if (factor.from.x !== factor.to.x) { 17709 childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom); 17710 childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo); 17711 } 17712 17713 if (restore) { 17714 $.effects.saveStyle(child); 17715 } 17716 17717 // Animate children 17718 child.css(childFrom);
vendor: 9,255 bytes, lines 17719-18027
17719 child.animate(childTo, options.duration, options.easing, function() { 17720 17721 // Restore children 17722 if (restore) { 17723 $.effects.restoreStyle(child); 17724 } 17725 }); 17726 }); 17727 } 17728 17729 // Animate 17730 element.animate(to, { 17731 queue: false, 17732 duration: options.duration, 17733 easing: options.easing, 17734 complete: function() { 17735 17736 var offset = element.offset(); 17737 17738 if (to.opacity === 0) { 17739 element.css("opacity", from.opacity); 17740 } 17741 17742 if (!restore) { 17743 element 17744 .css("position", position === "static" ? "relative" : position) 17745 .offset(offset); 17746 17747 // Need to save style here so that automatic style restoration 17748 // doesn't restore to the original styles from before the animation. 17749 $.effects.saveStyle(element); 17750 } 17751 17752 done(); 17753 } 17754 }); 17755 17756 }); 17757 17758 17759 /*! 17760 * jQuery UI Effects Scale 1.12.1 17761 * http://jqueryui.com 17762 * 17763 * Copyright jQuery Foundation and other contributors 17764 * Released under the MIT license. 17765 * http://jquery.org/license 17766 */ 17767 17768 //>>label: Scale Effect 17769 //>>group: Effects 17770 //>>description: Grows or shrinks an element and its content. 17771 //>>docs: http://api.jqueryui.com/scale-effect/ 17772 //>>demos: http://jqueryui.com/effect/ 17773 17774 17775 17776 var effectsEffectScale = $.effects.define("scale", function(options, done) { 17777 17778 // Create element 17779 var el = $(this), 17780 mode = options.mode, 17781 percent = parseInt(options.percent, 10) || 17782 (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)), 17783 17784 newOptions = $.extend(true, { 17785 from: $.effects.scaledDimensions(el), 17786 to: $.effects.scaledDimensions(el, percent, options.direction || "both"), 17787 origin: options.origin || ["middle", "center"] 17788 }, options); 17789 17790 // Fade option to support puff 17791 if (options.fade) { 17792 newOptions.from.opacity = 1; 17793 newOptions.to.opacity = 0; 17794 } 17795 17796 $.effects.effect.size.call(this, newOptions, done); 17797 }); 17798 17799 17800 /*! 17801 * jQuery UI Effects Puff 1.12.1 17802 * http://jqueryui.com 17803 * 17804 * Copyright jQuery Foundation and other contributors 17805 * Released under the MIT license. 17806 * http://jquery.org/license 17807 */ 17808 17809 //>>label: Puff Effect 17810 //>>group: Effects 17811 //>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 17812 //>>docs: http://api.jqueryui.com/puff-effect/ 17813 //>>demos: http://jqueryui.com/effect/ 17814 17815 17816 17817 var effectsEffectPuff = $.effects.define("puff", "hide", function(options, done) { 17818 var newOptions = $.extend(true, {}, options, { 17819 fade: true, 17820 percent: parseInt(options.percent, 10) || 150 17821 }); 17822 17823 $.effects.effect.scale.call(this, newOptions, done); 17824 }); 17825 17826 17827 /*! 17828 * jQuery UI Effects Pulsate 1.12.1 17829 * http://jqueryui.com 17830 * 17831 * Copyright jQuery Foundation and other contributors 17832 * Released under the MIT license. 17833 * http://jquery.org/license 17834 */ 17835 17836 //>>label: Pulsate Effect 17837 //>>group: Effects 17838 //>>description: Pulsates an element n times by changing the opacity to zero and back. 17839 //>>docs: http://api.jqueryui.com/pulsate-effect/ 17840 //>>demos: http://jqueryui.com/effect/ 17841 17842 17843 17844 var effectsEffectPulsate = $.effects.define("pulsate", "show", function(options, done) { 17845 var element = $(this), 17846 mode = options.mode, 17847 show = mode === "show", 17848 hide = mode === "hide", 17849 showhide = show || hide, 17850 17851 // Showing or hiding leaves off the "last" animation 17852 anims = ((options.times || 5) * 2) + (showhide ? 1 : 0), 17853 duration = options.duration / anims, 17854 animateTo = 0, 17855 i = 1, 17856 queuelen = element.queue().length; 17857 17858 if (show || !element.is(":visible")) { 17859 element.css("opacity", 0).show(); 17860 animateTo = 1; 17861 } 17862 17863 // Anims - 1 opacity "toggles" 17864 for (; i < anims; i++) { 17865 element.animate({ opacity: animateTo }, duration, options.easing); 17866 animateTo = 1 - animateTo; 17867 } 17868 17869 element.animate({ opacity: animateTo }, duration, options.easing); 17870 17871 element.queue(done); 17872 17873 $.effects.unshift(element, queuelen, anims + 1); 17874 }); 17875 17876 17877 /*! 17878 * jQuery UI Effects Shake 1.12.1 17879 * http://jqueryui.com 17880 * 17881 * Copyright jQuery Foundation and other contributors 17882 * Released under the MIT license. 17883 * http://jquery.org/license 17884 */ 17885 17886 //>>label: Shake Effect 17887 //>>group: Effects 17888 //>>description: Shakes an element horizontally or vertically n times. 17889 //>>docs: http://api.jqueryui.com/shake-effect/ 17890 //>>demos: http://jqueryui.com/effect/ 17891 17892 17893 17894 var effectsEffectShake = $.effects.define("shake", function(options, done) { 17895 17896 var i = 1, 17897 element = $(this), 17898 direction = options.direction || "left", 17899 distance = options.distance || 20, 17900 times = options.times || 3, 17901 anims = times * 2 + 1, 17902 speed = Math.round(options.duration / anims), 17903 ref = (direction === "up" || direction === "down") ? "top" : "left", 17904 positiveMotion = (direction === "up" || direction === "left"), 17905 animation = {}, 17906 animation1 = {}, 17907 animation2 = {}, 17908 17909 queuelen = element.queue().length; 17910 17911 $.effects.createPlaceholder(element); 17912 17913 // Animation 17914 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 17915 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 17916 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 17917 17918 // Animate 17919 element.animate(animation, speed, options.easing); 17920 17921 // Shakes 17922 for (; i < times; i++) { 17923 element 17924 .animate(animation1, speed, options.easing) 17925 .animate(animation2, speed, options.easing); 17926 } 17927 17928 element 17929 .animate(animation1, speed, options.easing) 17930 .animate(animation, speed / 2, options.easing) 17931 .queue(done); 17932 17933 $.effects.unshift(element, queuelen, anims + 1); 17934 }); 17935 17936 17937 /*! 17938 * jQuery UI Effects Slide 1.12.1 17939 * http://jqueryui.com 17940 * 17941 * Copyright jQuery Foundation and other contributors 17942 * Released under the MIT license. 17943 * http://jquery.org/license 17944 */ 17945 17946 //>>label: Slide Effect 17947 //>>group: Effects 17948 //>>description: Slides an element in and out of the viewport. 17949 //>>docs: http://api.jqueryui.com/slide-effect/ 17950 //>>demos: http://jqueryui.com/effect/ 17951 17952 17953 17954 var effectsEffectSlide = $.effects.define("slide", "show", function(options, done) { 17955 var startClip, startRef, 17956 element = $(this), 17957 map = { 17958 up: ["bottom", "top"], 17959 down: ["top", "bottom"], 17960 left: ["right", "left"], 17961 right: ["left", "right"] 17962 }, 17963 mode = options.mode, 17964 direction = options.direction || "left", 17965 ref = (direction === "up" || direction === "down") ? "top" : "left", 17966 positiveMotion = (direction === "up" || direction === "left"), 17967 distance = options.distance || 17968 element[ref === "top" ? "outerHeight" : "outerWidth"](true), 17969 animation = {}; 17970 17971 $.effects.createPlaceholder(element); 17972 17973 startClip = element.cssClip(); 17974 startRef = element.position()[ref]; 17975 17976 // Define hide animation 17977 animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef; 17978 animation.clip = element.cssClip(); 17979 animation.clip[map[direction][1]] = animation.clip[map[direction][0]]; 17980 17981 // Reverse the animation if we're showing 17982 if (mode === "show") { 17983 element.cssClip(animation.clip); 17984 element.css(ref, animation[ref]); 17985 animation.clip = startClip; 17986 animation[ref] = startRef; 17987 } 17988 17989 // Actually animate 17990 element.animate(animation, { 17991 queue: false, 17992 duration: options.duration, 17993 easing: options.easing, 17994 complete: done 17995 }); 17996 }); 17997 17998 17999 /*! 18000 * jQuery UI Effects Transfer 1.12.1 18001 * http://jqueryui.com 18002 * 18003 * Copyright jQuery Foundation and other contributors 18004 * Released under the MIT license. 18005 * http://jquery.org/license 18006 */ 18007 18008 //>>label: Transfer Effect 18009 //>>group: Effects 18010 //>>description: Displays a transfer effect from one element to another. 18011 //>>docs: http://api.jqueryui.com/transfer-effect/ 18012 //>>demos: http://jqueryui.com/effect/ 18013 18014 18015 18016 var effect; 18017 if ($.uiBackCompat !== false) { 18018 effect = $.effects.define("transfer", function(options, done) { 18019 $(this).transfer(options, done); 18020 }); 18021 } 18022 var effectsEffectTransfer = effect; 18023 18024 18025 18026 18027}));
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.