vendor: 9,724 bytes, lines 1-360
1/*! jQuery UI - v1.11.4 - 2015-03-11 2* http://jqueryui.com 3* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js 4* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ 5 6(function (factory) { 7 if (typeof define === "function" && define.amd) { 8 // AMD. Register as an anonymous module. 9 define(["jquery"], factory); 10 } else { 11 // Browser globals 12 factory(jQuery); 13 } 14}(function ($) { 15 /*! 16 * jQuery UI Core 1.11.4 17 * http://jqueryui.com 18 * 19 * Copyright jQuery Foundation and other contributors 20 * Released under the MIT license. 21 * http://jquery.org/license 22 * 23 * http://api.jqueryui.com/category/ui-core/ 24 */ 25 26 // $.ui might exist from components with no dependencies, e.g., $.ui.position 27 $.ui = $.ui || {}; 28 29 $.extend($.ui, { 30 version: "1.11.4", 31 32 keyCode: { 33 BACKSPACE: 8, 34 COMMA: 188, 35 DELETE: 46, 36 DOWN: 40, 37 END: 35, 38 ENTER: 13, 39 ESCAPE: 27, 40 HOME: 36, 41 LEFT: 37, 42 PAGE_DOWN: 34, 43 PAGE_UP: 33, 44 PERIOD: 190, 45 RIGHT: 39, 46 SPACE: 32, 47 TAB: 9, 48 UP: 38 49 } 50 }); 51 52 // plugins 53 $.fn.extend({ 54 scrollParent: function (includeHidden) { 55 var position = this.css("position"), 56 excludeStaticParent = position === "absolute", 57 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 58 scrollParent = this.parents().filter(function () { 59 var parent = $(this); 60 if (excludeStaticParent && parent.css("position") === "static") { 61 return false; 62 } 63 return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + parent.css("overflow-x")); 64 }).eq(0); 65 66 return position === "fixed" || !scrollParent.length ? $(this[0].ownerDocument || document) : scrollParent; 67 }, 68 69 uniqueId: (function () { 70 var uuid = 0; 71 72 return function () { 73 return this.each(function () { 74 if (!this.id) { 75 this.id = "ui-id-" + (++uuid); 76 } 77 }); 78 }; 79 })(), 80 81 removeUniqueId: function () { 82 return this.each(function () { 83 if (/^ui-id-\d+$/.test(this.id)) { 84 $(this).removeAttr("id"); 85 } 86 }); 87 } 88 }); 89 90 // selectors 91 function focusable(element, isTabIndexNotNaN) { 92 var map, mapName, img, 93 nodeName = element.nodeName.toLowerCase(); 94 if ("area" === nodeName) { 95 map = element.parentNode; 96 mapName = map.name; 97 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 98 return false; 99 } 100 img = $("img[usemap='#" + mapName + "']")[0]; 101 return !!img && visible(img); 102 } 103 return (/^(input|select|textarea|button|object)$/.test(nodeName) ? 104 !element.disabled : 105 "a" === nodeName ? 106 element.href || isTabIndexNotNaN : 107 isTabIndexNotNaN) && 108 // the element and all of its ancestors must be visible 109 visible(element); 110 } 111 112 function visible(element) { 113 return $.expr.filters.visible(element) && 114 !$(element).parents().addBack().filter(function () { 115 return $.css(this, "visibility") === "hidden"; 116 }).length; 117 } 118 119 $.extend($.expr[":"], { 120 data: $.expr.createPseudo ? 121 $.expr.createPseudo(function (dataName) { 122 return function (elem) { 123 return !!$.data(elem, dataName); 124 }; 125 }) : 126 // support: jQuery <1.8 127 function (elem, i, match) { 128 return !!$.data(elem, match[3]); 129 }, 130 131 focusable: function (element) { 132 return focusable(element, !isNaN($.attr(element, "tabindex"))); 133 }, 134 135 tabbable: function (element) { 136 var tabIndex = $.attr(element, "tabindex"), 137 isTabIndexNaN = isNaN(tabIndex); 138 return (isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN); 139 } 140 }); 141 142 // support: jQuery <1.8 143 if (!$("<a>").outerWidth(1).jquery) { 144 $.each(["Width", "Height"], function (i, name) { 145 var side = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"], 146 type = name.toLowerCase(), 147 orig = { 148 innerWidth: $.fn.innerWidth, 149 innerHeight: $.fn.innerHeight, 150 outerWidth: $.fn.outerWidth, 151 outerHeight: $.fn.outerHeight 152 }; 153 154 function reduce(elem, size, border, margin) { 155 $.each(side, function () { 156 size -= parseFloat($.css(elem, "padding" + this)) || 0; 157 if (border) { 158 size -= parseFloat($.css(elem, "border" + this + "Width")) || 0; 159 } 160 if (margin) { 161 size -= parseFloat($.css(elem, "margin" + this)) || 0; 162 } 163 }); 164 return size; 165 } 166 167 $.fn["inner" + name] = function (size) { 168 if (size === undefined) { 169 return orig["inner" + name].call(this); 170 } 171 172 return this.each(function () { 173 $(this).css(type, reduce(this, size) + "px"); 174 }); 175 }; 176 177 $.fn["outer" + name] = function (size, margin) { 178 if (typeof size !== "number") { 179 return orig["outer" + name].call(this, size); 180 } 181 182 return this.each(function () { 183 $(this).css(type, reduce(this, size, true, margin) + "px"); 184 }); 185 }; 186 }); 187 } 188 189 // support: jQuery <1.8 190 if (!$.fn.addBack) { 191 $.fn.addBack = function (selector) { 192 return this.add(selector == null ? 193 this.prevObject : this.prevObject.filter(selector) 194 ); 195 }; 196 } 197 198 // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) 199 if ($("<a>").data("a-b", "a").removeData("a-b").data("a-b")) { 200 $.fn.removeData = (function (removeData) { 201 return function (key) { 202 if (arguments.length) { 203 return removeData.call(this, $.camelCase(key)); 204 } else { 205 return removeData.call(this); 206 } 207 }; 208 })($.fn.removeData); 209 } 210 211 // deprecated 212 $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); 213 214 $.fn.extend({ 215 focus: (function (orig) { 216 return function (delay, fn) { 217 return typeof delay === "number" ? 218 this.each(function () { 219 var elem = this; 220 setTimeout(function () { 221 $(elem).focus(); 222 if (fn) { 223 fn.call(elem); 224 } 225 }, delay); 226 }) : 227 orig.apply(this, arguments); 228 }; 229 })($.fn.focus), 230 231 disableSelection: (function () { 232 var eventType = "onselectstart" in document.createElement("div") ? 233 "selectstart" : 234 "mousedown"; 235 236 return function () { 237 return this.bind(eventType + ".ui-disableSelection", function (event) { 238 event.preventDefault(); 239 }); 240 }; 241 })(), 242 243 enableSelection: function () { 244 return this.unbind(".ui-disableSelection"); 245 }, 246 247 zIndex: function (zIndex) { 248 if (zIndex !== undefined) { 249 return this.css("zIndex", zIndex); 250 } 251 252 if (this.length) { 253 var elem = $(this[0]), position, value; 254 while (elem.length && elem[0] !== document) { 255 // Ignore z-index if position is set to a value where z-index is ignored by the browser 256 // This makes behavior of this function consistent across browsers 257 // WebKit always returns auto if the element is positioned 258 position = elem.css("position"); 259 if (position === "absolute" || position === "relative" || position === "fixed") { 260 // IE returns 0 when zIndex is not specified 261 // other browsers return a string 262 // we ignore the case of nested elements with an explicit value of 0 263 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 264 value = parseInt(elem.css("zIndex"), 10); 265 if (!isNaN(value) && value !== 0) { 266 return value; 267 } 268 } 269 elem = elem.parent(); 270 } 271 } 272 273 return 0; 274 } 275 }); 276 277 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 278 $.ui.plugin = { 279 add: function (module, option, set) { 280 var i, 281 proto = $.ui[module].prototype; 282 for (i in set) { 283 proto.plugins[i] = proto.plugins[i] || []; 284 proto.plugins[i].push([option, set[i]]); 285 } 286 }, 287 call: function (instance, name, args, allowDisconnected) { 288 var i, 289 set = instance.plugins[name]; 290 291 if (!set) { 292 return; 293 } 294 295 if (!allowDisconnected && (!instance.element[0].parentNode || instance.element[0].parentNode.nodeType === 11)) { 296 return; 297 } 298 299 for (i = 0; i < set.length; i++) { 300 if (instance.options[set[i][0]]) { 301 set[i][1].apply(instance.element, args); 302 } 303 } 304 } 305 }; 306 307 /*! 308 * jQuery UI Widget 1.11.4 309 * http://jqueryui.com 310 * 311 * Copyright jQuery Foundation and other contributors 312 * Released under the MIT license. 313 * http://jquery.org/license 314 * 315 * http://api.jqueryui.com/jQuery.widget/ 316 */ 317 318 var widget_uuid = 0, 319 widget_slice = Array.prototype.slice; 320 321 $.cleanData = (function (orig) { 322 return function (elems) { 323 var events, elem, i; 324 for (i = 0; (elem = elems[i]) != null; i++) { 325 try { 326 // Only trigger remove when necessary to save time 327 events = $._data(elem, "events"); 328 if (events && events.remove) { 329 $(elem).triggerHandler("remove"); 330 } 331 332 // http://bugs.jquery.com/ticket/8235 333 } catch (e) { } 334 } 335 orig(elems); 336 }; 337 })($.cleanData); 338 339 $.widget = function (name, base, prototype) { 340 var fullName, existingConstructor, constructor, basePrototype, 341 // proxiedPrototype allows the provided prototype to remain unmodified 342 // so that it can be used as a mixin for multiple widgets (#8876) 343 proxiedPrototype = {}, 344 namespace = name.split(".")[0]; 345 346 name = name.split(".")[1]; 347 fullName = namespace + "-" + name; 348 349 if (!prototype) { 350 prototype = base; 351 base = $.Widget; 352 } 353 354 // create selector for plugin 355 $.expr[":"][fullName.toLowerCase()] = function (elem) { 356 return !!$.data(elem, fullName); 357 }; 358 359 $[namespace] = $[namespace] || {}; 360 existingConstructor = $[namespace][name];
vendor: 18,687 bytes, lines 361-1003
361 constructor = $[namespace][name] = function (options, element) { 362 // allow instantiation without "new" keyword 363 if (!this._createWidget) { 364 return new constructor(options, element); 365 } 366 367 // allow instantiation without initializing for simple inheritance 368 // must use "new" keyword (the code above always passes args) 369 if (arguments.length) { 370 this._createWidget(options, element); 371 } 372 }; 373 // extend with the existing constructor to carry over any static properties 374 $.extend(constructor, existingConstructor, { 375 version: prototype.version, 376 // copy the object used to create the prototype in case we need to 377 // redefine the widget later 378 _proto: $.extend({}, prototype), 379 // track widgets that inherit from this widget in case this widget is 380 // redefined after a widget inherits from it 381 _childConstructors: [] 382 }); 383 384 basePrototype = new base(); 385 // we need to make the options hash a property directly on the new instance 386 // otherwise we'll modify the options hash on the prototype that we're 387 // inheriting from 388 basePrototype.options = $.widget.extend({}, basePrototype.options); 389 $.each(prototype, function (prop, value) { 390 if (!$.isFunction(value)) { 391 proxiedPrototype[prop] = value; 392 return; 393 } 394 proxiedPrototype[prop] = (function () { 395 var _super = function () { 396 return base.prototype[prop].apply(this, arguments); 397 }, 398 _superApply = function (args) { 399 return base.prototype[prop].apply(this, args); 400 }; 401 return function () { 402 var __super = this._super, 403 __superApply = this._superApply, 404 returnValue; 405 406 this._super = _super; 407 this._superApply = _superApply; 408 409 returnValue = value.apply(this, arguments); 410 411 this._super = __super; 412 this._superApply = __superApply; 413 414 return returnValue; 415 }; 416 })(); 417 }); 418 constructor.prototype = $.widget.extend(basePrototype, { 419 // TODO: remove support for widgetEventPrefix 420 // always use the name + a colon as the prefix, e.g., draggable:start 421 // don't prefix for widgets that aren't DOM-based 422 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 423 }, proxiedPrototype, { 424 constructor: constructor, 425 namespace: namespace, 426 widgetName: name, 427 widgetFullName: fullName 428 }); 429 430 // If this widget is being redefined then we need to find all widgets that 431 // are inheriting from it and redefine all of them so that they inherit from 432 // the new version of this widget. We're essentially trying to replace one 433 // level in the prototype chain. 434 if (existingConstructor) { 435 $.each(existingConstructor._childConstructors, function (i, child) { 436 var childPrototype = child.prototype; 437 438 // redefine the child widget using the same prototype that was 439 // originally used, but inherit from the new version of the base 440 $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto); 441 }); 442 // remove the list of existing child constructors from the old constructor 443 // so the old child constructors can be garbage collected 444 delete existingConstructor._childConstructors; 445 } else { 446 base._childConstructors.push(constructor); 447 } 448 449 $.widget.bridge(name, constructor); 450 451 return constructor; 452 }; 453 454 $.widget.extend = function (target) { 455 var input = widget_slice.call(arguments, 1), 456 inputIndex = 0, 457 inputLength = input.length, 458 key, 459 value; 460 for (; inputIndex < inputLength; inputIndex++) { 461 for (key in input[inputIndex]) { 462 value = input[inputIndex][key]; 463 if (input[inputIndex].hasOwnProperty(key) && value !== undefined) { 464 // Clone objects 465 if ($.isPlainObject(value)) { 466 target[key] = $.isPlainObject(target[key]) ? 467 $.widget.extend({}, target[key], value) : 468 // Don't extend strings, arrays, etc. with objects 469 $.widget.extend({}, value); 470 // Copy everything else by reference 471 } else { 472 target[key] = value; 473 } 474 } 475 } 476 } 477 return target; 478 }; 479 480 $.widget.bridge = function (name, object) { 481 var fullName = object.prototype.widgetFullName || name; 482 $.fn[name] = function (options) { 483 var isMethodCall = typeof options === "string", 484 args = widget_slice.call(arguments, 1), 485 returnValue = this; 486 487 if (isMethodCall) { 488 this.each(function () { 489 var methodValue, 490 instance = $.data(this, fullName); 491 if (options === "instance") { 492 returnValue = instance; 493 return false; 494 } 495 if (!instance) { 496 return $.error("cannot call methods on " + name + " prior to initialization; " + 497 "attempted to call method '" + options + "'"); 498 } 499 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 500 return $.error("no such method '" + options + "' for " + name + " widget instance"); 501 } 502 methodValue = instance[options].apply(instance, args); 503 if (methodValue !== instance && methodValue !== undefined) { 504 returnValue = methodValue && methodValue.jquery ? 505 returnValue.pushStack(methodValue.get()) : 506 methodValue; 507 return false; 508 } 509 }); 510 } else { 511 // Allow multiple hashes to be passed on init 512 if (args.length) { 513 options = $.widget.extend.apply(null, [options].concat(args)); 514 } 515 516 this.each(function () { 517 var instance = $.data(this, fullName); 518 if (instance) { 519 instance.option(options || {}); 520 if (instance._init) { 521 instance._init(); 522 } 523 } else { 524 $.data(this, fullName, new object(options, this)); 525 } 526 }); 527 } 528 529 return returnValue; 530 }; 531 }; 532 533 $.Widget = function ( /* options, element */) { }; 534 $.Widget._childConstructors = []; 535 536 $.Widget.prototype = { 537 widgetName: "widget", 538 widgetEventPrefix: "", 539 defaultElement: "<div>", 540 options: { 541 disabled: false, 542 543 // callbacks 544 create: null 545 }, 546 _createWidget: function (options, element) { 547 element = $(element || this.defaultElement || this)[0]; 548 this.element = $(element); 549 this.uuid = widget_uuid++; 550 this.eventNamespace = "." + this.widgetName + this.uuid; 551 552 this.bindings = $(); 553 this.hoverable = $(); 554 this.focusable = $(); 555 556 if (element !== this) { 557 $.data(element, this.widgetFullName, this); 558 this._on(true, this.element, { 559 remove: function (event) { 560 if (event.target === element) { 561 this.destroy(); 562 } 563 } 564 }); 565 this.document = $(element.style ? 566 // element within the document 567 element.ownerDocument : 568 // element is window or document 569 element.document || element); 570 this.window = $(this.document[0].defaultView || this.document[0].parentWindow); 571 } 572 573 this.options = $.widget.extend({}, 574 this.options, 575 this._getCreateOptions(), 576 options); 577 578 this._create(); 579 this._trigger("create", null, this._getCreateEventData()); 580 this._init(); 581 }, 582 _getCreateOptions: $.noop, 583 _getCreateEventData: $.noop, 584 _create: $.noop, 585 _init: $.noop, 586 587 destroy: function () { 588 this._destroy(); 589 // we can probably remove the unbind calls in 2.0 590 // all event bindings should go through this._on() 591 this.element 592 .unbind(this.eventNamespace) 593 .removeData(this.widgetFullName) 594 // support: jquery <1.6.3 595 // http://bugs.jquery.com/ticket/9413 596 .removeData($.camelCase(this.widgetFullName)); 597 this.widget() 598 .unbind(this.eventNamespace) 599 .removeAttr("aria-disabled") 600 .removeClass( 601 this.widgetFullName + "-disabled " + 602 "ui-state-disabled"); 603 604 // clean up events and states 605 this.bindings.unbind(this.eventNamespace); 606 this.hoverable.removeClass("ui-state-hover"); 607 this.focusable.removeClass("ui-state-focus"); 608 }, 609 _destroy: $.noop, 610 611 widget: function () { 612 return this.element; 613 }, 614 615 option: function (key, value) { 616 var options = key, 617 parts, 618 curOption, 619 i; 620 621 if (arguments.length === 0) { 622 // don't return a reference to the internal hash 623 return $.widget.extend({}, this.options); 624 } 625 626 if (typeof key === "string") { 627 // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 628 options = {}; 629 parts = key.split("."); 630 key = parts.shift(); 631 if (parts.length) { 632 curOption = options[key] = $.widget.extend({}, this.options[key]); 633 for (i = 0; i < parts.length - 1; i++) { 634 curOption[parts[i]] = curOption[parts[i]] || {}; 635 curOption = curOption[parts[i]]; 636 } 637 key = parts.pop(); 638 if (arguments.length === 1) { 639 return curOption[key] === undefined ? null : curOption[key]; 640 } 641 curOption[key] = value; 642 } else { 643 if (arguments.length === 1) { 644 return this.options[key] === undefined ? null : this.options[key]; 645 } 646 options[key] = value; 647 } 648 } 649 650 this._setOptions(options); 651 652 return this; 653 }, 654 _setOptions: function (options) { 655 var key; 656 657 for (key in options) { 658 this._setOption(key, options[key]); 659 } 660 661 return this; 662 }, 663 _setOption: function (key, value) { 664 this.options[key] = value; 665 666 if (key === "disabled") { 667 this.widget() 668 .toggleClass(this.widgetFullName + "-disabled", !!value); 669 670 // If the widget is becoming disabled, then nothing is interactive 671 if (value) { 672 this.hoverable.removeClass("ui-state-hover"); 673 this.focusable.removeClass("ui-state-focus"); 674 } 675 } 676 677 return this; 678 }, 679 680 enable: function () { 681 return this._setOptions({ disabled: false }); 682 }, 683 disable: function () { 684 return this._setOptions({ disabled: true }); 685 }, 686 687 _on: function (suppressDisabledCheck, element, handlers) { 688 var delegateElement, 689 instance = this; 690 691 // no suppressDisabledCheck flag, shuffle arguments 692 if (typeof suppressDisabledCheck !== "boolean") { 693 handlers = element; 694 element = suppressDisabledCheck; 695 suppressDisabledCheck = false; 696 } 697 698 // no element argument, shuffle and use this.element 699 if (!handlers) { 700 handlers = element; 701 element = this.element; 702 delegateElement = this.widget(); 703 } else { 704 element = delegateElement = $(element); 705 this.bindings = this.bindings.add(element); 706 } 707 708 $.each(handlers, function (event, handler) { 709 function handlerProxy() { 710 // allow widgets to customize the disabled handling 711 // - disabled as an array instead of boolean 712 // - disabled class as method for disabling individual parts 713 if (!suppressDisabledCheck && 714 (instance.options.disabled === true || 715 $(this).hasClass("ui-state-disabled"))) { 716 return; 717 } 718 return (typeof handler === "string" ? instance[handler] : handler) 719 .apply(instance, arguments); 720 } 721 722 // copy the guid so direct unbinding works 723 if (typeof handler !== "string") { 724 handlerProxy.guid = handler.guid = 725 handler.guid || handlerProxy.guid || $.guid++; 726 } 727 728 var match = event.match(/^([\w:-]*)\s*(.*)$/), 729 eventName = match[1] + instance.eventNamespace, 730 selector = match[2]; 731 if (selector) { 732 delegateElement.delegate(selector, eventName, handlerProxy); 733 } else { 734 element.bind(eventName, handlerProxy); 735 } 736 }); 737 }, 738 739 _off: function (element, eventName) { 740 eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + 741 this.eventNamespace; 742 element.unbind(eventName).undelegate(eventName); 743 744 // Clear the stack to avoid memory leaks (#10056) 745 this.bindings = $(this.bindings.not(element).get()); 746 this.focusable = $(this.focusable.not(element).get()); 747 this.hoverable = $(this.hoverable.not(element).get()); 748 }, 749 750 _delay: function (handler, delay) { 751 function handlerProxy() { 752 return (typeof handler === "string" ? instance[handler] : handler) 753 .apply(instance, arguments); 754 } 755 var instance = this; 756 return setTimeout(handlerProxy, delay || 0); 757 }, 758 759 _hoverable: function (element) { 760 this.hoverable = this.hoverable.add(element); 761 this._on(element, { 762 mouseenter: function (event) { 763 $(event.currentTarget).addClass("ui-state-hover"); 764 }, 765 mouseleave: function (event) { 766 $(event.currentTarget).removeClass("ui-state-hover"); 767 } 768 }); 769 }, 770 771 _focusable: function (element) { 772 this.focusable = this.focusable.add(element); 773 this._on(element, { 774 focusin: function (event) { 775 $(event.currentTarget).addClass("ui-state-focus"); 776 }, 777 focusout: function (event) { 778 $(event.currentTarget).removeClass("ui-state-focus"); 779 } 780 }); 781 }, 782 783 _trigger: function (type, event, data) { 784 var prop, orig, 785 callback = this.options[type]; 786 787 data = data || {}; 788 event = $.Event(event); 789 event.type = (type === this.widgetEventPrefix ? 790 type : 791 this.widgetEventPrefix + type).toLowerCase(); 792 // the original event may come from any element 793 // so we need to reset the target on the new event 794 event.target = this.element[0]; 795 796 // copy original event properties over to the new event 797 orig = event.originalEvent; 798 if (orig) { 799 for (prop in orig) { 800 if (!(prop in event)) { 801 event[prop] = orig[prop]; 802 } 803 } 804 } 805 806 this.element.trigger(event, data); 807 return !($.isFunction(callback) && 808 callback.apply(this.element[0], [event].concat(data)) === false || 809 event.isDefaultPrevented()); 810 } 811 }; 812 813 $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) { 814 $.Widget.prototype["_" + method] = function (element, options, callback) { 815 if (typeof options === "string") { 816 options = { effect: options }; 817 } 818 var hasOptions, 819 effectName = !options ? 820 method : 821 options === true || typeof options === "number" ? 822 defaultEffect : 823 options.effect || defaultEffect; 824 options = options || {}; 825 if (typeof options === "number") { 826 options = { duration: options }; 827 } 828 hasOptions = !$.isEmptyObject(options); 829 options.complete = callback; 830 if (options.delay) { 831 element.delay(options.delay); 832 } 833 if (hasOptions && $.effects && $.effects.effect[effectName]) { 834 element[method](options); 835 } else if (effectName !== method && element[effectName]) { 836 element[effectName](options.duration, options.easing, callback); 837 } else { 838 element.queue(function (next) { 839 $(this)[method](); 840 if (callback) { 841 callback.call(element[0]); 842 } 843 next(); 844 }); 845 } 846 }; 847 }); 848 849 var widget = $.widget; 850 851 /*! 852 * jQuery UI Mouse 1.11.4 853 * http://jqueryui.com 854 * 855 * Copyright jQuery Foundation and other contributors 856 * Released under the MIT license. 857 * http://jquery.org/license 858 * 859 * http://api.jqueryui.com/mouse/ 860 */ 861 862 var mouseHandled = false; 863 $(document).mouseup(function () { 864 mouseHandled = false; 865 }); 866 867 var mouse = $.widget("ui.mouse", { 868 version: "1.11.4", 869 options: { 870 cancel: "input,textarea,button,select,option", 871 distance: 1, 872 delay: 0 873 }, 874 _mouseInit: function () { 875 var that = this; 876 877 this.element 878 .bind("mousedown." + this.widgetName, function (event) { 879 return that._mouseDown(event); 880 }) 881 .bind("click." + this.widgetName, function (event) { 882 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 883 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 884 event.stopImmediatePropagation(); 885 return false; 886 } 887 }); 888 889 this.started = false; 890 }, 891 892 // TODO: make sure destroying one instance of mouse doesn't mess with 893 // other instances of mouse 894 _mouseDestroy: function () { 895 this.element.unbind("." + this.widgetName); 896 if (this._mouseMoveDelegate) { 897 this.document 898 .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) 899 .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); 900 } 901 }, 902 903 _mouseDown: function (event) { 904 // don't let more than one widget handle mouseStart 905 if (mouseHandled) { 906 return; 907 } 908 909 this._mouseMoved = false; 910 911 // we may have missed mouseup (out of window) 912 (this._mouseStarted && this._mouseUp(event)); 913 914 this._mouseDownEvent = event; 915 916 var that = this, 917 btnIsLeft = (event.which === 1), 918 // event.target.nodeName works around a bug in IE 8 with 919 // disabled inputs (#7620) 920 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); 921 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 922 return true; 923 } 924 925 this.mouseDelayMet = !this.options.delay; 926 if (!this.mouseDelayMet) { 927 this._mouseDelayTimer = setTimeout(function () { 928 that.mouseDelayMet = true; 929 }, this.options.delay); 930 } 931 932 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 933 this._mouseStarted = (this._mouseStart(event) !== false); 934 if (!this._mouseStarted) { 935 event.preventDefault(); 936 return true; 937 } 938 } 939 940 // Click event may never have fired (Gecko & Opera) 941 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 942 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 943 } 944 945 // these delegates are required to keep context 946 this._mouseMoveDelegate = function (event) { 947 return that._mouseMove(event); 948 }; 949 this._mouseUpDelegate = function (event) { 950 return that._mouseUp(event); 951 }; 952 953 this.document 954 .bind("mousemove." + this.widgetName, this._mouseMoveDelegate) 955 .bind("mouseup." + this.widgetName, this._mouseUpDelegate); 956 957 event.preventDefault(); 958 959 mouseHandled = true; 960 return true; 961 }, 962 963 _mouseMove: function (event) { 964 // Only check for mouseups outside the document if you've moved inside the document 965 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 966 // fire a mousemove event if content is placed under the cursor. See #7778 967 // Support: IE <9 968 if (this._mouseMoved) { 969 // IE mouseup check - mouseup happened when mouse was out of window 970 if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) { 971 return this._mouseUp(event); 972 973 // Iframe mouseup check - mouseup occurred in another document 974 } else if (!event.which) { 975 return this._mouseUp(event); 976 } 977 } 978 979 if (event.which || event.button) { 980 this._mouseMoved = true; 981 } 982 983 if (this._mouseStarted) { 984 this._mouseDrag(event); 985 return event.preventDefault(); 986 } 987 988 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 989 this._mouseStarted = 990 (this._mouseStart(this._mouseDownEvent, event) !== false); 991 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 992 } 993 994 return !this._mouseStarted; 995 }, 996 997 _mouseUp: function (event) { 998 this.document 999 .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) 1000 .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); 1001 1002 if (this._mouseStarted) { 1003 this._mouseStarted = false;
vendor: 22,585 bytes, lines 1004-1758
1004 1005 if (event.target === this._mouseDownEvent.target) { 1006 $.data(event.target, this.widgetName + ".preventClickEvent", true); 1007 } 1008 1009 this._mouseStop(event); 1010 } 1011 1012 mouseHandled = false; 1013 return false; 1014 }, 1015 1016 _mouseDistanceMet: function (event) { 1017 return (Math.max( 1018 Math.abs(this._mouseDownEvent.pageX - event.pageX), 1019 Math.abs(this._mouseDownEvent.pageY - event.pageY) 1020 ) >= this.options.distance 1021 ); 1022 }, 1023 1024 _mouseDelayMet: function (/* event */) { 1025 return this.mouseDelayMet; 1026 }, 1027 1028 // These are placeholder methods, to be overriden by extending plugin 1029 _mouseStart: function (/* event */) { }, 1030 _mouseDrag: function (/* event */) { }, 1031 _mouseStop: function (/* event */) { }, 1032 _mouseCapture: function (/* event */) { return true; } 1033 }); 1034 1035 /*! 1036 * jQuery UI Position 1.11.4 1037 * http://jqueryui.com 1038 * 1039 * Copyright jQuery Foundation and other contributors 1040 * Released under the MIT license. 1041 * http://jquery.org/license 1042 * 1043 * http://api.jqueryui.com/position/ 1044 */ 1045 1046 (function () { 1047 $.ui = $.ui || {}; 1048 1049 var cachedScrollbarWidth, supportsOffsetFractions, 1050 max = Math.max, 1051 abs = Math.abs, 1052 round = Math.round, 1053 rhorizontal = /left|center|right/, 1054 rvertical = /top|center|bottom/, 1055 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 1056 rposition = /^\w+/, 1057 rpercent = /%$/, 1058 _position = $.fn.position; 1059 1060 function getOffsets(offsets, width, height) { 1061 return [ 1062 parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1), 1063 parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1) 1064 ]; 1065 } 1066 1067 function parseCss(element, property) { 1068 return parseInt($.css(element, property), 10) || 0; 1069 } 1070 1071 function getDimensions(elem) { 1072 var raw = elem[0]; 1073 if (raw.nodeType === 9) { 1074 return { 1075 width: elem.width(), 1076 height: elem.height(), 1077 offset: { top: 0, left: 0 } 1078 }; 1079 } 1080 if ($.isWindow(raw)) { 1081 return { 1082 width: elem.width(), 1083 height: elem.height(), 1084 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 1085 }; 1086 } 1087 if (raw.preventDefault) { 1088 return { 1089 width: 0, 1090 height: 0, 1091 offset: { top: raw.pageY, left: raw.pageX } 1092 }; 1093 } 1094 return { 1095 width: elem.outerWidth(), 1096 height: elem.outerHeight(), 1097 offset: elem.offset() 1098 }; 1099 } 1100 1101 $.position = { 1102 scrollbarWidth: function () { 1103 if (cachedScrollbarWidth !== undefined) { 1104 return cachedScrollbarWidth; 1105 } 1106 var w1, w2, 1107 div = $("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"), 1108 innerDiv = div.children()[0]; 1109 1110 $("body").append(div); 1111 w1 = innerDiv.offsetWidth; 1112 div.css("overflow", "scroll"); 1113 1114 w2 = innerDiv.offsetWidth; 1115 1116 if (w1 === w2) { 1117 w2 = div[0].clientWidth; 1118 } 1119 1120 div.remove(); 1121 1122 return (cachedScrollbarWidth = w1 - w2); 1123 }, 1124 getScrollInfo: function (within) { 1125 var overflowX = within.isWindow || within.isDocument ? "" : 1126 within.element.css("overflow-x"), 1127 overflowY = within.isWindow || within.isDocument ? "" : 1128 within.element.css("overflow-y"), 1129 hasOverflowX = overflowX === "scroll" || 1130 (overflowX === "auto" && within.width < within.element[0].scrollWidth), 1131 hasOverflowY = overflowY === "scroll" || 1132 (overflowY === "auto" && within.height < within.element[0].scrollHeight); 1133 return { 1134 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 1135 height: hasOverflowX ? $.position.scrollbarWidth() : 0 1136 }; 1137 }, 1138 getWithinInfo: function (element) { 1139 var withinElement = $(element || window), 1140 isWindow = $.isWindow(withinElement[0]), 1141 isDocument = !!withinElement[0] && withinElement[0].nodeType === 9; 1142 return { 1143 element: withinElement, 1144 isWindow: isWindow, 1145 isDocument: isDocument, 1146 offset: withinElement.offset() || { left: 0, top: 0 }, 1147 scrollLeft: withinElement.scrollLeft(), 1148 scrollTop: withinElement.scrollTop(), 1149 1150 // support: jQuery 1.6.x 1151 // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows 1152 width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(), 1153 height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight() 1154 }; 1155 } 1156 }; 1157 1158 $.fn.position = function (options) { 1159 if (!options || !options.of) { 1160 return _position.apply(this, arguments); 1161 } 1162 1163 // make a copy, we don't want to modify arguments 1164 options = $.extend({}, options); 1165 1166 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 1167 target = $(options.of), 1168 within = $.position.getWithinInfo(options.within), 1169 scrollInfo = $.position.getScrollInfo(within), 1170 collision = (options.collision || "flip").split(" "), 1171 offsets = {}; 1172 1173 dimensions = getDimensions(target); 1174 if (target[0].preventDefault) { 1175 // force left top to allow flipping 1176 options.at = "left top"; 1177 } 1178 targetWidth = dimensions.width; 1179 targetHeight = dimensions.height; 1180 targetOffset = dimensions.offset; 1181 // clone to reuse original targetOffset later 1182 basePosition = $.extend({}, targetOffset); 1183 1184 // force my and at to have valid horizontal and vertical positions 1185 // if a value is missing or invalid, it will be converted to center 1186 $.each(["my", "at"], function () { 1187 var pos = (options[this] || "").split(" "), 1188 horizontalOffset, 1189 verticalOffset; 1190 1191 if (pos.length === 1) { 1192 pos = rhorizontal.test(pos[0]) ? 1193 pos.concat(["center"]) : 1194 rvertical.test(pos[0]) ? 1195 ["center"].concat(pos) : 1196 ["center", "center"]; 1197 } 1198 pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center"; 1199 pos[1] = rvertical.test(pos[1]) ? pos[1] : "center"; 1200 1201 // calculate offsets 1202 horizontalOffset = roffset.exec(pos[0]); 1203 verticalOffset = roffset.exec(pos[1]); 1204 offsets[this] = [ 1205 horizontalOffset ? horizontalOffset[0] : 0, 1206 verticalOffset ? verticalOffset[0] : 0 1207 ]; 1208 1209 // reduce to just the positions without the offsets 1210 options[this] = [ 1211 rposition.exec(pos[0])[0], 1212 rposition.exec(pos[1])[0] 1213 ]; 1214 }); 1215 1216 // normalize collision option 1217 if (collision.length === 1) { 1218 collision[1] = collision[0]; 1219 } 1220 1221 if (options.at[0] === "right") { 1222 basePosition.left += targetWidth; 1223 } else if (options.at[0] === "center") { 1224 basePosition.left += targetWidth / 2; 1225 } 1226 1227 if (options.at[1] === "bottom") { 1228 basePosition.top += targetHeight; 1229 } else if (options.at[1] === "center") { 1230 basePosition.top += targetHeight / 2; 1231 } 1232 1233 atOffset = getOffsets(offsets.at, targetWidth, targetHeight); 1234 basePosition.left += atOffset[0]; 1235 basePosition.top += atOffset[1]; 1236 1237 return this.each(function () { 1238 var collisionPosition, using, 1239 elem = $(this), 1240 elemWidth = elem.outerWidth(), 1241 elemHeight = elem.outerHeight(), 1242 marginLeft = parseCss(this, "marginLeft"), 1243 marginTop = parseCss(this, "marginTop"), 1244 collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") + scrollInfo.width, 1245 collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") + scrollInfo.height, 1246 position = $.extend({}, basePosition), 1247 myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight()); 1248 1249 if (options.my[0] === "right") { 1250 position.left -= elemWidth; 1251 } else if (options.my[0] === "center") { 1252 position.left -= elemWidth / 2; 1253 } 1254 1255 if (options.my[1] === "bottom") { 1256 position.top -= elemHeight; 1257 } else if (options.my[1] === "center") { 1258 position.top -= elemHeight / 2; 1259 } 1260 1261 position.left += myOffset[0]; 1262 position.top += myOffset[1]; 1263 1264 // if the browser doesn't support fractions, then round for consistent results 1265 if (!supportsOffsetFractions) { 1266 position.left = round(position.left); 1267 position.top = round(position.top); 1268 } 1269 1270 collisionPosition = { 1271 marginLeft: marginLeft, 1272 marginTop: marginTop 1273 }; 1274 1275 $.each(["left", "top"], function (i, dir) { 1276 if ($.ui.position[collision[i]]) { 1277 $.ui.position[collision[i]][dir](position, { 1278 targetWidth: targetWidth, 1279 targetHeight: targetHeight, 1280 elemWidth: elemWidth, 1281 elemHeight: elemHeight, 1282 collisionPosition: collisionPosition, 1283 collisionWidth: collisionWidth, 1284 collisionHeight: collisionHeight, 1285 offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]], 1286 my: options.my, 1287 at: options.at, 1288 within: within, 1289 elem: elem 1290 }); 1291 } 1292 }); 1293 1294 if (options.using) { 1295 // adds feedback as second argument to using callback, if present 1296 using = function (props) { 1297 var left = targetOffset.left - position.left, 1298 right = left + targetWidth - elemWidth, 1299 top = targetOffset.top - position.top, 1300 bottom = top + targetHeight - elemHeight, 1301 feedback = { 1302 target: { 1303 element: target, 1304 left: targetOffset.left, 1305 top: targetOffset.top, 1306 width: targetWidth, 1307 height: targetHeight 1308 }, 1309 element: { 1310 element: elem, 1311 left: position.left, 1312 top: position.top, 1313 width: elemWidth, 1314 height: elemHeight 1315 }, 1316 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1317 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1318 }; 1319 if (targetWidth < elemWidth && abs(left + right) < targetWidth) { 1320 feedback.horizontal = "center"; 1321 } 1322 if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) { 1323 feedback.vertical = "middle"; 1324 } 1325 if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) { 1326 feedback.important = "horizontal"; 1327 } else { 1328 feedback.important = "vertical"; 1329 } 1330 options.using.call(this, props, feedback); 1331 }; 1332 } 1333 1334 elem.offset($.extend(position, { using: using })); 1335 }); 1336 }; 1337 1338 $.ui.position = { 1339 fit: { 1340 left: function (position, data) { 1341 var within = data.within, 1342 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1343 outerWidth = within.width, 1344 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1345 overLeft = withinOffset - collisionPosLeft, 1346 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1347 newOverRight; 1348 1349 // element is wider than within 1350 if (data.collisionWidth > outerWidth) { 1351 // element is initially over the left side of within 1352 if (overLeft > 0 && overRight <= 0) { 1353 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; 1354 position.left += overLeft - newOverRight; 1355 // element is initially over right side of within 1356 } else if (overRight > 0 && overLeft <= 0) { 1357 position.left = withinOffset; 1358 // element is initially over both left and right sides of within 1359 } else { 1360 if (overLeft > overRight) { 1361 position.left = withinOffset + outerWidth - data.collisionWidth; 1362 } else { 1363 position.left = withinOffset; 1364 } 1365 } 1366 // too far left -> align with left edge 1367 } else if (overLeft > 0) { 1368 position.left += overLeft; 1369 // too far right -> align with right edge 1370 } else if (overRight > 0) { 1371 position.left -= overRight; 1372 // adjust based on position and margin 1373 } else { 1374 position.left = max(position.left - collisionPosLeft, position.left); 1375 } 1376 }, 1377 top: function (position, data) { 1378 var within = data.within, 1379 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1380 outerHeight = data.within.height, 1381 collisionPosTop = position.top - data.collisionPosition.marginTop, 1382 overTop = withinOffset - collisionPosTop, 1383 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1384 newOverBottom; 1385 1386 // element is taller than within 1387 if (data.collisionHeight > outerHeight) { 1388 // element is initially over the top of within 1389 if (overTop > 0 && overBottom <= 0) { 1390 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; 1391 position.top += overTop - newOverBottom; 1392 // element is initially over bottom of within 1393 } else if (overBottom > 0 && overTop <= 0) { 1394 position.top = withinOffset; 1395 // element is initially over both top and bottom of within 1396 } else { 1397 if (overTop > overBottom) { 1398 position.top = withinOffset + outerHeight - data.collisionHeight; 1399 } else { 1400 position.top = withinOffset; 1401 } 1402 } 1403 // too far up -> align with top 1404 } else if (overTop > 0) { 1405 position.top += overTop; 1406 // too far down -> align with bottom edge 1407 } else if (overBottom > 0) { 1408 position.top -= overBottom; 1409 // adjust based on position and margin 1410 } else { 1411 position.top = max(position.top - collisionPosTop, position.top); 1412 } 1413 } 1414 }, 1415 flip: { 1416 left: function (position, data) { 1417 var within = data.within, 1418 withinOffset = within.offset.left + within.scrollLeft, 1419 outerWidth = within.width, 1420 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1421 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1422 overLeft = collisionPosLeft - offsetLeft, 1423 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1424 myOffset = data.my[0] === "left" ? 1425 -data.elemWidth : 1426 data.my[0] === "right" ? 1427 data.elemWidth : 1428 0, 1429 atOffset = data.at[0] === "left" ? 1430 data.targetWidth : 1431 data.at[0] === "right" ? 1432 -data.targetWidth : 1433 0, 1434 offset = -2 * data.offset[0], 1435 newOverRight, 1436 newOverLeft; 1437 1438 if (overLeft < 0) { 1439 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; 1440 if (newOverRight < 0 || newOverRight < abs(overLeft)) { 1441 position.left += myOffset + atOffset + offset; 1442 } 1443 } else if (overRight > 0) { 1444 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; 1445 if (newOverLeft > 0 || abs(newOverLeft) < overRight) { 1446 position.left += myOffset + atOffset + offset; 1447 } 1448 } 1449 }, 1450 top: function (position, data) { 1451 var within = data.within, 1452 withinOffset = within.offset.top + within.scrollTop, 1453 outerHeight = within.height, 1454 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1455 collisionPosTop = position.top - data.collisionPosition.marginTop, 1456 overTop = collisionPosTop - offsetTop, 1457 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1458 top = data.my[1] === "top", 1459 myOffset = top ? 1460 -data.elemHeight : 1461 data.my[1] === "bottom" ? 1462 data.elemHeight : 1463 0, 1464 atOffset = data.at[1] === "top" ? 1465 data.targetHeight : 1466 data.at[1] === "bottom" ? 1467 -data.targetHeight : 1468 0, 1469 offset = -2 * data.offset[1], 1470 newOverTop, 1471 newOverBottom; 1472 if (overTop < 0) { 1473 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; 1474 if (newOverBottom < 0 || newOverBottom < abs(overTop)) { 1475 position.top += myOffset + atOffset + offset; 1476 } 1477 } else if (overBottom > 0) { 1478 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; 1479 if (newOverTop > 0 || abs(newOverTop) < overBottom) { 1480 position.top += myOffset + atOffset + offset; 1481 } 1482 } 1483 } 1484 }, 1485 flipfit: { 1486 left: function () { 1487 $.ui.position.flip.left.apply(this, arguments); 1488 $.ui.position.fit.left.apply(this, arguments); 1489 }, 1490 top: function () { 1491 $.ui.position.flip.top.apply(this, arguments); 1492 $.ui.position.fit.top.apply(this, arguments); 1493 } 1494 } 1495 }; 1496 1497 // fraction support test 1498 (function () { 1499 var testElement, testElementParent, testElementStyle, offsetLeft, i, 1500 body = document.getElementsByTagName("body")[0], 1501 div = document.createElement("div"); 1502 1503 //Create a "fake body" for testing based on method used in jQuery.support 1504 testElement = document.createElement(body ? "div" : "body"); 1505 testElementStyle = { 1506 visibility: "hidden", 1507 width: 0, 1508 height: 0, 1509 border: 0, 1510 margin: 0, 1511 background: "none" 1512 }; 1513 if (body) { 1514 $.extend(testElementStyle, { 1515 position: "absolute", 1516 left: "-1000px", 1517 top: "-1000px" 1518 }); 1519 } 1520 for (i in testElementStyle) { 1521 testElement.style[i] = testElementStyle[i]; 1522 } 1523 testElement.appendChild(div); 1524 testElementParent = body || document.documentElement; 1525 testElementParent.insertBefore(testElement, testElementParent.firstChild); 1526 1527 div.style.cssText = "position: absolute; left: 10.7432222px;"; 1528 1529 offsetLeft = $(div).offset().left; 1530 supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; 1531 1532 testElement.innerHTML = ""; 1533 testElementParent.removeChild(testElement); 1534 })(); 1535 })(); 1536 1537 var position = $.ui.position; 1538 1539 /*! 1540 * jQuery UI Accordion 1.11.4 1541 * http://jqueryui.com 1542 * 1543 * Copyright jQuery Foundation and other contributors 1544 * Released under the MIT license. 1545 * http://jquery.org/license 1546 * 1547 * http://api.jqueryui.com/accordion/ 1548 */ 1549 1550 var accordion = $.widget("ui.accordion", { 1551 version: "1.11.4", 1552 options: { 1553 active: 0, 1554 animate: {}, 1555 collapsible: false, 1556 event: "click", 1557 header: "> li > :first-child,> :not(li):even", 1558 heightStyle: "auto", 1559 icons: { 1560 activeHeader: "ui-icon-triangle-1-s", 1561 header: "ui-icon-triangle-1-e" 1562 }, 1563 1564 // callbacks 1565 activate: null, 1566 beforeActivate: null 1567 }, 1568 1569 hideProps: { 1570 borderTopWidth: "hide", 1571 borderBottomWidth: "hide", 1572 paddingTop: "hide", 1573 paddingBottom: "hide", 1574 height: "hide" 1575 }, 1576 1577 showProps: { 1578 borderTopWidth: "show", 1579 borderBottomWidth: "show", 1580 paddingTop: "show", 1581 paddingBottom: "show", 1582 height: "show" 1583 }, 1584 1585 _create: function () { 1586 var options = this.options; 1587 this.prevShow = this.prevHide = $(); 1588 this.element.addClass("ui-accordion ui-widget ui-helper-reset") 1589 // ARIA 1590 .attr("role", "tablist"); 1591 1592 // don't allow collapsible: false and active: false / null 1593 if (!options.collapsible && (options.active === false || options.active == null)) { 1594 options.active = 0; 1595 } 1596 1597 this._processPanels(); 1598 // handle negative values 1599 if (options.active < 0) { 1600 options.active += this.headers.length; 1601 } 1602 this._refresh(); 1603 }, 1604 1605 _getCreateEventData: function () { 1606 return { 1607 header: this.active, 1608 panel: !this.active.length ? $() : this.active.next() 1609 }; 1610 }, 1611 1612 _createIcons: function () { 1613 var icons = this.options.icons; 1614 if (icons) { 1615 $("<span>") 1616 .addClass("ui-accordion-header-icon ui-icon " + icons.header) 1617 .prependTo(this.headers); 1618 this.active.children(".ui-accordion-header-icon") 1619 .removeClass(icons.header) 1620 .addClass(icons.activeHeader); 1621 this.headers.addClass("ui-accordion-icons"); 1622 } 1623 }, 1624 1625 _destroyIcons: function () { 1626 this.headers 1627 .removeClass("ui-accordion-icons") 1628 .children(".ui-accordion-header-icon") 1629 .remove(); 1630 }, 1631 1632 _destroy: function () { 1633 var contents; 1634 1635 // clean up main element 1636 this.element 1637 .removeClass("ui-accordion ui-widget ui-helper-reset") 1638 .removeAttr("role"); 1639 1640 // clean up headers 1641 this.headers 1642 .removeClass("ui-accordion-header ui-accordion-header-active ui-state-default " + 1643 "ui-corner-all ui-state-active ui-state-disabled ui-corner-top") 1644 .removeAttr("role") 1645 .removeAttr("aria-expanded") 1646 .removeAttr("aria-selected") 1647 .removeAttr("aria-controls") 1648 .removeAttr("tabIndex") 1649 .removeUniqueId(); 1650 1651 this._destroyIcons(); 1652 1653 // clean up content panels 1654 contents = this.headers.next() 1655 .removeClass("ui-helper-reset ui-widget-content ui-corner-bottom " + 1656 "ui-accordion-content ui-accordion-content-active ui-state-disabled") 1657 .css("display", "") 1658 .removeAttr("role") 1659 .removeAttr("aria-hidden") 1660 .removeAttr("aria-labelledby") 1661 .removeUniqueId(); 1662 1663 if (this.options.heightStyle !== "content") { 1664 contents.css("height", ""); 1665 } 1666 }, 1667 1668 _setOption: function (key, value) { 1669 if (key === "active") { 1670 // _activate() will handle invalid values and update this.options 1671 this._activate(value); 1672 return; 1673 } 1674 1675 if (key === "event") { 1676 if (this.options.event) { 1677 this._off(this.headers, this.options.event); 1678 } 1679 this._setupEvents(value); 1680 } 1681 1682 this._super(key, value); 1683 1684 // setting collapsible: false while collapsed; open first panel 1685 if (key === "collapsible" && !value && this.options.active === false) { 1686 this._activate(0); 1687 } 1688 1689 if (key === "icons") { 1690 this._destroyIcons(); 1691 if (value) { 1692 this._createIcons(); 1693 } 1694 } 1695 1696 // #5332 - opacity doesn't cascade to positioned elements in IE 1697 // so we need to add the disabled class to the headers and panels 1698 if (key === "disabled") { 1699 this.element 1700 .toggleClass("ui-state-disabled", !!value) 1701 .attr("aria-disabled", value); 1702 this.headers.add(this.headers.next()) 1703 .toggleClass("ui-state-disabled", !!value); 1704 } 1705 }, 1706 1707 _keydown: function (event) { 1708 if (event.altKey || event.ctrlKey) { 1709 return; 1710 } 1711 1712 var keyCode = $.ui.keyCode, 1713 length = this.headers.length, 1714 currentIndex = this.headers.index(event.target), 1715 toFocus = false; 1716 1717 switch (event.keyCode) { 1718 case keyCode.RIGHT: 1719 case keyCode.DOWN: 1720 toFocus = this.headers[(currentIndex + 1) % length]; 1721 break; 1722 case keyCode.LEFT: 1723 case keyCode.UP: 1724 toFocus = this.headers[(currentIndex - 1 + length) % length]; 1725 break; 1726 case keyCode.SPACE: 1727 case keyCode.ENTER: 1728 this._eventHandler(event); 1729 break; 1730 case keyCode.HOME: 1731 toFocus = this.headers[0]; 1732 break; 1733 case keyCode.END: 1734 toFocus = this.headers[length - 1]; 1735 break; 1736 } 1737 1738 if (toFocus) { 1739 $(event.target).attr("tabIndex", -1); 1740 $(toFocus).attr("tabIndex", 0); 1741 toFocus.focus(); 1742 event.preventDefault(); 1743 } 1744 }, 1745 1746 _panelKeyDown: function (event) { 1747 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 1748 $(event.currentTarget).prev().focus(); 1749 } 1750 }, 1751 1752 refresh: function () { 1753 var options = this.options; 1754 this._processPanels(); 1755 1756 // was collapsed or no panel 1757 if ((options.active === false && options.collapsible === true) || !this.headers.length) { 1758 options.active = false;
vendor: 17,417 bytes, lines 1759-2405
1759 this.active = $(); 1760 // active false only when collapsible is true 1761 } else if (options.active === false) { 1762 this._activate(0); 1763 // was active, but active panel is gone 1764 } else if (this.active.length && !$.contains(this.element[0], this.active[0])) { 1765 // all remaining panel are disabled 1766 if (this.headers.length === this.headers.find(".ui-state-disabled").length) { 1767 options.active = false; 1768 this.active = $(); 1769 // activate previous panel 1770 } else { 1771 this._activate(Math.max(0, options.active - 1)); 1772 } 1773 // was active, active panel still exists 1774 } else { 1775 // make sure active index is correct 1776 options.active = this.headers.index(this.active); 1777 } 1778 1779 this._destroyIcons(); 1780 1781 this._refresh(); 1782 }, 1783 1784 _processPanels: function () { 1785 var prevHeaders = this.headers, 1786 prevPanels = this.panels; 1787 1788 this.headers = this.element.find(this.options.header) 1789 .addClass("ui-accordion-header ui-state-default ui-corner-all"); 1790 1791 this.panels = this.headers.next() 1792 .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom") 1793 .filter(":not(.ui-accordion-content-active)") 1794 .hide(); 1795 1796 // Avoid memory leaks (#10056) 1797 if (prevPanels) { 1798 this._off(prevHeaders.not(this.headers)); 1799 this._off(prevPanels.not(this.panels)); 1800 } 1801 }, 1802 1803 _refresh: function () { 1804 var maxHeight, 1805 options = this.options, 1806 heightStyle = options.heightStyle, 1807 parent = this.element.parent(); 1808 1809 this.active = this._findActive(options.active) 1810 .addClass("ui-accordion-header-active ui-state-active ui-corner-top") 1811 .removeClass("ui-corner-all"); 1812 this.active.next() 1813 .addClass("ui-accordion-content-active") 1814 .show(); 1815 1816 this.headers 1817 .attr("role", "tab") 1818 .each(function () { 1819 var header = $(this), 1820 headerId = header.uniqueId().attr("id"), 1821 panel = header.next(), 1822 panelId = panel.uniqueId().attr("id"); 1823 header.attr("aria-controls", panelId); 1824 panel.attr("aria-labelledby", headerId); 1825 }) 1826 .next() 1827 .attr("role", "tabpanel"); 1828 1829 this.headers 1830 .not(this.active) 1831 .attr({ 1832 "aria-selected": "false", 1833 "aria-expanded": "false", 1834 tabIndex: -1 1835 }) 1836 .next() 1837 .attr({ 1838 "aria-hidden": "true" 1839 }) 1840 .hide(); 1841 1842 // make sure at least one header is in the tab order 1843 if (!this.active.length) { 1844 this.headers.eq(0).attr("tabIndex", 0); 1845 } else { 1846 this.active.attr({ 1847 "aria-selected": "true", 1848 "aria-expanded": "true", 1849 tabIndex: 0 1850 }) 1851 .next() 1852 .attr({ 1853 "aria-hidden": "false" 1854 }); 1855 } 1856 1857 this._createIcons(); 1858 1859 this._setupEvents(options.event); 1860 1861 if (heightStyle === "fill") { 1862 maxHeight = parent.height(); 1863 this.element.siblings(":visible").each(function () { 1864 var elem = $(this), 1865 position = elem.css("position"); 1866 1867 if (position === "absolute" || position === "fixed") { 1868 return; 1869 } 1870 maxHeight -= elem.outerHeight(true); 1871 }); 1872 1873 this.headers.each(function () { 1874 maxHeight -= $(this).outerHeight(true); 1875 }); 1876 1877 this.headers.next() 1878 .each(function () { 1879 $(this).height(Math.max(0, maxHeight - 1880 $(this).innerHeight() + $(this).height())); 1881 }) 1882 .css("overflow", "auto"); 1883 } else if (heightStyle === "auto") { 1884 maxHeight = 0; 1885 this.headers.next() 1886 .each(function () { 1887 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 1888 }) 1889 .height(maxHeight); 1890 } 1891 }, 1892 1893 _activate: function (index) { 1894 var active = this._findActive(index)[0]; 1895 1896 // trying to activate the already active panel 1897 if (active === this.active[0]) { 1898 return; 1899 } 1900 1901 // trying to collapse, simulate a click on the currently active header 1902 active = active || this.active[0]; 1903 1904 this._eventHandler({ 1905 target: active, 1906 currentTarget: active, 1907 preventDefault: $.noop 1908 }); 1909 }, 1910 1911 _findActive: function (selector) { 1912 return typeof selector === "number" ? this.headers.eq(selector) : $(); 1913 }, 1914 1915 _setupEvents: function (event) { 1916 var events = { 1917 keydown: "_keydown" 1918 }; 1919 if (event) { 1920 $.each(event.split(" "), function (index, eventName) { 1921 events[eventName] = "_eventHandler"; 1922 }); 1923 } 1924 1925 this._off(this.headers.add(this.headers.next())); 1926 this._on(this.headers, events); 1927 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 1928 this._hoverable(this.headers); 1929 this._focusable(this.headers); 1930 }, 1931 1932 _eventHandler: function (event) { 1933 var options = this.options, 1934 active = this.active, 1935 clicked = $(event.currentTarget), 1936 clickedIsActive = clicked[0] === active[0], 1937 collapsing = clickedIsActive && options.collapsible, 1938 toShow = collapsing ? $() : clicked.next(), 1939 toHide = active.next(), 1940 eventData = { 1941 oldHeader: active, 1942 oldPanel: toHide, 1943 newHeader: collapsing ? $() : clicked, 1944 newPanel: toShow 1945 }; 1946 1947 event.preventDefault(); 1948 1949 if ( 1950 // click on active header, but not collapsible 1951 (clickedIsActive && !options.collapsible) || 1952 // allow canceling activation 1953 (this._trigger("beforeActivate", event, eventData) === false)) { 1954 return; 1955 } 1956 1957 options.active = collapsing ? false : this.headers.index(clicked); 1958 1959 // when the call to ._toggle() comes after the class changes 1960 // it causes a very odd bug in IE 8 (see #6720) 1961 this.active = clickedIsActive ? $() : clicked; 1962 this._toggle(eventData); 1963 1964 // switch classes 1965 // corner classes on the previously active header stay after the animation 1966 active.removeClass("ui-accordion-header-active ui-state-active"); 1967 if (options.icons) { 1968 active.children(".ui-accordion-header-icon") 1969 .removeClass(options.icons.activeHeader) 1970 .addClass(options.icons.header); 1971 } 1972 1973 if (!clickedIsActive) { 1974 clicked 1975 .removeClass("ui-corner-all") 1976 .addClass("ui-accordion-header-active ui-state-active ui-corner-top"); 1977 if (options.icons) { 1978 clicked.children(".ui-accordion-header-icon") 1979 .removeClass(options.icons.header) 1980 .addClass(options.icons.activeHeader); 1981 } 1982 1983 clicked 1984 .next() 1985 .addClass("ui-accordion-content-active"); 1986 } 1987 }, 1988 1989 _toggle: function (data) { 1990 var toShow = data.newPanel, 1991 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 1992 1993 // handle activating a panel during the animation for another activation 1994 this.prevShow.add(this.prevHide).stop(true, true); 1995 this.prevShow = toShow; 1996 this.prevHide = toHide; 1997 1998 if (this.options.animate) { 1999 this._animate(toShow, toHide, data); 2000 } else { 2001 toHide.hide(); 2002 toShow.show(); 2003 this._toggleComplete(data); 2004 } 2005 2006 toHide.attr({ 2007 "aria-hidden": "true" 2008 }); 2009 toHide.prev().attr({ 2010 "aria-selected": "false", 2011 "aria-expanded": "false" 2012 }); 2013 // if we're switching panels, remove the old header from the tab order 2014 // if we're opening from collapsed state, remove the previous header from the tab order 2015 // if we're collapsing, then keep the collapsing header in the tab order 2016 if (toShow.length && toHide.length) { 2017 toHide.prev().attr({ 2018 "tabIndex": -1, 2019 "aria-expanded": "false" 2020 }); 2021 } else if (toShow.length) { 2022 this.headers.filter(function () { 2023 return parseInt($(this).attr("tabIndex"), 10) === 0; 2024 }) 2025 .attr("tabIndex", -1); 2026 } 2027 2028 toShow 2029 .attr("aria-hidden", "false") 2030 .prev() 2031 .attr({ 2032 "aria-selected": "true", 2033 "aria-expanded": "true", 2034 tabIndex: 0 2035 }); 2036 }, 2037 2038 _animate: function (toShow, toHide, data) { 2039 var total, easing, duration, 2040 that = this, 2041 adjust = 0, 2042 boxSizing = toShow.css("box-sizing"), 2043 down = toShow.length && 2044 (!toHide.length || (toShow.index() < toHide.index())), 2045 animate = this.options.animate || {}, 2046 options = down && animate.down || animate, 2047 complete = function () { 2048 that._toggleComplete(data); 2049 }; 2050 2051 if (typeof options === "number") { 2052 duration = options; 2053 } 2054 if (typeof options === "string") { 2055 easing = options; 2056 } 2057 // fall back from options to animation in case of partial down settings 2058 easing = easing || options.easing || animate.easing; 2059 duration = duration || options.duration || animate.duration; 2060 2061 if (!toHide.length) { 2062 return toShow.animate(this.showProps, duration, easing, complete); 2063 } 2064 if (!toShow.length) { 2065 return toHide.animate(this.hideProps, duration, easing, complete); 2066 } 2067 2068 total = toShow.show().outerHeight(); 2069 toHide.animate(this.hideProps, { 2070 duration: duration, 2071 easing: easing, 2072 step: function (now, fx) { 2073 fx.now = Math.round(now); 2074 } 2075 }); 2076 toShow 2077 .hide() 2078 .animate(this.showProps, { 2079 duration: duration, 2080 easing: easing, 2081 complete: complete, 2082 step: function (now, fx) { 2083 fx.now = Math.round(now); 2084 if (fx.prop !== "height") { 2085 if (boxSizing === "content-box") { 2086 adjust += fx.now; 2087 } 2088 } else if (that.options.heightStyle !== "content") { 2089 fx.now = Math.round(total - toHide.outerHeight() - adjust); 2090 adjust = 0; 2091 } 2092 } 2093 }); 2094 }, 2095 2096 _toggleComplete: function (data) { 2097 var toHide = data.oldPanel; 2098 2099 toHide 2100 .removeClass("ui-accordion-content-active") 2101 .prev() 2102 .removeClass("ui-corner-top") 2103 .addClass("ui-corner-all"); 2104 2105 // Work around for rendering bug in IE (#5421) 2106 if (toHide.length) { 2107 toHide.parent()[0].className = toHide.parent()[0].className; 2108 } 2109 this._trigger("activate", null, data); 2110 } 2111 }); 2112 2113 /*! 2114 * jQuery UI Menu 1.11.4 2115 * http://jqueryui.com 2116 * 2117 * Copyright jQuery Foundation and other contributors 2118 * Released under the MIT license. 2119 * http://jquery.org/license 2120 * 2121 * http://api.jqueryui.com/menu/ 2122 */ 2123 2124 var menu = $.widget("ui.menu", { 2125 version: "1.11.4", 2126 defaultElement: "<ul>", 2127 delay: 300, 2128 options: { 2129 icons: { 2130 submenu: "ui-icon-carat-1-e" 2131 }, 2132 items: "> *", 2133 menus: "ul", 2134 position: { 2135 my: "left-1 top", 2136 at: "right top" 2137 }, 2138 role: "menu", 2139 2140 // callbacks 2141 blur: null, 2142 focus: null, 2143 select: null 2144 }, 2145 2146 _create: function () { 2147 this.activeMenu = this.element; 2148 2149 // Flag used to prevent firing of the click handler 2150 // as the event bubbles up through nested menus 2151 this.mouseHandled = false; 2152 this.element 2153 .uniqueId() 2154 .addClass("ui-menu ui-widget ui-widget-content") 2155 .toggleClass("ui-menu-icons", !!this.element.find(".ui-icon").length) 2156 .attr({ 2157 role: this.options.role, 2158 tabIndex: 0 2159 }); 2160 2161 if (this.options.disabled) { 2162 this.element 2163 .addClass("ui-state-disabled") 2164 .attr("aria-disabled", "true"); 2165 } 2166 2167 this._on({ 2168 // Prevent focus from sticking to links inside menu after clicking 2169 // them (focus should always stay on UL during navigation). 2170 "mousedown .ui-menu-item": function (event) { 2171 event.preventDefault(); 2172 }, 2173 "click .ui-menu-item": function (event) { 2174 var target = $(event.target); 2175 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 2176 this.select(event); 2177 2178 // Only set the mouseHandled flag if the event will bubble, see #9469. 2179 if (!event.isPropagationStopped()) { 2180 this.mouseHandled = true; 2181 } 2182 2183 // Open submenu on click 2184 if (target.has(".ui-menu").length) { 2185 this.expand(event); 2186 } else if (!this.element.is(":focus") && $(this.document[0].activeElement).closest(".ui-menu").length) { 2187 // Redirect focus to the menu 2188 this.element.trigger("focus", [true]); 2189 2190 // If the active item is on the top level, let it stay active. 2191 // Otherwise, blur the active item since it is no longer visible. 2192 if (this.active && this.active.parents(".ui-menu").length === 1) { 2193 clearTimeout(this.timer); 2194 } 2195 } 2196 } 2197 }, 2198 "mouseenter .ui-menu-item": function (event) { 2199 // Ignore mouse events while typeahead is active, see #10458. 2200 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 2201 // is over an item in the menu 2202 if (this.previousFilter) { 2203 return; 2204 } 2205 var target = $(event.currentTarget); 2206 // Remove ui-state-active class from siblings of the newly focused menu item 2207 // to avoid a jump caused by adjacent elements both having a class with a border 2208 target.siblings(".ui-state-active").removeClass("ui-state-active"); 2209 this.focus(event, target); 2210 }, 2211 mouseleave: "collapseAll", 2212 "mouseleave .ui-menu": "collapseAll", 2213 focus: function (event, keepActiveItem) { 2214 // If there's already an active item, keep it active 2215 // If not, activate the first item 2216 var item = this.active || this.element.find(this.options.items).eq(0); 2217 2218 if (!keepActiveItem) { 2219 this.focus(event, item); 2220 } 2221 }, 2222 blur: function (event) { 2223 this._delay(function () { 2224 if (!$.contains(this.element[0], this.document[0].activeElement)) { 2225 this.collapseAll(event); 2226 } 2227 }); 2228 }, 2229 keydown: "_keydown" 2230 }); 2231 2232 this.refresh(); 2233 2234 // Clicks outside of a menu collapse any open menus 2235 this._on(this.document, { 2236 click: function (event) { 2237 if (this._closeOnDocumentClick(event)) { 2238 this.collapseAll(event); 2239 } 2240 2241 // Reset the mouseHandled flag 2242 this.mouseHandled = false; 2243 } 2244 }); 2245 }, 2246 2247 _destroy: function () { 2248 // Destroy (sub)menus 2249 this.element 2250 .removeAttr("aria-activedescendant") 2251 .find(".ui-menu").addBack() 2252 .removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front") 2253 .removeAttr("role") 2254 .removeAttr("tabIndex") 2255 .removeAttr("aria-labelledby") 2256 .removeAttr("aria-expanded") 2257 .removeAttr("aria-hidden") 2258 .removeAttr("aria-disabled") 2259 .removeUniqueId() 2260 .show(); 2261 2262 // Destroy menu items 2263 this.element.find(".ui-menu-item") 2264 .removeClass("ui-menu-item") 2265 .removeAttr("role") 2266 .removeAttr("aria-disabled") 2267 .removeUniqueId() 2268 .removeClass("ui-state-hover") 2269 .removeAttr("tabIndex") 2270 .removeAttr("role") 2271 .removeAttr("aria-haspopup") 2272 .children().each(function () { 2273 var elem = $(this); 2274 if (elem.data("ui-menu-submenu-carat")) { 2275 elem.remove(); 2276 } 2277 }); 2278 2279 // Destroy menu dividers 2280 this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content"); 2281 }, 2282 2283 _keydown: function (event) { 2284 var match, prev, character, skip, 2285 preventDefault = true; 2286 2287 switch (event.keyCode) { 2288 case $.ui.keyCode.PAGE_UP: 2289 this.previousPage(event); 2290 break; 2291 case $.ui.keyCode.PAGE_DOWN: 2292 this.nextPage(event); 2293 break; 2294 case $.ui.keyCode.HOME: 2295 this._move("first", "first", event); 2296 break; 2297 case $.ui.keyCode.END: 2298 this._move("last", "last", event); 2299 break; 2300 case $.ui.keyCode.UP: 2301 this.previous(event); 2302 break; 2303 case $.ui.keyCode.DOWN: 2304 this.next(event); 2305 break; 2306 case $.ui.keyCode.LEFT: 2307 this.collapse(event); 2308 break; 2309 case $.ui.keyCode.RIGHT: 2310 if (this.active && !this.active.is(".ui-state-disabled")) { 2311 this.expand(event); 2312 } 2313 break; 2314 case $.ui.keyCode.ENTER: 2315 case $.ui.keyCode.SPACE: 2316 this._activate(event); 2317 break; 2318 case $.ui.keyCode.ESCAPE: 2319 this.collapse(event); 2320 break; 2321 default: 2322 preventDefault = false; 2323 prev = this.previousFilter || ""; 2324 character = String.fromCharCode(event.keyCode); 2325 skip = false; 2326 2327 clearTimeout(this.filterTimer); 2328 2329 if (character === prev) { 2330 skip = true; 2331 } else { 2332 character = prev + character; 2333 } 2334 2335 match = this._filterMenuItems(character); 2336 match = skip && match.index(this.active.next()) !== -1 ? 2337 this.active.nextAll(".ui-menu-item") : 2338 match; 2339 2340 // If no matches on the current filter, reset to the last character pressed 2341 // to move down the menu to the first item that starts with that character 2342 if (!match.length) { 2343 character = String.fromCharCode(event.keyCode); 2344 match = this._filterMenuItems(character); 2345 } 2346 2347 if (match.length) { 2348 this.focus(event, match); 2349 this.previousFilter = character; 2350 this.filterTimer = this._delay(function () { 2351 delete this.previousFilter; 2352 }, 1000); 2353 } else { 2354 delete this.previousFilter; 2355 } 2356 } 2357 2358 if (preventDefault) { 2359 event.preventDefault(); 2360 } 2361 }, 2362 2363 _activate: function (event) { 2364 if (!this.active.is(".ui-state-disabled")) { 2365 if (this.active.is("[aria-haspopup='true']")) { 2366 this.expand(event); 2367 } else { 2368 this.select(event); 2369 } 2370 } 2371 }, 2372 2373 refresh: function () { 2374 var menus, items, 2375 that = this, 2376 icon = this.options.icons.submenu, 2377 submenus = this.element.find(this.options.menus); 2378 2379 this.element.toggleClass("ui-menu-icons", !!this.element.find(".ui-icon").length); 2380 2381 // Initialize nested menus 2382 submenus.filter(":not(.ui-menu)") 2383 .addClass("ui-menu ui-widget ui-widget-content ui-front") 2384 .hide() 2385 .attr({ 2386 role: this.options.role, 2387 "aria-hidden": "true", 2388 "aria-expanded": "false" 2389 }) 2390 .each(function () { 2391 var menu = $(this), 2392 item = menu.parent(), 2393 submenuCarat = $("<span>") 2394 .addClass("ui-menu-icon ui-icon " + icon) 2395 .data("ui-menu-submenu-carat", true); 2396 2397 item 2398 .attr("aria-haspopup", "true") 2399 .prepend(submenuCarat); 2400 menu.attr("aria-labelledby", item.attr("id")); 2401 }); 2402 2403 menus = submenus.add(this.element); 2404 items = menus.find(this.options.items); 2405
vendor: 4,103 bytes, lines 2406-2557
2406 // Initialize menu-items containing spaces and/or dashes only as dividers 2407 items.not(".ui-menu-item").each(function () { 2408 var item = $(this); 2409 if (that._isDivider(item)) { 2410 item.addClass("ui-widget-content ui-menu-divider"); 2411 } 2412 }); 2413 2414 // Don't refresh list items that are already adapted 2415 items.not(".ui-menu-item, .ui-menu-divider") 2416 .addClass("ui-menu-item") 2417 .uniqueId() 2418 .attr({ 2419 tabIndex: -1, 2420 role: this._itemRole() 2421 }); 2422 2423 // Add aria-disabled attribute to any disabled menu item 2424 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 2425 2426 // If the active item has been removed, blur the menu 2427 if (this.active && !$.contains(this.element[0], this.active[0])) { 2428 this.blur(); 2429 } 2430 }, 2431 2432 _itemRole: function () { 2433 return { 2434 menu: "menuitem", 2435 listbox: "option" 2436 }[this.options.role]; 2437 }, 2438 2439 _setOption: function (key, value) { 2440 if (key === "icons") { 2441 this.element.find(".ui-menu-icon") 2442 .removeClass(this.options.icons.submenu) 2443 .addClass(value.submenu); 2444 } 2445 if (key === "disabled") { 2446 this.element 2447 .toggleClass("ui-state-disabled", !!value) 2448 .attr("aria-disabled", value); 2449 } 2450 this._super(key, value); 2451 }, 2452 2453 focus: function (event, item) { 2454 var nested, focused; 2455 this.blur(event, event && event.type === "focus"); 2456 2457 this._scrollIntoView(item); 2458 2459 this.active = item.first(); 2460 focused = this.active.addClass("ui-state-focus").removeClass("ui-state-active"); 2461 // Only update aria-activedescendant if there's a role 2462 // otherwise we assume focus is managed elsewhere 2463 if (this.options.role) { 2464 this.element.attr("aria-activedescendant", focused.attr("id")); 2465 } 2466 2467 // Highlight active parent menu item, if any 2468 this.active 2469 .parent() 2470 .closest(".ui-menu-item") 2471 .addClass("ui-state-active"); 2472 2473 if (event && event.type === "keydown") { 2474 this._close(); 2475 } else { 2476 this.timer = this._delay(function () { 2477 this._close(); 2478 }, this.delay); 2479 } 2480 2481 nested = item.children(".ui-menu"); 2482 if (nested.length && event && (/^mouse/.test(event.type))) { 2483 this._startOpening(nested); 2484 } 2485 this.activeMenu = item.parent(); 2486 2487 this._trigger("focus", event, { item: item }); 2488 }, 2489 2490 _scrollIntoView: function (item) { 2491 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 2492 if (this._hasScroll()) { 2493 borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 2494 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 2495 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 2496 scroll = this.activeMenu.scrollTop(); 2497 elementHeight = this.activeMenu.height(); 2498 itemHeight = item.outerHeight(); 2499 2500 if (offset < 0) { 2501 this.activeMenu.scrollTop(scroll + offset); 2502 } else if (offset + itemHeight > elementHeight) { 2503 this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight); 2504 } 2505 } 2506 }, 2507 2508 blur: function (event, fromFocus) { 2509 if (!fromFocus) { 2510 clearTimeout(this.timer); 2511 } 2512 2513 if (!this.active) { 2514 return; 2515 } 2516 2517 this.active.removeClass("ui-state-focus"); 2518 this.active = null; 2519 2520 this._trigger("blur", event, { item: this.active }); 2521 }, 2522 2523 _startOpening: function (submenu) { 2524 clearTimeout(this.timer); 2525 2526 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 2527 // shift in the submenu position when mousing over the carat icon 2528 if (submenu.attr("aria-hidden") !== "true") { 2529 return; 2530 } 2531 2532 this.timer = this._delay(function () { 2533 this._close(); 2534 this._open(submenu); 2535 }, this.delay); 2536 }, 2537 2538 _open: function (submenu) { 2539 var position = $.extend({ 2540 of: this.active 2541 }, this.options.position); 2542 2543 clearTimeout(this.timer); 2544 this.element.find(".ui-menu").not(submenu.parents(".ui-menu")) 2545 .hide() 2546 .attr("aria-hidden", "true"); 2547 2548 submenu 2549 .show() 2550 .removeAttr("aria-hidden") 2551 .attr("aria-expanded", "true") 2552 .position(position); 2553 }, 2554 2555 collapseAll: function (event, all) { 2556 clearTimeout(this.timer); 2557 this.timer = this._delay(function () {
vendor: 6,164 bytes, lines 2558-2794
2558 // If we were passed an event, look for the submenu that contains the event 2559 var currentMenu = all ? this.element : 2560 $(event && event.target).closest(this.element.find(".ui-menu")); 2561 2562 // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway 2563 if (!currentMenu.length) { 2564 currentMenu = this.element; 2565 } 2566 2567 this._close(currentMenu); 2568 2569 this.blur(event); 2570 this.activeMenu = currentMenu; 2571 }, this.delay); 2572 }, 2573 2574 // With no arguments, closes the currently active menu - if nothing is active 2575 // it closes all menus. If passed an argument, it will search for menus BELOW 2576 _close: function (startMenu) { 2577 if (!startMenu) { 2578 startMenu = this.active ? this.active.parent() : this.element; 2579 } 2580 2581 startMenu 2582 .find(".ui-menu") 2583 .hide() 2584 .attr("aria-hidden", "true") 2585 .attr("aria-expanded", "false") 2586 .end() 2587 .find(".ui-state-active").not(".ui-state-focus") 2588 .removeClass("ui-state-active"); 2589 }, 2590 2591 _closeOnDocumentClick: function (event) { 2592 return !$(event.target).closest(".ui-menu").length; 2593 }, 2594 2595 _isDivider: function (item) { 2596 // Match hyphen, em dash, en dash 2597 return !/[^\-\u2014\u2013\s]/.test(item.text()); 2598 }, 2599 2600 collapse: function (event) { 2601 var newItem = this.active && 2602 this.active.parent().closest(".ui-menu-item", this.element); 2603 if (newItem && newItem.length) { 2604 this._close(); 2605 this.focus(event, newItem); 2606 } 2607 }, 2608 2609 expand: function (event) { 2610 var newItem = this.active && 2611 this.active 2612 .children(".ui-menu ") 2613 .find(this.options.items) 2614 .first(); 2615 2616 if (newItem && newItem.length) { 2617 this._open(newItem.parent()); 2618 2619 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 2620 this._delay(function () { 2621 this.focus(event, newItem); 2622 }); 2623 } 2624 }, 2625 2626 next: function (event) { 2627 this._move("next", "first", event); 2628 }, 2629 2630 previous: function (event) { 2631 this._move("prev", "last", event); 2632 }, 2633 2634 isFirstItem: function () { 2635 return this.active && !this.active.prevAll(".ui-menu-item").length; 2636 }, 2637 2638 isLastItem: function () { 2639 return this.active && !this.active.nextAll(".ui-menu-item").length; 2640 }, 2641 2642 _move: function (direction, filter, event) { 2643 var next; 2644 if (this.active) { 2645 if (direction === "first" || direction === "last") { 2646 next = this.active 2647 [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item") 2648 .eq(-1); 2649 } else { 2650 next = this.active 2651 [direction + "All"](".ui-menu-item") 2652 .eq(0); 2653 } 2654 } 2655 if (!next || !next.length || !this.active) { 2656 next = this.activeMenu.find(this.options.items)[filter](); 2657 } 2658 2659 this.focus(event, next); 2660 }, 2661 2662 nextPage: function (event) { 2663 var item, base, height; 2664 2665 if (!this.active) { 2666 this.next(event); 2667 return; 2668 } 2669 if (this.isLastItem()) { 2670 return; 2671 } 2672 if (this._hasScroll()) { 2673 base = this.active.offset().top; 2674 height = this.element.height(); 2675 this.active.nextAll(".ui-menu-item").each(function () { 2676 item = $(this); 2677 return item.offset().top - base - height < 0; 2678 }); 2679 2680 this.focus(event, item); 2681 } else { 2682 this.focus(event, this.activeMenu.find(this.options.items) 2683 [!this.active ? "first" : "last"]()); 2684 } 2685 }, 2686 2687 previousPage: function (event) { 2688 var item, base, height; 2689 if (!this.active) { 2690 this.next(event); 2691 return; 2692 } 2693 if (this.isFirstItem()) { 2694 return; 2695 } 2696 if (this._hasScroll()) { 2697 base = this.active.offset().top; 2698 height = this.element.height(); 2699 this.active.prevAll(".ui-menu-item").each(function () { 2700 item = $(this); 2701 return item.offset().top - base + height > 0; 2702 }); 2703 2704 this.focus(event, item); 2705 } else { 2706 this.focus(event, this.activeMenu.find(this.options.items).first()); 2707 } 2708 }, 2709 2710 _hasScroll: function () { 2711 return this.element.outerHeight() < this.element.prop("scrollHeight"); 2712 }, 2713 2714 select: function (event) { 2715 // TODO: It should never be possible to not have an active item at this 2716 // point, but the tests don't trigger mouseenter before click. 2717 this.active = this.active || $(event.target).closest(".ui-menu-item"); 2718 var ui = { item: this.active }; 2719 if (!this.active.has(".ui-menu").length) { 2720 this.collapseAll(event, true); 2721 } 2722 this._trigger("select", event, ui); 2723 }, 2724 2725 _filterMenuItems: function (character) { 2726 var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), 2727 regex = new RegExp("^" + escapedCharacter, "i"); 2728 2729 return this.activeMenu 2730 .find(this.options.items) 2731 2732 // Only match on items, not dividers or other content (#10571) 2733 .filter(".ui-menu-item") 2734 .filter(function () { 2735 return regex.test($.trim($(this).text())); 2736 }); 2737 } 2738 }); 2739 2740 /*! 2741 * jQuery UI Autocomplete 1.11.4 2742 * http://jqueryui.com 2743 * 2744 * Copyright jQuery Foundation and other contributors 2745 * Released under the MIT license. 2746 * http://jquery.org/license 2747 * 2748 * http://api.jqueryui.com/autocomplete/ 2749 */ 2750 2751 $.widget("ui.autocomplete", { 2752 version: "1.11.4", 2753 defaultElement: "<input>", 2754 options: { 2755 appendTo: null, 2756 autoFocus: false, 2757 delay: 300, 2758 minLength: 1, 2759 position: { 2760 my: "left top", 2761 at: "left bottom", 2762 collision: "none" 2763 }, 2764 source: null, 2765 2766 // callbacks 2767 change: null, 2768 close: null, 2769 focus: null, 2770 open: null, 2771 response: null, 2772 search: null, 2773 select: null 2774 }, 2775 2776 requestIndex: 0, 2777 pending: 0, 2778 2779 _create: function () { 2780 // Some browsers only repeat keydown events, not keypress events, 2781 // so we use the suppressKeyPress flag to determine if we've already 2782 // handled the keydown event. #7269 2783 // Unfortunately the code for & in keypress is the same as the up arrow, 2784 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 2785 // events when we know the keydown event was used to modify the 2786 // search term. #7799 2787 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 2788 nodeName = this.element[0].nodeName.toLowerCase(), 2789 isTextarea = nodeName === "textarea", 2790 isInput = nodeName === "input"; 2791 2792 this.isMultiLine = 2793 // Textareas are always multi-line 2794 isTextarea ? true :
vendor: 42,865 bytes, lines 2795-4111
2795 // Inputs are always single-line, even if inside a contentEditable element 2796 // IE also treats inputs as contentEditable 2797 isInput ? false : 2798 // All other element types are determined by whether or not they're contentEditable 2799 this.element.prop("isContentEditable"); 2800 2801 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 2802 this.isNewMenu = true; 2803 2804 this.element 2805 .addClass("ui-autocomplete-input") 2806 .attr("autocomplete", "off"); 2807 2808 this._on(this.element, { 2809 keydown: function (event) { 2810 if (this.element.prop("readOnly")) { 2811 suppressKeyPress = true; 2812 suppressInput = true; 2813 suppressKeyPressRepeat = true; 2814 return; 2815 } 2816 2817 suppressKeyPress = false; 2818 suppressInput = false; 2819 suppressKeyPressRepeat = false; 2820 var keyCode = $.ui.keyCode; 2821 switch (event.keyCode) { 2822 case keyCode.PAGE_UP: 2823 suppressKeyPress = true; 2824 this._move("previousPage", event); 2825 break; 2826 case keyCode.PAGE_DOWN: 2827 suppressKeyPress = true; 2828 this._move("nextPage", event); 2829 break; 2830 case keyCode.UP: 2831 suppressKeyPress = true; 2832 this._keyEvent("previous", event); 2833 break; 2834 case keyCode.DOWN: 2835 suppressKeyPress = true; 2836 this._keyEvent("next", event); 2837 break; 2838 case keyCode.ENTER: 2839 // when menu is open and has focus 2840 if (this.menu.active) { 2841 // #6055 - Opera still allows the keypress to occur 2842 // which causes forms to submit 2843 suppressKeyPress = true; 2844 event.preventDefault(); 2845 this.menu.select(event); 2846 } 2847 break; 2848 case keyCode.TAB: 2849 if (this.menu.active) { 2850 this.menu.select(event); 2851 } 2852 break; 2853 case keyCode.ESCAPE: 2854 if (this.menu.element.is(":visible")) { 2855 if (!this.isMultiLine) { 2856 this._value(this.term); 2857 } 2858 this.close(event); 2859 // Different browsers have different default behavior for escape 2860 // Single press can mean undo or clear 2861 // Double press in IE means clear the whole form 2862 event.preventDefault(); 2863 } 2864 break; 2865 default: 2866 suppressKeyPressRepeat = true; 2867 // search timeout should be triggered before the input value is changed 2868 this._searchTimeout(event); 2869 break; 2870 } 2871 }, 2872 keypress: function (event) { 2873 if (suppressKeyPress) { 2874 suppressKeyPress = false; 2875 if (!this.isMultiLine || this.menu.element.is(":visible")) { 2876 event.preventDefault(); 2877 } 2878 return; 2879 } 2880 if (suppressKeyPressRepeat) { 2881 return; 2882 } 2883 2884 // replicate some key handlers to allow them to repeat in Firefox and Opera 2885 var keyCode = $.ui.keyCode; 2886 switch (event.keyCode) { 2887 case keyCode.PAGE_UP: 2888 this._move("previousPage", event); 2889 break; 2890 case keyCode.PAGE_DOWN: 2891 this._move("nextPage", event); 2892 break; 2893 case keyCode.UP: 2894 this._keyEvent("previous", event); 2895 break; 2896 case keyCode.DOWN: 2897 this._keyEvent("next", event); 2898 break; 2899 } 2900 }, 2901 input: function (event) { 2902 if (suppressInput) { 2903 suppressInput = false; 2904 event.preventDefault(); 2905 return; 2906 } 2907 this._searchTimeout(event); 2908 }, 2909 focus: function () { 2910 this.selectedItem = null; 2911 this.previous = this._value(); 2912 }, 2913 blur: function (event) { 2914 if (this.cancelBlur) { 2915 delete this.cancelBlur; 2916 return; 2917 } 2918 2919 clearTimeout(this.searching); 2920 this.close(event); 2921 this._change(event); 2922 } 2923 }); 2924 2925 this._initSource(); 2926 this.menu = $("<ul>") 2927 .addClass("ui-autocomplete ui-front") 2928 .appendTo(this._appendTo()) 2929 .menu({ 2930 // disable ARIA support, the live region takes care of that 2931 role: null 2932 }) 2933 .hide() 2934 .menu("instance"); 2935 2936 this._on(this.menu.element, { 2937 mousedown: function (event) { 2938 // prevent moving focus out of the text field 2939 event.preventDefault(); 2940 2941 // IE doesn't prevent moving focus even with event.preventDefault() 2942 // so we set a flag to know when we should ignore the blur event 2943 this.cancelBlur = true; 2944 this._delay(function () { 2945 delete this.cancelBlur; 2946 }); 2947 2948 // clicking on the scrollbar causes focus to shift to the body 2949 // but we can't detect a mouseup or a click immediately afterward 2950 // so we have to track the next mousedown and close the menu if 2951 // the user clicks somewhere outside of the autocomplete 2952 var menuElement = this.menu.element[0]; 2953 if (!$(event.target).closest(".ui-menu-item").length) { 2954 this._delay(function () { 2955 var that = this; 2956 this.document.one("mousedown", function (event) { 2957 if (event.target !== that.element[0] && 2958 event.target !== menuElement && 2959 !$.contains(menuElement, event.target)) { 2960 that.close(); 2961 } 2962 }); 2963 }); 2964 } 2965 }, 2966 menufocus: function (event, ui) { 2967 var label, item; 2968 // support: Firefox 2969 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 2970 if (this.isNewMenu) { 2971 this.isNewMenu = false; 2972 if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) { 2973 this.menu.blur(); 2974 2975 this.document.one("mousemove", function () { 2976 $(event.target).trigger(event.originalEvent); 2977 }); 2978 2979 return; 2980 } 2981 } 2982 2983 item = ui.item.data("ui-autocomplete-item"); 2984 if (false !== this._trigger("focus", event, { item: item })) { 2985 // use value to match what will end up in the input, if it was a key event 2986 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 2987 this._value(item.value); 2988 } 2989 } 2990 2991 // Announce the value in the liveRegion 2992 label = ui.item.attr("aria-label") || item.value; 2993 if (label && $.trim(label).length) { 2994 this.liveRegion.children().hide(); 2995 $("<div>").text(label).appendTo(this.liveRegion); 2996 } 2997 }, 2998 menuselect: function (event, ui) { 2999 var item = ui.item.data("ui-autocomplete-item"), 3000 previous = this.previous; 3001 3002 // only trigger when focus was lost (click on menu) 3003 if (this.element[0] !== this.document[0].activeElement) { 3004 this.element.focus(); 3005 this.previous = previous; 3006 // #6109 - IE triggers two focus events and the second 3007 // is asynchronous, so we need to reset the previous 3008 // term synchronously and asynchronously :-( 3009 this._delay(function () { 3010 this.previous = previous; 3011 this.selectedItem = item; 3012 }); 3013 } 3014 3015 if (false !== this._trigger("select", event, { item: item })) { 3016 this._value(item.value); 3017 } 3018 // reset the term after the select event 3019 // this allows custom select handling to work properly 3020 this.term = this._value(); 3021 3022 this.close(event); 3023 this.selectedItem = item; 3024 } 3025 }); 3026 3027 this.liveRegion = $("<span>", { 3028 role: "status", 3029 "aria-live": "assertive", 3030 "aria-relevant": "additions" 3031 }) 3032 .addClass("ui-helper-hidden-accessible") 3033 .appendTo(this.document[0].body); 3034 3035 // turning off autocomplete prevents the browser from remembering the 3036 // value when navigating through history, so we re-enable autocomplete 3037 // if the page is unloaded before the widget is destroyed. #7790 3038 this._on(this.window, { 3039 beforeunload: function () { 3040 this.element.removeAttr("autocomplete"); 3041 } 3042 }); 3043 }, 3044 3045 _destroy: function () { 3046 clearTimeout(this.searching); 3047 this.element 3048 .removeClass("ui-autocomplete-input") 3049 .removeAttr("autocomplete"); 3050 this.menu.element.remove(); 3051 this.liveRegion.remove(); 3052 }, 3053 3054 _setOption: function (key, value) { 3055 this._super(key, value); 3056 if (key === "source") { 3057 this._initSource(); 3058 } 3059 if (key === "appendTo") { 3060 this.menu.element.appendTo(this._appendTo()); 3061 } 3062 if (key === "disabled" && value && this.xhr) { 3063 this.xhr.abort(); 3064 } 3065 }, 3066 3067 _appendTo: function () { 3068 var element = this.options.appendTo; 3069 3070 if (element) { 3071 element = element.jquery || element.nodeType ? 3072 $(element) : 3073 this.document.find(element).eq(0); 3074 } 3075 3076 if (!element || !element[0]) { 3077 element = this.element.closest(".ui-front"); 3078 } 3079 3080 if (!element.length) { 3081 element = this.document[0].body; 3082 } 3083 3084 return element; 3085 }, 3086 3087 _initSource: function () { 3088 var array, url, 3089 that = this; 3090 if ($.isArray(this.options.source)) { 3091 array = this.options.source; 3092 this.source = function (request, response) { 3093 response($.ui.autocomplete.filter(array, request.term)); 3094 }; 3095 } else if (typeof this.options.source === "string") { 3096 url = this.options.source; 3097 this.source = function (request, response) { 3098 if (that.xhr) { 3099 that.xhr.abort(); 3100 } 3101 that.xhr = $.ajax({ 3102 url: url, 3103 data: request, 3104 dataType: "json", 3105 success: function (data) { 3106 response(data); 3107 }, 3108 error: function () { 3109 response([]); 3110 } 3111 }); 3112 }; 3113 } else { 3114 this.source = this.options.source; 3115 } 3116 }, 3117 3118 _searchTimeout: function (event) { 3119 clearTimeout(this.searching); 3120 this.searching = this._delay(function () { 3121 // Search if the value has changed, or if the user retypes the same value (see #7434) 3122 var equalValues = this.term === this._value(), 3123 menuVisible = this.menu.element.is(":visible"), 3124 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 3125 3126 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 3127 this.selectedItem = null; 3128 this.search(null, event); 3129 } 3130 }, this.options.delay); 3131 }, 3132 3133 search: function (value, event) { 3134 value = value != null ? value : this._value(); 3135 3136 // always save the actual value, not the one passed as an argument 3137 this.term = this._value(); 3138 3139 if (value.length < this.options.minLength) { 3140 return this.close(event); 3141 } 3142 3143 if (this._trigger("search", event) === false) { 3144 return; 3145 } 3146 3147 return this._search(value); 3148 }, 3149 3150 _search: function (value) { 3151 this.pending++; 3152 this.element.addClass("ui-autocomplete-loading"); 3153 this.cancelSearch = false; 3154 3155 this.source({ term: value }, this._response()); 3156 }, 3157 3158 _response: function () { 3159 var index = ++this.requestIndex; 3160 3161 return $.proxy(function (content) { 3162 if (index === this.requestIndex) { 3163 this.__response(content); 3164 } 3165 3166 this.pending--; 3167 if (!this.pending) { 3168 this.element.removeClass("ui-autocomplete-loading"); 3169 } 3170 }, this); 3171 }, 3172 3173 __response: function (content) { 3174 if (content) { 3175 content = this._normalize(content); 3176 } 3177 this._trigger("response", null, { content: content }); 3178 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 3179 this._suggest(content); 3180 this._trigger("open"); 3181 } else { 3182 // use ._close() instead of .close() so we don't cancel future searches 3183 this._close(); 3184 } 3185 }, 3186 3187 close: function (event) { 3188 this.cancelSearch = true; 3189 this._close(event); 3190 }, 3191 3192 _close: function (event) { 3193 if (this.menu.element.is(":visible")) { 3194 this.menu.element.hide(); 3195 this.menu.blur(); 3196 this.isNewMenu = true; 3197 this._trigger("close", event); 3198 } 3199 }, 3200 3201 _change: function (event) { 3202 if (this.previous !== this._value()) { 3203 this._trigger("change", event, { item: this.selectedItem }); 3204 } 3205 }, 3206 3207 _normalize: function (items) { 3208 // assume all items have the right format when the first item is complete 3209 if (items.length && items[0].label && items[0].value) { 3210 return items; 3211 } 3212 return $.map(items, function (item) { 3213 if (typeof item === "string") { 3214 return { 3215 label: item, 3216 value: item 3217 }; 3218 } 3219 return $.extend({}, item, { 3220 label: item.label || item.value, 3221 value: item.value || item.label 3222 }); 3223 }); 3224 }, 3225 3226 _suggest: function (items) { 3227 var ul = this.menu.element.empty(); 3228 this._renderMenu(ul, items); 3229 this.isNewMenu = true; 3230 this.menu.refresh(); 3231 3232 // size and position menu 3233 ul.show(); 3234 this._resizeMenu(); 3235 ul.position($.extend({ 3236 of: this.element 3237 }, this.options.position)); 3238 3239 if (this.options.autoFocus) { 3240 this.menu.next(); 3241 } 3242 }, 3243 3244 _resizeMenu: function () { 3245 var ul = this.menu.element; 3246 ul.outerWidth(Math.max( 3247 // Firefox wraps long text (possibly a rounding bug) 3248 // so we add 1px to avoid the wrapping (#7513) 3249 ul.width("").outerWidth() + 1, 3250 this.element.outerWidth() 3251 )); 3252 }, 3253 3254 _renderMenu: function (ul, items) { 3255 var that = this; 3256 $.each(items, function (index, item) { 3257 that._renderItemData(ul, item); 3258 }); 3259 }, 3260 3261 _renderItemData: function (ul, item) { 3262 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 3263 }, 3264 3265 _renderItem: function (ul, item) { 3266 return $("<li>").text(item.label).appendTo(ul); 3267 }, 3268 3269 _move: function (direction, event) { 3270 if (!this.menu.element.is(":visible")) { 3271 this.search(null, event); 3272 return; 3273 } 3274 if (this.menu.isFirstItem() && /^previous/.test(direction) || 3275 this.menu.isLastItem() && /^next/.test(direction)) { 3276 if (!this.isMultiLine) { 3277 this._value(this.term); 3278 } 3279 3280 this.menu.blur(); 3281 return; 3282 } 3283 this.menu[direction](event); 3284 }, 3285 3286 widget: function () { 3287 return this.menu.element; 3288 }, 3289 3290 _value: function () { 3291 return this.valueMethod.apply(this.element, arguments); 3292 }, 3293 3294 _keyEvent: function (keyEvent, event) { 3295 if (!this.isMultiLine || this.menu.element.is(":visible")) { 3296 this._move(keyEvent, event); 3297 3298 // prevents moving cursor to beginning/end of the text field in some browsers 3299 event.preventDefault(); 3300 } 3301 } 3302 }); 3303 3304 $.extend($.ui.autocomplete, { 3305 escapeRegex: function (value) { 3306 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 3307 }, 3308 filter: function (array, term) { 3309 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 3310 return $.grep(array, function (value) { 3311 return matcher.test(value.label || value.value || value); 3312 }); 3313 } 3314 }); 3315 3316 // live region extension, adding a `messages` option 3317 // NOTE: This is an experimental API. We are still investigating 3318 // a full solution for string manipulation and internationalization. 3319 $.widget("ui.autocomplete", $.ui.autocomplete, { 3320 options: { 3321 messages: { 3322 noResults: "No search results.", 3323 results: function (amount) { 3324 return amount + (amount > 1 ? " results are" : " result is") + 3325 " available, use up and down arrow keys to navigate."; 3326 } 3327 } 3328 }, 3329 3330 __response: function (content) { 3331 var message; 3332 this._superApply(arguments); 3333 if (this.options.disabled || this.cancelSearch) { 3334 return; 3335 } 3336 if (content && content.length) { 3337 message = this.options.messages.results(content.length); 3338 } else { 3339 message = this.options.messages.noResults; 3340 } 3341 this.liveRegion.children().hide(); 3342 $("<div>").text(message).appendTo(this.liveRegion); 3343 } 3344 }); 3345 3346 var autocomplete = $.ui.autocomplete; 3347 3348 /*! 3349 * jQuery UI Button 1.11.4 3350 * http://jqueryui.com 3351 * 3352 * Copyright jQuery Foundation and other contributors 3353 * Released under the MIT license. 3354 * http://jquery.org/license 3355 * 3356 * http://api.jqueryui.com/button/ 3357 */ 3358 3359 var lastActive, 3360 baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", 3361 typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", 3362 formResetHandler = function () { 3363 var form = $(this); 3364 setTimeout(function () { 3365 form.find(":ui-button").button("refresh"); 3366 }, 1); 3367 }, 3368 radioGroup = function (radio) { 3369 var name = radio.name, 3370 form = radio.form, 3371 radios = $([]); 3372 if (name) { 3373 name = name.replace(/'/g, "\\'"); 3374 if (form) { 3375 radios = $(form).find("[name='" + name + "'][type=radio]"); 3376 } else { 3377 radios = $("[name='" + name + "'][type=radio]", radio.ownerDocument) 3378 .filter(function () { 3379 return !this.form; 3380 }); 3381 } 3382 } 3383 return radios; 3384 }; 3385 3386 $.widget("ui.button", { 3387 version: "1.11.4", 3388 defaultElement: "<button>", 3389 options: { 3390 disabled: null, 3391 text: true, 3392 label: null, 3393 icons: { 3394 primary: null, 3395 secondary: null 3396 } 3397 }, 3398 _create: function () { 3399 this.element.closest("form") 3400 .unbind("reset" + this.eventNamespace) 3401 .bind("reset" + this.eventNamespace, formResetHandler); 3402 3403 if (typeof this.options.disabled !== "boolean") { 3404 this.options.disabled = !!this.element.prop("disabled"); 3405 } else { 3406 this.element.prop("disabled", this.options.disabled); 3407 } 3408 3409 this._determineButtonType(); 3410 this.hasTitle = !!this.buttonElement.attr("title"); 3411 3412 var that = this, 3413 options = this.options, 3414 toggleButton = this.type === "checkbox" || this.type === "radio", 3415 activeClass = !toggleButton ? "ui-state-active" : ""; 3416 3417 if (options.label === null) { 3418 options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); 3419 } 3420 3421 this._hoverable(this.buttonElement); 3422 3423 this.buttonElement 3424 .addClass(baseClasses) 3425 .attr("role", "button") 3426 .bind("mouseenter" + this.eventNamespace, function () { 3427 if (options.disabled) { 3428 return; 3429 } 3430 if (this === lastActive) { 3431 $(this).addClass("ui-state-active"); 3432 } 3433 }) 3434 .bind("mouseleave" + this.eventNamespace, function () { 3435 if (options.disabled) { 3436 return; 3437 } 3438 $(this).removeClass(activeClass); 3439 }) 3440 .bind("click" + this.eventNamespace, function (event) { 3441 if (options.disabled) { 3442 event.preventDefault(); 3443 event.stopImmediatePropagation(); 3444 } 3445 }); 3446 3447 // Can't use _focusable() because the element that receives focus 3448 // and the element that gets the ui-state-focus class are different 3449 this._on({ 3450 focus: function () { 3451 this.buttonElement.addClass("ui-state-focus"); 3452 }, 3453 blur: function () { 3454 this.buttonElement.removeClass("ui-state-focus"); 3455 } 3456 }); 3457 3458 if (toggleButton) { 3459 this.element.bind("change" + this.eventNamespace, function () { 3460 that.refresh(); 3461 }); 3462 } 3463 3464 if (this.type === "checkbox") { 3465 this.buttonElement.bind("click" + this.eventNamespace, function () { 3466 if (options.disabled) { 3467 return false; 3468 } 3469 }); 3470 } else if (this.type === "radio") { 3471 this.buttonElement.bind("click" + this.eventNamespace, function () { 3472 if (options.disabled) { 3473 return false; 3474 } 3475 $(this).addClass("ui-state-active"); 3476 that.buttonElement.attr("aria-pressed", "true"); 3477 3478 var radio = that.element[0]; 3479 radioGroup(radio) 3480 .not(radio) 3481 .map(function () { 3482 return $(this).button("widget")[0]; 3483 }) 3484 .removeClass("ui-state-active") 3485 .attr("aria-pressed", "false"); 3486 }); 3487 } else { 3488 this.buttonElement 3489 .bind("mousedown" + this.eventNamespace, function () { 3490 if (options.disabled) { 3491 return false; 3492 } 3493 $(this).addClass("ui-state-active"); 3494 lastActive = this; 3495 that.document.one("mouseup", function () { 3496 lastActive = null; 3497 }); 3498 }) 3499 .bind("mouseup" + this.eventNamespace, function () { 3500 if (options.disabled) { 3501 return false; 3502 } 3503 $(this).removeClass("ui-state-active"); 3504 }) 3505 .bind("keydown" + this.eventNamespace, function (event) { 3506 if (options.disabled) { 3507 return false; 3508 } 3509 if (event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER) { 3510 $(this).addClass("ui-state-active"); 3511 } 3512 }) 3513 // see #8559, we bind to blur here in case the button element loses 3514 // focus between keydown and keyup, it would be left in an "active" state 3515 .bind("keyup" + this.eventNamespace + " blur" + this.eventNamespace, function () { 3516 $(this).removeClass("ui-state-active"); 3517 }); 3518 3519 if (this.buttonElement.is("a")) { 3520 this.buttonElement.keyup(function (event) { 3521 if (event.keyCode === $.ui.keyCode.SPACE) { 3522 // TODO pass through original event correctly (just as 2nd argument doesn't work) 3523 $(this).click(); 3524 } 3525 }); 3526 } 3527 } 3528 3529 this._setOption("disabled", options.disabled); 3530 this._resetButton(); 3531 }, 3532 3533 _determineButtonType: function () { 3534 var ancestor, labelSelector, checked; 3535 3536 if (this.element.is("[type=checkbox]")) { 3537 this.type = "checkbox"; 3538 } else if (this.element.is("[type=radio]")) { 3539 this.type = "radio"; 3540 } else if (this.element.is("input")) { 3541 this.type = "input"; 3542 } else { 3543 this.type = "button"; 3544 } 3545 3546 if (this.type === "checkbox" || this.type === "radio") { 3547 // we don't search against the document in case the element 3548 // is disconnected from the DOM 3549 ancestor = this.element.parents().last(); 3550 labelSelector = "label[for='" + this.element.attr("id") + "']"; 3551 this.buttonElement = ancestor.find(labelSelector); 3552 if (!this.buttonElement.length) { 3553 ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); 3554 this.buttonElement = ancestor.filter(labelSelector); 3555 if (!this.buttonElement.length) { 3556 this.buttonElement = ancestor.find(labelSelector); 3557 } 3558 } 3559 this.element.addClass("ui-helper-hidden-accessible"); 3560 3561 checked = this.element.is(":checked"); 3562 if (checked) { 3563 this.buttonElement.addClass("ui-state-active"); 3564 } 3565 this.buttonElement.prop("aria-pressed", checked); 3566 } else { 3567 this.buttonElement = this.element; 3568 } 3569 }, 3570 3571 widget: function () { 3572 return this.buttonElement; 3573 }, 3574 3575 _destroy: function () { 3576 this.element 3577 .removeClass("ui-helper-hidden-accessible"); 3578 this.buttonElement 3579 .removeClass(baseClasses + " ui-state-active " + typeClasses) 3580 .removeAttr("role") 3581 .removeAttr("aria-pressed") 3582 .html(this.buttonElement.find(".ui-button-text").html()); 3583 3584 if (!this.hasTitle) { 3585 this.buttonElement.removeAttr("title"); 3586 } 3587 }, 3588 3589 _setOption: function (key, value) { 3590 this._super(key, value); 3591 if (key === "disabled") { 3592 this.widget().toggleClass("ui-state-disabled", !!value); 3593 this.element.prop("disabled", !!value); 3594 if (value) { 3595 if (this.type === "checkbox" || this.type === "radio") { 3596 this.buttonElement.removeClass("ui-state-focus"); 3597 } else { 3598 this.buttonElement.removeClass("ui-state-focus ui-state-active"); 3599 } 3600 } 3601 return; 3602 } 3603 this._resetButton(); 3604 }, 3605 3606 refresh: function () { 3607 //See #8237 & #8828 3608 var isDisabled = this.element.is("input, button") ? this.element.is(":disabled") : this.element.hasClass("ui-button-disabled"); 3609 3610 if (isDisabled !== this.options.disabled) { 3611 this._setOption("disabled", isDisabled); 3612 } 3613 if (this.type === "radio") { 3614 radioGroup(this.element[0]).each(function () { 3615 if ($(this).is(":checked")) { 3616 $(this).button("widget") 3617 .addClass("ui-state-active") 3618 .attr("aria-pressed", "true"); 3619 } else { 3620 $(this).button("widget") 3621 .removeClass("ui-state-active") 3622 .attr("aria-pressed", "false"); 3623 } 3624 }); 3625 } else if (this.type === "checkbox") { 3626 if (this.element.is(":checked")) { 3627 this.buttonElement 3628 .addClass("ui-state-active") 3629 .attr("aria-pressed", "true"); 3630 } else { 3631 this.buttonElement 3632 .removeClass("ui-state-active") 3633 .attr("aria-pressed", "false"); 3634 } 3635 } 3636 }, 3637 3638 _resetButton: function () { 3639 if (this.type === "input") { 3640 if (this.options.label) { 3641 this.element.val(this.options.label); 3642 } 3643 return; 3644 } 3645 var buttonElement = this.buttonElement.removeClass(typeClasses), 3646 buttonText = $("<span></span>", this.document[0]) 3647 .addClass("ui-button-text") 3648 .html(this.options.label) 3649 .appendTo(buttonElement.empty()) 3650 .text(), 3651 icons = this.options.icons, 3652 multipleIcons = icons.primary && icons.secondary, 3653 buttonClasses = []; 3654 3655 if (icons.primary || icons.secondary) { 3656 if (this.options.text) { 3657 buttonClasses.push("ui-button-text-icon" + (multipleIcons ? "s" : (icons.primary ? "-primary" : "-secondary"))); 3658 } 3659 3660 if (icons.primary) { 3661 buttonElement.prepend("<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>"); 3662 } 3663 3664 if (icons.secondary) { 3665 buttonElement.append("<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>"); 3666 } 3667 3668 if (!this.options.text) { 3669 buttonClasses.push(multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only"); 3670 3671 if (!this.hasTitle) { 3672 buttonElement.attr("title", $.trim(buttonText)); 3673 } 3674 } 3675 } else { 3676 buttonClasses.push("ui-button-text-only"); 3677 } 3678 buttonElement.addClass(buttonClasses.join(" ")); 3679 } 3680 }); 3681 3682 $.widget("ui.buttonset", { 3683 version: "1.11.4", 3684 options: { 3685 items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)" 3686 }, 3687 3688 _create: function () { 3689 this.element.addClass("ui-buttonset"); 3690 }, 3691 3692 _init: function () { 3693 this.refresh(); 3694 }, 3695 3696 _setOption: function (key, value) { 3697 if (key === "disabled") { 3698 this.buttons.button("option", key, value); 3699 } 3700 3701 this._super(key, value); 3702 }, 3703 3704 refresh: function () { 3705 var rtl = this.element.css("direction") === "rtl", 3706 allButtons = this.element.find(this.options.items), 3707 existingButtons = allButtons.filter(":ui-button"); 3708 3709 // Initialize new buttons 3710 allButtons.not(":ui-button").button(); 3711 3712 // Refresh existing buttons 3713 existingButtons.button("refresh"); 3714 3715 this.buttons = allButtons 3716 .map(function () { 3717 return $(this).button("widget")[0]; 3718 }) 3719 .removeClass("ui-corner-all ui-corner-left ui-corner-right") 3720 .filter(":first") 3721 .addClass(rtl ? "ui-corner-right" : "ui-corner-left") 3722 .end() 3723 .filter(":last") 3724 .addClass(rtl ? "ui-corner-left" : "ui-corner-right") 3725 .end() 3726 .end(); 3727 }, 3728 3729 _destroy: function () { 3730 this.element.removeClass("ui-buttonset"); 3731 this.buttons 3732 .map(function () { 3733 return $(this).button("widget")[0]; 3734 }) 3735 .removeClass("ui-corner-left ui-corner-right") 3736 .end() 3737 .button("destroy"); 3738 } 3739 }); 3740 3741 var button = $.ui.button; 3742 3743 /*! 3744 * jQuery UI Datepicker 1.11.4 3745 * http://jqueryui.com 3746 * 3747 * Copyright jQuery Foundation and other contributors 3748 * Released under the MIT license. 3749 * http://jquery.org/license 3750 * 3751 * http://api.jqueryui.com/datepicker/ 3752 */ 3753 3754 $.extend($.ui, { datepicker: { version: "1.11.4" } }); 3755 3756 var datepicker_instActive; 3757 3758 function datepicker_getZindex(elem) { 3759 var position, value; 3760 while (elem.length && elem[0] !== document) { 3761 // Ignore z-index if position is set to a value where z-index is ignored by the browser 3762 // This makes behavior of this function consistent across browsers 3763 // WebKit always returns auto if the element is positioned 3764 position = elem.css("position"); 3765 if (position === "absolute" || position === "relative" || position === "fixed") { 3766 // IE returns 0 when zIndex is not specified 3767 // other browsers return a string 3768 // we ignore the case of nested elements with an explicit value of 0 3769 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 3770 value = parseInt(elem.css("zIndex"), 10); 3771 if (!isNaN(value) && value !== 0) { 3772 return value; 3773 } 3774 } 3775 elem = elem.parent(); 3776 } 3777 3778 return 0; 3779 } 3780 /* Date picker manager. 3781 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 3782 Settings for (groups of) date pickers are maintained in an instance object, 3783 allowing multiple different settings on the same page. */ 3784 3785 function Datepicker() { 3786 this._curInst = null; // The current instance in use 3787 this._keyEvent = false; // If the last event was a key event 3788 this._disabledInputs = []; // List of date picker inputs that have been disabled 3789 this._datepickerShowing = false; // True if the popup picker is showing , false if not 3790 this._inDialog = false; // True if showing within a "dialog", false if not 3791 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 3792 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 3793 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 3794 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 3795 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 3796 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 3797 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 3798 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 3799 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 3800 this.regional = []; // Available regional settings, indexed by language code 3801 this.regional[""] = { // Default regional settings 3802 closeText: "Done", // Display text for close link 3803 prevText: "Prev", // Display text for previous month link 3804 nextText: "Next", // Display text for next month link 3805 currentText: "Today", // Display text for current month link 3806 monthNames: ["January", "February", "March", "April", "May", "June", 3807 "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting 3808 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting 3809 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting 3810 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 3811 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 3812 weekHeader: "Wk", // Column header for week of the year 3813 dateFormat: "mm/dd/yy", // See format options on parseDate 3814 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 3815 isRTL: false, // True if right-to-left language, false if left-to-right 3816 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 3817 yearSuffix: "" // Additional text to append to the year in the month headers 3818 }; 3819 this._defaults = { // Global defaults for all the date picker instances 3820 showOn: "focus", // "focus" for popup on focus, 3821 // "button" for trigger button, or "both" for either 3822 showAnim: "fadeIn", // Name of jQuery animation for popup 3823 showOptions: {}, // Options for enhanced animations 3824 defaultDate: null, // Used when field is blank: actual date, 3825 // +/-number for offset from today, null for today 3826 appendText: "", // Display text following the input box, e.g. showing the format 3827 buttonText: "...", // Text for trigger button 3828 buttonImage: "", // URL for trigger button image 3829 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 3830 hideIfNoPrevNext: false, // True to hide next/previous month links 3831 // if not applicable, false to just disable them 3832 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 3833 gotoCurrent: false, // True if today link goes back to current selection instead 3834 changeMonth: false, // True if month can be selected directly, false if only prev/next 3835 changeYear: false, // True if year can be selected directly, false if only prev/next 3836 yearRange: "c-10:c+10", // Range of years to display in drop-down, 3837 // either relative to today's year (-nn:+nn), relative to currently displayed year 3838 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 3839 showOtherMonths: false, // True to show dates in other months, false to leave blank 3840 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 3841 showWeek: false, // True to show week of the year, false to not show it 3842 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 3843 // takes a Date and returns the number of the week for it 3844 shortYearCutoff: "+10", // Short year values < this are in the current century, 3845 // > this are in the previous century, 3846 // string value starting with "+" for current year + value 3847 minDate: null, // The earliest selectable date, or null for no limit 3848 maxDate: null, // The latest selectable date, or null for no limit 3849 duration: "fast", // Duration of display/closure 3850 beforeShowDay: null, // Function that takes a date and returns an array with 3851 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 3852 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 3853 beforeShow: null, // Function that takes an input field and 3854 // returns a set of custom settings for the date picker 3855 onSelect: null, // Define a callback function when a date is selected 3856 onChangeMonthYear: null, // Define a callback function when the month or year is changed 3857 onClose: null, // Define a callback function when the datepicker is closed 3858 numberOfMonths: 1, // Number of months to show at a time 3859 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 3860 stepMonths: 1, // Number of months to step back/forward 3861 stepBigMonths: 12, // Number of months to step back/forward for the big links 3862 altField: "", // Selector for an alternate field to store selected dates into 3863 altFormat: "", // The date format to use for the alternate field 3864 constrainInput: true, // The input is constrained by the current date format 3865 showButtonPanel: false, // True to show button panel, false to not show it 3866 autoSize: false, // True to size the input for the date format, false to leave as is 3867 disabled: false // The initial disabled state 3868 }; 3869 $.extend(this._defaults, this.regional[""]); 3870 this.regional.en = $.extend(true, {}, this.regional[""]); 3871 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 3872 this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); 3873 } 3874 3875 $.extend(Datepicker.prototype, { 3876 /* Class name added to elements to indicate already configured with a date picker. */ 3877 markerClassName: "hasDatepicker", 3878 3879 //Keep track of the maximum number of rows displayed (see #7043) 3880 maxRows: 4, 3881 3882 // TODO rename to "widget" when switching to widget factory 3883 _widgetDatepicker: function () { 3884 return this.dpDiv; 3885 }, 3886 3887 /* Override the default settings for all instances of the date picker. 3888 * @param settings object - the new settings to use as defaults (anonymous object) 3889 * @return the manager object 3890 */ 3891 setDefaults: function (settings) { 3892 datepicker_extendRemove(this._defaults, settings || {}); 3893 return this; 3894 }, 3895 3896 /* Attach the date picker to a jQuery selection. 3897 * @param target element - the target input field or division or span 3898 * @param settings object - the new settings to use for this date picker instance (anonymous) 3899 */ 3900 _attachDatepicker: function (target, settings) { 3901 var nodeName, inline, inst; 3902 nodeName = target.nodeName.toLowerCase(); 3903 inline = (nodeName === "div" || nodeName === "span"); 3904 if (!target.id) { 3905 this.uuid += 1; 3906 target.id = "dp" + this.uuid; 3907 } 3908 inst = this._newInst($(target), inline); 3909 inst.settings = $.extend({}, settings || {}); 3910 if (nodeName === "input") { 3911 this._connectDatepicker(target, inst); 3912 } else if (inline) { 3913 this._inlineDatepicker(target, inst); 3914 } 3915 }, 3916 3917 /* Create a new instance object. */ 3918 _newInst: function (target, inline) { 3919 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 3920 return { 3921 id: id, input: target, // associated target 3922 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 3923 drawMonth: 0, drawYear: 0, // month being drawn 3924 inline: inline, // is datepicker inline or not 3925 dpDiv: (!inline ? this.dpDiv : // presentation div 3926 datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))) 3927 }; 3928 }, 3929 3930 /* Attach the date picker to an input field. */ 3931 _connectDatepicker: function (target, inst) { 3932 var input = $(target); 3933 inst.append = $([]); 3934 inst.trigger = $([]); 3935 if (input.hasClass(this.markerClassName)) { 3936 return; 3937 } 3938 this._attachments(input, inst); 3939 input.addClass(this.markerClassName).keydown(this._doKeyDown). 3940 keypress(this._doKeyPress).keyup(this._doKeyUp); 3941 this._autoSize(inst); 3942 $.data(target, "datepicker", inst); 3943 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 3944 if (inst.settings.disabled) { 3945 this._disableDatepicker(target); 3946 } 3947 }, 3948 3949 /* Make attachments based on settings. */ 3950 _attachments: function (input, inst) { 3951 var showOn, buttonText, buttonImage, 3952 appendText = this._get(inst, "appendText"), 3953 isRTL = this._get(inst, "isRTL"); 3954 3955 if (inst.append) { 3956 inst.append.remove(); 3957 } 3958 if (appendText) { 3959 inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); 3960 input[isRTL ? "before" : "after"](inst.append); 3961 } 3962 3963 input.unbind("focus", this._showDatepicker); 3964 3965 if (inst.trigger) { 3966 inst.trigger.remove(); 3967 } 3968 3969 showOn = this._get(inst, "showOn"); 3970 if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field 3971 input.focus(this._showDatepicker); 3972 } 3973 if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked 3974 buttonText = this._get(inst, "buttonText"); 3975 buttonImage = this._get(inst, "buttonImage"); 3976 inst.trigger = $(this._get(inst, "buttonImageOnly") ? 3977 $("<img/>").addClass(this._triggerClass). 3978 attr({ src: buttonImage, alt: buttonText, title: buttonText }) : 3979 $("<button type='button'></button>").addClass(this._triggerClass). 3980 html(!buttonImage ? buttonText : $("<img/>").attr( 3981 { src: buttonImage, alt: buttonText, title: buttonText }))); 3982 input[isRTL ? "before" : "after"](inst.trigger); 3983 inst.trigger.click(function () { 3984 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { 3985 $.datepicker._hideDatepicker(); 3986 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { 3987 $.datepicker._hideDatepicker(); 3988 $.datepicker._showDatepicker(input[0]); 3989 } else { 3990 $.datepicker._showDatepicker(input[0]); 3991 } 3992 return false; 3993 }); 3994 } 3995 }, 3996 3997 /* Apply the maximum length for the date format. */ 3998 _autoSize: function (inst) { 3999 if (this._get(inst, "autoSize") && !inst.inline) { 4000 var findMax, max, maxI, i, 4001 date = new Date(2009, 12 - 1, 20), // Ensure double digits 4002 dateFormat = this._get(inst, "dateFormat"); 4003 4004 if (dateFormat.match(/[DM]/)) { 4005 findMax = function (names) { 4006 max = 0; 4007 maxI = 0; 4008 for (i = 0; i < names.length; i++) { 4009 if (names[i].length > max) { 4010 max = names[i].length; 4011 maxI = i; 4012 } 4013 } 4014 return maxI; 4015 }; 4016 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 4017 "monthNames" : "monthNamesShort")))); 4018 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 4019 "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); 4020 } 4021 inst.input.attr("size", this._formatDate(inst, date).length); 4022 } 4023 }, 4024 4025 /* Attach an inline date picker to a div. */ 4026 _inlineDatepicker: function (target, inst) { 4027 var divSpan = $(target); 4028 if (divSpan.hasClass(this.markerClassName)) { 4029 return; 4030 } 4031 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 4032 $.data(target, "datepicker", inst); 4033 this._setDate(inst, this._getDefaultDate(inst), true); 4034 this._updateDatepicker(inst); 4035 this._updateAlternate(inst); 4036 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 4037 if (inst.settings.disabled) { 4038 this._disableDatepicker(target); 4039 } 4040 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 4041 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 4042 inst.dpDiv.css("display", "block"); 4043 }, 4044 4045 /* Pop-up the date picker in a "dialog" box. 4046 * @param input element - ignored 4047 * @param date string or Date - the initial date to display 4048 * @param onSelect function - the function to call when a date is selected 4049 * @param settings object - update the dialog date picker instance's settings (anonymous object) 4050 * @param pos int[2] - coordinates for the dialog's position within the screen or 4051 * event - with x/y coordinates or 4052 * leave empty for default (screen centre) 4053 * @return the manager object 4054 */ 4055 _dialogDatepicker: function (input, date, onSelect, settings, pos) { 4056 var id, browserWidth, browserHeight, scrollX, scrollY, 4057 inst = this._dialogInst; // internal instance 4058 4059 if (!inst) { 4060 this.uuid += 1; 4061 id = "dp" + this.uuid; 4062 this._dialogInput = $("<input type='text' id='" + id + 4063 "' style='position: absolute; top: -100px; width: 0px;'/>"); 4064 this._dialogInput.keydown(this._doKeyDown); 4065 $("body").append(this._dialogInput); 4066 inst = this._dialogInst = this._newInst(this._dialogInput, false); 4067 inst.settings = {}; 4068 $.data(this._dialogInput[0], "datepicker", inst); 4069 } 4070 datepicker_extendRemove(inst.settings, settings || {}); 4071 date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); 4072 this._dialogInput.val(date); 4073 4074 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 4075 if (!this._pos) { 4076 browserWidth = document.documentElement.clientWidth; 4077 browserHeight = document.documentElement.clientHeight; 4078 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 4079 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 4080 this._pos = // should use actual width/height below 4081 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 4082 } 4083 4084 // move input on screen for focus, but hidden behind dialog 4085 this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); 4086 inst.settings.onSelect = onSelect; 4087 this._inDialog = true; 4088 this.dpDiv.addClass(this._dialogClass); 4089 this._showDatepicker(this._dialogInput[0]); 4090 if ($.blockUI) { 4091 $.blockUI(this.dpDiv); 4092 } 4093 $.data(this._dialogInput[0], "datepicker", inst); 4094 return this; 4095 }, 4096 4097 /* Detach a datepicker from its control. 4098 * @param target element - the target input field or division or span 4099 */ 4100 _destroyDatepicker: function (target) { 4101 var nodeName, 4102 $target = $(target), 4103 inst = $.data(target, "datepicker"); 4104 4105 if (!$target.hasClass(this.markerClassName)) { 4106 return; 4107 } 4108 4109 nodeName = target.nodeName.toLowerCase(); 4110 $.removeData(target, "datepicker"); 4111 if (nodeName === "input") {
vendor: 7,137 bytes, lines 4112-4323
4112 inst.append.remove(); 4113 inst.trigger.remove(); 4114 $target.removeClass(this.markerClassName). 4115 unbind("focus", this._showDatepicker). 4116 unbind("keydown", this._doKeyDown). 4117 unbind("keypress", this._doKeyPress). 4118 unbind("keyup", this._doKeyUp); 4119 } else if (nodeName === "div" || nodeName === "span") { 4120 $target.removeClass(this.markerClassName).empty(); 4121 } 4122 4123 if (datepicker_instActive === inst) { 4124 datepicker_instActive = null; 4125 } 4126 }, 4127 4128 /* Enable the date picker to a jQuery selection. 4129 * @param target element - the target input field or division or span 4130 */ 4131 _enableDatepicker: function (target) { 4132 var nodeName, inline, 4133 $target = $(target), 4134 inst = $.data(target, "datepicker"); 4135 4136 if (!$target.hasClass(this.markerClassName)) { 4137 return; 4138 } 4139 4140 nodeName = target.nodeName.toLowerCase(); 4141 if (nodeName === "input") { 4142 target.disabled = false; 4143 inst.trigger.filter("button"). 4144 each(function () { this.disabled = false; }).end(). 4145 filter("img").css({ opacity: "1.0", cursor: "" }); 4146 } else if (nodeName === "div" || nodeName === "span") { 4147 inline = $target.children("." + this._inlineClass); 4148 inline.children().removeClass("ui-state-disabled"); 4149 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 4150 prop("disabled", false); 4151 } 4152 this._disabledInputs = $.map(this._disabledInputs, 4153 function (value) { return (value === target ? null : value); }); // delete entry 4154 }, 4155 4156 /* Disable the date picker to a jQuery selection. 4157 * @param target element - the target input field or division or span 4158 */ 4159 _disableDatepicker: function (target) { 4160 var nodeName, inline, 4161 $target = $(target), 4162 inst = $.data(target, "datepicker"); 4163 4164 if (!$target.hasClass(this.markerClassName)) { 4165 return; 4166 } 4167 4168 nodeName = target.nodeName.toLowerCase(); 4169 if (nodeName === "input") { 4170 target.disabled = true; 4171 inst.trigger.filter("button"). 4172 each(function () { this.disabled = true; }).end(). 4173 filter("img").css({ opacity: "0.5", cursor: "default" }); 4174 } else if (nodeName === "div" || nodeName === "span") { 4175 inline = $target.children("." + this._inlineClass); 4176 inline.children().addClass("ui-state-disabled"); 4177 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 4178 prop("disabled", true); 4179 } 4180 this._disabledInputs = $.map(this._disabledInputs, 4181 function (value) { return (value === target ? null : value); }); // delete entry 4182 this._disabledInputs[this._disabledInputs.length] = target; 4183 }, 4184 4185 /* Is the first field in a jQuery collection disabled as a datepicker? 4186 * @param target element - the target input field or division or span 4187 * @return boolean - true if disabled, false if enabled 4188 */ 4189 _isDisabledDatepicker: function (target) { 4190 if (!target) { 4191 return false; 4192 } 4193 for (var i = 0; i < this._disabledInputs.length; i++) { 4194 if (this._disabledInputs[i] === target) { 4195 return true; 4196 } 4197 } 4198 return false; 4199 }, 4200 4201 /* Retrieve the instance data for the target control. 4202 * @param target element - the target input field or division or span 4203 * @return object - the associated instance data 4204 * @throws error if a jQuery problem getting data 4205 */ 4206 _getInst: function (target) { 4207 try { 4208 return $.data(target, "datepicker"); 4209 } 4210 catch (err) { 4211 throw "Missing instance data for this datepicker"; 4212 } 4213 }, 4214 4215 /* Update or retrieve the settings for a date picker attached to an input field or division. 4216 * @param target element - the target input field or division or span 4217 * @param name object - the new settings to update or 4218 * string - the name of the setting to change or retrieve, 4219 * when retrieving also "all" for all instance settings or 4220 * "defaults" for all global defaults 4221 * @param value any - the new value for the setting 4222 * (omit if above is an object or to retrieve a value) 4223 */ 4224 _optionDatepicker: function (target, name, value) { 4225 var settings, date, minDate, maxDate, 4226 inst = this._getInst(target); 4227 4228 if (arguments.length === 2 && typeof name === "string") { 4229 return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : 4230 (inst ? (name === "all" ? $.extend({}, inst.settings) : 4231 this._get(inst, name)) : null)); 4232 } 4233 4234 settings = name || {}; 4235 if (typeof name === "string") { 4236 settings = {}; 4237 settings[name] = value; 4238 } 4239 4240 if (inst) { 4241 if (this._curInst === inst) { 4242 this._hideDatepicker(); 4243 } 4244 4245 date = this._getDateDatepicker(target, true); 4246 minDate = this._getMinMaxDate(inst, "min"); 4247 maxDate = this._getMinMaxDate(inst, "max"); 4248 datepicker_extendRemove(inst.settings, settings); 4249 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 4250 if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { 4251 inst.settings.minDate = this._formatDate(inst, minDate); 4252 } 4253 if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { 4254 inst.settings.maxDate = this._formatDate(inst, maxDate); 4255 } 4256 if ("disabled" in settings) { 4257 if (settings.disabled) { 4258 this._disableDatepicker(target); 4259 } else { 4260 this._enableDatepicker(target); 4261 } 4262 } 4263 this._attachments($(target), inst); 4264 this._autoSize(inst); 4265 this._setDate(inst, date); 4266 this._updateAlternate(inst); 4267 this._updateDatepicker(inst); 4268 } 4269 }, 4270 4271 // change method deprecated 4272 _changeDatepicker: function (target, name, value) { 4273 this._optionDatepicker(target, name, value); 4274 }, 4275 4276 /* Redraw the date picker attached to an input field or division. 4277 * @param target element - the target input field or division or span 4278 */ 4279 _refreshDatepicker: function (target) { 4280 var inst = this._getInst(target); 4281 if (inst) { 4282 this._updateDatepicker(inst); 4283 } 4284 }, 4285 4286 /* Set the dates for a jQuery selection. 4287 * @param target element - the target input field or division or span 4288 * @param date Date - the new date 4289 */ 4290 _setDateDatepicker: function (target, date) { 4291 var inst = this._getInst(target); 4292 if (inst) { 4293 this._setDate(inst, date); 4294 this._updateDatepicker(inst); 4295 this._updateAlternate(inst); 4296 } 4297 }, 4298 4299 /* Get the date(s) for the first entry in a jQuery selection. 4300 * @param target element - the target input field or division or span 4301 * @param noDefault boolean - true if no default date is to be used 4302 * @return Date - the current date 4303 */ 4304 _getDateDatepicker: function (target, noDefault) { 4305 var inst = this._getInst(target); 4306 if (inst && !inst.inline) { 4307 this._setDateFromField(inst, noDefault); 4308 } 4309 return (inst ? this._getDate(inst) : null); 4310 }, 4311 4312 /* Handle keystrokes. */ 4313 _doKeyDown: function (event) { 4314 var onSelect, dateStr, sel, 4315 inst = $.datepicker._getInst(event.target), 4316 handled = true, 4317 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 4318 4319 inst._keyEvent = true; 4320 if ($.datepicker._datepickerShowing) { 4321 switch (event.keyCode) { 4322 case 9: $.datepicker._hideDatepicker(); 4323 handled = false;
vendor: 4,545 bytes, lines 4324-4447
4324 break; // hide on tab out 4325 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + 4326 $.datepicker._currentClass + ")", inst.dpDiv); 4327 if (sel[0]) { 4328 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 4329 } 4330 4331 onSelect = $.datepicker._get(inst, "onSelect"); 4332 if (onSelect) { 4333 dateStr = $.datepicker._formatDate(inst); 4334 4335 // trigger custom callback 4336 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 4337 } else { 4338 $.datepicker._hideDatepicker(); 4339 } 4340 4341 return false; // don't submit the form 4342 case 27: $.datepicker._hideDatepicker(); 4343 break; // hide on escape 4344 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 4345 -$.datepicker._get(inst, "stepBigMonths") : 4346 -$.datepicker._get(inst, "stepMonths")), "M"); 4347 break; // previous month/year on page up/+ ctrl 4348 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 4349 +$.datepicker._get(inst, "stepBigMonths") : 4350 +$.datepicker._get(inst, "stepMonths")), "M"); 4351 break; // next month/year on page down/+ ctrl 4352 case 35: if (event.ctrlKey || event.metaKey) { 4353 $.datepicker._clearDate(event.target); 4354 } 4355 handled = event.ctrlKey || event.metaKey; 4356 break; // clear on ctrl or command +end 4357 case 36: if (event.ctrlKey || event.metaKey) { 4358 $.datepicker._gotoToday(event.target); 4359 } 4360 handled = event.ctrlKey || event.metaKey; 4361 break; // current on ctrl or command +home 4362 case 37: if (event.ctrlKey || event.metaKey) { 4363 $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); 4364 } 4365 handled = event.ctrlKey || event.metaKey; 4366 // -1 day on ctrl or command +left 4367 if (event.originalEvent.altKey) { 4368 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 4369 -$.datepicker._get(inst, "stepBigMonths") : 4370 -$.datepicker._get(inst, "stepMonths")), "M"); 4371 } 4372 // next month/year on alt +left on Mac 4373 break; 4374 case 38: if (event.ctrlKey || event.metaKey) { 4375 $.datepicker._adjustDate(event.target, -7, "D"); 4376 } 4377 handled = event.ctrlKey || event.metaKey; 4378 break; // -1 week on ctrl or command +up 4379 case 39: if (event.ctrlKey || event.metaKey) { 4380 $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); 4381 } 4382 handled = event.ctrlKey || event.metaKey; 4383 // +1 day on ctrl or command +right 4384 if (event.originalEvent.altKey) { 4385 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 4386 +$.datepicker._get(inst, "stepBigMonths") : 4387 +$.datepicker._get(inst, "stepMonths")), "M"); 4388 } 4389 // next month/year on alt +right 4390 break; 4391 case 40: if (event.ctrlKey || event.metaKey) { 4392 $.datepicker._adjustDate(event.target, +7, "D"); 4393 } 4394 handled = event.ctrlKey || event.metaKey; 4395 break; // +1 week on ctrl or command +down 4396 default: handled = false; 4397 } 4398 } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home 4399 $.datepicker._showDatepicker(this); 4400 } else { 4401 handled = false; 4402 } 4403 4404 if (handled) { 4405 event.preventDefault(); 4406 event.stopPropagation(); 4407 } 4408 }, 4409 4410 /* Filter entered characters - based on date format. */ 4411 _doKeyPress: function (event) { 4412 var chars, chr, 4413 inst = $.datepicker._getInst(event.target); 4414 4415 if ($.datepicker._get(inst, "constrainInput")) { 4416 chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); 4417 chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); 4418 return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); 4419 } 4420 }, 4421 4422 /* Synchronise manual entry and field/alternate field. */ 4423 _doKeyUp: function (event) { 4424 var date, 4425 inst = $.datepicker._getInst(event.target); 4426 4427 if (inst.input.val() !== inst.lastVal) { 4428 try { 4429 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 4430 (inst.input ? inst.input.val() : null), 4431 $.datepicker._getFormatConfig(inst)); 4432 4433 if (date) { // only if valid 4434 $.datepicker._setDateFromField(inst); 4435 $.datepicker._updateAlternate(inst); 4436 $.datepicker._updateDatepicker(inst); 4437 } 4438 } 4439 catch (err) { 4440 } 4441 } 4442 return true; 4443 }, 4444 4445 /* Pop-up the date picker for a given input field. 4446 * If false returned from beforeShow event handler do not show. 4447 * @param input element - the input field attached to the date picker or
vendor: 13,042 bytes, lines 4448-4832
4448 * event - if triggered by focus 4449 */ 4450 _showDatepicker: function (input) { 4451 input = input.target || input; 4452 if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger 4453 input = $("input", input.parentNode)[0]; 4454 } 4455 4456 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here 4457 return; 4458 } 4459 4460 var inst, beforeShow, beforeShowSettings, isFixed, 4461 offset, showAnim, duration; 4462 4463 inst = $.datepicker._getInst(input); 4464 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 4465 $.datepicker._curInst.dpDiv.stop(true, true); 4466 if (inst && $.datepicker._datepickerShowing) { 4467 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 4468 } 4469 } 4470 4471 beforeShow = $.datepicker._get(inst, "beforeShow"); 4472 beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 4473 if (beforeShowSettings === false) { 4474 return; 4475 } 4476 datepicker_extendRemove(inst.settings, beforeShowSettings); 4477 4478 inst.lastVal = null; 4479 $.datepicker._lastInput = input; 4480 $.datepicker._setDateFromField(inst); 4481 4482 if ($.datepicker._inDialog) { // hide cursor 4483 input.value = ""; 4484 } 4485 if (!$.datepicker._pos) { // position below input 4486 $.datepicker._pos = $.datepicker._findPos(input); 4487 $.datepicker._pos[1] += input.offsetHeight; // add the height 4488 } 4489 4490 isFixed = false; 4491 $(input).parents().each(function () { 4492 isFixed |= $(this).css("position") === "fixed"; 4493 return !isFixed; 4494 }); 4495 4496 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 4497 $.datepicker._pos = null; 4498 //to avoid flashes on Firefox 4499 inst.dpDiv.empty(); 4500 // determine sizing offscreen 4501 inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); 4502 $.datepicker._updateDatepicker(inst); 4503 // fix width for dynamic number of date pickers 4504 // and adjust position before showing 4505 offset = $.datepicker._checkOffset(inst, offset, isFixed); 4506 inst.dpDiv.css({ 4507 position: ($.datepicker._inDialog && $.blockUI ? 4508 "static" : (isFixed ? "fixed" : "absolute")), display: "none", 4509 left: offset.left + "px", top: offset.top + "px" 4510 }); 4511 4512 if (!inst.inline) { 4513 showAnim = $.datepicker._get(inst, "showAnim"); 4514 duration = $.datepicker._get(inst, "duration"); 4515 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 4516 $.datepicker._datepickerShowing = true; 4517 4518 if ($.effects && $.effects.effect[showAnim]) { 4519 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); 4520 } else { 4521 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 4522 } 4523 4524 if ($.datepicker._shouldFocusInput(inst)) { 4525 inst.input.focus(); 4526 } 4527 4528 $.datepicker._curInst = inst; 4529 } 4530 }, 4531 4532 /* Generate the date picker content. */ 4533 _updateDatepicker: function (inst) { 4534 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 4535 datepicker_instActive = inst; // for delegate hover events 4536 inst.dpDiv.empty().append(this._generateHTML(inst)); 4537 this._attachHandlers(inst); 4538 4539 var origyearshtml, 4540 numMonths = this._getNumberOfMonths(inst), 4541 cols = numMonths[1], 4542 width = 17, 4543 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"); 4544 4545 if (activeCell.length > 0) { 4546 datepicker_handleMouseover.apply(activeCell.get(0)); 4547 } 4548 4549 inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); 4550 if (cols > 1) { 4551 inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); 4552 } 4553 inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + 4554 "Class"]("ui-datepicker-multi"); 4555 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + 4556 "Class"]("ui-datepicker-rtl"); 4557 4558 if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) { 4559 inst.input.focus(); 4560 } 4561 4562 // deffered render of the years select (to avoid flashes on Firefox) 4563 if (inst.yearshtml) { 4564 origyearshtml = inst.yearshtml; 4565 setTimeout(function () { 4566 //assure that inst.yearshtml didn't change. 4567 if (origyearshtml === inst.yearshtml && inst.yearshtml) { 4568 inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); 4569 } 4570 origyearshtml = inst.yearshtml = null; 4571 }, 0); 4572 } 4573 }, 4574 4575 // #6694 - don't focus the input if it's already focused 4576 // this breaks the change event in IE 4577 // Support: IE and jQuery <1.9 4578 _shouldFocusInput: function (inst) { 4579 return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus"); 4580 }, 4581 4582 /* Check positioning to remain on screen. */ 4583 _checkOffset: function (inst, offset, isFixed) { 4584 var dpWidth = inst.dpDiv.outerWidth(), 4585 dpHeight = inst.dpDiv.outerHeight(), 4586 inputWidth = inst.input ? inst.input.outerWidth() : 0, 4587 inputHeight = inst.input ? inst.input.outerHeight() : 0, 4588 viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), 4589 viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 4590 4591 offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); 4592 offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; 4593 offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 4594 4595 // now check if datepicker is showing outside window viewport - move to a better place if so. 4596 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 4597 Math.abs(offset.left + dpWidth - viewWidth) : 0); 4598 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 4599 Math.abs(dpHeight + inputHeight) : 0); 4600 4601 return offset; 4602 }, 4603 4604 /* Find an object's position on the screen. */ 4605 _findPos: function (obj) { 4606 var position, 4607 inst = this._getInst(obj), 4608 isRTL = this._get(inst, "isRTL"); 4609 4610 while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { 4611 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 4612 } 4613 4614 position = $(obj).offset(); 4615 return [position.left, position.top]; 4616 }, 4617 4618 /* Hide the date picker from view. 4619 * @param input element - the input field attached to the date picker 4620 */ 4621 _hideDatepicker: function (input) { 4622 var showAnim, duration, postProcess, onClose, 4623 inst = this._curInst; 4624 4625 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 4626 return; 4627 } 4628 4629 if (this._datepickerShowing) { 4630 showAnim = this._get(inst, "showAnim"); 4631 duration = this._get(inst, "duration"); 4632 postProcess = function () { 4633 $.datepicker._tidyDialog(inst); 4634 }; 4635 4636 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 4637 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 4638 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); 4639 } else { 4640 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : 4641 (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); 4642 } 4643 4644 if (!showAnim) { 4645 postProcess(); 4646 } 4647 this._datepickerShowing = false; 4648 4649 onClose = this._get(inst, "onClose"); 4650 if (onClose) { 4651 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); 4652 } 4653 4654 this._lastInput = null; 4655 if (this._inDialog) { 4656 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); 4657 if ($.blockUI) { 4658 $.unblockUI(); 4659 $("body").append(this.dpDiv); 4660 } 4661 } 4662 this._inDialog = false; 4663 } 4664 }, 4665 4666 /* Tidy up after a dialog display. */ 4667 _tidyDialog: function (inst) { 4668 inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar"); 4669 }, 4670 4671 /* Close date picker if clicked elsewhere. */ 4672 _checkExternalClick: function (event) { 4673 if (!$.datepicker._curInst) { 4674 return; 4675 } 4676 4677 var $target = $(event.target), 4678 inst = $.datepicker._getInst($target[0]); 4679 4680 if ((($target[0].id !== $.datepicker._mainDivId && 4681 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 4682 !$target.hasClass($.datepicker.markerClassName) && 4683 !$target.closest("." + $.datepicker._triggerClass).length && 4684 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || 4685 ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) { 4686 $.datepicker._hideDatepicker(); 4687 } 4688 }, 4689 4690 /* Adjust one of the date sub-fields. */ 4691 _adjustDate: function (id, offset, period) { 4692 var target = $(id), 4693 inst = this._getInst(target[0]); 4694 4695 if (this._isDisabledDatepicker(target[0])) { 4696 return; 4697 } 4698 this._adjustInstDate(inst, offset + 4699 (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning 4700 period); 4701 this._updateDatepicker(inst); 4702 }, 4703 4704 /* Action for current link. */ 4705 _gotoToday: function (id) { 4706 var date, 4707 target = $(id), 4708 inst = this._getInst(target[0]); 4709 4710 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 4711 inst.selectedDay = inst.currentDay; 4712 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 4713 inst.drawYear = inst.selectedYear = inst.currentYear; 4714 } else { 4715 date = new Date(); 4716 inst.selectedDay = date.getDate(); 4717 inst.drawMonth = inst.selectedMonth = date.getMonth(); 4718 inst.drawYear = inst.selectedYear = date.getFullYear(); 4719 } 4720 this._notifyChange(inst); 4721 this._adjustDate(target); 4722 }, 4723 4724 /* Action for selecting a new month/year. */ 4725 _selectMonthYear: function (id, select, period) { 4726 var target = $(id), 4727 inst = this._getInst(target[0]); 4728 4729 inst["selected" + (period === "M" ? "Month" : "Year")] = 4730 inst["draw" + (period === "M" ? "Month" : "Year")] = 4731 parseInt(select.options[select.selectedIndex].value, 10); 4732 4733 this._notifyChange(inst); 4734 this._adjustDate(target); 4735 }, 4736 4737 /* Action for selecting a day. */ 4738 _selectDay: function (id, month, year, td) { 4739 var inst, 4740 target = $(id); 4741 4742 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 4743 return; 4744 } 4745 4746 inst = this._getInst(target[0]); 4747 inst.selectedDay = inst.currentDay = $("a", td).html(); 4748 inst.selectedMonth = inst.currentMonth = month; 4749 inst.selectedYear = inst.currentYear = year; 4750 this._selectDate(id, this._formatDate(inst, 4751 inst.currentDay, inst.currentMonth, inst.currentYear)); 4752 }, 4753 4754 /* Erase the input field and hide the date picker. */ 4755 _clearDate: function (id) { 4756 var target = $(id); 4757 this._selectDate(target, ""); 4758 }, 4759 4760 /* Update the input field with the selected date. */ 4761 _selectDate: function (id, dateStr) { 4762 var onSelect, 4763 target = $(id), 4764 inst = this._getInst(target[0]); 4765 4766 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 4767 if (inst.input) { 4768 inst.input.val(dateStr); 4769 } 4770 this._updateAlternate(inst); 4771 4772 onSelect = this._get(inst, "onSelect"); 4773 if (onSelect) { 4774 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 4775 } else if (inst.input) { 4776 inst.input.trigger("change"); // fire the change event 4777 } 4778 4779 if (inst.inline) { 4780 this._updateDatepicker(inst); 4781 } else { 4782 this._hideDatepicker(); 4783 this._lastInput = inst.input[0]; 4784 if (typeof (inst.input[0]) !== "object") { 4785 inst.input.focus(); // restore focus 4786 } 4787 this._lastInput = null; 4788 } 4789 }, 4790 4791 /* Update any alternate field to synchronise with the main field. */ 4792 _updateAlternate: function (inst) { 4793 var altFormat, date, dateStr, 4794 altField = this._get(inst, "altField"); 4795 4796 if (altField) { // update alternate field too 4797 altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 4798 date = this._getDate(inst); 4799 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 4800 $(altField).each(function () { $(this).val(dateStr); }); 4801 } 4802 }, 4803 4804 /* Set as beforeShowDay function to prevent selection of weekends. 4805 * @param date Date - the date to customise 4806 * @return [boolean, string] - is this date selectable?, what is its CSS class? 4807 */ 4808 noWeekends: function (date) { 4809 var day = date.getDay(); 4810 return [(day > 0 && day < 6), ""]; 4811 }, 4812 4813 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 4814 * @param date Date - the date to get the week for 4815 * @return number - the number of the week within the year that contains this date 4816 */ 4817 iso8601Week: function (date) { 4818 var time, 4819 checkDate = new Date(date.getTime()); 4820 4821 // Find Thursday of this week starting on Monday 4822 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 4823 4824 time = checkDate.getTime(); 4825 checkDate.setMonth(0); // Compare with Jan 1 4826 checkDate.setDate(1); 4827 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 4828 }, 4829 4830 /* Parse a string value into a date object. 4831 * See formatDate below for the possible formats. 4832 *
vendor: 18,044 bytes, lines 4833-5376
4833 * @param format string - the expected format of the date 4834 * @param value string - the date in the above format 4835 * @param settings Object - attributes include: 4836 * shortYearCutoff number - the cutoff year for determining the century (optional) 4837 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 4838 * dayNames string[7] - names of the days from Sunday (optional) 4839 * monthNamesShort string[12] - abbreviated names of the months (optional) 4840 * monthNames string[12] - names of the months (optional) 4841 * @return Date - the extracted date value or null if value is blank 4842 */ 4843 parseDate: function (format, value, settings) { 4844 if (format == null || value == null) { 4845 throw "Invalid arguments"; 4846 } 4847 4848 value = (typeof value === "object" ? value.toString() : value + ""); 4849 if (value === "") { 4850 return null; 4851 } 4852 4853 var iFormat, dim, extra, 4854 iValue = 0, 4855 shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, 4856 shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : 4857 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), 4858 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 4859 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 4860 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 4861 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 4862 year = -1, 4863 month = -1, 4864 day = -1, 4865 doy = -1, 4866 literal = false, 4867 date, 4868 // Check whether a format character is doubled 4869 lookAhead = function (match) { 4870 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 4871 if (matches) { 4872 iFormat++; 4873 } 4874 return matches; 4875 }, 4876 // Extract a number from the string value 4877 getNumber = function (match) { 4878 var isDoubled = lookAhead(match), 4879 size = (match === "@" ? 14 : (match === "!" ? 20 : 4880 (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), 4881 minSize = (match === "y" ? size : 1), 4882 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 4883 num = value.substring(iValue).match(digits); 4884 if (!num) { 4885 throw "Missing number at position " + iValue; 4886 } 4887 iValue += num[0].length; 4888 return parseInt(num[0], 10); 4889 }, 4890 // Extract a name from the string value and convert to an index 4891 getName = function (match, shortNames, longNames) { 4892 var index = -1, 4893 names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 4894 return [[k, v]]; 4895 }).sort(function (a, b) { 4896 return -(a[1].length - b[1].length); 4897 }); 4898 4899 $.each(names, function (i, pair) { 4900 var name = pair[1]; 4901 if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { 4902 index = pair[0]; 4903 iValue += name.length; 4904 return false; 4905 } 4906 }); 4907 if (index !== -1) { 4908 return index + 1; 4909 } else { 4910 throw "Unknown name at position " + iValue; 4911 } 4912 }, 4913 // Confirm that a literal character matches the string value 4914 checkLiteral = function () { 4915 if (value.charAt(iValue) !== format.charAt(iFormat)) { 4916 throw "Unexpected literal at position " + iValue; 4917 } 4918 iValue++; 4919 }; 4920 4921 for (iFormat = 0; iFormat < format.length; iFormat++) { 4922 if (literal) { 4923 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 4924 literal = false; 4925 } else { 4926 checkLiteral(); 4927 } 4928 } else { 4929 switch (format.charAt(iFormat)) { 4930 case "d": 4931 day = getNumber("d"); 4932 break; 4933 case "D": 4934 getName("D", dayNamesShort, dayNames); 4935 break; 4936 case "o": 4937 doy = getNumber("o"); 4938 break; 4939 case "m": 4940 month = getNumber("m"); 4941 break; 4942 case "M": 4943 month = getName("M", monthNamesShort, monthNames); 4944 break; 4945 case "y": 4946 year = getNumber("y"); 4947 break; 4948 case "@": 4949 date = new Date(getNumber("@")); 4950 year = date.getFullYear(); 4951 month = date.getMonth() + 1; 4952 day = date.getDate(); 4953 break; 4954 case "!": 4955 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 4956 year = date.getFullYear(); 4957 month = date.getMonth() + 1; 4958 day = date.getDate(); 4959 break; 4960 case "'": 4961 if (lookAhead("'")) { 4962 checkLiteral(); 4963 } else { 4964 literal = true; 4965 } 4966 break; 4967 default: 4968 checkLiteral(); 4969 } 4970 } 4971 } 4972 4973 if (iValue < value.length) { 4974 extra = value.substr(iValue); 4975 if (!/^\s+/.test(extra)) { 4976 throw "Extra/unparsed characters found in date: " + extra; 4977 } 4978 } 4979 4980 if (year === -1) { 4981 year = new Date().getFullYear(); 4982 } else if (year < 100) { 4983 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 4984 (year <= shortYearCutoff ? 0 : -100); 4985 } 4986 4987 if (doy > -1) { 4988 month = 1; 4989 day = doy; 4990 do { 4991 dim = this._getDaysInMonth(year, month - 1); 4992 if (day <= dim) { 4993 break; 4994 } 4995 month++; 4996 day -= dim; 4997 } while (true); 4998 } 4999 5000 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 5001 if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { 5002 throw "Invalid date"; // E.g. 31/02/00 5003 } 5004 return date; 5005 }, 5006 5007 /* Standard date formats. */ 5008 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 5009 COOKIE: "D, dd M yy", 5010 ISO_8601: "yy-mm-dd", 5011 RFC_822: "D, d M y", 5012 RFC_850: "DD, dd-M-y", 5013 RFC_1036: "D, d M y", 5014 RFC_1123: "D, d M yy", 5015 RFC_2822: "D, d M yy", 5016 RSS: "D, d M y", // RFC 822 5017 TICKS: "!", 5018 TIMESTAMP: "@", 5019 W3C: "yy-mm-dd", // ISO 8601 5020 5021 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 5022 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 5023 5024 /* Format a date object into a string value. 5025 * The format can be combinations of the following: 5026 * d - day of month (no leading zero) 5027 * dd - day of month (two digit) 5028 * o - day of year (no leading zeros) 5029 * oo - day of year (three digit) 5030 * D - day name short 5031 * DD - day name long 5032 * m - month of year (no leading zero) 5033 * mm - month of year (two digit) 5034 * M - month name short 5035 * MM - month name long 5036 * y - year (two digit) 5037 * yy - year (four digit) 5038 * @ - Unix timestamp (ms since 01/01/1970) 5039 * ! - Windows ticks (100ns since 01/01/0001) 5040 * "..." - literal text 5041 * '' - single quote 5042 * 5043 * @param format string - the desired format of the date 5044 * @param date Date - the date value to format 5045 * @param settings Object - attributes include: 5046 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 5047 * dayNames string[7] - names of the days from Sunday (optional) 5048 * monthNamesShort string[12] - abbreviated names of the months (optional) 5049 * monthNames string[12] - names of the months (optional) 5050 * @return string - the date in the above format 5051 */ 5052 formatDate: function (format, date, settings) { 5053 if (!date) { 5054 return ""; 5055 } 5056 5057 var iFormat, 5058 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 5059 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 5060 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 5061 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 5062 // Check whether a format character is doubled 5063 lookAhead = function (match) { 5064 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 5065 if (matches) { 5066 iFormat++; 5067 } 5068 return matches; 5069 }, 5070 // Format a number, with leading zero if necessary 5071 formatNumber = function (match, value, len) { 5072 var num = "" + value; 5073 if (lookAhead(match)) { 5074 while (num.length < len) { 5075 num = "0" + num; 5076 } 5077 } 5078 return num; 5079 }, 5080 // Format a name, short or long as requested 5081 formatName = function (match, value, shortNames, longNames) { 5082 return (lookAhead(match) ? longNames[value] : shortNames[value]); 5083 }, 5084 output = "", 5085 literal = false; 5086 5087 if (date) { 5088 for (iFormat = 0; iFormat < format.length; iFormat++) { 5089 if (literal) { 5090 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 5091 literal = false; 5092 } else { 5093 output += format.charAt(iFormat); 5094 } 5095 } else { 5096 switch (format.charAt(iFormat)) { 5097 case "d": 5098 output += formatNumber("d", date.getDate(), 2); 5099 break; 5100 case "D": 5101 output += formatName("D", date.getDay(), dayNamesShort, dayNames); 5102 break; 5103 case "o": 5104 output += formatNumber("o", 5105 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 5106 break; 5107 case "m": 5108 output += formatNumber("m", date.getMonth() + 1, 2); 5109 break; 5110 case "M": 5111 output += formatName("M", date.getMonth(), monthNamesShort, monthNames); 5112 break; 5113 case "y": 5114 output += (lookAhead("y") ? date.getFullYear() : 5115 (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100); 5116 break; 5117 case "@": 5118 output += date.getTime(); 5119 break; 5120 case "!": 5121 output += date.getTime() * 10000 + this._ticksTo1970; 5122 break; 5123 case "'": 5124 if (lookAhead("'")) { 5125 output += "'"; 5126 } else { 5127 literal = true; 5128 } 5129 break; 5130 default: 5131 output += format.charAt(iFormat); 5132 } 5133 } 5134 } 5135 } 5136 return output; 5137 }, 5138 5139 /* Extract all possible characters from the date format. */ 5140 _possibleChars: function (format) { 5141 var iFormat, 5142 chars = "", 5143 literal = false, 5144 // Check whether a format character is doubled 5145 lookAhead = function (match) { 5146 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 5147 if (matches) { 5148 iFormat++; 5149 } 5150 return matches; 5151 }; 5152 5153 for (iFormat = 0; iFormat < format.length; iFormat++) { 5154 if (literal) { 5155 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 5156 literal = false; 5157 } else { 5158 chars += format.charAt(iFormat); 5159 } 5160 } else { 5161 switch (format.charAt(iFormat)) { 5162 case "d": case "m": case "y": case "@": 5163 chars += "0123456789"; 5164 break; 5165 case "D": case "M": 5166 return null; // Accept anything 5167 case "'": 5168 if (lookAhead("'")) { 5169 chars += "'"; 5170 } else { 5171 literal = true; 5172 } 5173 break; 5174 default: 5175 chars += format.charAt(iFormat); 5176 } 5177 } 5178 } 5179 return chars; 5180 }, 5181 5182 /* Get a setting value, defaulting if necessary. */ 5183 _get: function (inst, name) { 5184 return inst.settings[name] !== undefined ? 5185 inst.settings[name] : this._defaults[name]; 5186 }, 5187 5188 /* Parse existing date and initialise date picker. */ 5189 _setDateFromField: function (inst, noDefault) { 5190 if (inst.input.val() === inst.lastVal) { 5191 return; 5192 } 5193 5194 var dateFormat = this._get(inst, "dateFormat"), 5195 dates = inst.lastVal = inst.input ? inst.input.val() : null, 5196 defaultDate = this._getDefaultDate(inst), 5197 date = defaultDate, 5198 settings = this._getFormatConfig(inst); 5199 5200 try { 5201 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 5202 } catch (event) { 5203 dates = (noDefault ? "" : dates); 5204 } 5205 inst.selectedDay = date.getDate(); 5206 inst.drawMonth = inst.selectedMonth = date.getMonth(); 5207 inst.drawYear = inst.selectedYear = date.getFullYear(); 5208 inst.currentDay = (dates ? date.getDate() : 0); 5209 inst.currentMonth = (dates ? date.getMonth() : 0); 5210 inst.currentYear = (dates ? date.getFullYear() : 0); 5211 this._adjustInstDate(inst); 5212 }, 5213 5214 /* Retrieve the default date shown on opening. */ 5215 _getDefaultDate: function (inst) { 5216 return this._restrictMinMax(inst, 5217 this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); 5218 }, 5219 5220 /* A date may be specified as an exact value or a relative one. */ 5221 _determineDate: function (inst, date, defaultDate) { 5222 var offsetNumeric = function (offset) { 5223 var date = new Date(); 5224 date.setDate(date.getDate() + offset); 5225 return date; 5226 }, 5227 offsetString = function (offset) { 5228 try { 5229 return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 5230 offset, $.datepicker._getFormatConfig(inst)); 5231 } 5232 catch (e) { 5233 // Ignore 5234 } 5235 5236 var date = (offset.toLowerCase().match(/^c/) ? 5237 $.datepicker._getDate(inst) : null) || new Date(), 5238 year = date.getFullYear(), 5239 month = date.getMonth(), 5240 day = date.getDate(), 5241 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 5242 matches = pattern.exec(offset); 5243 5244 while (matches) { 5245 switch (matches[2] || "d") { 5246 case "d": case "D": 5247 day += parseInt(matches[1], 10); break; 5248 case "w": case "W": 5249 day += parseInt(matches[1], 10) * 7; break; 5250 case "m": case "M": 5251 month += parseInt(matches[1], 10); 5252 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 5253 break; 5254 case "y": case "Y": 5255 year += parseInt(matches[1], 10); 5256 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 5257 break; 5258 } 5259 matches = pattern.exec(offset); 5260 } 5261 return new Date(year, month, day); 5262 }, 5263 newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : 5264 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 5265 5266 newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); 5267 if (newDate) { 5268 newDate.setHours(0); 5269 newDate.setMinutes(0); 5270 newDate.setSeconds(0); 5271 newDate.setMilliseconds(0); 5272 } 5273 return this._daylightSavingAdjust(newDate); 5274 }, 5275 5276 /* Handle switch to/from daylight saving. 5277 * Hours may be non-zero on daylight saving cut-over: 5278 * > 12 when midnight changeover, but then cannot generate 5279 * midnight datetime, so jump to 1AM, otherwise reset. 5280 * @param date (Date) the date to check 5281 * @return (Date) the corrected date 5282 */ 5283 _daylightSavingAdjust: function (date) { 5284 if (!date) { 5285 return null; 5286 } 5287 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 5288 return date; 5289 }, 5290 5291 /* Set the date(s) directly. */ 5292 _setDate: function (inst, date, noChange) { 5293 var clear = !date, 5294 origMonth = inst.selectedMonth, 5295 origYear = inst.selectedYear, 5296 newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 5297 5298 inst.selectedDay = inst.currentDay = newDate.getDate(); 5299 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 5300 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 5301 if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { 5302 this._notifyChange(inst); 5303 } 5304 this._adjustInstDate(inst); 5305 if (inst.input) { 5306 inst.input.val(clear ? "" : this._formatDate(inst)); 5307 } 5308 }, 5309 5310 /* Retrieve the date(s) directly. */ 5311 _getDate: function (inst) { 5312 var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : 5313 this._daylightSavingAdjust(new Date( 5314 inst.currentYear, inst.currentMonth, inst.currentDay))); 5315 return startDate; 5316 }, 5317 5318 /* Attach the onxxx handlers. These are declared statically so 5319 * they work with static code transformers like Caja. 5320 */ 5321 _attachHandlers: function (inst) { 5322 var stepMonths = this._get(inst, "stepMonths"), 5323 id = "#" + inst.id.replace(/\\\\/g, "\\"); 5324 inst.dpDiv.find("[data-handler]").map(function () { 5325 var handler = { 5326 prev: function () { 5327 $.datepicker._adjustDate(id, -stepMonths, "M"); 5328 }, 5329 next: function () { 5330 $.datepicker._adjustDate(id, +stepMonths, "M"); 5331 }, 5332 hide: function () { 5333 $.datepicker._hideDatepicker(); 5334 }, 5335 today: function () { 5336 $.datepicker._gotoToday(id); 5337 }, 5338 selectDay: function () { 5339 $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); 5340 return false; 5341 }, 5342 selectMonth: function () { 5343 $.datepicker._selectMonthYear(id, this, "M"); 5344 return false; 5345 }, 5346 selectYear: function () { 5347 $.datepicker._selectMonthYear(id, this, "Y"); 5348 return false; 5349 } 5350 }; 5351 $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); 5352 }); 5353 }, 5354 5355 /* Generate the HTML for the current state of the date picker. */ 5356 _generateHTML: function (inst) { 5357 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 5358 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 5359 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 5360 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 5361 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 5362 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 5363 tempDate = new Date(), 5364 today = this._daylightSavingAdjust( 5365 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time 5366 isRTL = this._get(inst, "isRTL"), 5367 showButtonPanel = this._get(inst, "showButtonPanel"), 5368 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 5369 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 5370 numMonths = this._getNumberOfMonths(inst), 5371 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 5372 stepMonths = this._get(inst, "stepMonths"), 5373 isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), 5374 currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 5375 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), 5376 minDate = this._getMinMaxDate(inst, "min"),
vendor: 4,142 bytes, lines 5377-5457
5377 maxDate = this._getMinMaxDate(inst, "max"), 5378 drawMonth = inst.drawMonth - showCurrentAtPos, 5379 drawYear = inst.drawYear; 5380 5381 if (drawMonth < 0) { 5382 drawMonth += 12; 5383 drawYear--; 5384 } 5385 if (maxDate) { 5386 maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 5387 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 5388 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 5389 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 5390 drawMonth--; 5391 if (drawMonth < 0) { 5392 drawMonth = 11; 5393 drawYear--; 5394 } 5395 } 5396 } 5397 inst.drawMonth = drawMonth; 5398 inst.drawYear = drawYear; 5399 5400 prevText = this._get(inst, "prevText"); 5401 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 5402 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 5403 this._getFormatConfig(inst))); 5404 5405 prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? 5406 "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + 5407 " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" : 5408 (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>")); 5409 5410 nextText = this._get(inst, "nextText"); 5411 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 5412 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 5413 this._getFormatConfig(inst))); 5414 5415 next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? 5416 "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + 5417 " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" : 5418 (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>")); 5419 5420 currentText = this._get(inst, "currentText"); 5421 gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); 5422 currentText = (!navigationAsDateFormat ? currentText : 5423 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 5424 5425 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'>" + 5426 this._get(inst, "closeText") + "</button>" : ""); 5427 5428 buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") + 5429 (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'" + 5430 ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; 5431 5432 firstDay = parseInt(this._get(inst, "firstDay"), 10); 5433 firstDay = (isNaN(firstDay) ? 0 : firstDay); 5434 5435 showWeek = this._get(inst, "showWeek"); 5436 dayNames = this._get(inst, "dayNames"); 5437 dayNamesMin = this._get(inst, "dayNamesMin"); 5438 monthNames = this._get(inst, "monthNames"); 5439 monthNamesShort = this._get(inst, "monthNamesShort"); 5440 beforeShowDay = this._get(inst, "beforeShowDay"); 5441 showOtherMonths = this._get(inst, "showOtherMonths"); 5442 selectOtherMonths = this._get(inst, "selectOtherMonths"); 5443 defaultDate = this._getDefaultDate(inst); 5444 html = ""; 5445 dow; 5446 for (row = 0; row < numMonths[0]; row++) { 5447 group = ""; 5448 this.maxRows = 4; 5449 for (col = 0; col < numMonths[1]; col++) { 5450 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 5451 cornerClass = " ui-corner-all"; 5452 calender = ""; 5453 if (isMultiMonth) { 5454 calender += "<div class='ui-datepicker-group"; 5455 if (numMonths[1] > 1) { 5456 switch (col) { 5457 case 0: calender += " ui-datepicker-group-first";
vendor: 5,151 bytes, lines 5458-5535
5458 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; 5459 case numMonths[1] - 1: calender += " ui-datepicker-group-last"; 5460 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; 5461 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 5462 } 5463 } 5464 calender += "'>"; 5465 } 5466 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 5467 (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + 5468 (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + 5469 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 5470 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 5471 "</div><table class='ui-datepicker-calendar'><thead>" + 5472 "<tr>"; 5473 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); 5474 for (dow = 0; dow < 7; dow++) { // days of the week 5475 day = (dow + firstDay) % 7; 5476 thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + 5477 "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; 5478 } 5479 calender += thead + "</tr></thead><tbody>"; 5480 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 5481 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { 5482 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 5483 } 5484 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 5485 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 5486 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 5487 this.maxRows = numRows; 5488 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 5489 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows 5490 calender += "<tr>"; 5491 tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 5492 this._get(inst, "calculateWeek")(printDate) + "</td>"); 5493 for (dow = 0; dow < 7; dow++) { // create date picker days 5494 daySettings = (beforeShowDay ? 5495 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); 5496 otherMonth = (printDate.getMonth() !== drawMonth); 5497 unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 5498 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 5499 tbody += "<td class='" + 5500 ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends 5501 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 5502 ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key 5503 (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? 5504 // or defaultDate is current printedDate and defaultDate is selectedDate 5505 " " + this._dayOverClass : "") + // highlight selected day 5506 (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days 5507 (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates 5508 (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day 5509 (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) 5510 ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title 5511 (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions 5512 (otherMonth && !showOtherMonths ? " " : // display for other months 5513 (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 5514 (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + 5515 (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day 5516 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 5517 "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date 5518 printDate.setDate(printDate.getDate() + 1); 5519 printDate = this._daylightSavingAdjust(printDate); 5520 } 5521 calender += tbody + "</tr>"; 5522 } 5523 drawMonth++; 5524 if (drawMonth > 11) { 5525 drawMonth = 0; 5526 drawYear++; 5527 } 5528 calender += "</tbody></table>" + (isMultiMonth ? "</div>" + 5529 ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); 5530 group += calender; 5531 } 5532 html += group; 5533 } 5534 html += buttonPanel; 5535 inst._keyEvent = false;
vendor: 10,518 bytes, lines 5536-5810
5536 return html; 5537 }, 5538 5539 /* Generate the month and year header. */ 5540 _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, 5541 secondary, monthNames, monthNamesShort) { 5542 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 5543 changeMonth = this._get(inst, "changeMonth"), 5544 changeYear = this._get(inst, "changeYear"), 5545 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 5546 html = "<div class='ui-datepicker-title'>", 5547 monthHtml = ""; 5548 5549 // month selection 5550 if (secondary || !changeMonth) { 5551 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; 5552 } else { 5553 inMinYear = (minDate && minDate.getFullYear() === drawYear); 5554 inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); 5555 monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; 5556 for (month = 0; month < 12; month++) { 5557 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { 5558 monthHtml += "<option value='" + month + "'" + 5559 (month === drawMonth ? " selected='selected'" : "") + 5560 ">" + monthNamesShort[month] + "</option>"; 5561 } 5562 } 5563 monthHtml += "</select>"; 5564 } 5565 5566 if (!showMonthAfterYear) { 5567 html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); 5568 } 5569 5570 // year selection 5571 if (!inst.yearshtml) { 5572 inst.yearshtml = ""; 5573 if (secondary || !changeYear) { 5574 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 5575 } else { 5576 // determine range of years to display 5577 years = this._get(inst, "yearRange").split(":"); 5578 thisYear = new Date().getFullYear(); 5579 determineYear = function (value) { 5580 var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : 5581 (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : 5582 parseInt(value, 10))); 5583 return (isNaN(year) ? thisYear : year); 5584 }; 5585 year = determineYear(years[0]); 5586 endYear = Math.max(year, determineYear(years[1] || "")); 5587 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 5588 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 5589 inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; 5590 for (; year <= endYear; year++) { 5591 inst.yearshtml += "<option value='" + year + "'" + 5592 (year === drawYear ? " selected='selected'" : "") + 5593 ">" + year + "</option>"; 5594 } 5595 inst.yearshtml += "</select>"; 5596 5597 html += inst.yearshtml; 5598 inst.yearshtml = null; 5599 } 5600 } 5601 5602 html += this._get(inst, "yearSuffix"); 5603 if (showMonthAfterYear) { 5604 html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; 5605 } 5606 html += "</div>"; // Close datepicker_header 5607 return html; 5608 }, 5609 5610 /* Adjust one of the date sub-fields. */ 5611 _adjustInstDate: function (inst, offset, period) { 5612 var year = inst.drawYear + (period === "Y" ? offset : 0), 5613 month = inst.drawMonth + (period === "M" ? offset : 0), 5614 day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), 5615 date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); 5616 5617 inst.selectedDay = date.getDate(); 5618 inst.drawMonth = inst.selectedMonth = date.getMonth(); 5619 inst.drawYear = inst.selectedYear = date.getFullYear(); 5620 if (period === "M" || period === "Y") { 5621 this._notifyChange(inst); 5622 } 5623 }, 5624 5625 /* Ensure a date is within any min/max bounds. */ 5626 _restrictMinMax: function (inst, date) { 5627 var minDate = this._getMinMaxDate(inst, "min"), 5628 maxDate = this._getMinMaxDate(inst, "max"), 5629 newDate = (minDate && date < minDate ? minDate : date); 5630 return (maxDate && newDate > maxDate ? maxDate : newDate); 5631 }, 5632 5633 /* Notify change of month/year. */ 5634 _notifyChange: function (inst) { 5635 var onChange = this._get(inst, "onChangeMonthYear"); 5636 if (onChange) { 5637 onChange.apply((inst.input ? inst.input[0] : null), 5638 [inst.selectedYear, inst.selectedMonth + 1, inst]); 5639 } 5640 }, 5641 5642 /* Determine the number of months to show. */ 5643 _getNumberOfMonths: function (inst) { 5644 var numMonths = this._get(inst, "numberOfMonths"); 5645 return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); 5646 }, 5647 5648 /* Determine the current maximum date - ensure no time components are set. */ 5649 _getMinMaxDate: function (inst, minMax) { 5650 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 5651 }, 5652 5653 /* Find the number of days in a given month. */ 5654 _getDaysInMonth: function (year, month) { 5655 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 5656 }, 5657 5658 /* Find the day of the week of the first of a month. */ 5659 _getFirstDayOfMonth: function (year, month) { 5660 return new Date(year, month, 1).getDay(); 5661 }, 5662 5663 /* Determines if we should allow a "next/prev" month display change. */ 5664 _canAdjustMonth: function (inst, offset, curYear, curMonth) { 5665 var numMonths = this._getNumberOfMonths(inst), 5666 date = this._daylightSavingAdjust(new Date(curYear, 5667 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 5668 5669 if (offset < 0) { 5670 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 5671 } 5672 return this._isInRange(inst, date); 5673 }, 5674 5675 /* Is the given date in the accepted range? */ 5676 _isInRange: function (inst, date) { 5677 var yearSplit, currentYear, 5678 minDate = this._getMinMaxDate(inst, "min"), 5679 maxDate = this._getMinMaxDate(inst, "max"), 5680 minYear = null, 5681 maxYear = null, 5682 years = this._get(inst, "yearRange"); 5683 if (years) { 5684 yearSplit = years.split(":"); 5685 currentYear = new Date().getFullYear(); 5686 minYear = parseInt(yearSplit[0], 10); 5687 maxYear = parseInt(yearSplit[1], 10); 5688 if (yearSplit[0].match(/[+\-].*/)) { 5689 minYear += currentYear; 5690 } 5691 if (yearSplit[1].match(/[+\-].*/)) { 5692 maxYear += currentYear; 5693 } 5694 } 5695 5696 return ((!minDate || date.getTime() >= minDate.getTime()) && 5697 (!maxDate || date.getTime() <= maxDate.getTime()) && 5698 (!minYear || date.getFullYear() >= minYear) && 5699 (!maxYear || date.getFullYear() <= maxYear)); 5700 }, 5701 5702 /* Provide the configuration settings for formatting/parsing. */ 5703 _getFormatConfig: function (inst) { 5704 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 5705 shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : 5706 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 5707 return { 5708 shortYearCutoff: shortYearCutoff, 5709 dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), 5710 monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames") 5711 }; 5712 }, 5713 5714 /* Format the given date for display. */ 5715 _formatDate: function (inst, day, month, year) { 5716 if (!day) { 5717 inst.currentDay = inst.selectedDay; 5718 inst.currentMonth = inst.selectedMonth; 5719 inst.currentYear = inst.selectedYear; 5720 } 5721 var date = (day ? (typeof day === "object" ? day : 5722 this._daylightSavingAdjust(new Date(year, month, day))) : 5723 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 5724 return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); 5725 } 5726 }); 5727 5728 /* 5729 * Bind hover events for datepicker elements. 5730 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 5731 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 5732 */ 5733 function datepicker_bindHover(dpDiv) { 5734 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 5735 return dpDiv.delegate(selector, "mouseout", function () { 5736 $(this).removeClass("ui-state-hover"); 5737 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 5738 $(this).removeClass("ui-datepicker-prev-hover"); 5739 } 5740 if (this.className.indexOf("ui-datepicker-next") !== -1) { 5741 $(this).removeClass("ui-datepicker-next-hover"); 5742 } 5743 }) 5744 .delegate(selector, "mouseover", datepicker_handleMouseover); 5745 } 5746 5747 function datepicker_handleMouseover() { 5748 if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { 5749 $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 5750 $(this).addClass("ui-state-hover"); 5751 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 5752 $(this).addClass("ui-datepicker-prev-hover"); 5753 } 5754 if (this.className.indexOf("ui-datepicker-next") !== -1) { 5755 $(this).addClass("ui-datepicker-next-hover"); 5756 } 5757 } 5758 } 5759 5760 /* jQuery extend now ignores nulls! */ 5761 function datepicker_extendRemove(target, props) { 5762 $.extend(target, props); 5763 for (var name in props) { 5764 if (props[name] == null) { 5765 target[name] = props[name]; 5766 } 5767 } 5768 return target; 5769 } 5770 5771 /* Invoke the datepicker functionality. 5772 @param options string - a command, optionally followed by additional parameters or 5773 Object - settings for attaching new datepicker functionality 5774 @return jQuery object */ 5775 $.fn.datepicker = function (options) { 5776 /* Verify an empty collection wasn't passed - Fixes #6976 */ 5777 if (!this.length) { 5778 return this; 5779 } 5780 5781 /* Initialise the date picker. */ 5782 if (!$.datepicker.initialized) { 5783 $(document).mousedown($.datepicker._checkExternalClick); 5784 $.datepicker.initialized = true; 5785 } 5786 5787 /* Append datepicker main container to body if not exist. */ 5788 if ($("#" + $.datepicker._mainDivId).length === 0) { 5789 $("body").append($.datepicker.dpDiv); 5790 } 5791 5792 var otherArgs = Array.prototype.slice.call(arguments, 1); 5793 if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { 5794 return $.datepicker["_" + options + "Datepicker"]. 5795 apply($.datepicker, [this[0]].concat(otherArgs)); 5796 } 5797 if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { 5798 return $.datepicker["_" + options + "Datepicker"]. 5799 apply($.datepicker, [this[0]].concat(otherArgs)); 5800 } 5801 return this.each(function () { 5802 typeof options === "string" ? 5803 $.datepicker["_" + options + "Datepicker"]. 5804 apply($.datepicker, [this].concat(otherArgs)) : 5805 $.datepicker._attachDatepicker(this, options); 5806 }); 5807 }; 5808 5809 $.datepicker = new Datepicker(); // singleton instance 5810 $.datepicker.initialized = false;
vendor: 9,638 bytes, lines 5811-6161
5811 $.datepicker.uuid = new Date().getTime(); 5812 $.datepicker.version = "1.11.4"; 5813 5814 var datepicker = $.datepicker; 5815 5816 /*! 5817 * jQuery UI Draggable 1.11.4 5818 * http://jqueryui.com 5819 * 5820 * Copyright jQuery Foundation and other contributors 5821 * Released under the MIT license. 5822 * http://jquery.org/license 5823 * 5824 * http://api.jqueryui.com/draggable/ 5825 */ 5826 5827 $.widget("ui.draggable", $.ui.mouse, { 5828 version: "1.11.4", 5829 widgetEventPrefix: "drag", 5830 options: { 5831 addClasses: true, 5832 appendTo: "parent", 5833 axis: false, 5834 connectToSortable: false, 5835 containment: false, 5836 cursor: "auto", 5837 cursorAt: false, 5838 grid: false, 5839 handle: false, 5840 helper: "original", 5841 iframeFix: false, 5842 opacity: false, 5843 refreshPositions: false, 5844 revert: false, 5845 revertDuration: 500, 5846 scope: "default", 5847 scroll: true, 5848 scrollSensitivity: 20, 5849 scrollSpeed: 20, 5850 snap: false, 5851 snapMode: "both", 5852 snapTolerance: 20, 5853 stack: false, 5854 zIndex: false, 5855 5856 // callbacks 5857 drag: null, 5858 start: null, 5859 stop: null 5860 }, 5861 _create: function () { 5862 if (this.options.helper === "original") { 5863 this._setPositionRelative(); 5864 } 5865 if (this.options.addClasses) { 5866 this.element.addClass("ui-draggable"); 5867 } 5868 if (this.options.disabled) { 5869 this.element.addClass("ui-draggable-disabled"); 5870 } 5871 this._setHandleClassName(); 5872 5873 this._mouseInit(); 5874 }, 5875 5876 _setOption: function (key, value) { 5877 this._super(key, value); 5878 if (key === "handle") { 5879 this._removeHandleClassName(); 5880 this._setHandleClassName(); 5881 } 5882 }, 5883 5884 _destroy: function () { 5885 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 5886 this.destroyOnClear = true; 5887 return; 5888 } 5889 this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"); 5890 this._removeHandleClassName(); 5891 this._mouseDestroy(); 5892 }, 5893 5894 _mouseCapture: function (event) { 5895 var o = this.options; 5896 5897 this._blurActiveElement(event); 5898 5899 // among others, prevent a drag on a resizable-handle 5900 if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { 5901 return false; 5902 } 5903 5904 //Quit if we're not on a valid handle 5905 this.handle = this._getHandle(event); 5906 if (!this.handle) { 5907 return false; 5908 } 5909 5910 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 5911 5912 return true; 5913 }, 5914 5915 _blockFrames: function (selector) { 5916 this.iframeBlocks = this.document.find(selector).map(function () { 5917 var iframe = $(this); 5918 5919 return $("<div>") 5920 .css("position", "absolute") 5921 .appendTo(iframe.parent()) 5922 .outerWidth(iframe.outerWidth()) 5923 .outerHeight(iframe.outerHeight()) 5924 .offset(iframe.offset())[0]; 5925 }); 5926 }, 5927 5928 _unblockFrames: function () { 5929 if (this.iframeBlocks) { 5930 this.iframeBlocks.remove(); 5931 delete this.iframeBlocks; 5932 } 5933 }, 5934 5935 _blurActiveElement: function (event) { 5936 var document = this.document[0]; 5937 5938 // Only need to blur if the event occurred on the draggable itself, see #10527 5939 if (!this.handleElement.is(event.target)) { 5940 return; 5941 } 5942 5943 // support: IE9 5944 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 5945 try { 5946 // Support: IE9, IE10 5947 // If the <body> is blurred, IE will switch windows, see #9520 5948 if (document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body") { 5949 // Blur any element that currently has focus, see #4261 5950 $(document.activeElement).blur(); 5951 } 5952 } catch (error) { } 5953 }, 5954 5955 _mouseStart: function (event) { 5956 var o = this.options; 5957 5958 //Create and append the visible helper 5959 this.helper = this._createHelper(event); 5960 5961 this.helper.addClass("ui-draggable-dragging"); 5962 5963 //Cache the helper size 5964 this._cacheHelperProportions(); 5965 5966 //If ddmanager is used for droppables, set the global draggable 5967 if ($.ui.ddmanager) { 5968 $.ui.ddmanager.current = this; 5969 } 5970 5971 /* 5972 * - Position generation - 5973 * This block generates everything position related - it's the core of draggables. 5974 */ 5975 5976 //Cache the margins of the original element 5977 this._cacheMargins(); 5978 5979 //Store the helper's css position 5980 this.cssPosition = this.helper.css("position"); 5981 this.scrollParent = this.helper.scrollParent(true); 5982 this.offsetParent = this.helper.offsetParent(); 5983 this.hasFixedAncestor = this.helper.parents().filter(function () { 5984 return $(this).css("position") === "fixed"; 5985 }).length > 0; 5986 5987 //The element's absolute position on the page minus margins 5988 this.positionAbs = this.element.offset(); 5989 this._refreshOffsets(event); 5990 5991 //Generate the original position 5992 this.originalPosition = this.position = this._generatePosition(event, false); 5993 this.originalPageX = event.pageX; 5994 this.originalPageY = event.pageY; 5995 5996 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 5997 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 5998 5999 //Set a containment if given in the options 6000 this._setContainment(); 6001 6002 //Trigger event + callbacks 6003 if (this._trigger("start", event) === false) { 6004 this._clear(); 6005 return false; 6006 } 6007 6008 //Recache the helper size 6009 this._cacheHelperProportions(); 6010 6011 //Prepare the droppable offsets 6012 if ($.ui.ddmanager && !o.dropBehaviour) { 6013 $.ui.ddmanager.prepareOffsets(this, event); 6014 } 6015 6016 // Reset helper's right/bottom css if they're set and set explicit width/height instead 6017 // as this prevents resizing of elements with right/bottom set (see #7772) 6018 this._normalizeRightBottom(); 6019 6020 this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position 6021 6022 //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) 6023 if ($.ui.ddmanager) { 6024 $.ui.ddmanager.dragStart(this, event); 6025 } 6026 6027 return true; 6028 }, 6029 6030 _refreshOffsets: function (event) { 6031 this.offset = { 6032 top: this.positionAbs.top - this.margins.top, 6033 left: this.positionAbs.left - this.margins.left, 6034 scroll: false, 6035 parent: this._getParentOffset(), 6036 relative: this._getRelativeOffset() 6037 }; 6038 6039 this.offset.click = { 6040 left: event.pageX - this.offset.left, 6041 top: event.pageY - this.offset.top 6042 }; 6043 }, 6044 6045 _mouseDrag: function (event, noPropagation) { 6046 // reset any necessary cached properties (see #5009) 6047 if (this.hasFixedAncestor) { 6048 this.offset.parent = this._getParentOffset(); 6049 } 6050 6051 //Compute the helpers position 6052 this.position = this._generatePosition(event, true); 6053 this.positionAbs = this._convertPositionTo("absolute"); 6054 6055 //Call plugins and callbacks and use the resulting position if something is returned 6056 if (!noPropagation) { 6057 var ui = this._uiHash(); 6058 if (this._trigger("drag", event, ui) === false) { 6059 this._mouseUp({}); 6060 return false; 6061 } 6062 this.position = ui.position; 6063 } 6064 6065 this.helper[0].style.left = this.position.left + "px"; 6066 this.helper[0].style.top = this.position.top + "px"; 6067 6068 if ($.ui.ddmanager) { 6069 $.ui.ddmanager.drag(this, event); 6070 } 6071 6072 return false; 6073 }, 6074 6075 _mouseStop: function (event) { 6076 //If we are using droppables, inform the manager about the drop 6077 var that = this, 6078 dropped = false; 6079 if ($.ui.ddmanager && !this.options.dropBehaviour) { 6080 dropped = $.ui.ddmanager.drop(this, event); 6081 } 6082 6083 //if a drop comes from outside (a sortable) 6084 if (this.dropped) { 6085 dropped = this.dropped; 6086 this.dropped = false; 6087 } 6088 6089 if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { 6090 $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function () { 6091 if (that._trigger("stop", event) !== false) { 6092 that._clear(); 6093 } 6094 }); 6095 } else { 6096 if (this._trigger("stop", event) !== false) { 6097 this._clear(); 6098 } 6099 } 6100 6101 return false; 6102 }, 6103 6104 _mouseUp: function (event) { 6105 this._unblockFrames(); 6106 6107 //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) 6108 if ($.ui.ddmanager) { 6109 $.ui.ddmanager.dragStop(this, event); 6110 } 6111 6112 // Only need to focus if the event occurred on the draggable itself, see #10527 6113 if (this.handleElement.is(event.target)) { 6114 // The interaction is over; whether or not the click resulted in a drag, focus the element 6115 this.element.focus(); 6116 } 6117 6118 return $.ui.mouse.prototype._mouseUp.call(this, event); 6119 }, 6120 6121 cancel: function () { 6122 if (this.helper.is(".ui-draggable-dragging")) { 6123 this._mouseUp({}); 6124 } else { 6125 this._clear(); 6126 } 6127 6128 return this; 6129 }, 6130 6131 _getHandle: function (event) { 6132 return this.options.handle ? 6133 !!$(event.target).closest(this.element.find(this.options.handle)).length : 6134 true; 6135 }, 6136 6137 _setHandleClassName: function () { 6138 this.handleElement = this.options.handle ? 6139 this.element.find(this.options.handle) : this.element; 6140 this.handleElement.addClass("ui-draggable-handle"); 6141 }, 6142 6143 _removeHandleClassName: function () { 6144 this.handleElement.removeClass("ui-draggable-handle"); 6145 }, 6146 6147 _createHelper: function (event) { 6148 var o = this.options, 6149 helperIsFunction = $.isFunction(o.helper), 6150 helper = helperIsFunction ? 6151 $(o.helper.apply(this.element[0], [event])) : 6152 (o.helper === "clone" ? 6153 this.element.clone().removeAttr("id") : 6154 this.element); 6155 6156 if (!helper.parents("body").length) { 6157 helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo)); 6158 } 6159 6160 // http://bugs.jqueryui.com/ticket/9446 6161 // a helper function can return the original element
vendor: 4,378 bytes, lines 6162-6291
6162 // which wouldn't have been set to relative in _create 6163 if (helperIsFunction && helper[0] === this.element[0]) { 6164 this._setPositionRelative(); 6165 } 6166 6167 if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) { 6168 helper.css("position", "absolute"); 6169 } 6170 6171 return helper; 6172 }, 6173 6174 _setPositionRelative: function () { 6175 if (!(/^(?:r|a|f)/).test(this.element.css("position"))) { 6176 this.element[0].style.position = "relative"; 6177 } 6178 }, 6179 6180 _adjustOffsetFromHelper: function (obj) { 6181 if (typeof obj === "string") { 6182 obj = obj.split(" "); 6183 } 6184 if ($.isArray(obj)) { 6185 obj = { left: +obj[0], top: +obj[1] || 0 }; 6186 } 6187 if ("left" in obj) { 6188 this.offset.click.left = obj.left + this.margins.left; 6189 } 6190 if ("right" in obj) { 6191 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 6192 } 6193 if ("top" in obj) { 6194 this.offset.click.top = obj.top + this.margins.top; 6195 } 6196 if ("bottom" in obj) { 6197 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 6198 } 6199 }, 6200 6201 _isRootNode: function (element) { 6202 return (/(html|body)/i).test(element.tagName) || element === this.document[0]; 6203 }, 6204 6205 _getParentOffset: function () { 6206 //Get the offsetParent and cache its position 6207 var po = this.offsetParent.offset(), 6208 document = this.document[0]; 6209 6210 // This is a special case where we need to modify a offset calculated on start, since the following happened: 6211 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 6212 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 6213 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 6214 if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { 6215 po.left += this.scrollParent.scrollLeft(); 6216 po.top += this.scrollParent.scrollTop(); 6217 } 6218 6219 if (this._isRootNode(this.offsetParent[0])) { 6220 po = { top: 0, left: 0 }; 6221 } 6222 6223 return { 6224 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 6225 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 6226 }; 6227 }, 6228 6229 _getRelativeOffset: function () { 6230 if (this.cssPosition !== "relative") { 6231 return { top: 0, left: 0 }; 6232 } 6233 6234 var p = this.element.position(), 6235 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 6236 6237 return { 6238 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 6239 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) 6240 }; 6241 }, 6242 6243 _cacheMargins: function () { 6244 this.margins = { 6245 left: (parseInt(this.element.css("marginLeft"), 10) || 0), 6246 top: (parseInt(this.element.css("marginTop"), 10) || 0), 6247 right: (parseInt(this.element.css("marginRight"), 10) || 0), 6248 bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) 6249 }; 6250 }, 6251 6252 _cacheHelperProportions: function () { 6253 this.helperProportions = { 6254 width: this.helper.outerWidth(), 6255 height: this.helper.outerHeight() 6256 }; 6257 }, 6258 6259 _setContainment: function () { 6260 var isUserScrollable, c, ce, 6261 o = this.options, 6262 document = this.document[0]; 6263 6264 this.relativeContainer = null; 6265 6266 if (!o.containment) { 6267 this.containment = null; 6268 return; 6269 } 6270 6271 if (o.containment === "window") { 6272 this.containment = [ 6273 $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 6274 $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 6275 $(window).scrollLeft() + $(window).width() - this.helperProportions.width - this.margins.left, 6276 $(window).scrollTop() + ($(window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 6277 ]; 6278 return; 6279 } 6280 6281 if (o.containment === "document") { 6282 this.containment = [ 6283 0, 6284 0, 6285 $(document).width() - this.helperProportions.width - this.margins.left, 6286 ($(document).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 6287 ]; 6288 return; 6289 } 6290 6291 if (o.containment.constructor === Array) {
vendor: 10,094 bytes, lines 6292-6570
6292 this.containment = o.containment; 6293 return; 6294 } 6295 6296 if (o.containment === "parent") { 6297 o.containment = this.helper[0].parentNode; 6298 } 6299 6300 c = $(o.containment); 6301 ce = c[0]; 6302 6303 if (!ce) { 6304 return; 6305 } 6306 6307 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 6308 6309 this.containment = [ 6310 (parseInt(c.css("borderLeftWidth"), 10) || 0) + (parseInt(c.css("paddingLeft"), 10) || 0), 6311 (parseInt(c.css("borderTopWidth"), 10) || 0) + (parseInt(c.css("paddingTop"), 10) || 0), 6312 (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 6313 (parseInt(c.css("borderRightWidth"), 10) || 0) - 6314 (parseInt(c.css("paddingRight"), 10) || 0) - 6315 this.helperProportions.width - 6316 this.margins.left - 6317 this.margins.right, 6318 (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 6319 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 6320 (parseInt(c.css("paddingBottom"), 10) || 0) - 6321 this.helperProportions.height - 6322 this.margins.top - 6323 this.margins.bottom 6324 ]; 6325 this.relativeContainer = c; 6326 }, 6327 6328 _convertPositionTo: function (d, pos) { 6329 if (!pos) { 6330 pos = this.position; 6331 } 6332 6333 var mod = d === "absolute" ? 1 : -1, 6334 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 6335 6336 return { 6337 top: ( 6338 pos.top + // The absolute mouse position 6339 this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent 6340 this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) 6341 ((this.cssPosition === "fixed" ? -this.offset.scroll.top : (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod) 6342 ), 6343 left: ( 6344 pos.left + // The absolute mouse position 6345 this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent 6346 this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) 6347 ((this.cssPosition === "fixed" ? -this.offset.scroll.left : (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod) 6348 ) 6349 }; 6350 }, 6351 6352 _generatePosition: function (event, constrainPosition) { 6353 var containment, co, top, left, 6354 o = this.options, 6355 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 6356 pageX = event.pageX, 6357 pageY = event.pageY; 6358 6359 // Cache the scroll 6360 if (!scrollIsRootNode || !this.offset.scroll) { 6361 this.offset.scroll = { 6362 top: this.scrollParent.scrollTop(), 6363 left: this.scrollParent.scrollLeft() 6364 }; 6365 } 6366 6367 /* 6368 * - Position constraining - 6369 * Constrain the position to a mix of grid, containment. 6370 */ 6371 6372 // If we are not dragging yet, we won't check for options 6373 if (constrainPosition) { 6374 if (this.containment) { 6375 if (this.relativeContainer) { 6376 co = this.relativeContainer.offset(); 6377 containment = [ 6378 this.containment[0] + co.left, 6379 this.containment[1] + co.top, 6380 this.containment[2] + co.left, 6381 this.containment[3] + co.top 6382 ]; 6383 } else { 6384 containment = this.containment; 6385 } 6386 6387 if (event.pageX - this.offset.click.left < containment[0]) { 6388 pageX = containment[0] + this.offset.click.left; 6389 } 6390 if (event.pageY - this.offset.click.top < containment[1]) { 6391 pageY = containment[1] + this.offset.click.top; 6392 } 6393 if (event.pageX - this.offset.click.left > containment[2]) { 6394 pageX = containment[2] + this.offset.click.left; 6395 } 6396 if (event.pageY - this.offset.click.top > containment[3]) { 6397 pageY = containment[3] + this.offset.click.top; 6398 } 6399 } 6400 6401 if (o.grid) { 6402 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) 6403 top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 6404 pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; 6405 6406 left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; 6407 pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; 6408 } 6409 6410 if (o.axis === "y") { 6411 pageX = this.originalPageX; 6412 } 6413 6414 if (o.axis === "x") { 6415 pageY = this.originalPageY; 6416 } 6417 } 6418 6419 return { 6420 top: ( 6421 pageY - // The absolute mouse position 6422 this.offset.click.top - // Click offset (relative to the element) 6423 this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent 6424 this.offset.parent.top + // The offsetParent's offset without borders (offset + border) 6425 (this.cssPosition === "fixed" ? -this.offset.scroll.top : (scrollIsRootNode ? 0 : this.offset.scroll.top)) 6426 ), 6427 left: ( 6428 pageX - // The absolute mouse position 6429 this.offset.click.left - // Click offset (relative to the element) 6430 this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent 6431 this.offset.parent.left + // The offsetParent's offset without borders (offset + border) 6432 (this.cssPosition === "fixed" ? -this.offset.scroll.left : (scrollIsRootNode ? 0 : this.offset.scroll.left)) 6433 ) 6434 }; 6435 }, 6436 6437 _clear: function () { 6438 this.helper.removeClass("ui-draggable-dragging"); 6439 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 6440 this.helper.remove(); 6441 } 6442 this.helper = null; 6443 this.cancelHelperRemoval = false; 6444 if (this.destroyOnClear) { 6445 this.destroy(); 6446 } 6447 }, 6448 6449 _normalizeRightBottom: function () { 6450 if (this.options.axis !== "y" && this.helper.css("right") !== "auto") { 6451 this.helper.width(this.helper.width()); 6452 this.helper.css("right", "auto"); 6453 } 6454 if (this.options.axis !== "x" && this.helper.css("bottom") !== "auto") { 6455 this.helper.height(this.helper.height()); 6456 this.helper.css("bottom", "auto"); 6457 } 6458 }, 6459 6460 // From now on bulk stuff - mainly helpers 6461 6462 _trigger: function (type, event, ui) { 6463 ui = ui || this._uiHash(); 6464 $.ui.plugin.call(this, type, [event, ui, this], true); 6465 6466 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 6467 if (/^(drag|start|stop)/.test(type)) { 6468 this.positionAbs = this._convertPositionTo("absolute"); 6469 ui.offset = this.positionAbs; 6470 } 6471 return $.Widget.prototype._trigger.call(this, type, event, ui); 6472 }, 6473 6474 plugins: {}, 6475 6476 _uiHash: function () { 6477 return { 6478 helper: this.helper, 6479 position: this.position, 6480 originalPosition: this.originalPosition, 6481 offset: this.positionAbs 6482 }; 6483 } 6484 }); 6485 6486 $.ui.plugin.add("draggable", "connectToSortable", { 6487 start: function (event, ui, draggable) { 6488 var uiSortable = $.extend({}, ui, { 6489 item: draggable.element 6490 }); 6491 6492 draggable.sortables = []; 6493 $(draggable.options.connectToSortable).each(function () { 6494 var sortable = $(this).sortable("instance"); 6495 6496 if (sortable && !sortable.options.disabled) { 6497 draggable.sortables.push(sortable); 6498 6499 // refreshPositions is called at drag start to refresh the containerCache 6500 // which is used in drag. This ensures it's initialized and synchronized 6501 // with any changes that might have happened on the page since initialization. 6502 sortable.refreshPositions(); 6503 sortable._trigger("activate", event, uiSortable); 6504 } 6505 }); 6506 }, 6507 stop: function (event, ui, draggable) { 6508 var uiSortable = $.extend({}, ui, { 6509 item: draggable.element 6510 }); 6511 6512 draggable.cancelHelperRemoval = false; 6513 6514 $.each(draggable.sortables, function () { 6515 var sortable = this; 6516 6517 if (sortable.isOver) { 6518 sortable.isOver = 0; 6519 6520 // Allow this sortable to handle removing the helper 6521 draggable.cancelHelperRemoval = true; 6522 sortable.cancelHelperRemoval = false; 6523 6524 // Use _storedCSS To restore properties in the sortable, 6525 // as this also handles revert (#9675) since the draggable 6526 // may have modified them in unexpected ways (#8809) 6527 sortable._storedCSS = { 6528 position: sortable.placeholder.css("position"), 6529 top: sortable.placeholder.css("top"), 6530 left: sortable.placeholder.css("left") 6531 }; 6532 6533 sortable._mouseStop(event); 6534 6535 // Once drag has ended, the sortable should return to using 6536 // its original helper, not the shared helper from draggable 6537 sortable.options.helper = sortable.options._helper; 6538 } else { 6539 // Prevent this Sortable from removing the helper. 6540 // However, don't set the draggable to remove the helper 6541 // either as another connected Sortable may yet handle the removal. 6542 sortable.cancelHelperRemoval = true; 6543 6544 sortable._trigger("deactivate", event, uiSortable); 6545 } 6546 }); 6547 }, 6548 drag: function (event, ui, draggable) { 6549 $.each(draggable.sortables, function () { 6550 var innermostIntersecting = false, 6551 sortable = this; 6552 6553 // Copy over variables that sortable's _intersectsWith uses 6554 sortable.positionAbs = draggable.positionAbs; 6555 sortable.helperProportions = draggable.helperProportions; 6556 sortable.offset.click = draggable.offset.click; 6557 6558 if (sortable._intersectsWith(sortable.containerCache)) { 6559 innermostIntersecting = true; 6560 6561 $.each(draggable.sortables, function () { 6562 // Copy over variables that sortable's _intersectsWith uses 6563 this.positionAbs = draggable.positionAbs; 6564 this.helperProportions = draggable.helperProportions; 6565 this.offset.click = draggable.offset.click; 6566 6567 if (this !== sortable && 6568 this._intersectsWith(this.containerCache) && 6569 $.contains(sortable.element[0], this.element[0])) { 6570 innermostIntersecting = false;
vendor: 7,275 bytes, lines 6571-6779
6571 } 6572 6573 return innermostIntersecting; 6574 }); 6575 } 6576 6577 if (innermostIntersecting) { 6578 // If it intersects, we use a little isOver variable and set it once, 6579 // so that the move-in stuff gets fired only once. 6580 if (!sortable.isOver) { 6581 sortable.isOver = 1; 6582 6583 // Store draggable's parent in case we need to reappend to it later. 6584 draggable._parent = ui.helper.parent(); 6585 6586 sortable.currentItem = ui.helper 6587 .appendTo(sortable.element) 6588 .data("ui-sortable-item", true); 6589 6590 // Store helper option to later restore it 6591 sortable.options._helper = sortable.options.helper; 6592 6593 sortable.options.helper = function () { 6594 return ui.helper[0]; 6595 }; 6596 6597 // Fire the start events of the sortable with our passed browser event, 6598 // and our own helper (so it doesn't create a new one) 6599 event.target = sortable.currentItem[0]; 6600 sortable._mouseCapture(event, true); 6601 sortable._mouseStart(event, true, true); 6602 6603 // Because the browser event is way off the new appended portlet, 6604 // modify necessary variables to reflect the changes 6605 sortable.offset.click.top = draggable.offset.click.top; 6606 sortable.offset.click.left = draggable.offset.click.left; 6607 sortable.offset.parent.left -= draggable.offset.parent.left - 6608 sortable.offset.parent.left; 6609 sortable.offset.parent.top -= draggable.offset.parent.top - 6610 sortable.offset.parent.top; 6611 6612 draggable._trigger("toSortable", event); 6613 6614 // Inform draggable that the helper is in a valid drop zone, 6615 // used solely in the revert option to handle "valid/invalid". 6616 draggable.dropped = sortable.element; 6617 6618 // Need to refreshPositions of all sortables in the case that 6619 // adding to one sortable changes the location of the other sortables (#9675) 6620 $.each(draggable.sortables, function () { 6621 this.refreshPositions(); 6622 }); 6623 6624 // hack so receive/update callbacks work (mostly) 6625 draggable.currentItem = draggable.element; 6626 sortable.fromOutside = draggable; 6627 } 6628 6629 if (sortable.currentItem) { 6630 sortable._mouseDrag(event); 6631 // Copy the sortable's position because the draggable's can potentially reflect 6632 // a relative position, while sortable is always absolute, which the dragged 6633 // element has now become. (#8809) 6634 ui.position = sortable.position; 6635 } 6636 } else { 6637 // If it doesn't intersect with the sortable, and it intersected before, 6638 // we fake the drag stop of the sortable, but make sure it doesn't remove 6639 // the helper by using cancelHelperRemoval. 6640 if (sortable.isOver) { 6641 sortable.isOver = 0; 6642 sortable.cancelHelperRemoval = true; 6643 6644 // Calling sortable's mouseStop would trigger a revert, 6645 // so revert must be temporarily false until after mouseStop is called. 6646 sortable.options._revert = sortable.options.revert; 6647 sortable.options.revert = false; 6648 6649 sortable._trigger("out", event, sortable._uiHash(sortable)); 6650 sortable._mouseStop(event, true); 6651 6652 // restore sortable behaviors that were modfied 6653 // when the draggable entered the sortable area (#9481) 6654 sortable.options.revert = sortable.options._revert; 6655 sortable.options.helper = sortable.options._helper; 6656 6657 if (sortable.placeholder) { 6658 sortable.placeholder.remove(); 6659 } 6660 6661 // Restore and recalculate the draggable's offset considering the sortable 6662 // may have modified them in unexpected ways. (#8809, #10669) 6663 ui.helper.appendTo(draggable._parent); 6664 draggable._refreshOffsets(event); 6665 ui.position = draggable._generatePosition(event, true); 6666 6667 draggable._trigger("fromSortable", event); 6668 6669 // Inform draggable that the helper is no longer in a valid drop zone 6670 draggable.dropped = false; 6671 6672 // Need to refreshPositions of all sortables just in case removing 6673 // from one sortable changes the location of other sortables (#9675) 6674 $.each(draggable.sortables, function () { 6675 this.refreshPositions(); 6676 }); 6677 } 6678 } 6679 }); 6680 } 6681 }); 6682 6683 $.ui.plugin.add("draggable", "cursor", { 6684 start: function (event, ui, instance) { 6685 var t = $("body"), 6686 o = instance.options; 6687 6688 if (t.css("cursor")) { 6689 o._cursor = t.css("cursor"); 6690 } 6691 t.css("cursor", o.cursor); 6692 }, 6693 stop: function (event, ui, instance) { 6694 var o = instance.options; 6695 if (o._cursor) { 6696 $("body").css("cursor", o._cursor); 6697 } 6698 } 6699 }); 6700 6701 $.ui.plugin.add("draggable", "opacity", { 6702 start: function (event, ui, instance) { 6703 var t = $(ui.helper), 6704 o = instance.options; 6705 if (t.css("opacity")) { 6706 o._opacity = t.css("opacity"); 6707 } 6708 t.css("opacity", o.opacity); 6709 }, 6710 stop: function (event, ui, instance) { 6711 var o = instance.options; 6712 if (o._opacity) { 6713 $(ui.helper).css("opacity", o._opacity); 6714 } 6715 } 6716 }); 6717 6718 $.ui.plugin.add("draggable", "scroll", { 6719 start: function (event, ui, i) { 6720 if (!i.scrollParentNotHidden) { 6721 i.scrollParentNotHidden = i.helper.scrollParent(false); 6722 } 6723 6724 if (i.scrollParentNotHidden[0] !== i.document[0] && i.scrollParentNotHidden[0].tagName !== "HTML") { 6725 i.overflowOffset = i.scrollParentNotHidden.offset(); 6726 } 6727 }, 6728 drag: function (event, ui, i) { 6729 var o = i.options, 6730 scrolled = false, 6731 scrollParent = i.scrollParentNotHidden[0], 6732 document = i.document[0]; 6733 6734 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 6735 if (!o.axis || o.axis !== "x") { 6736 if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < o.scrollSensitivity) { 6737 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 6738 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 6739 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 6740 } 6741 } 6742 6743 if (!o.axis || o.axis !== "y") { 6744 if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < o.scrollSensitivity) { 6745 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 6746 } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 6747 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 6748 } 6749 } 6750 } else { 6751 if (!o.axis || o.axis !== "x") { 6752 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 6753 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 6754 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { 6755 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 6756 } 6757 } 6758 6759 if (!o.axis || o.axis !== "y") { 6760 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 6761 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 6762 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { 6763 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 6764 } 6765 } 6766 } 6767 6768 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 6769 $.ui.ddmanager.prepareOffsets(i, event); 6770 } 6771 } 6772 }); 6773 6774 $.ui.plugin.add("draggable", "snap", { 6775 start: function (event, ui, i) { 6776 var o = i.options; 6777 6778 i.snapElements = []; 6779
vendor: 11,060 bytes, lines 6780-7177
6780 $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap).each(function () { 6781 var $t = $(this), 6782 $o = $t.offset(); 6783 if (this !== i.element[0]) { 6784 i.snapElements.push({ 6785 item: this, 6786 width: $t.outerWidth(), height: $t.outerHeight(), 6787 top: $o.top, left: $o.left 6788 }); 6789 } 6790 }); 6791 }, 6792 drag: function (event, ui, inst) { 6793 var ts, bs, ls, rs, l, r, t, b, i, first, 6794 o = inst.options, 6795 d = o.snapTolerance, 6796 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 6797 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 6798 6799 for (i = inst.snapElements.length - 1; i >= 0; i--) { 6800 l = inst.snapElements[i].left - inst.margins.left; 6801 r = l + inst.snapElements[i].width; 6802 t = inst.snapElements[i].top - inst.margins.top; 6803 b = t + inst.snapElements[i].height; 6804 6805 if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains(inst.snapElements[i].item.ownerDocument, inst.snapElements[i].item)) { 6806 if (inst.snapElements[i].snapping) { 6807 (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 6808 } 6809 inst.snapElements[i].snapping = false; 6810 continue; 6811 } 6812 6813 if (o.snapMode !== "inner") { 6814 ts = Math.abs(t - y2) <= d; 6815 bs = Math.abs(b - y1) <= d; 6816 ls = Math.abs(l - x2) <= d; 6817 rs = Math.abs(r - x1) <= d; 6818 if (ts) { 6819 ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top; 6820 } 6821 if (bs) { 6822 ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top; 6823 } 6824 if (ls) { 6825 ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left; 6826 } 6827 if (rs) { 6828 ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left; 6829 } 6830 } 6831 6832 first = (ts || bs || ls || rs); 6833 6834 if (o.snapMode !== "outer") { 6835 ts = Math.abs(t - y1) <= d; 6836 bs = Math.abs(b - y2) <= d; 6837 ls = Math.abs(l - x1) <= d; 6838 rs = Math.abs(r - x2) <= d; 6839 if (ts) { 6840 ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top; 6841 } 6842 if (bs) { 6843 ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top; 6844 } 6845 if (ls) { 6846 ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left; 6847 } 6848 if (rs) { 6849 ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left; 6850 } 6851 } 6852 6853 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 6854 (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 6855 } 6856 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 6857 } 6858 } 6859 }); 6860 6861 $.ui.plugin.add("draggable", "stack", { 6862 start: function (event, ui, instance) { 6863 var min, 6864 o = instance.options, 6865 group = $.makeArray($(o.stack)).sort(function (a, b) { 6866 return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0); 6867 }); 6868 6869 if (!group.length) { return; } 6870 6871 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 6872 $(group).each(function (i) { 6873 $(this).css("zIndex", min + i); 6874 }); 6875 this.css("zIndex", (min + group.length)); 6876 } 6877 }); 6878 6879 $.ui.plugin.add("draggable", "zIndex", { 6880 start: function (event, ui, instance) { 6881 var t = $(ui.helper), 6882 o = instance.options; 6883 6884 if (t.css("zIndex")) { 6885 o._zIndex = t.css("zIndex"); 6886 } 6887 t.css("zIndex", o.zIndex); 6888 }, 6889 stop: function (event, ui, instance) { 6890 var o = instance.options; 6891 6892 if (o._zIndex) { 6893 $(ui.helper).css("zIndex", o._zIndex); 6894 } 6895 } 6896 }); 6897 6898 var draggable = $.ui.draggable; 6899 6900 /*! 6901 * jQuery UI Resizable 1.11.4 6902 * http://jqueryui.com 6903 * 6904 * Copyright jQuery Foundation and other contributors 6905 * Released under the MIT license. 6906 * http://jquery.org/license 6907 * 6908 * http://api.jqueryui.com/resizable/ 6909 */ 6910 6911 $.widget("ui.resizable", $.ui.mouse, { 6912 version: "1.11.4", 6913 widgetEventPrefix: "resize", 6914 options: { 6915 alsoResize: false, 6916 animate: false, 6917 animateDuration: "slow", 6918 animateEasing: "swing", 6919 aspectRatio: false, 6920 autoHide: false, 6921 containment: false, 6922 ghost: false, 6923 grid: false, 6924 handles: "e,s,se", 6925 helper: false, 6926 maxHeight: null, 6927 maxWidth: null, 6928 minHeight: 10, 6929 minWidth: 10, 6930 // See #7960 6931 zIndex: 90, 6932 6933 // callbacks 6934 resize: null, 6935 start: null, 6936 stop: null 6937 }, 6938 6939 _num: function (value) { 6940 return parseInt(value, 10) || 0; 6941 }, 6942 6943 _isNumber: function (value) { 6944 return !isNaN(parseInt(value, 10)); 6945 }, 6946 6947 _hasScroll: function (el, a) { 6948 if ($(el).css("overflow") === "hidden") { 6949 return false; 6950 } 6951 6952 var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop", 6953 has = false; 6954 6955 if (el[scroll] > 0) { 6956 return true; 6957 } 6958 6959 // TODO: determine which cases actually cause this to happen 6960 // if the element doesn't have the scroll set, see if it's possible to 6961 // set the scroll 6962 el[scroll] = 1; 6963 has = (el[scroll] > 0); 6964 el[scroll] = 0; 6965 return has; 6966 }, 6967 6968 _create: function () { 6969 var n, i, handle, axis, hname, 6970 that = this, 6971 o = this.options; 6972 this.element.addClass("ui-resizable"); 6973 6974 $.extend(this, { 6975 _aspectRatio: !!(o.aspectRatio), 6976 aspectRatio: o.aspectRatio, 6977 originalElement: this.element, 6978 _proportionallyResizeElements: [], 6979 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 6980 }); 6981 6982 // Wrap the element if it cannot hold child nodes 6983 if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) { 6984 this.element.wrap( 6985 $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ 6986 position: this.element.css("position"), 6987 width: this.element.outerWidth(), 6988 height: this.element.outerHeight(), 6989 top: this.element.css("top"), 6990 left: this.element.css("left") 6991 }) 6992 ); 6993 6994 this.element = this.element.parent().data( 6995 "ui-resizable", this.element.resizable("instance") 6996 ); 6997 6998 this.elementIsWrapper = true; 6999 7000 this.element.css({ 7001 marginLeft: this.originalElement.css("marginLeft"), 7002 marginTop: this.originalElement.css("marginTop"), 7003 marginRight: this.originalElement.css("marginRight"), 7004 marginBottom: this.originalElement.css("marginBottom") 7005 }); 7006 this.originalElement.css({ 7007 marginLeft: 0, 7008 marginTop: 0, 7009 marginRight: 0, 7010 marginBottom: 0 7011 }); 7012 // support: Safari 7013 // Prevent Safari textarea resize 7014 this.originalResizeStyle = this.originalElement.css("resize"); 7015 this.originalElement.css("resize", "none"); 7016 7017 this._proportionallyResizeElements.push(this.originalElement.css({ 7018 position: "static", 7019 zoom: 1, 7020 display: "block" 7021 })); 7022 7023 // support: IE9 7024 // avoid IE jump (hard set the margin) 7025 this.originalElement.css({ margin: this.originalElement.css("margin") }); 7026 7027 this._proportionallyResize(); 7028 } 7029 7030 this.handles = o.handles || 7031 (!$(".ui-resizable-handle", this.element).length ? 7032 "e,s,se" : { 7033 n: ".ui-resizable-n", 7034 e: ".ui-resizable-e", 7035 s: ".ui-resizable-s", 7036 w: ".ui-resizable-w", 7037 se: ".ui-resizable-se", 7038 sw: ".ui-resizable-sw", 7039 ne: ".ui-resizable-ne", 7040 nw: ".ui-resizable-nw" 7041 }); 7042 7043 this._handles = $(); 7044 if (this.handles.constructor === String) { 7045 if (this.handles === "all") { 7046 this.handles = "n,e,s,w,se,sw,ne,nw"; 7047 } 7048 7049 n = this.handles.split(","); 7050 this.handles = {}; 7051 7052 for (i = 0; i < n.length; i++) { 7053 handle = $.trim(n[i]); 7054 hname = "ui-resizable-" + handle; 7055 axis = $("<div class='ui-resizable-handle " + hname + "'></div>"); 7056 7057 axis.css({ zIndex: o.zIndex }); 7058 7059 // TODO : What's going on here? 7060 if ("se" === handle) { 7061 axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se"); 7062 } 7063 7064 this.handles[handle] = ".ui-resizable-" + handle; 7065 this.element.append(axis); 7066 } 7067 } 7068 7069 this._renderAxis = function (target) { 7070 var i, axis, padPos, padWrapper; 7071 7072 target = target || this.element; 7073 7074 for (i in this.handles) { 7075 if (this.handles[i].constructor === String) { 7076 this.handles[i] = this.element.children(this.handles[i]).first().show(); 7077 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 7078 this.handles[i] = $(this.handles[i]); 7079 this._on(this.handles[i], { "mousedown": that._mouseDown }); 7080 } 7081 7082 if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) { 7083 axis = $(this.handles[i], this.element); 7084 7085 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); 7086 7087 padPos = ["padding", 7088 /ne|nw|n/.test(i) ? "Top" : 7089 /se|sw|s/.test(i) ? "Bottom" : 7090 /^e$/.test(i) ? "Right" : "Left"].join(""); 7091 7092 target.css(padPos, padWrapper); 7093 7094 this._proportionallyResize(); 7095 } 7096 7097 this._handles = this._handles.add(this.handles[i]); 7098 } 7099 }; 7100 7101 // TODO: make renderAxis a prototype function 7102 this._renderAxis(this.element); 7103 7104 this._handles = this._handles.add(this.element.find(".ui-resizable-handle")); 7105 this._handles.disableSelection(); 7106 7107 this._handles.mouseover(function () { 7108 if (!that.resizing) { 7109 if (this.className) { 7110 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 7111 } 7112 that.axis = axis && axis[1] ? axis[1] : "se"; 7113 } 7114 }); 7115 7116 if (o.autoHide) { 7117 this._handles.hide(); 7118 $(this.element) 7119 .addClass("ui-resizable-autohide") 7120 .mouseenter(function () { 7121 if (o.disabled) { 7122 return; 7123 } 7124 $(this).removeClass("ui-resizable-autohide"); 7125 that._handles.show(); 7126 }) 7127 .mouseleave(function () { 7128 if (o.disabled) { 7129 return; 7130 } 7131 if (!that.resizing) { 7132 $(this).addClass("ui-resizable-autohide"); 7133 that._handles.hide(); 7134 } 7135 }); 7136 } 7137 7138 this._mouseInit(); 7139 }, 7140 7141 _destroy: function () { 7142 this._mouseDestroy(); 7143 7144 var wrapper, 7145 _destroy = function (exp) { 7146 $(exp) 7147 .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") 7148 .removeData("resizable") 7149 .removeData("ui-resizable") 7150 .unbind(".resizable") 7151 .find(".ui-resizable-handle") 7152 .remove(); 7153 }; 7154 7155 // TODO: Unwrap at same DOM position 7156 if (this.elementIsWrapper) { 7157 _destroy(this.element); 7158 wrapper = this.element; 7159 this.originalElement.css({ 7160 position: wrapper.css("position"), 7161 width: wrapper.outerWidth(), 7162 height: wrapper.outerHeight(), 7163 top: wrapper.css("top"), 7164 left: wrapper.css("left") 7165 }).insertAfter(wrapper); 7166 wrapper.remove(); 7167 } 7168 7169 this.originalElement.css("resize", this.originalResizeStyle); 7170 _destroy(this.originalElement); 7171 7172 return this; 7173 }, 7174 7175 _mouseCapture: function (event) { 7176 var i, handle, 7177 capture = false;
vendor: 13,027 bytes, lines 7178-7668
7178 7179 for (i in this.handles) { 7180 handle = $(this.handles[i])[0]; 7181 if (handle === event.target || $.contains(handle, event.target)) { 7182 capture = true; 7183 } 7184 } 7185 7186 return !this.options.disabled && capture; 7187 }, 7188 7189 _mouseStart: function (event) { 7190 var curleft, curtop, cursor, 7191 o = this.options, 7192 el = this.element; 7193 7194 this.resizing = true; 7195 7196 this._renderProxy(); 7197 7198 curleft = this._num(this.helper.css("left")); 7199 curtop = this._num(this.helper.css("top")); 7200 7201 if (o.containment) { 7202 curleft += $(o.containment).scrollLeft() || 0; 7203 curtop += $(o.containment).scrollTop() || 0; 7204 } 7205 7206 this.offset = this.helper.offset(); 7207 this.position = { left: curleft, top: curtop }; 7208 7209 this.size = this._helper ? { 7210 width: this.helper.width(), 7211 height: this.helper.height() 7212 } : { 7213 width: el.width(), 7214 height: el.height() 7215 }; 7216 7217 this.originalSize = this._helper ? { 7218 width: el.outerWidth(), 7219 height: el.outerHeight() 7220 } : { 7221 width: el.width(), 7222 height: el.height() 7223 }; 7224 7225 this.sizeDiff = { 7226 width: el.outerWidth() - el.width(), 7227 height: el.outerHeight() - el.height() 7228 }; 7229 7230 this.originalPosition = { left: curleft, top: curtop }; 7231 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 7232 7233 this.aspectRatio = (typeof o.aspectRatio === "number") ? 7234 o.aspectRatio : 7235 ((this.originalSize.width / this.originalSize.height) || 1); 7236 7237 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 7238 $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); 7239 7240 el.addClass("ui-resizable-resizing"); 7241 this._propagate("start", event); 7242 return true; 7243 }, 7244 7245 _mouseDrag: function (event) { 7246 var data, props, 7247 smp = this.originalMousePosition, 7248 a = this.axis, 7249 dx = (event.pageX - smp.left) || 0, 7250 dy = (event.pageY - smp.top) || 0, 7251 trigger = this._change[a]; 7252 7253 this._updatePrevProperties(); 7254 7255 if (!trigger) { 7256 return false; 7257 } 7258 7259 data = trigger.apply(this, [event, dx, dy]); 7260 7261 this._updateVirtualBoundaries(event.shiftKey); 7262 if (this._aspectRatio || event.shiftKey) { 7263 data = this._updateRatio(data, event); 7264 } 7265 7266 data = this._respectSize(data, event); 7267 7268 this._updateCache(data); 7269 7270 this._propagate("resize", event); 7271 7272 props = this._applyChanges(); 7273 7274 if (!this._helper && this._proportionallyResizeElements.length) { 7275 this._proportionallyResize(); 7276 } 7277 7278 if (!$.isEmptyObject(props)) { 7279 this._updatePrevProperties(); 7280 this._trigger("resize", event, this.ui()); 7281 this._applyChanges(); 7282 } 7283 7284 return false; 7285 }, 7286 7287 _mouseStop: function (event) { 7288 this.resizing = false; 7289 var pr, ista, soffseth, soffsetw, s, left, top, 7290 o = this.options, that = this; 7291 7292 if (this._helper) { 7293 pr = this._proportionallyResizeElements; 7294 ista = pr.length && (/textarea/i).test(pr[0].nodeName); 7295 soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 7296 soffsetw = ista ? 0 : that.sizeDiff.width; 7297 7298 s = { 7299 width: (that.helper.width() - soffsetw), 7300 height: (that.helper.height() - soffseth) 7301 }; 7302 left = (parseInt(that.element.css("left"), 10) + 7303 (that.position.left - that.originalPosition.left)) || null; 7304 top = (parseInt(that.element.css("top"), 10) + 7305 (that.position.top - that.originalPosition.top)) || null; 7306 7307 if (!o.animate) { 7308 this.element.css($.extend(s, { top: top, left: left })); 7309 } 7310 7311 that.helper.height(that.size.height); 7312 that.helper.width(that.size.width); 7313 7314 if (this._helper && !o.animate) { 7315 this._proportionallyResize(); 7316 } 7317 } 7318 7319 $("body").css("cursor", "auto"); 7320 7321 this.element.removeClass("ui-resizable-resizing"); 7322 7323 this._propagate("stop", event); 7324 7325 if (this._helper) { 7326 this.helper.remove(); 7327 } 7328 7329 return false; 7330 }, 7331 7332 _updatePrevProperties: function () { 7333 this.prevPosition = { 7334 top: this.position.top, 7335 left: this.position.left 7336 }; 7337 this.prevSize = { 7338 width: this.size.width, 7339 height: this.size.height 7340 }; 7341 }, 7342 7343 _applyChanges: function () { 7344 var props = {}; 7345 7346 if (this.position.top !== this.prevPosition.top) { 7347 props.top = this.position.top + "px"; 7348 } 7349 if (this.position.left !== this.prevPosition.left) { 7350 props.left = this.position.left + "px"; 7351 } 7352 if (this.size.width !== this.prevSize.width) { 7353 props.width = this.size.width + "px"; 7354 } 7355 if (this.size.height !== this.prevSize.height) { 7356 props.height = this.size.height + "px"; 7357 } 7358 7359 this.helper.css(props); 7360 7361 return props; 7362 }, 7363 7364 _updateVirtualBoundaries: function (forceAspectRatio) { 7365 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 7366 o = this.options; 7367 7368 b = { 7369 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 7370 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 7371 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 7372 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity 7373 }; 7374 7375 if (this._aspectRatio || forceAspectRatio) { 7376 pMinWidth = b.minHeight * this.aspectRatio; 7377 pMinHeight = b.minWidth / this.aspectRatio; 7378 pMaxWidth = b.maxHeight * this.aspectRatio; 7379 pMaxHeight = b.maxWidth / this.aspectRatio; 7380 7381 if (pMinWidth > b.minWidth) { 7382 b.minWidth = pMinWidth; 7383 } 7384 if (pMinHeight > b.minHeight) { 7385 b.minHeight = pMinHeight; 7386 } 7387 if (pMaxWidth < b.maxWidth) { 7388 b.maxWidth = pMaxWidth; 7389 } 7390 if (pMaxHeight < b.maxHeight) { 7391 b.maxHeight = pMaxHeight; 7392 } 7393 } 7394 this._vBoundaries = b; 7395 }, 7396 7397 _updateCache: function (data) { 7398 this.offset = this.helper.offset(); 7399 if (this._isNumber(data.left)) { 7400 this.position.left = data.left; 7401 } 7402 if (this._isNumber(data.top)) { 7403 this.position.top = data.top; 7404 } 7405 if (this._isNumber(data.height)) { 7406 this.size.height = data.height; 7407 } 7408 if (this._isNumber(data.width)) { 7409 this.size.width = data.width; 7410 } 7411 }, 7412 7413 _updateRatio: function (data) { 7414 var cpos = this.position, 7415 csize = this.size, 7416 a = this.axis; 7417 7418 if (this._isNumber(data.height)) { 7419 data.width = (data.height * this.aspectRatio); 7420 } else if (this._isNumber(data.width)) { 7421 data.height = (data.width / this.aspectRatio); 7422 } 7423 7424 if (a === "sw") { 7425 data.left = cpos.left + (csize.width - data.width); 7426 data.top = null; 7427 } 7428 if (a === "nw") { 7429 data.top = cpos.top + (csize.height - data.height); 7430 data.left = cpos.left + (csize.width - data.width); 7431 } 7432 7433 return data; 7434 }, 7435 7436 _respectSize: function (data) { 7437 var o = this._vBoundaries, 7438 a = this.axis, 7439 ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), 7440 ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 7441 isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), 7442 isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), 7443 dw = this.originalPosition.left + this.originalSize.width, 7444 dh = this.position.top + this.size.height, 7445 cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 7446 if (isminw) { 7447 data.width = o.minWidth; 7448 } 7449 if (isminh) { 7450 data.height = o.minHeight; 7451 } 7452 if (ismaxw) { 7453 data.width = o.maxWidth; 7454 } 7455 if (ismaxh) { 7456 data.height = o.maxHeight; 7457 } 7458 7459 if (isminw && cw) { 7460 data.left = dw - o.minWidth; 7461 } 7462 if (ismaxw && cw) { 7463 data.left = dw - o.maxWidth; 7464 } 7465 if (isminh && ch) { 7466 data.top = dh - o.minHeight; 7467 } 7468 if (ismaxh && ch) { 7469 data.top = dh - o.maxHeight; 7470 } 7471 7472 // Fixing jump error on top/left - bug #2330 7473 if (!data.width && !data.height && !data.left && data.top) { 7474 data.top = null; 7475 } else if (!data.width && !data.height && !data.top && data.left) { 7476 data.left = null; 7477 } 7478 7479 return data; 7480 }, 7481 7482 _getPaddingPlusBorderDimensions: function (element) { 7483 var i = 0, 7484 widths = [], 7485 borders = [ 7486 element.css("borderTopWidth"), 7487 element.css("borderRightWidth"), 7488 element.css("borderBottomWidth"), 7489 element.css("borderLeftWidth") 7490 ], 7491 paddings = [ 7492 element.css("paddingTop"), 7493 element.css("paddingRight"), 7494 element.css("paddingBottom"), 7495 element.css("paddingLeft") 7496 ]; 7497 7498 for (; i < 4; i++) { 7499 widths[i] = (parseInt(borders[i], 10) || 0); 7500 widths[i] += (parseInt(paddings[i], 10) || 0); 7501 } 7502 7503 return { 7504 height: widths[0] + widths[2], 7505 width: widths[1] + widths[3] 7506 }; 7507 }, 7508 7509 _proportionallyResize: function () { 7510 if (!this._proportionallyResizeElements.length) { 7511 return; 7512 } 7513 7514 var prel, 7515 i = 0, 7516 element = this.helper || this.element; 7517 7518 for (; i < this._proportionallyResizeElements.length; i++) { 7519 prel = this._proportionallyResizeElements[i]; 7520 7521 // TODO: Seems like a bug to cache this.outerDimensions 7522 // considering that we are in a loop. 7523 if (!this.outerDimensions) { 7524 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 7525 } 7526 7527 prel.css({ 7528 height: (element.height() - this.outerDimensions.height) || 0, 7529 width: (element.width() - this.outerDimensions.width) || 0 7530 }); 7531 } 7532 }, 7533 7534 _renderProxy: function () { 7535 var el = this.element, o = this.options; 7536 this.elementOffset = el.offset(); 7537 7538 if (this._helper) { 7539 this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); 7540 7541 this.helper.addClass(this._helper).css({ 7542 width: this.element.outerWidth() - 1, 7543 height: this.element.outerHeight() - 1, 7544 position: "absolute", 7545 left: this.elementOffset.left + "px", 7546 top: this.elementOffset.top + "px", 7547 zIndex: ++o.zIndex //TODO: Don't modify option 7548 }); 7549 7550 this.helper 7551 .appendTo("body") 7552 .disableSelection(); 7553 } else { 7554 this.helper = this.element; 7555 } 7556 }, 7557 7558 _change: { 7559 e: function (event, dx) { 7560 return { width: this.originalSize.width + dx }; 7561 }, 7562 w: function (event, dx) { 7563 var cs = this.originalSize, sp = this.originalPosition; 7564 return { left: sp.left + dx, width: cs.width - dx }; 7565 }, 7566 n: function (event, dx, dy) { 7567 var cs = this.originalSize, sp = this.originalPosition; 7568 return { top: sp.top + dy, height: cs.height - dy }; 7569 }, 7570 s: function (event, dx, dy) { 7571 return { height: this.originalSize.height + dy }; 7572 }, 7573 se: function (event, dx, dy) { 7574 return $.extend(this._change.s.apply(this, arguments), 7575 this._change.e.apply(this, [event, dx, dy])); 7576 }, 7577 sw: function (event, dx, dy) { 7578 return $.extend(this._change.s.apply(this, arguments), 7579 this._change.w.apply(this, [event, dx, dy])); 7580 }, 7581 ne: function (event, dx, dy) { 7582 return $.extend(this._change.n.apply(this, arguments), 7583 this._change.e.apply(this, [event, dx, dy])); 7584 }, 7585 nw: function (event, dx, dy) { 7586 return $.extend(this._change.n.apply(this, arguments), 7587 this._change.w.apply(this, [event, dx, dy])); 7588 } 7589 }, 7590 7591 _propagate: function (n, event) { 7592 $.ui.plugin.call(this, n, [event, this.ui()]); 7593 (n !== "resize" && this._trigger(n, event, this.ui())); 7594 }, 7595 7596 plugins: {}, 7597 7598 ui: function () { 7599 return { 7600 originalElement: this.originalElement, 7601 element: this.element, 7602 helper: this.helper, 7603 position: this.position, 7604 size: this.size, 7605 originalSize: this.originalSize, 7606 originalPosition: this.originalPosition 7607 }; 7608 } 7609 }); 7610 7611 /* 7612 * Resizable Extensions 7613 */ 7614 7615 $.ui.plugin.add("resizable", "animate", { 7616 stop: function (event) { 7617 var that = $(this).resizable("instance"), 7618 o = that.options, 7619 pr = that._proportionallyResizeElements, 7620 ista = pr.length && (/textarea/i).test(pr[0].nodeName), 7621 soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 7622 soffsetw = ista ? 0 : that.sizeDiff.width, 7623 style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, 7624 left = (parseInt(that.element.css("left"), 10) + 7625 (that.position.left - that.originalPosition.left)) || null, 7626 top = (parseInt(that.element.css("top"), 10) + 7627 (that.position.top - that.originalPosition.top)) || null; 7628 7629 that.element.animate( 7630 $.extend(style, top && left ? { top: top, left: left } : {}), { 7631 duration: o.animateDuration, 7632 easing: o.animateEasing, 7633 step: function () { 7634 var data = { 7635 width: parseInt(that.element.css("width"), 10), 7636 height: parseInt(that.element.css("height"), 10), 7637 top: parseInt(that.element.css("top"), 10), 7638 left: parseInt(that.element.css("left"), 10) 7639 }; 7640 7641 if (pr && pr.length) { 7642 $(pr[0]).css({ width: data.width, height: data.height }); 7643 } 7644 7645 // propagating resize, and updating values for each animation step 7646 that._updateCache(data); 7647 that._propagate("resize", event); 7648 } 7649 } 7650 ); 7651 } 7652 }); 7653 7654 $.ui.plugin.add("resizable", "containment", { 7655 start: function () { 7656 var element, p, co, ch, cw, width, height, 7657 that = $(this).resizable("instance"), 7658 o = that.options, 7659 el = that.element, 7660 oc = o.containment, 7661 ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; 7662 7663 if (!ce) { 7664 return; 7665 } 7666 7667 that.containerElement = $(ce); 7668
vendor: 4,199 bytes, lines 7669-7823
7669 if (/document/.test(oc) || oc === document) { 7670 that.containerOffset = { 7671 left: 0, 7672 top: 0 7673 }; 7674 that.containerPosition = { 7675 left: 0, 7676 top: 0 7677 }; 7678 7679 that.parentData = { 7680 element: $(document), 7681 left: 0, 7682 top: 0, 7683 width: $(document).width(), 7684 height: $(document).height() || document.body.parentNode.scrollHeight 7685 }; 7686 } else { 7687 element = $(ce); 7688 p = []; 7689 $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) { 7690 p[i] = that._num(element.css("padding" + name)); 7691 }); 7692 7693 that.containerOffset = element.offset(); 7694 that.containerPosition = element.position(); 7695 that.containerSize = { 7696 height: (element.innerHeight() - p[3]), 7697 width: (element.innerWidth() - p[1]) 7698 }; 7699 7700 co = that.containerOffset; 7701 ch = that.containerSize.height; 7702 cw = that.containerSize.width; 7703 width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw); 7704 height = (that._hasScroll(ce) ? ce.scrollHeight : ch); 7705 7706 that.parentData = { 7707 element: ce, 7708 left: co.left, 7709 top: co.top, 7710 width: width, 7711 height: height 7712 }; 7713 } 7714 }, 7715 7716 resize: function (event) { 7717 var woset, hoset, isParent, isOffsetRelative, 7718 that = $(this).resizable("instance"), 7719 o = that.options, 7720 co = that.containerOffset, 7721 cp = that.position, 7722 pRatio = that._aspectRatio || event.shiftKey, 7723 cop = { 7724 top: 0, 7725 left: 0 7726 }, 7727 ce = that.containerElement, 7728 continueResize = true; 7729 7730 if (ce[0] !== document && (/static/).test(ce.css("position"))) { 7731 cop = co; 7732 } 7733 7734 if (cp.left < (that._helper ? co.left : 0)) { 7735 that.size.width = that.size.width + 7736 (that._helper ? 7737 (that.position.left - co.left) : 7738 (that.position.left - cop.left)); 7739 7740 if (pRatio) { 7741 that.size.height = that.size.width / that.aspectRatio; 7742 continueResize = false; 7743 } 7744 that.position.left = o.helper ? co.left : 0; 7745 } 7746 7747 if (cp.top < (that._helper ? co.top : 0)) { 7748 that.size.height = that.size.height + 7749 (that._helper ? 7750 (that.position.top - co.top) : 7751 that.position.top); 7752 7753 if (pRatio) { 7754 that.size.width = that.size.height * that.aspectRatio; 7755 continueResize = false; 7756 } 7757 that.position.top = that._helper ? co.top : 0; 7758 } 7759 7760 isParent = that.containerElement.get(0) === that.element.parent().get(0); 7761 isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); 7762 7763 if (isParent && isOffsetRelative) { 7764 that.offset.left = that.parentData.left + that.position.left; 7765 that.offset.top = that.parentData.top + that.position.top; 7766 } else { 7767 that.offset.left = that.element.offset().left; 7768 that.offset.top = that.element.offset().top; 7769 } 7770 7771 woset = Math.abs(that.sizeDiff.width + 7772 (that._helper ? 7773 that.offset.left - cop.left : 7774 (that.offset.left - co.left))); 7775 7776 hoset = Math.abs(that.sizeDiff.height + 7777 (that._helper ? 7778 that.offset.top - cop.top : 7779 (that.offset.top - co.top))); 7780 7781 if (woset + that.size.width >= that.parentData.width) { 7782 that.size.width = that.parentData.width - woset; 7783 if (pRatio) { 7784 that.size.height = that.size.width / that.aspectRatio; 7785 continueResize = false; 7786 } 7787 } 7788 7789 if (hoset + that.size.height >= that.parentData.height) { 7790 that.size.height = that.parentData.height - hoset; 7791 if (pRatio) { 7792 that.size.width = that.size.height * that.aspectRatio; 7793 continueResize = false; 7794 } 7795 } 7796 7797 if (!continueResize) { 7798 that.position.left = that.prevPosition.left; 7799 that.position.top = that.prevPosition.top; 7800 that.size.width = that.prevSize.width; 7801 that.size.height = that.prevSize.height; 7802 } 7803 }, 7804 7805 stop: function () { 7806 var that = $(this).resizable("instance"), 7807 o = that.options, 7808 co = that.containerOffset, 7809 cop = that.containerPosition, 7810 ce = that.containerElement, 7811 helper = $(that.helper), 7812 ho = helper.offset(), 7813 w = helper.outerWidth() - that.sizeDiff.width, 7814 h = helper.outerHeight() - that.sizeDiff.height; 7815 7816 if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { 7817 $(this).css({ 7818 left: ho.left - cop.left - co.left, 7819 width: w, 7820 height: h 7821 }); 7822 } 7823
vendor: 6,866 bytes, lines 7824-8106
7824 if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { 7825 $(this).css({ 7826 left: ho.left - cop.left - co.left, 7827 width: w, 7828 height: h 7829 }); 7830 } 7831 } 7832 }); 7833 7834 $.ui.plugin.add("resizable", "alsoResize", { 7835 start: function () { 7836 var that = $(this).resizable("instance"), 7837 o = that.options; 7838 7839 $(o.alsoResize).each(function () { 7840 var el = $(this); 7841 el.data("ui-resizable-alsoresize", { 7842 width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), 7843 left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10) 7844 }); 7845 }); 7846 }, 7847 7848 resize: function (event, ui) { 7849 var that = $(this).resizable("instance"), 7850 o = that.options, 7851 os = that.originalSize, 7852 op = that.originalPosition, 7853 delta = { 7854 height: (that.size.height - os.height) || 0, 7855 width: (that.size.width - os.width) || 0, 7856 top: (that.position.top - op.top) || 0, 7857 left: (that.position.left - op.left) || 0 7858 }; 7859 7860 $(o.alsoResize).each(function () { 7861 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, 7862 css = el.parents(ui.originalElement[0]).length ? 7863 ["width", "height"] : 7864 ["width", "height", "top", "left"]; 7865 7866 $.each(css, function (i, prop) { 7867 var sum = (start[prop] || 0) + (delta[prop] || 0); 7868 if (sum && sum >= 0) { 7869 style[prop] = sum || null; 7870 } 7871 }); 7872 7873 el.css(style); 7874 }); 7875 }, 7876 7877 stop: function () { 7878 $(this).removeData("resizable-alsoresize"); 7879 } 7880 }); 7881 7882 $.ui.plugin.add("resizable", "ghost", { 7883 start: function () { 7884 var that = $(this).resizable("instance"), o = that.options, cs = that.size; 7885 7886 that.ghost = that.originalElement.clone(); 7887 that.ghost 7888 .css({ 7889 opacity: 0.25, 7890 display: "block", 7891 position: "relative", 7892 height: cs.height, 7893 width: cs.width, 7894 margin: 0, 7895 left: 0, 7896 top: 0 7897 }) 7898 .addClass("ui-resizable-ghost") 7899 .addClass(typeof o.ghost === "string" ? o.ghost : ""); 7900 7901 that.ghost.appendTo(that.helper); 7902 }, 7903 7904 resize: function () { 7905 var that = $(this).resizable("instance"); 7906 if (that.ghost) { 7907 that.ghost.css({ 7908 position: "relative", 7909 height: that.size.height, 7910 width: that.size.width 7911 }); 7912 } 7913 }, 7914 7915 stop: function () { 7916 var that = $(this).resizable("instance"); 7917 if (that.ghost && that.helper) { 7918 that.helper.get(0).removeChild(that.ghost.get(0)); 7919 } 7920 } 7921 }); 7922 7923 $.ui.plugin.add("resizable", "grid", { 7924 resize: function () { 7925 var outerDimensions, 7926 that = $(this).resizable("instance"), 7927 o = that.options, 7928 cs = that.size, 7929 os = that.originalSize, 7930 op = that.originalPosition, 7931 a = that.axis, 7932 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, 7933 gridX = (grid[0] || 1), 7934 gridY = (grid[1] || 1), 7935 ox = Math.round((cs.width - os.width) / gridX) * gridX, 7936 oy = Math.round((cs.height - os.height) / gridY) * gridY, 7937 newWidth = os.width + ox, 7938 newHeight = os.height + oy, 7939 isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), 7940 isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), 7941 isMinWidth = o.minWidth && (o.minWidth > newWidth), 7942 isMinHeight = o.minHeight && (o.minHeight > newHeight); 7943 7944 o.grid = grid; 7945 7946 if (isMinWidth) { 7947 newWidth += gridX; 7948 } 7949 if (isMinHeight) { 7950 newHeight += gridY; 7951 } 7952 if (isMaxWidth) { 7953 newWidth -= gridX; 7954 } 7955 if (isMaxHeight) { 7956 newHeight -= gridY; 7957 } 7958 7959 if (/^(se|s|e)$/.test(a)) { 7960 that.size.width = newWidth; 7961 that.size.height = newHeight; 7962 } else if (/^(ne)$/.test(a)) { 7963 that.size.width = newWidth; 7964 that.size.height = newHeight; 7965 that.position.top = op.top - oy; 7966 } else if (/^(sw)$/.test(a)) { 7967 that.size.width = newWidth; 7968 that.size.height = newHeight; 7969 that.position.left = op.left - ox; 7970 } else { 7971 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 7972 outerDimensions = that._getPaddingPlusBorderDimensions(this); 7973 } 7974 7975 if (newHeight - gridY > 0) { 7976 that.size.height = newHeight; 7977 that.position.top = op.top - oy; 7978 } else { 7979 newHeight = gridY - outerDimensions.height; 7980 that.size.height = newHeight; 7981 that.position.top = op.top + os.height - newHeight; 7982 } 7983 if (newWidth - gridX > 0) { 7984 that.size.width = newWidth; 7985 that.position.left = op.left - ox; 7986 } else { 7987 newWidth = gridX - outerDimensions.width; 7988 that.size.width = newWidth; 7989 that.position.left = op.left + os.width - newWidth; 7990 } 7991 } 7992 } 7993 }); 7994 7995 var resizable = $.ui.resizable; 7996 7997 /*! 7998 * jQuery UI Dialog 1.11.4 7999 * http://jqueryui.com 8000 * 8001 * Copyright jQuery Foundation and other contributors 8002 * Released under the MIT license. 8003 * http://jquery.org/license 8004 * 8005 * http://api.jqueryui.com/dialog/ 8006 */ 8007 8008 var dialog = $.widget("ui.dialog", { 8009 version: "1.11.4", 8010 options: { 8011 appendTo: "body", 8012 autoOpen: true, 8013 buttons: [], 8014 closeOnEscape: true, 8015 closeText: "Close", 8016 dialogClass: "", 8017 draggable: true, 8018 hide: null, 8019 height: "auto", 8020 maxHeight: null, 8021 maxWidth: null, 8022 minHeight: 150, 8023 minWidth: 150, 8024 modal: false, 8025 position: { 8026 my: "center", 8027 at: "center", 8028 of: window, 8029 collision: "fit", 8030 // Ensure the titlebar is always visible 8031 using: function (pos) { 8032 var topOffset = $(this).css(pos).offset().top; 8033 if (topOffset < 0) { 8034 $(this).css("top", pos.top - topOffset); 8035 } 8036 } 8037 }, 8038 resizable: true, 8039 show: null, 8040 title: null, 8041 width: 300, 8042 8043 // callbacks 8044 beforeClose: null, 8045 close: null, 8046 drag: null, 8047 dragStart: null, 8048 dragStop: null, 8049 focus: null, 8050 open: null, 8051 resize: null, 8052 resizeStart: null, 8053 resizeStop: null 8054 }, 8055 8056 sizeRelatedOptions: { 8057 buttons: true, 8058 height: true, 8059 maxHeight: true, 8060 maxWidth: true, 8061 minHeight: true, 8062 minWidth: true, 8063 width: true 8064 }, 8065 8066 resizableRelatedOptions: { 8067 maxHeight: true, 8068 maxWidth: true, 8069 minHeight: true, 8070 minWidth: true 8071 }, 8072 8073 _create: function () { 8074 this.originalCss = { 8075 display: this.element[0].style.display, 8076 width: this.element[0].style.width, 8077 minHeight: this.element[0].style.minHeight, 8078 maxHeight: this.element[0].style.maxHeight, 8079 height: this.element[0].style.height 8080 }; 8081 this.originalPosition = { 8082 parent: this.element.parent(), 8083 index: this.element.parent().children().index(this.element) 8084 }; 8085 this.originalTitle = this.element.attr("title"); 8086 this.options.title = this.options.title || this.originalTitle; 8087 8088 this._createWrapper(); 8089 8090 this.element 8091 .show() 8092 .removeAttr("title") 8093 .addClass("ui-dialog-content ui-widget-content") 8094 .appendTo(this.uiDialog); 8095 8096 this._createTitlebar(); 8097 this._createButtonPane(); 8098 8099 if (this.options.draggable && $.fn.draggable) { 8100 this._makeDraggable(); 8101 } 8102 if (this.options.resizable && $.fn.resizable) { 8103 this._makeResizable(); 8104 } 8105 8106 this._isOpen = false;
vendor: 23,197 bytes, lines 8107-9003
8107 8108 this._trackFocus(); 8109 }, 8110 8111 _init: function () { 8112 if (this.options.autoOpen) { 8113 this.open(); 8114 } 8115 }, 8116 8117 _appendTo: function () { 8118 var element = this.options.appendTo; 8119 if (element && (element.jquery || element.nodeType)) { 8120 return $(element); 8121 } 8122 return this.document.find(element || "body").eq(0); 8123 }, 8124 8125 _destroy: function () { 8126 var next, 8127 originalPosition = this.originalPosition; 8128 8129 this._untrackInstance(); 8130 this._destroyOverlay(); 8131 8132 this.element 8133 .removeUniqueId() 8134 .removeClass("ui-dialog-content ui-widget-content") 8135 .css(this.originalCss) 8136 // Without detaching first, the following becomes really slow 8137 .detach(); 8138 8139 this.uiDialog.stop(true, true).remove(); 8140 8141 if (this.originalTitle) { 8142 this.element.attr("title", this.originalTitle); 8143 } 8144 8145 next = originalPosition.parent.children().eq(originalPosition.index); 8146 // Don't try to place the dialog next to itself (#8613) 8147 if (next.length && next[0] !== this.element[0]) { 8148 next.before(this.element); 8149 } else { 8150 originalPosition.parent.append(this.element); 8151 } 8152 }, 8153 8154 widget: function () { 8155 return this.uiDialog; 8156 }, 8157 8158 disable: $.noop, 8159 enable: $.noop, 8160 8161 close: function (event) { 8162 var activeElement, 8163 that = this; 8164 8165 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 8166 return; 8167 } 8168 8169 this._isOpen = false; 8170 this._focusedElement = null; 8171 this._destroyOverlay(); 8172 this._untrackInstance(); 8173 8174 if (!this.opener.filter(":focusable").focus().length) { 8175 // support: IE9 8176 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 8177 try { 8178 activeElement = this.document[0].activeElement; 8179 8180 // Support: IE9, IE10 8181 // If the <body> is blurred, IE will switch windows, see #4520 8182 if (activeElement && activeElement.nodeName.toLowerCase() !== "body") { 8183 // Hiding a focused element doesn't trigger blur in WebKit 8184 // so in case we have nothing to focus on, explicitly blur the active element 8185 // https://bugs.webkit.org/show_bug.cgi?id=47182 8186 $(activeElement).blur(); 8187 } 8188 } catch (error) { } 8189 } 8190 8191 this._hide(this.uiDialog, this.options.hide, function () { 8192 that._trigger("close", event); 8193 }); 8194 }, 8195 8196 isOpen: function () { 8197 return this._isOpen; 8198 }, 8199 8200 moveToTop: function () { 8201 this._moveToTop(); 8202 }, 8203 8204 _moveToTop: function (event, silent) { 8205 var moved = false, 8206 zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () { 8207 return +$(this).css("z-index"); 8208 }).get(), 8209 zIndexMax = Math.max.apply(null, zIndices); 8210 8211 if (zIndexMax >= +this.uiDialog.css("z-index")) { 8212 this.uiDialog.css("z-index", zIndexMax + 1); 8213 moved = true; 8214 } 8215 8216 if (moved && !silent) { 8217 this._trigger("focus", event); 8218 } 8219 return moved; 8220 }, 8221 8222 open: function () { 8223 var that = this; 8224 if (this._isOpen) { 8225 if (this._moveToTop()) { 8226 this._focusTabbable(); 8227 } 8228 return; 8229 } 8230 8231 this._isOpen = true; 8232 this.opener = $(this.document[0].activeElement); 8233 8234 this._size(); 8235 this._position(); 8236 this._createOverlay(); 8237 this._moveToTop(null, true); 8238 8239 // Ensure the overlay is moved to the top with the dialog, but only when 8240 // opening. The overlay shouldn't move after the dialog is open so that 8241 // modeless dialogs opened after the modal dialog stack properly. 8242 if (this.overlay) { 8243 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 8244 } 8245 8246 this._show(this.uiDialog, this.options.show, function () { 8247 that._focusTabbable(); 8248 that._trigger("focus"); 8249 }); 8250 8251 // Track the dialog immediately upon openening in case a focus event 8252 // somehow occurs outside of the dialog before an element inside the 8253 // dialog is focused (#10152) 8254 this._makeFocusTarget(); 8255 8256 this._trigger("open"); 8257 }, 8258 8259 _focusTabbable: function () { 8260 // Set focus to the first match: 8261 // 1. An element that was focused previously 8262 // 2. First element inside the dialog matching [autofocus] 8263 // 3. Tabbable element inside the content element 8264 // 4. Tabbable element inside the buttonpane 8265 // 5. The close button 8266 // 6. The dialog itself 8267 var hasFocus = this._focusedElement; 8268 if (!hasFocus) { 8269 hasFocus = this.element.find("[autofocus]"); 8270 } 8271 if (!hasFocus.length) { 8272 hasFocus = this.element.find(":tabbable"); 8273 } 8274 if (!hasFocus.length) { 8275 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 8276 } 8277 if (!hasFocus.length) { 8278 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 8279 } 8280 if (!hasFocus.length) { 8281 hasFocus = this.uiDialog; 8282 } 8283 hasFocus.eq(0).focus(); 8284 }, 8285 8286 _keepFocus: function (event) { 8287 function checkFocus() { 8288 var activeElement = this.document[0].activeElement, 8289 isActive = this.uiDialog[0] === activeElement || 8290 $.contains(this.uiDialog[0], activeElement); 8291 if (!isActive) { 8292 this._focusTabbable(); 8293 } 8294 } 8295 event.preventDefault(); 8296 checkFocus.call(this); 8297 // support: IE 8298 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 8299 // so we check again later 8300 this._delay(checkFocus); 8301 }, 8302 8303 _createWrapper: function () { 8304 this.uiDialog = $("<div>") 8305 .addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " + 8306 this.options.dialogClass) 8307 .hide() 8308 .attr({ 8309 // Setting tabIndex makes the div focusable 8310 tabIndex: -1, 8311 role: "dialog" 8312 }) 8313 .appendTo(this._appendTo()); 8314 8315 this._on(this.uiDialog, { 8316 keydown: function (event) { 8317 if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 8318 event.keyCode === $.ui.keyCode.ESCAPE) { 8319 event.preventDefault(); 8320 this.close(event); 8321 return; 8322 } 8323 8324 // prevent tabbing out of dialogs 8325 if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) { 8326 return; 8327 } 8328 var tabbables = this.uiDialog.find(":tabbable"), 8329 first = tabbables.filter(":first"), 8330 last = tabbables.filter(":last"); 8331 8332 if ((event.target === last[0] || event.target === this.uiDialog[0]) && !event.shiftKey) { 8333 this._delay(function () { 8334 first.focus(); 8335 }); 8336 event.preventDefault(); 8337 } else if ((event.target === first[0] || event.target === this.uiDialog[0]) && event.shiftKey) { 8338 this._delay(function () { 8339 last.focus(); 8340 }); 8341 event.preventDefault(); 8342 } 8343 }, 8344 mousedown: function (event) { 8345 if (this._moveToTop(event)) { 8346 this._focusTabbable(); 8347 } 8348 } 8349 }); 8350 8351 // We assume that any existing aria-describedby attribute means 8352 // that the dialog content is marked up properly 8353 // otherwise we brute force the content as the description 8354 if (!this.element.find("[aria-describedby]").length) { 8355 this.uiDialog.attr({ 8356 "aria-describedby": this.element.uniqueId().attr("id") 8357 }); 8358 } 8359 }, 8360 8361 _createTitlebar: function () { 8362 var uiDialogTitle; 8363 8364 this.uiDialogTitlebar = $("<div>") 8365 .addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix") 8366 .prependTo(this.uiDialog); 8367 this._on(this.uiDialogTitlebar, { 8368 mousedown: function (event) { 8369 // Don't prevent click on close button (#8838) 8370 // Focusing a dialog that is partially scrolled out of view 8371 // causes the browser to scroll it into view, preventing the click event 8372 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 8373 // Dialog isn't getting focus when dragging (#8063) 8374 this.uiDialog.focus(); 8375 } 8376 } 8377 }); 8378 8379 // support: IE 8380 // Use type="button" to prevent enter keypresses in textboxes from closing the 8381 // dialog in IE (#9312) 8382 this.uiDialogTitlebarClose = $("<button type='button'></button>") 8383 .button({ 8384 label: this.options.closeText, 8385 icons: { 8386 primary: "ui-icon-closethick" 8387 }, 8388 text: false 8389 }) 8390 .addClass("ui-dialog-titlebar-close") 8391 .appendTo(this.uiDialogTitlebar); 8392 this._on(this.uiDialogTitlebarClose, { 8393 click: function (event) { 8394 event.preventDefault(); 8395 this.close(event); 8396 } 8397 }); 8398 8399 uiDialogTitle = $("<span>") 8400 .uniqueId() 8401 .addClass("ui-dialog-title") 8402 .prependTo(this.uiDialogTitlebar); 8403 this._title(uiDialogTitle); 8404 8405 this.uiDialog.attr({ 8406 "aria-labelledby": uiDialogTitle.attr("id") 8407 }); 8408 }, 8409 8410 _title: function (title) { 8411 if (!this.options.title) { 8412 title.html(" "); 8413 } 8414 title.text(this.options.title); 8415 }, 8416 8417 _createButtonPane: function () { 8418 this.uiDialogButtonPane = $("<div>") 8419 .addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"); 8420 8421 this.uiButtonSet = $("<div>") 8422 .addClass("ui-dialog-buttonset") 8423 .appendTo(this.uiDialogButtonPane); 8424 8425 this._createButtons(); 8426 }, 8427 8428 _createButtons: function () { 8429 var that = this, 8430 buttons = this.options.buttons; 8431 8432 // if we already have a button pane, remove it 8433 this.uiDialogButtonPane.remove(); 8434 this.uiButtonSet.empty(); 8435 8436 if ($.isEmptyObject(buttons) || ($.isArray(buttons) && !buttons.length)) { 8437 this.uiDialog.removeClass("ui-dialog-buttons"); 8438 return; 8439 } 8440 8441 $.each(buttons, function (name, props) { 8442 var click, buttonOptions; 8443 props = $.isFunction(props) ? 8444 { click: props, text: name } : 8445 props; 8446 // Default to a non-submitting button 8447 props = $.extend({ type: "button" }, props); 8448 // Change the context for the click callback to be the main element 8449 click = props.click; 8450 props.click = function () { 8451 click.apply(that.element[0], arguments); 8452 }; 8453 buttonOptions = { 8454 icons: props.icons, 8455 text: props.showText 8456 }; 8457 delete props.icons; 8458 delete props.showText; 8459 $("<button></button>", props) 8460 .button(buttonOptions) 8461 .appendTo(that.uiButtonSet); 8462 }); 8463 this.uiDialog.addClass("ui-dialog-buttons"); 8464 this.uiDialogButtonPane.appendTo(this.uiDialog); 8465 }, 8466 8467 _makeDraggable: function () { 8468 var that = this, 8469 options = this.options; 8470 8471 function filteredUi(ui) { 8472 return { 8473 position: ui.position, 8474 offset: ui.offset 8475 }; 8476 } 8477 8478 this.uiDialog.draggable({ 8479 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 8480 handle: ".ui-dialog-titlebar", 8481 containment: "document", 8482 start: function (event, ui) { 8483 $(this).addClass("ui-dialog-dragging"); 8484 that._blockFrames(); 8485 that._trigger("dragStart", event, filteredUi(ui)); 8486 }, 8487 drag: function (event, ui) { 8488 that._trigger("drag", event, filteredUi(ui)); 8489 }, 8490 stop: function (event, ui) { 8491 var left = ui.offset.left - that.document.scrollLeft(), 8492 top = ui.offset.top - that.document.scrollTop(); 8493 8494 options.position = { 8495 my: "left top", 8496 at: "left" + (left >= 0 ? "+" : "") + left + " " + 8497 "top" + (top >= 0 ? "+" : "") + top, 8498 of: that.window 8499 }; 8500 $(this).removeClass("ui-dialog-dragging"); 8501 that._unblockFrames(); 8502 that._trigger("dragStop", event, filteredUi(ui)); 8503 } 8504 }); 8505 }, 8506 8507 _makeResizable: function () { 8508 var that = this, 8509 options = this.options, 8510 handles = options.resizable, 8511 // .ui-resizable has position: relative defined in the stylesheet 8512 // but dialogs have to use absolute or fixed positioning 8513 position = this.uiDialog.css("position"), 8514 resizeHandles = typeof handles === "string" ? 8515 handles : 8516 "n,e,s,w,se,sw,ne,nw"; 8517 8518 function filteredUi(ui) { 8519 return { 8520 originalPosition: ui.originalPosition, 8521 originalSize: ui.originalSize, 8522 position: ui.position, 8523 size: ui.size 8524 }; 8525 } 8526 8527 this.uiDialog.resizable({ 8528 cancel: ".ui-dialog-content", 8529 containment: "document", 8530 alsoResize: this.element, 8531 maxWidth: options.maxWidth, 8532 maxHeight: options.maxHeight, 8533 minWidth: options.minWidth, 8534 minHeight: this._minHeight(), 8535 handles: resizeHandles, 8536 start: function (event, ui) { 8537 $(this).addClass("ui-dialog-resizing"); 8538 that._blockFrames(); 8539 that._trigger("resizeStart", event, filteredUi(ui)); 8540 }, 8541 resize: function (event, ui) { 8542 that._trigger("resize", event, filteredUi(ui)); 8543 }, 8544 stop: function (event, ui) { 8545 var offset = that.uiDialog.offset(), 8546 left = offset.left - that.document.scrollLeft(), 8547 top = offset.top - that.document.scrollTop(); 8548 8549 options.height = that.uiDialog.height(); 8550 options.width = that.uiDialog.width(); 8551 options.position = { 8552 my: "left top", 8553 at: "left" + (left >= 0 ? "+" : "") + left + " " + 8554 "top" + (top >= 0 ? "+" : "") + top, 8555 of: that.window 8556 }; 8557 $(this).removeClass("ui-dialog-resizing"); 8558 that._unblockFrames(); 8559 that._trigger("resizeStop", event, filteredUi(ui)); 8560 } 8561 }) 8562 .css("position", position); 8563 }, 8564 8565 _trackFocus: function () { 8566 this._on(this.widget(), { 8567 focusin: function (event) { 8568 this._makeFocusTarget(); 8569 this._focusedElement = $(event.target); 8570 } 8571 }); 8572 }, 8573 8574 _makeFocusTarget: function () { 8575 this._untrackInstance(); 8576 this._trackingInstances().unshift(this); 8577 }, 8578 8579 _untrackInstance: function () { 8580 var instances = this._trackingInstances(), 8581 exists = $.inArray(this, instances); 8582 if (exists !== -1) { 8583 instances.splice(exists, 1); 8584 } 8585 }, 8586 8587 _trackingInstances: function () { 8588 var instances = this.document.data("ui-dialog-instances"); 8589 if (!instances) { 8590 instances = []; 8591 this.document.data("ui-dialog-instances", instances); 8592 } 8593 return instances; 8594 }, 8595 8596 _minHeight: function () { 8597 var options = this.options; 8598 8599 return options.height === "auto" ? 8600 options.minHeight : 8601 Math.min(options.minHeight, options.height); 8602 }, 8603 8604 _position: function () { 8605 // Need to show the dialog to get the actual offset in the position plugin 8606 var isVisible = this.uiDialog.is(":visible"); 8607 if (!isVisible) { 8608 this.uiDialog.show(); 8609 } 8610 this.uiDialog.position(this.options.position); 8611 if (!isVisible) { 8612 this.uiDialog.hide(); 8613 } 8614 }, 8615 8616 _setOptions: function (options) { 8617 var that = this, 8618 resize = false, 8619 resizableOptions = {}; 8620 8621 $.each(options, function (key, value) { 8622 that._setOption(key, value); 8623 8624 if (key in that.sizeRelatedOptions) { 8625 resize = true; 8626 } 8627 if (key in that.resizableRelatedOptions) { 8628 resizableOptions[key] = value; 8629 } 8630 }); 8631 8632 if (resize) { 8633 this._size(); 8634 this._position(); 8635 } 8636 if (this.uiDialog.is(":data(ui-resizable)")) { 8637 this.uiDialog.resizable("option", resizableOptions); 8638 } 8639 }, 8640 8641 _setOption: function (key, value) { 8642 var isDraggable, isResizable, 8643 uiDialog = this.uiDialog; 8644 8645 if (key === "dialogClass") { 8646 uiDialog 8647 .removeClass(this.options.dialogClass) 8648 .addClass(value); 8649 } 8650 8651 if (key === "disabled") { 8652 return; 8653 } 8654 8655 this._super(key, value); 8656 8657 if (key === "appendTo") { 8658 this.uiDialog.appendTo(this._appendTo()); 8659 } 8660 8661 if (key === "buttons") { 8662 this._createButtons(); 8663 } 8664 8665 if (key === "closeText") { 8666 this.uiDialogTitlebarClose.button({ 8667 // Ensure that we always pass a string 8668 label: "" + value 8669 }); 8670 } 8671 8672 if (key === "draggable") { 8673 isDraggable = uiDialog.is(":data(ui-draggable)"); 8674 if (isDraggable && !value) { 8675 uiDialog.draggable("destroy"); 8676 } 8677 8678 if (!isDraggable && value) { 8679 this._makeDraggable(); 8680 } 8681 } 8682 8683 if (key === "position") { 8684 this._position(); 8685 } 8686 8687 if (key === "resizable") { 8688 // currently resizable, becoming non-resizable 8689 isResizable = uiDialog.is(":data(ui-resizable)"); 8690 if (isResizable && !value) { 8691 uiDialog.resizable("destroy"); 8692 } 8693 8694 // currently resizable, changing handles 8695 if (isResizable && typeof value === "string") { 8696 uiDialog.resizable("option", "handles", value); 8697 } 8698 8699 // currently non-resizable, becoming resizable 8700 if (!isResizable && value !== false) { 8701 this._makeResizable(); 8702 } 8703 } 8704 8705 if (key === "title") { 8706 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 8707 } 8708 }, 8709 8710 _size: function () { 8711 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 8712 // divs will both have width and height set, so we need to reset them 8713 var nonContentHeight, minContentHeight, maxContentHeight, 8714 options = this.options; 8715 8716 // Reset content sizing 8717 this.element.show().css({ 8718 width: "auto", 8719 minHeight: 0, 8720 maxHeight: "none", 8721 height: 0 8722 }); 8723 8724 if (options.minWidth > options.width) { 8725 options.width = options.minWidth; 8726 } 8727 8728 // reset wrapper sizing 8729 // determine the height of all the non-content elements 8730 nonContentHeight = this.uiDialog.css({ 8731 height: "auto", 8732 width: options.width 8733 }) 8734 .outerHeight(); 8735 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 8736 maxContentHeight = typeof options.maxHeight === "number" ? 8737 Math.max(0, options.maxHeight - nonContentHeight) : 8738 "none"; 8739 8740 if (options.height === "auto") { 8741 this.element.css({ 8742 minHeight: minContentHeight, 8743 maxHeight: maxContentHeight, 8744 height: "auto" 8745 }); 8746 } else { 8747 this.element.height(Math.max(0, options.height - nonContentHeight)); 8748 } 8749 8750 if (this.uiDialog.is(":data(ui-resizable)")) { 8751 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 8752 } 8753 }, 8754 8755 _blockFrames: function () { 8756 this.iframeBlocks = this.document.find("iframe").map(function () { 8757 var iframe = $(this); 8758 8759 return $("<div>") 8760 .css({ 8761 position: "absolute", 8762 width: iframe.outerWidth(), 8763 height: iframe.outerHeight() 8764 }) 8765 .appendTo(iframe.parent()) 8766 .offset(iframe.offset())[0]; 8767 }); 8768 }, 8769 8770 _unblockFrames: function () { 8771 if (this.iframeBlocks) { 8772 this.iframeBlocks.remove(); 8773 delete this.iframeBlocks; 8774 } 8775 }, 8776 8777 _allowInteraction: function (event) { 8778 if ($(event.target).closest(".ui-dialog").length) { 8779 return true; 8780 } 8781 8782 // TODO: Remove hack when datepicker implements 8783 // the .ui-front logic (#8989) 8784 return !!$(event.target).closest(".ui-datepicker").length; 8785 }, 8786 8787 _createOverlay: function () { 8788 if (!this.options.modal) { 8789 return; 8790 } 8791 8792 // We use a delay in case the overlay is created from an 8793 // event that we're going to be cancelling (#2804) 8794 var isOpening = true; 8795 this._delay(function () { 8796 isOpening = false; 8797 }); 8798 8799 if (!this.document.data("ui-dialog-overlays")) { 8800 // Prevent use of anchors and inputs 8801 // Using _on() for an event handler shared across many instances is 8802 // safe because the dialogs stack and must be closed in reverse order 8803 this._on(this.document, { 8804 focusin: function (event) { 8805 if (isOpening) { 8806 return; 8807 } 8808 8809 if (!this._allowInteraction(event)) { 8810 event.preventDefault(); 8811 this._trackingInstances()[0]._focusTabbable(); 8812 } 8813 } 8814 }); 8815 } 8816 8817 this.overlay = $("<div>") 8818 .addClass("ui-widget-overlay ui-front") 8819 .appendTo(this._appendTo()); 8820 this._on(this.overlay, { 8821 mousedown: "_keepFocus" 8822 }); 8823 this.document.data("ui-dialog-overlays", 8824 (this.document.data("ui-dialog-overlays") || 0) + 1); 8825 }, 8826 8827 _destroyOverlay: function () { 8828 if (!this.options.modal) { 8829 return; 8830 } 8831 8832 if (this.overlay) { 8833 var overlays = this.document.data("ui-dialog-overlays") - 1; 8834 8835 if (!overlays) { 8836 this.document 8837 .unbind("focusin") 8838 .removeData("ui-dialog-overlays"); 8839 } else { 8840 this.document.data("ui-dialog-overlays", overlays); 8841 } 8842 8843 this.overlay.remove(); 8844 this.overlay = null; 8845 } 8846 } 8847 }); 8848 8849 /*! 8850 * jQuery UI Droppable 1.11.4 8851 * http://jqueryui.com 8852 * 8853 * Copyright jQuery Foundation and other contributors 8854 * Released under the MIT license. 8855 * http://jquery.org/license 8856 * 8857 * http://api.jqueryui.com/droppable/ 8858 */ 8859 8860 $.widget("ui.droppable", { 8861 version: "1.11.4", 8862 widgetEventPrefix: "drop", 8863 options: { 8864 accept: "*", 8865 activeClass: false, 8866 addClasses: true, 8867 greedy: false, 8868 hoverClass: false, 8869 scope: "default", 8870 tolerance: "intersect", 8871 8872 // callbacks 8873 activate: null, 8874 deactivate: null, 8875 drop: null, 8876 out: null, 8877 over: null 8878 }, 8879 _create: function () { 8880 var proportions, 8881 o = this.options, 8882 accept = o.accept; 8883 8884 this.isover = false; 8885 this.isout = true; 8886 8887 this.accept = $.isFunction(accept) ? accept : function (d) { 8888 return d.is(accept); 8889 }; 8890 8891 this.proportions = function ( /* valueToWrite */) { 8892 if (arguments.length) { 8893 // Store the droppable's proportions 8894 proportions = arguments[0]; 8895 } else { 8896 // Retrieve or derive the droppable's proportions 8897 return proportions ? 8898 proportions : 8899 proportions = { 8900 width: this.element[0].offsetWidth, 8901 height: this.element[0].offsetHeight 8902 }; 8903 } 8904 }; 8905 8906 this._addToManager(o.scope); 8907 8908 o.addClasses && this.element.addClass("ui-droppable"); 8909 }, 8910 8911 _addToManager: function (scope) { 8912 // Add the reference and positions to the manager 8913 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 8914 $.ui.ddmanager.droppables[scope].push(this); 8915 }, 8916 8917 _splice: function (drop) { 8918 var i = 0; 8919 for (; i < drop.length; i++) { 8920 if (drop[i] === this) { 8921 drop.splice(i, 1); 8922 } 8923 } 8924 }, 8925 8926 _destroy: function () { 8927 var drop = $.ui.ddmanager.droppables[this.options.scope]; 8928 8929 this._splice(drop); 8930 8931 this.element.removeClass("ui-droppable ui-droppable-disabled"); 8932 }, 8933 8934 _setOption: function (key, value) { 8935 if (key === "accept") { 8936 this.accept = $.isFunction(value) ? value : function (d) { 8937 return d.is(value); 8938 }; 8939 } else if (key === "scope") { 8940 var drop = $.ui.ddmanager.droppables[this.options.scope]; 8941 8942 this._splice(drop); 8943 this._addToManager(value); 8944 } 8945 8946 this._super(key, value); 8947 }, 8948 8949 _activate: function (event) { 8950 var draggable = $.ui.ddmanager.current; 8951 if (this.options.activeClass) { 8952 this.element.addClass(this.options.activeClass); 8953 } 8954 if (draggable) { 8955 this._trigger("activate", event, this.ui(draggable)); 8956 } 8957 }, 8958 8959 _deactivate: function (event) { 8960 var draggable = $.ui.ddmanager.current; 8961 if (this.options.activeClass) { 8962 this.element.removeClass(this.options.activeClass); 8963 } 8964 if (draggable) { 8965 this._trigger("deactivate", event, this.ui(draggable)); 8966 } 8967 }, 8968 8969 _over: function (event) { 8970 var draggable = $.ui.ddmanager.current; 8971 8972 // Bail if draggable and droppable are same element 8973 if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { 8974 return; 8975 } 8976 8977 if (this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) { 8978 if (this.options.hoverClass) { 8979 this.element.addClass(this.options.hoverClass); 8980 } 8981 this._trigger("over", event, this.ui(draggable)); 8982 } 8983 }, 8984 8985 _out: function (event) { 8986 var draggable = $.ui.ddmanager.current; 8987 8988 // Bail if draggable and droppable are same element 8989 if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { 8990 return; 8991 } 8992 8993 if (this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) { 8994 if (this.options.hoverClass) { 8995 this.element.removeClass(this.options.hoverClass); 8996 } 8997 this._trigger("out", event, this.ui(draggable)); 8998 } 8999 }, 9000 9001 _drop: function (event, custom) { 9002 var draggable = custom || $.ui.ddmanager.current, 9003 childrenIntersection = false;
vendor: 4,274 bytes, lines 9004-9134
9004 9005 // Bail if draggable and droppable are same element 9006 if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { 9007 return false; 9008 } 9009 9010 this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function () { 9011 var inst = $(this).droppable("instance"); 9012 if ( 9013 inst.options.greedy && 9014 !inst.options.disabled && 9015 inst.options.scope === draggable.options.scope && 9016 inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) && 9017 $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance, event) 9018 ) { childrenIntersection = true; return false; } 9019 }); 9020 if (childrenIntersection) { 9021 return false; 9022 } 9023 9024 if (this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) { 9025 if (this.options.activeClass) { 9026 this.element.removeClass(this.options.activeClass); 9027 } 9028 if (this.options.hoverClass) { 9029 this.element.removeClass(this.options.hoverClass); 9030 } 9031 this._trigger("drop", event, this.ui(draggable)); 9032 return this.element; 9033 } 9034 9035 return false; 9036 }, 9037 9038 ui: function (c) { 9039 return { 9040 draggable: (c.currentItem || c.element), 9041 helper: c.helper, 9042 position: c.position, 9043 offset: c.positionAbs 9044 }; 9045 } 9046 }); 9047 9048 $.ui.intersect = (function () { 9049 function isOverAxis(x, reference, size) { 9050 return (x >= reference) && (x < (reference + size)); 9051 } 9052 9053 return function (draggable, droppable, toleranceMode, event) { 9054 if (!droppable.offset) { 9055 return false; 9056 } 9057 9058 var x1 = (draggable.positionAbs || draggable.position.absolute).left + draggable.margins.left, 9059 y1 = (draggable.positionAbs || draggable.position.absolute).top + draggable.margins.top, 9060 x2 = x1 + draggable.helperProportions.width, 9061 y2 = y1 + draggable.helperProportions.height, 9062 l = droppable.offset.left, 9063 t = droppable.offset.top, 9064 r = l + droppable.proportions().width, 9065 b = t + droppable.proportions().height; 9066 9067 switch (toleranceMode) { 9068 case "fit": 9069 return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 9070 case "intersect": 9071 return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 9072 x2 - (draggable.helperProportions.width / 2) < r && // Left Half 9073 t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 9074 y2 - (draggable.helperProportions.height / 2) < b); // Top Half 9075 case "pointer": 9076 return isOverAxis(event.pageY, t, droppable.proportions().height) && isOverAxis(event.pageX, l, droppable.proportions().width); 9077 case "touch": 9078 return ( 9079 (y1 >= t && y1 <= b) || // Top edge touching 9080 (y2 >= t && y2 <= b) || // Bottom edge touching 9081 (y1 < t && y2 > b) // Surrounded vertically 9082 ) && ( 9083 (x1 >= l && x1 <= r) || // Left edge touching 9084 (x2 >= l && x2 <= r) || // Right edge touching 9085 (x1 < l && x2 > r) // Surrounded horizontally 9086 ); 9087 default: 9088 return false; 9089 } 9090 }; 9091 })(); 9092 9093 /* 9094 This manager tracks offsets of draggables and droppables 9095 */ 9096 $.ui.ddmanager = { 9097 current: null, 9098 droppables: { "default": [] }, 9099 prepareOffsets: function (t, event) { 9100 var i, j, 9101 m = $.ui.ddmanager.droppables[t.options.scope] || [], 9102 type = event ? event.type : null, // workaround for #2317 9103 list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 9104 9105 droppablesLoop: for (i = 0; i < m.length; i++) { 9106 // No disabled and non-accepted 9107 if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], (t.currentItem || t.element)))) { 9108 continue; 9109 } 9110 9111 // Filter out elements in the current dragged item 9112 for (j = 0; j < list.length; j++) { 9113 if (list[j] === m[i].element[0]) { 9114 m[i].proportions().height = 0; 9115 continue droppablesLoop; 9116 } 9117 } 9118 9119 m[i].visible = m[i].element.css("display") !== "none"; 9120 if (!m[i].visible) { 9121 continue; 9122 } 9123 9124 // Activate the droppable if used directly from draggables 9125 if (type === "mousedown") { 9126 m[i]._activate.call(m[i], event); 9127 } 9128 9129 m[i].offset = m[i].element.offset(); 9130 m[i].proportions({ width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }); 9131 } 9132 }, 9133 drop: function (draggable, event) { 9134 var dropped = false;
vendor: 72,100 bytes, lines 9135-11905
9135 // Create a copy of the droppables in case the list changes during the drop (#9116) 9136 $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () { 9137 if (!this.options) { 9138 return; 9139 } 9140 if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance, event)) { 9141 dropped = this._drop.call(this, event) || dropped; 9142 } 9143 9144 if (!this.options.disabled && this.visible && this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) { 9145 this.isout = true; 9146 this.isover = false; 9147 this._deactivate.call(this, event); 9148 } 9149 }); 9150 return dropped; 9151 }, 9152 dragStart: function (draggable, event) { 9153 // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) 9154 draggable.element.parentsUntil("body").bind("scroll.droppable", function () { 9155 if (!draggable.options.refreshPositions) { 9156 $.ui.ddmanager.prepareOffsets(draggable, event); 9157 } 9158 }); 9159 }, 9160 drag: function (draggable, event) { 9161 // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. 9162 if (draggable.options.refreshPositions) { 9163 $.ui.ddmanager.prepareOffsets(draggable, event); 9164 } 9165 9166 // Run through all droppables and check their positions based on specific tolerance options 9167 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () { 9168 if (this.options.disabled || this.greedyChild || !this.visible) { 9169 return; 9170 } 9171 9172 var parentInstance, scope, parent, 9173 intersects = $.ui.intersect(draggable, this, this.options.tolerance, event), 9174 c = !intersects && this.isover ? "isout" : (intersects && !this.isover ? "isover" : null); 9175 if (!c) { 9176 return; 9177 } 9178 9179 if (this.options.greedy) { 9180 // find droppable parents with same scope 9181 scope = this.options.scope; 9182 parent = this.element.parents(":data(ui-droppable)").filter(function () { 9183 return $(this).droppable("instance").options.scope === scope; 9184 }); 9185 9186 if (parent.length) { 9187 parentInstance = $(parent[0]).droppable("instance"); 9188 parentInstance.greedyChild = (c === "isover"); 9189 } 9190 } 9191 9192 // we just moved into a greedy child 9193 if (parentInstance && c === "isover") { 9194 parentInstance.isover = false; 9195 parentInstance.isout = true; 9196 parentInstance._out.call(parentInstance, event); 9197 } 9198 9199 this[c] = true; 9200 this[c === "isout" ? "isover" : "isout"] = false; 9201 this[c === "isover" ? "_over" : "_out"].call(this, event); 9202 9203 // we just moved out of a greedy child 9204 if (parentInstance && c === "isout") { 9205 parentInstance.isout = false; 9206 parentInstance.isover = true; 9207 parentInstance._over.call(parentInstance, event); 9208 } 9209 }); 9210 }, 9211 dragStop: function (draggable, event) { 9212 draggable.element.parentsUntil("body").unbind("scroll.droppable"); 9213 // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) 9214 if (!draggable.options.refreshPositions) { 9215 $.ui.ddmanager.prepareOffsets(draggable, event); 9216 } 9217 } 9218 }; 9219 9220 var droppable = $.ui.droppable; 9221 9222 /*! 9223 * jQuery UI Effects 1.11.4 9224 * http://jqueryui.com 9225 * 9226 * Copyright jQuery Foundation and other contributors 9227 * Released under the MIT license. 9228 * http://jquery.org/license 9229 * 9230 * http://api.jqueryui.com/category/effects-core/ 9231 */ 9232 9233 var dataSpace = "ui-effects-", 9234 9235 // Create a local jQuery because jQuery Color relies on it and the 9236 // global may not exist with AMD and a custom build (#10199) 9237 jQuery = $; 9238 9239 $.effects = { 9240 effect: {} 9241 }; 9242 9243 /*! 9244 * jQuery Color Animations v2.1.2 9245 * https://github.com/jquery/jquery-color 9246 * 9247 * Copyright 2014 jQuery Foundation and other contributors 9248 * Released under the MIT license. 9249 * http://jquery.org/license 9250 * 9251 * Date: Wed Jan 16 08:47:09 2013 -0600 9252 */ 9253 (function (jQuery, undefined) { 9254 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 9255 9256 // plusequals test for += 100 -= 100 9257 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 9258 // a set of RE's that can match strings and generate color tuples. 9259 stringParsers = [{ 9260 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 9261 parse: function (execResult) { 9262 return [ 9263 execResult[1], 9264 execResult[2], 9265 execResult[3], 9266 execResult[4] 9267 ]; 9268 } 9269 }, { 9270 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 9271 parse: function (execResult) { 9272 return [ 9273 execResult[1] * 2.55, 9274 execResult[2] * 2.55, 9275 execResult[3] * 2.55, 9276 execResult[4] 9277 ]; 9278 } 9279 }, { 9280 // this regex ignores A-F because it's compared against an already lowercased string 9281 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, 9282 parse: function (execResult) { 9283 return [ 9284 parseInt(execResult[1], 16), 9285 parseInt(execResult[2], 16), 9286 parseInt(execResult[3], 16) 9287 ]; 9288 } 9289 }, { 9290 // this regex ignores A-F because it's compared against an already lowercased string 9291 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, 9292 parse: function (execResult) { 9293 return [ 9294 parseInt(execResult[1] + execResult[1], 16), 9295 parseInt(execResult[2] + execResult[2], 16), 9296 parseInt(execResult[3] + execResult[3], 16) 9297 ]; 9298 } 9299 }, { 9300 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 9301 space: "hsla", 9302 parse: function (execResult) { 9303 return [ 9304 execResult[1], 9305 execResult[2] / 100, 9306 execResult[3] / 100, 9307 execResult[4] 9308 ]; 9309 } 9310 }], 9311 9312 // jQuery.Color( ) 9313 color = jQuery.Color = function (color, green, blue, alpha) { 9314 return new jQuery.Color.fn.parse(color, green, blue, alpha); 9315 }, 9316 spaces = { 9317 rgba: { 9318 props: { 9319 red: { 9320 idx: 0, 9321 type: "byte" 9322 }, 9323 green: { 9324 idx: 1, 9325 type: "byte" 9326 }, 9327 blue: { 9328 idx: 2, 9329 type: "byte" 9330 } 9331 } 9332 }, 9333 9334 hsla: { 9335 props: { 9336 hue: { 9337 idx: 0, 9338 type: "degrees" 9339 }, 9340 saturation: { 9341 idx: 1, 9342 type: "percent" 9343 }, 9344 lightness: { 9345 idx: 2, 9346 type: "percent" 9347 } 9348 } 9349 } 9350 }, 9351 propTypes = { 9352 "byte": { 9353 floor: true, 9354 max: 255 9355 }, 9356 "percent": { 9357 max: 1 9358 }, 9359 "degrees": { 9360 mod: 360, 9361 floor: true 9362 } 9363 }, 9364 support = color.support = {}, 9365 9366 // element for support tests 9367 supportElem = jQuery("<p>")[0], 9368 9369 // colors = jQuery.Color.names 9370 colors, 9371 9372 // local aliases of functions called often 9373 each = jQuery.each; 9374 9375 // determine rgba support immediately 9376 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 9377 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 9378 9379 // define cache name and alpha properties 9380 // for rgba and hsla spaces 9381 each(spaces, function (spaceName, space) { 9382 space.cache = "_" + spaceName; 9383 space.props.alpha = { 9384 idx: 3, 9385 type: "percent", 9386 def: 1 9387 }; 9388 }); 9389 9390 function clamp(value, prop, allowEmpty) { 9391 var type = propTypes[prop.type] || {}; 9392 9393 if (value == null) { 9394 return (allowEmpty || !prop.def) ? null : prop.def; 9395 } 9396 9397 // ~~ is an short way of doing floor for positive numbers 9398 value = type.floor ? ~~value : parseFloat(value); 9399 9400 // IE will pass in empty strings as value for alpha, 9401 // which will hit this case 9402 if (isNaN(value)) { 9403 return prop.def; 9404 } 9405 9406 if (type.mod) { 9407 // we add mod before modding to make sure that negatives values 9408 // get converted properly: -10 -> 350 9409 return (value + type.mod) % type.mod; 9410 } 9411 9412 // for now all property types without mod have min and max 9413 return 0 > value ? 0 : type.max < value ? type.max : value; 9414 } 9415 9416 function stringParse(string) { 9417 var inst = color(), 9418 rgba = inst._rgba = []; 9419 9420 string = string.toLowerCase(); 9421 9422 each(stringParsers, function (i, parser) { 9423 var parsed, 9424 match = parser.re.exec(string), 9425 values = match && parser.parse(match), 9426 spaceName = parser.space || "rgba"; 9427 9428 if (values) { 9429 parsed = inst[spaceName](values); 9430 9431 // if this was an rgba parse the assignment might happen twice 9432 // oh well.... 9433 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 9434 rgba = inst._rgba = parsed._rgba; 9435 9436 // exit each( stringParsers ) here because we matched 9437 return false; 9438 } 9439 }); 9440 9441 // Found a stringParser that handled it 9442 if (rgba.length) { 9443 // if this came from a parsed string, force "transparent" when alpha is 0 9444 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 9445 if (rgba.join() === "0,0,0,0") { 9446 jQuery.extend(rgba, colors.transparent); 9447 } 9448 return inst; 9449 } 9450 9451 // named colors 9452 return colors[string]; 9453 } 9454 9455 color.fn = jQuery.extend(color.prototype, { 9456 parse: function (red, green, blue, alpha) { 9457 if (red === undefined) { 9458 this._rgba = [null, null, null, null]; 9459 return this; 9460 } 9461 if (red.jquery || red.nodeType) { 9462 red = jQuery(red).css(green); 9463 green = undefined; 9464 } 9465 9466 var inst = this, 9467 type = jQuery.type(red), 9468 rgba = this._rgba = []; 9469 9470 // more than 1 argument specified - assume ( red, green, blue, alpha ) 9471 if (green !== undefined) { 9472 red = [red, green, blue, alpha]; 9473 type = "array"; 9474 } 9475 9476 if (type === "string") { 9477 return this.parse(stringParse(red) || colors._default); 9478 } 9479 9480 if (type === "array") { 9481 each(spaces.rgba.props, function (key, prop) { 9482 rgba[prop.idx] = clamp(red[prop.idx], prop); 9483 }); 9484 return this; 9485 } 9486 9487 if (type === "object") { 9488 if (red instanceof color) { 9489 each(spaces, function (spaceName, space) { 9490 if (red[space.cache]) { 9491 inst[space.cache] = red[space.cache].slice(); 9492 } 9493 }); 9494 } else { 9495 each(spaces, function (spaceName, space) { 9496 var cache = space.cache; 9497 each(space.props, function (key, prop) { 9498 // if the cache doesn't exist, and we know how to convert 9499 if (!inst[cache] && space.to) { 9500 // if the value was null, we don't need to copy it 9501 // if the key was alpha, we don't need to copy it either 9502 if (key === "alpha" || red[key] == null) { 9503 return; 9504 } 9505 inst[cache] = space.to(inst._rgba); 9506 } 9507 9508 // this is the only case where we allow nulls for ALL properties. 9509 // call clamp with alwaysAllowEmpty 9510 inst[cache][prop.idx] = clamp(red[key], prop, true); 9511 }); 9512 9513 // everything defined but alpha? 9514 if (inst[cache] && jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) { 9515 // use the default of 1 9516 inst[cache][3] = 1; 9517 if (space.from) { 9518 inst._rgba = space.from(inst[cache]); 9519 } 9520 } 9521 }); 9522 } 9523 return this; 9524 } 9525 }, 9526 is: function (compare) { 9527 var is = color(compare), 9528 same = true, 9529 inst = this; 9530 9531 each(spaces, function (_, space) { 9532 var localCache, 9533 isCache = is[space.cache]; 9534 if (isCache) { 9535 localCache = inst[space.cache] || space.to && space.to(inst._rgba) || []; 9536 each(space.props, function (_, prop) { 9537 if (isCache[prop.idx] != null) { 9538 same = (isCache[prop.idx] === localCache[prop.idx]); 9539 return same; 9540 } 9541 }); 9542 } 9543 return same; 9544 }); 9545 return same; 9546 }, 9547 _space: function () { 9548 var used = [], 9549 inst = this; 9550 each(spaces, function (spaceName, space) { 9551 if (inst[space.cache]) { 9552 used.push(spaceName); 9553 } 9554 }); 9555 return used.pop(); 9556 }, 9557 transition: function (other, distance) { 9558 var end = color(other), 9559 spaceName = end._space(), 9560 space = spaces[spaceName], 9561 startColor = this.alpha() === 0 ? color("transparent") : this, 9562 start = startColor[space.cache] || space.to(startColor._rgba), 9563 result = start.slice(); 9564 9565 end = end[space.cache]; 9566 each(space.props, function (key, prop) { 9567 var index = prop.idx, 9568 startValue = start[index], 9569 endValue = end[index], 9570 type = propTypes[prop.type] || {}; 9571 9572 // if null, don't override start value 9573 if (endValue === null) { 9574 return; 9575 } 9576 // if null - use end 9577 if (startValue === null) { 9578 result[index] = endValue; 9579 } else { 9580 if (type.mod) { 9581 if (endValue - startValue > type.mod / 2) { 9582 startValue += type.mod; 9583 } else if (startValue - endValue > type.mod / 2) { 9584 startValue -= type.mod; 9585 } 9586 } 9587 result[index] = clamp((endValue - startValue) * distance + startValue, prop); 9588 } 9589 }); 9590 return this[spaceName](result); 9591 }, 9592 blend: function (opaque) { 9593 // if we are already opaque - return ourself 9594 if (this._rgba[3] === 1) { 9595 return this; 9596 } 9597 9598 var rgb = this._rgba.slice(), 9599 a = rgb.pop(), 9600 blend = color(opaque)._rgba; 9601 9602 return color(jQuery.map(rgb, function (v, i) { 9603 return (1 - a) * blend[i] + a * v; 9604 })); 9605 }, 9606 toRgbaString: function () { 9607 var prefix = "rgba(", 9608 rgba = jQuery.map(this._rgba, function (v, i) { 9609 return v == null ? (i > 2 ? 1 : 0) : v; 9610 }); 9611 9612 if (rgba[3] === 1) { 9613 rgba.pop(); 9614 prefix = "rgb("; 9615 } 9616 9617 return prefix + rgba.join() + ")"; 9618 }, 9619 toHslaString: function () { 9620 var prefix = "hsla(", 9621 hsla = jQuery.map(this.hsla(), function (v, i) { 9622 if (v == null) { 9623 v = i > 2 ? 1 : 0; 9624 } 9625 9626 // catch 1 and 2 9627 if (i && i < 3) { 9628 v = Math.round(v * 100) + "%"; 9629 } 9630 return v; 9631 }); 9632 9633 if (hsla[3] === 1) { 9634 hsla.pop(); 9635 prefix = "hsl("; 9636 } 9637 return prefix + hsla.join() + ")"; 9638 }, 9639 toHexString: function (includeAlpha) { 9640 var rgba = this._rgba.slice(), 9641 alpha = rgba.pop(); 9642 9643 if (includeAlpha) { 9644 rgba.push(~~(alpha * 255)); 9645 } 9646 9647 return "#" + jQuery.map(rgba, function (v) { 9648 // default to 0 when nulls exist 9649 v = (v || 0).toString(16); 9650 return v.length === 1 ? "0" + v : v; 9651 }).join(""); 9652 }, 9653 toString: function () { 9654 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 9655 } 9656 }); 9657 color.fn.parse.prototype = color.fn; 9658 9659 // hsla conversions adapted from: 9660 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 9661 9662 function hue2rgb(p, q, h) { 9663 h = (h + 1) % 1; 9664 if (h * 6 < 1) { 9665 return p + (q - p) * h * 6; 9666 } 9667 if (h * 2 < 1) { 9668 return q; 9669 } 9670 if (h * 3 < 2) { 9671 return p + (q - p) * ((2 / 3) - h) * 6; 9672 } 9673 return p; 9674 } 9675 9676 spaces.hsla.to = function (rgba) { 9677 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 9678 return [null, null, null, rgba[3]]; 9679 } 9680 var r = rgba[0] / 255, 9681 g = rgba[1] / 255, 9682 b = rgba[2] / 255, 9683 a = rgba[3], 9684 max = Math.max(r, g, b), 9685 min = Math.min(r, g, b), 9686 diff = max - min, 9687 add = max + min, 9688 l = add * 0.5, 9689 h, s; 9690 9691 if (min === max) { 9692 h = 0; 9693 } else if (r === max) { 9694 h = (60 * (g - b) / diff) + 360; 9695 } else if (g === max) { 9696 h = (60 * (b - r) / diff) + 120; 9697 } else { 9698 h = (60 * (r - g) / diff) + 240; 9699 } 9700 9701 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 9702 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 9703 if (diff === 0) { 9704 s = 0; 9705 } else if (l <= 0.5) { 9706 s = diff / add; 9707 } else { 9708 s = diff / (2 - add); 9709 } 9710 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 9711 }; 9712 9713 spaces.hsla.from = function (hsla) { 9714 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 9715 return [null, null, null, hsla[3]]; 9716 } 9717 var h = hsla[0] / 360, 9718 s = hsla[1], 9719 l = hsla[2], 9720 a = hsla[3], 9721 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 9722 p = 2 * l - q; 9723 9724 return [ 9725 Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), 9726 Math.round(hue2rgb(p, q, h) * 255), 9727 Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), 9728 a 9729 ]; 9730 }; 9731 9732 each(spaces, function (spaceName, space) { 9733 var props = space.props, 9734 cache = space.cache, 9735 to = space.to, 9736 from = space.from; 9737 9738 // makes rgba() and hsla() 9739 color.fn[spaceName] = function (value) { 9740 // generate a cache for this space if it doesn't exist 9741 if (to && !this[cache]) { 9742 this[cache] = to(this._rgba); 9743 } 9744 if (value === undefined) { 9745 return this[cache].slice(); 9746 } 9747 9748 var ret, 9749 type = jQuery.type(value), 9750 arr = (type === "array" || type === "object") ? value : arguments, 9751 local = this[cache].slice(); 9752 9753 each(props, function (key, prop) { 9754 var val = arr[type === "object" ? key : prop.idx]; 9755 if (val == null) { 9756 val = local[prop.idx]; 9757 } 9758 local[prop.idx] = clamp(val, prop); 9759 }); 9760 9761 if (from) { 9762 ret = color(from(local)); 9763 ret[cache] = local; 9764 return ret; 9765 } else { 9766 return color(local); 9767 } 9768 }; 9769 9770 // makes red() green() blue() alpha() hue() saturation() lightness() 9771 each(props, function (key, prop) { 9772 // alpha is included in more than one space 9773 if (color.fn[key]) { 9774 return; 9775 } 9776 color.fn[key] = function (value) { 9777 var vtype = jQuery.type(value), 9778 fn = (key === "alpha" ? (this._hsla ? "hsla" : "rgba") : spaceName), 9779 local = this[fn](), 9780 cur = local[prop.idx], 9781 match; 9782 9783 if (vtype === "undefined") { 9784 return cur; 9785 } 9786 9787 if (vtype === "function") { 9788 value = value.call(this, cur); 9789 vtype = jQuery.type(value); 9790 } 9791 if (value == null && prop.empty) { 9792 return this; 9793 } 9794 if (vtype === "string") { 9795 match = rplusequals.exec(value); 9796 if (match) { 9797 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 9798 } 9799 } 9800 local[prop.idx] = value; 9801 return this[fn](local); 9802 }; 9803 }); 9804 }); 9805 9806 // add cssHook and .fx.step function for each named hook. 9807 // accept a space separated string of properties 9808 color.hook = function (hook) { 9809 var hooks = hook.split(" "); 9810 each(hooks, function (i, hook) { 9811 jQuery.cssHooks[hook] = { 9812 set: function (elem, value) { 9813 var parsed, curElem, 9814 backgroundColor = ""; 9815 9816 if (value !== "transparent" && (jQuery.type(value) !== "string" || (parsed = stringParse(value)))) { 9817 value = color(parsed || value); 9818 if (!support.rgba && value._rgba[3] !== 1) { 9819 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 9820 while ( 9821 (backgroundColor === "" || backgroundColor === "transparent") && 9822 curElem && curElem.style 9823 ) { 9824 try { 9825 backgroundColor = jQuery.css(curElem, "backgroundColor"); 9826 curElem = curElem.parentNode; 9827 } catch (e) { 9828 } 9829 } 9830 9831 value = value.blend(backgroundColor && backgroundColor !== "transparent" ? 9832 backgroundColor : 9833 "_default"); 9834 } 9835 9836 value = value.toRgbaString(); 9837 } 9838 try { 9839 elem.style[hook] = value; 9840 } catch (e) { 9841 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 9842 } 9843 } 9844 }; 9845 jQuery.fx.step[hook] = function (fx) { 9846 if (!fx.colorInit) { 9847 fx.start = color(fx.elem, hook); 9848 fx.end = color(fx.end); 9849 fx.colorInit = true; 9850 } 9851 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 9852 }; 9853 }); 9854 }; 9855 9856 color.hook(stepHooks); 9857 9858 jQuery.cssHooks.borderColor = { 9859 expand: function (value) { 9860 var expanded = {}; 9861 9862 each(["Top", "Right", "Bottom", "Left"], function (i, part) { 9863 expanded["border" + part + "Color"] = value; 9864 }); 9865 return expanded; 9866 } 9867 }; 9868 9869 // Basic color names only. 9870 // Usage of any of the other color names requires adding yourself or including 9871 // jquery.color.svg-names.js. 9872 colors = jQuery.Color.names = { 9873 // 4.1. Basic color keywords 9874 aqua: "#00ffff", 9875 black: "#000000", 9876 blue: "#0000ff", 9877 fuchsia: "#ff00ff", 9878 gray: "#808080", 9879 green: "#008000", 9880 lime: "#00ff00", 9881 maroon: "#800000", 9882 navy: "#000080", 9883 olive: "#808000", 9884 purple: "#800080", 9885 red: "#ff0000", 9886 silver: "#c0c0c0", 9887 teal: "#008080", 9888 white: "#ffffff", 9889 yellow: "#ffff00", 9890 9891 // 4.2.3. "transparent" color keyword 9892 transparent: [null, null, null, 0], 9893 9894 _default: "#ffffff" 9895 }; 9896 })(jQuery); 9897 9898 /******************************************************************************/ 9899 /****************************** CLASS ANIMATIONS ******************************/ 9900 /******************************************************************************/ 9901 (function () { 9902 var classAnimationActions = ["add", "remove", "toggle"], 9903 shorthandStyles = { 9904 border: 1, 9905 borderBottom: 1, 9906 borderColor: 1, 9907 borderLeft: 1, 9908 borderRight: 1, 9909 borderTop: 1, 9910 borderWidth: 1, 9911 margin: 1, 9912 padding: 1 9913 }; 9914 9915 $.each(["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], function (_, prop) { 9916 $.fx.step[prop] = function (fx) { 9917 if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) { 9918 jQuery.style(fx.elem, prop, fx.end); 9919 fx.setAttr = true; 9920 } 9921 }; 9922 }); 9923 9924 function getElementStyles(elem) { 9925 var key, len, 9926 style = elem.ownerDocument.defaultView ? 9927 elem.ownerDocument.defaultView.getComputedStyle(elem, null) : 9928 elem.currentStyle, 9929 styles = {}; 9930 9931 if (style && style.length && style[0] && style[style[0]]) { 9932 len = style.length; 9933 while (len--) { 9934 key = style[len]; 9935 if (typeof style[key] === "string") { 9936 styles[$.camelCase(key)] = style[key]; 9937 } 9938 } 9939 // support: Opera, IE <9 9940 } else { 9941 for (key in style) { 9942 if (typeof style[key] === "string") { 9943 styles[key] = style[key]; 9944 } 9945 } 9946 } 9947 9948 return styles; 9949 } 9950 9951 function styleDifference(oldStyle, newStyle) { 9952 var diff = {}, 9953 name, value; 9954 9955 for (name in newStyle) { 9956 value = newStyle[name]; 9957 if (oldStyle[name] !== value) { 9958 if (!shorthandStyles[name]) { 9959 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 9960 diff[name] = value; 9961 } 9962 } 9963 } 9964 } 9965 9966 return diff; 9967 } 9968 9969 // support: jQuery <1.8 9970 if (!$.fn.addBack) { 9971 $.fn.addBack = function (selector) { 9972 return this.add(selector == null ? 9973 this.prevObject : this.prevObject.filter(selector) 9974 ); 9975 }; 9976 } 9977 9978 $.effects.animateClass = function (value, duration, easing, callback) { 9979 var o = $.speed(duration, easing, callback); 9980 9981 return this.queue(function () { 9982 var animated = $(this), 9983 baseClass = animated.attr("class") || "", 9984 applyClassChange, 9985 allAnimations = o.children ? animated.find("*").addBack() : animated; 9986 9987 // map the animated objects to store the original styles. 9988 allAnimations = allAnimations.map(function () { 9989 var el = $(this); 9990 return { 9991 el: el, 9992 start: getElementStyles(this) 9993 }; 9994 }); 9995 9996 // apply class change 9997 applyClassChange = function () { 9998 $.each(classAnimationActions, function (i, action) { 9999 if (value[action]) { 10000 animated[action + "Class"](value[action]); 10001 } 10002 }); 10003 }; 10004 applyClassChange(); 10005 10006 // map all animated objects again - calculate new styles and diff 10007 allAnimations = allAnimations.map(function () { 10008 this.end = getElementStyles(this.el[0]); 10009 this.diff = styleDifference(this.start, this.end); 10010 return this; 10011 }); 10012 10013 // apply original class 10014 animated.attr("class", baseClass); 10015 10016 // map all animated objects again - this time collecting a promise 10017 allAnimations = allAnimations.map(function () { 10018 var styleInfo = this, 10019 dfd = $.Deferred(), 10020 opts = $.extend({}, o, { 10021 queue: false, 10022 complete: function () { 10023 dfd.resolve(styleInfo); 10024 } 10025 }); 10026 10027 this.el.animate(this.diff, opts); 10028 return dfd.promise(); 10029 }); 10030 10031 // once all animations have completed: 10032 $.when.apply($, allAnimations.get()).done(function () { 10033 // set the final class 10034 applyClassChange(); 10035 10036 // for each animated element, 10037 // clear all css properties that were animated 10038 $.each(arguments, function () { 10039 var el = this.el; 10040 $.each(this.diff, function (key) { 10041 el.css(key, ""); 10042 }); 10043 }); 10044 10045 // this is guarnteed to be there if you use jQuery.speed() 10046 // it also handles dequeuing the next anim... 10047 o.complete.call(animated[0]); 10048 }); 10049 }); 10050 }; 10051 10052 $.fn.extend({ 10053 addClass: (function (orig) { 10054 return function (classNames, speed, easing, callback) { 10055 return speed ? 10056 $.effects.animateClass.call(this, 10057 { add: classNames }, speed, easing, callback) : 10058 orig.apply(this, arguments); 10059 }; 10060 })($.fn.addClass), 10061 10062 removeClass: (function (orig) { 10063 return function (classNames, speed, easing, callback) { 10064 return arguments.length > 1 ? 10065 $.effects.animateClass.call(this, 10066 { remove: classNames }, speed, easing, callback) : 10067 orig.apply(this, arguments); 10068 }; 10069 })($.fn.removeClass), 10070 10071 toggleClass: (function (orig) { 10072 return function (classNames, force, speed, easing, callback) { 10073 if (typeof force === "boolean" || force === undefined) { 10074 if (!speed) { 10075 // without speed parameter 10076 return orig.apply(this, arguments); 10077 } else { 10078 return $.effects.animateClass.call(this, 10079 (force ? { add: classNames } : { remove: classNames }), 10080 speed, easing, callback); 10081 } 10082 } else { 10083 // without force parameter 10084 return $.effects.animateClass.call(this, 10085 { toggle: classNames }, force, speed, easing); 10086 } 10087 }; 10088 })($.fn.toggleClass), 10089 10090 switchClass: function (remove, add, speed, easing, callback) { 10091 return $.effects.animateClass.call(this, { 10092 add: add, 10093 remove: remove 10094 }, speed, easing, callback); 10095 } 10096 }); 10097 })(); 10098 10099 /******************************************************************************/ 10100 /*********************************** EFFECTS **********************************/ 10101 /******************************************************************************/ 10102 10103 (function () { 10104 $.extend($.effects, { 10105 version: "1.11.4", 10106 10107 // Saves a set of properties in a data storage 10108 save: function (element, set) { 10109 for (var i = 0; i < set.length; i++) { 10110 if (set[i] !== null) { 10111 element.data(dataSpace + set[i], element[0].style[set[i]]); 10112 } 10113 } 10114 }, 10115 10116 // Restores a set of previously saved properties from a data storage 10117 restore: function (element, set) { 10118 var val, i; 10119 for (i = 0; i < set.length; i++) { 10120 if (set[i] !== null) { 10121 val = element.data(dataSpace + set[i]); 10122 // support: jQuery 1.6.2 10123 // http://bugs.jquery.com/ticket/9917 10124 // jQuery 1.6.2 incorrectly returns undefined for any falsy value. 10125 // We can't differentiate between "" and 0 here, so we just assume 10126 // empty string since it's likely to be a more common value... 10127 if (val === undefined) { 10128 val = ""; 10129 } 10130 element.css(set[i], val); 10131 } 10132 } 10133 }, 10134 10135 setMode: function (el, mode) { 10136 if (mode === "toggle") { 10137 mode = el.is(":hidden") ? "show" : "hide"; 10138 } 10139 return mode; 10140 }, 10141 10142 // Translates a [top,left] array into a baseline value 10143 // this should be a little more flexible in the future to handle a string & hash 10144 getBaseline: function (origin, original) { 10145 var y, x; 10146 switch (origin[0]) { 10147 case "top": y = 0; break; 10148 case "middle": y = 0.5; break; 10149 case "bottom": y = 1; break; 10150 default: y = origin[0] / original.height; 10151 } 10152 switch (origin[1]) { 10153 case "left": x = 0; break; 10154 case "center": x = 0.5; break; 10155 case "right": x = 1; break; 10156 default: x = origin[1] / original.width; 10157 } 10158 return { 10159 x: x, 10160 y: y 10161 }; 10162 }, 10163 10164 // Wraps the element around a wrapper that copies position properties 10165 createWrapper: function (element) { 10166 // if the element is already wrapped, return it 10167 if (element.parent().is(".ui-effects-wrapper")) { 10168 return element.parent(); 10169 } 10170 10171 // wrap the element 10172 var props = { 10173 width: element.outerWidth(true), 10174 height: element.outerHeight(true), 10175 "float": element.css("float") 10176 }, 10177 wrapper = $("<div></div>") 10178 .addClass("ui-effects-wrapper") 10179 .css({ 10180 fontSize: "100%", 10181 background: "transparent", 10182 border: "none", 10183 margin: 0, 10184 padding: 0 10185 }), 10186 // Store the size in case width/height are defined in % - Fixes #5245 10187 size = { 10188 width: element.width(), 10189 height: element.height() 10190 }, 10191 active = document.activeElement; 10192 10193 // support: Firefox 10194 // Firefox incorrectly exposes anonymous content 10195 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 10196 try { 10197 active.id; 10198 } catch (e) { 10199 active = document.body; 10200 } 10201 10202 element.wrap(wrapper); 10203 10204 // Fixes #7595 - Elements lose focus when wrapped. 10205 if (element[0] === active || $.contains(element[0], active)) { 10206 $(active).focus(); 10207 } 10208 10209 wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element 10210 10211 // transfer positioning properties to the wrapper 10212 if (element.css("position") === "static") { 10213 wrapper.css({ position: "relative" }); 10214 element.css({ position: "relative" }); 10215 } else { 10216 $.extend(props, { 10217 position: element.css("position"), 10218 zIndex: element.css("z-index") 10219 }); 10220 $.each(["top", "left", "bottom", "right"], function (i, pos) { 10221 props[pos] = element.css(pos); 10222 if (isNaN(parseInt(props[pos], 10))) { 10223 props[pos] = "auto"; 10224 } 10225 }); 10226 element.css({ 10227 position: "relative", 10228 top: 0, 10229 left: 0, 10230 right: "auto", 10231 bottom: "auto" 10232 }); 10233 } 10234 element.css(size); 10235 10236 return wrapper.css(props).show(); 10237 }, 10238 10239 removeWrapper: function (element) { 10240 var active = document.activeElement; 10241 10242 if (element.parent().is(".ui-effects-wrapper")) { 10243 element.parent().replaceWith(element); 10244 10245 // Fixes #7595 - Elements lose focus when wrapped. 10246 if (element[0] === active || $.contains(element[0], active)) { 10247 $(active).focus(); 10248 } 10249 } 10250 10251 return element; 10252 }, 10253 10254 setTransition: function (element, list, factor, value) { 10255 value = value || {}; 10256 $.each(list, function (i, x) { 10257 var unit = element.cssUnit(x); 10258 if (unit[0] > 0) { 10259 value[x] = unit[0] * factor + unit[1]; 10260 } 10261 }); 10262 return value; 10263 } 10264 }); 10265 10266 // return an effect options object for the given parameters: 10267 function _normalizeArguments(effect, options, speed, callback) { 10268 // allow passing all options as the first parameter 10269 if ($.isPlainObject(effect)) { 10270 options = effect; 10271 effect = effect.effect; 10272 } 10273 10274 // convert to an object 10275 effect = { effect: effect }; 10276 10277 // catch (effect, null, ...) 10278 if (options == null) { 10279 options = {}; 10280 } 10281 10282 // catch (effect, callback) 10283 if ($.isFunction(options)) { 10284 callback = options; 10285 speed = null; 10286 options = {}; 10287 } 10288 10289 // catch (effect, speed, ?) 10290 if (typeof options === "number" || $.fx.speeds[options]) { 10291 callback = speed; 10292 speed = options; 10293 options = {}; 10294 } 10295 10296 // catch (effect, options, callback) 10297 if ($.isFunction(speed)) { 10298 callback = speed; 10299 speed = null; 10300 } 10301 10302 // add options to effect 10303 if (options) { 10304 $.extend(effect, options); 10305 } 10306 10307 speed = speed || options.duration; 10308 effect.duration = $.fx.off ? 0 : 10309 typeof speed === "number" ? speed : 10310 speed in $.fx.speeds ? $.fx.speeds[speed] : 10311 $.fx.speeds._default; 10312 10313 effect.complete = callback || options.complete; 10314 10315 return effect; 10316 } 10317 10318 function standardAnimationOption(option) { 10319 // Valid standard speeds (nothing, number, named speed) 10320 if (!option || typeof option === "number" || $.fx.speeds[option]) { 10321 return true; 10322 } 10323 10324 // Invalid strings - treat as "normal" speed 10325 if (typeof option === "string" && !$.effects.effect[option]) { 10326 return true; 10327 } 10328 10329 // Complete callback 10330 if ($.isFunction(option)) { 10331 return true; 10332 } 10333 10334 // Options hash (but not naming an effect) 10335 if (typeof option === "object" && !option.effect) { 10336 return true; 10337 } 10338 10339 // Didn't match any standard API 10340 return false; 10341 } 10342 10343 $.fn.extend({ 10344 effect: function ( /* effect, options, speed, callback */) { 10345 var args = _normalizeArguments.apply(this, arguments), 10346 mode = args.mode, 10347 queue = args.queue, 10348 effectMethod = $.effects.effect[args.effect]; 10349 10350 if ($.fx.off || !effectMethod) { 10351 // delegate to the original method (e.g., .show()) if possible 10352 if (mode) { 10353 return this[mode](args.duration, args.complete); 10354 } else { 10355 return this.each(function () { 10356 if (args.complete) { 10357 args.complete.call(this); 10358 } 10359 }); 10360 } 10361 } 10362 10363 function run(next) { 10364 var elem = $(this), 10365 complete = args.complete, 10366 mode = args.mode; 10367 10368 function done() { 10369 if ($.isFunction(complete)) { 10370 complete.call(elem[0]); 10371 } 10372 if ($.isFunction(next)) { 10373 next(); 10374 } 10375 } 10376 10377 // If the element already has the correct final state, delegate to 10378 // the core methods so the internal tracking of "olddisplay" works. 10379 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 10380 elem[mode](); 10381 done(); 10382 } else { 10383 effectMethod.call(elem[0], args, done); 10384 } 10385 } 10386 10387 return queue === false ? this.each(run) : this.queue(queue || "fx", run); 10388 }, 10389 10390 show: (function (orig) { 10391 return function (option) { 10392 if (standardAnimationOption(option)) { 10393 return orig.apply(this, arguments); 10394 } else { 10395 var args = _normalizeArguments.apply(this, arguments); 10396 args.mode = "show"; 10397 return this.effect.call(this, args); 10398 } 10399 }; 10400 })($.fn.show), 10401 10402 hide: (function (orig) { 10403 return function (option) { 10404 if (standardAnimationOption(option)) { 10405 return orig.apply(this, arguments); 10406 } else { 10407 var args = _normalizeArguments.apply(this, arguments); 10408 args.mode = "hide"; 10409 return this.effect.call(this, args); 10410 } 10411 }; 10412 })($.fn.hide), 10413 10414 toggle: (function (orig) { 10415 return function (option) { 10416 if (standardAnimationOption(option) || typeof option === "boolean") { 10417 return orig.apply(this, arguments); 10418 } else { 10419 var args = _normalizeArguments.apply(this, arguments); 10420 args.mode = "toggle"; 10421 return this.effect.call(this, args); 10422 } 10423 }; 10424 })($.fn.toggle), 10425 10426 // helper functions 10427 cssUnit: function (key) { 10428 var style = this.css(key), 10429 val = []; 10430 10431 $.each(["em", "px", "%", "pt"], function (i, unit) { 10432 if (style.indexOf(unit) > 0) { 10433 val = [parseFloat(style), unit]; 10434 } 10435 }); 10436 return val; 10437 } 10438 }); 10439 })(); 10440 10441 /******************************************************************************/ 10442 /*********************************** EASING ***********************************/ 10443 /******************************************************************************/ 10444 10445 (function () { 10446 // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 10447 10448 var baseEasings = {}; 10449 10450 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) { 10451 baseEasings[name] = function (p) { 10452 return Math.pow(p, i + 2); 10453 }; 10454 }); 10455 10456 $.extend(baseEasings, { 10457 Sine: function (p) { 10458 return 1 - Math.cos(p * Math.PI / 2); 10459 }, 10460 Circ: function (p) { 10461 return 1 - Math.sqrt(1 - p * p); 10462 }, 10463 Elastic: function (p) { 10464 return p === 0 || p === 1 ? p : 10465 -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); 10466 }, 10467 Back: function (p) { 10468 return p * p * (3 * p - 2); 10469 }, 10470 Bounce: function (p) { 10471 var pow2, 10472 bounce = 4; 10473 10474 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { } 10475 return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); 10476 } 10477 }); 10478 10479 $.each(baseEasings, function (name, easeIn) { 10480 $.easing["easeIn" + name] = easeIn; 10481 $.easing["easeOut" + name] = function (p) { 10482 return 1 - easeIn(1 - p); 10483 }; 10484 $.easing["easeInOut" + name] = function (p) { 10485 return p < 0.5 ? 10486 easeIn(p * 2) / 2 : 10487 1 - easeIn(p * -2 + 2) / 2; 10488 }; 10489 }); 10490 })(); 10491 10492 var effect = $.effects; 10493 10494 /*! 10495 * jQuery UI Effects Blind 1.11.4 10496 * http://jqueryui.com 10497 * 10498 * Copyright jQuery Foundation and other contributors 10499 * Released under the MIT license. 10500 * http://jquery.org/license 10501 * 10502 * http://api.jqueryui.com/blind-effect/ 10503 */ 10504 10505 var effectBlind = $.effects.effect.blind = function (o, done) { 10506 // Create element 10507 var el = $(this), 10508 rvertical = /up|down|vertical/, 10509 rpositivemotion = /up|left|vertical|horizontal/, 10510 props = ["position", "top", "bottom", "left", "right", "height", "width"], 10511 mode = $.effects.setMode(el, o.mode || "hide"), 10512 direction = o.direction || "up", 10513 vertical = rvertical.test(direction), 10514 ref = vertical ? "height" : "width", 10515 ref2 = vertical ? "top" : "left", 10516 motion = rpositivemotion.test(direction), 10517 animation = {}, 10518 show = mode === "show", 10519 wrapper, distance, margin; 10520 10521 // if already wrapped, the wrapper's properties are my property. #6245 10522 if (el.parent().is(".ui-effects-wrapper")) { 10523 $.effects.save(el.parent(), props); 10524 } else { 10525 $.effects.save(el, props); 10526 } 10527 el.show(); 10528 wrapper = $.effects.createWrapper(el).css({ 10529 overflow: "hidden" 10530 }); 10531 10532 distance = wrapper[ref](); 10533 margin = parseFloat(wrapper.css(ref2)) || 0; 10534 10535 animation[ref] = show ? distance : 0; 10536 if (!motion) { 10537 el 10538 .css(vertical ? "bottom" : "right", 0) 10539 .css(vertical ? "top" : "left", "auto") 10540 .css({ position: "absolute" }); 10541 10542 animation[ref2] = show ? margin : distance + margin; 10543 } 10544 10545 // start at 0 if we are showing 10546 if (show) { 10547 wrapper.css(ref, 0); 10548 if (!motion) { 10549 wrapper.css(ref2, margin + distance); 10550 } 10551 } 10552 10553 // Animate 10554 wrapper.animate(animation, { 10555 duration: o.duration, 10556 easing: o.easing, 10557 queue: false, 10558 complete: function () { 10559 if (mode === "hide") { 10560 el.hide(); 10561 } 10562 $.effects.restore(el, props); 10563 $.effects.removeWrapper(el); 10564 done(); 10565 } 10566 }); 10567 }; 10568 10569 /*! 10570 * jQuery UI Effects Bounce 1.11.4 10571 * http://jqueryui.com 10572 * 10573 * Copyright jQuery Foundation and other contributors 10574 * Released under the MIT license. 10575 * http://jquery.org/license 10576 * 10577 * http://api.jqueryui.com/bounce-effect/ 10578 */ 10579 10580 var effectBounce = $.effects.effect.bounce = function (o, done) { 10581 var el = $(this), 10582 props = ["position", "top", "bottom", "left", "right", "height", "width"], 10583 10584 // defaults: 10585 mode = $.effects.setMode(el, o.mode || "effect"), 10586 hide = mode === "hide", 10587 show = mode === "show", 10588 direction = o.direction || "up", 10589 distance = o.distance, 10590 times = o.times || 5, 10591 10592 // number of internal animations 10593 anims = times * 2 + (show || hide ? 1 : 0), 10594 speed = o.duration / anims, 10595 easing = o.easing, 10596 10597 // utility: 10598 ref = (direction === "up" || direction === "down") ? "top" : "left", 10599 motion = (direction === "up" || direction === "left"), 10600 i, 10601 upAnim, 10602 downAnim, 10603 10604 // we will need to re-assemble the queue to stack our animations in place 10605 queue = el.queue(), 10606 queuelen = queue.length; 10607 10608 // Avoid touching opacity to prevent clearType and PNG issues in IE 10609 if (show || hide) { 10610 props.push("opacity"); 10611 } 10612 10613 $.effects.save(el, props); 10614 el.show(); 10615 $.effects.createWrapper(el); // Create Wrapper 10616 10617 // default distance for the BIGGEST bounce is the outer Distance / 3 10618 if (!distance) { 10619 distance = el[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 10620 } 10621 10622 if (show) { 10623 downAnim = { opacity: 1 }; 10624 downAnim[ref] = 0; 10625 10626 // if we are showing, force opacity 0 and set the initial position 10627 // then do the "first" animation 10628 el.css("opacity", 0) 10629 .css(ref, motion ? -distance * 2 : distance * 2) 10630 .animate(downAnim, speed, easing); 10631 } 10632 10633 // start at the smallest distance if we are hiding 10634 if (hide) { 10635 distance = distance / Math.pow(2, times - 1); 10636 } 10637 10638 downAnim = {}; 10639 downAnim[ref] = 0; 10640 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 10641 for (i = 0; i < times; i++) { 10642 upAnim = {}; 10643 upAnim[ref] = (motion ? "-=" : "+=") + distance; 10644 10645 el.animate(upAnim, speed, easing) 10646 .animate(downAnim, speed, easing); 10647 10648 distance = hide ? distance * 2 : distance / 2; 10649 } 10650 10651 // Last Bounce when Hiding 10652 if (hide) { 10653 upAnim = { opacity: 0 }; 10654 upAnim[ref] = (motion ? "-=" : "+=") + distance; 10655 10656 el.animate(upAnim, speed, easing); 10657 } 10658 10659 el.queue(function () { 10660 if (hide) { 10661 el.hide(); 10662 } 10663 $.effects.restore(el, props); 10664 $.effects.removeWrapper(el); 10665 done(); 10666 }); 10667 10668 // inject all the animations we just queued to be first in line (after "inprogress") 10669 if (queuelen > 1) { 10670 queue.splice.apply(queue, 10671 [1, 0].concat(queue.splice(queuelen, anims + 1))); 10672 } 10673 el.dequeue(); 10674 }; 10675 10676 /*! 10677 * jQuery UI Effects Clip 1.11.4 10678 * http://jqueryui.com 10679 * 10680 * Copyright jQuery Foundation and other contributors 10681 * Released under the MIT license. 10682 * http://jquery.org/license 10683 * 10684 * http://api.jqueryui.com/clip-effect/ 10685 */ 10686 10687 var effectClip = $.effects.effect.clip = function (o, done) { 10688 // Create element 10689 var el = $(this), 10690 props = ["position", "top", "bottom", "left", "right", "height", "width"], 10691 mode = $.effects.setMode(el, o.mode || "hide"), 10692 show = mode === "show", 10693 direction = o.direction || "vertical", 10694 vert = direction === "vertical", 10695 size = vert ? "height" : "width", 10696 position = vert ? "top" : "left", 10697 animation = {}, 10698 wrapper, animate, distance; 10699 10700 // Save & Show 10701 $.effects.save(el, props); 10702 el.show(); 10703 10704 // Create Wrapper 10705 wrapper = $.effects.createWrapper(el).css({ 10706 overflow: "hidden" 10707 }); 10708 animate = (el[0].tagName === "IMG") ? wrapper : el; 10709 distance = animate[size](); 10710 10711 // Shift 10712 if (show) { 10713 animate.css(size, 0); 10714 animate.css(position, distance / 2); 10715 } 10716 10717 // Create Animation Object: 10718 animation[size] = show ? distance : 0; 10719 animation[position] = show ? 0 : distance / 2; 10720 10721 // Animate 10722 animate.animate(animation, { 10723 queue: false, 10724 duration: o.duration, 10725 easing: o.easing, 10726 complete: function () { 10727 if (!show) { 10728 el.hide(); 10729 } 10730 $.effects.restore(el, props); 10731 $.effects.removeWrapper(el); 10732 done(); 10733 } 10734 }); 10735 }; 10736 10737 /*! 10738 * jQuery UI Effects Drop 1.11.4 10739 * http://jqueryui.com 10740 * 10741 * Copyright jQuery Foundation and other contributors 10742 * Released under the MIT license. 10743 * http://jquery.org/license 10744 * 10745 * http://api.jqueryui.com/drop-effect/ 10746 */ 10747 10748 var effectDrop = $.effects.effect.drop = function (o, done) { 10749 var el = $(this), 10750 props = ["position", "top", "bottom", "left", "right", "opacity", "height", "width"], 10751 mode = $.effects.setMode(el, o.mode || "hide"), 10752 show = mode === "show", 10753 direction = o.direction || "left", 10754 ref = (direction === "up" || direction === "down") ? "top" : "left", 10755 motion = (direction === "up" || direction === "left") ? "pos" : "neg", 10756 animation = { 10757 opacity: show ? 1 : 0 10758 }, 10759 distance; 10760 10761 // Adjust 10762 $.effects.save(el, props); 10763 el.show(); 10764 $.effects.createWrapper(el); 10765 10766 distance = o.distance || el[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 10767 10768 if (show) { 10769 el 10770 .css("opacity", 0) 10771 .css(ref, motion === "pos" ? -distance : distance); 10772 } 10773 10774 // Animation 10775 animation[ref] = (show ? 10776 (motion === "pos" ? "+=" : "-=") : 10777 (motion === "pos" ? "-=" : "+=")) + 10778 distance; 10779 10780 // Animate 10781 el.animate(animation, { 10782 queue: false, 10783 duration: o.duration, 10784 easing: o.easing, 10785 complete: function () { 10786 if (mode === "hide") { 10787 el.hide(); 10788 } 10789 $.effects.restore(el, props); 10790 $.effects.removeWrapper(el); 10791 done(); 10792 } 10793 }); 10794 }; 10795 10796 /*! 10797 * jQuery UI Effects Explode 1.11.4 10798 * http://jqueryui.com 10799 * 10800 * Copyright jQuery Foundation and other contributors 10801 * Released under the MIT license. 10802 * http://jquery.org/license 10803 * 10804 * http://api.jqueryui.com/explode-effect/ 10805 */ 10806 10807 var effectExplode = $.effects.effect.explode = function (o, done) { 10808 var rows = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3, 10809 cells = rows, 10810 el = $(this), 10811 mode = $.effects.setMode(el, o.mode || "hide"), 10812 show = mode === "show", 10813 10814 // show and then visibility:hidden the element before calculating offset 10815 offset = el.show().css("visibility", "hidden").offset(), 10816 10817 // width and height of a piece 10818 width = Math.ceil(el.outerWidth() / cells), 10819 height = Math.ceil(el.outerHeight() / rows), 10820 pieces = [], 10821 10822 // loop 10823 i, j, left, top, mx, my; 10824 10825 // children animate complete: 10826 function childComplete() { 10827 pieces.push(this); 10828 if (pieces.length === rows * cells) { 10829 animComplete(); 10830 } 10831 } 10832 10833 // clone the element for each row and cell. 10834 for (i = 0; i < rows ; i++) { // ===> 10835 top = offset.top + i * height; 10836 my = i - (rows - 1) / 2; 10837 10838 for (j = 0; j < cells ; j++) { // ||| 10839 left = offset.left + j * width; 10840 mx = j - (cells - 1) / 2; 10841 10842 // Create a clone of the now hidden main element that will be absolute positioned 10843 // within a wrapper div off the -left and -top equal to size of our pieces 10844 el 10845 .clone() 10846 .appendTo("body") 10847 .wrap("<div></div>") 10848 .css({ 10849 position: "absolute", 10850 visibility: "visible", 10851 left: -j * width, 10852 top: -i * height 10853 }) 10854 10855 // select the wrapper - make it overflow: hidden and absolute positioned based on 10856 // where the original was located +left and +top equal to the size of pieces 10857 .parent() 10858 .addClass("ui-effects-explode") 10859 .css({ 10860 position: "absolute", 10861 overflow: "hidden", 10862 width: width, 10863 height: height, 10864 left: left + (show ? mx * width : 0), 10865 top: top + (show ? my * height : 0), 10866 opacity: show ? 0 : 1 10867 }).animate({ 10868 left: left + (show ? 0 : mx * width), 10869 top: top + (show ? 0 : my * height), 10870 opacity: show ? 1 : 0 10871 }, o.duration || 500, o.easing, childComplete); 10872 } 10873 } 10874 10875 function animComplete() { 10876 el.css({ 10877 visibility: "visible" 10878 }); 10879 $(pieces).remove(); 10880 if (!show) { 10881 el.hide(); 10882 } 10883 done(); 10884 } 10885 }; 10886 10887 /*! 10888 * jQuery UI Effects Fade 1.11.4 10889 * http://jqueryui.com 10890 * 10891 * Copyright jQuery Foundation and other contributors 10892 * Released under the MIT license. 10893 * http://jquery.org/license 10894 * 10895 * http://api.jqueryui.com/fade-effect/ 10896 */ 10897 10898 var effectFade = $.effects.effect.fade = function (o, done) { 10899 var el = $(this), 10900 mode = $.effects.setMode(el, o.mode || "toggle"); 10901 10902 el.animate({ 10903 opacity: mode 10904 }, { 10905 queue: false, 10906 duration: o.duration, 10907 easing: o.easing, 10908 complete: done 10909 }); 10910 }; 10911 10912 /*! 10913 * jQuery UI Effects Fold 1.11.4 10914 * http://jqueryui.com 10915 * 10916 * Copyright jQuery Foundation and other contributors 10917 * Released under the MIT license. 10918 * http://jquery.org/license 10919 * 10920 * http://api.jqueryui.com/fold-effect/ 10921 */ 10922 10923 var effectFold = $.effects.effect.fold = function (o, done) { 10924 // Create element 10925 var el = $(this), 10926 props = ["position", "top", "bottom", "left", "right", "height", "width"], 10927 mode = $.effects.setMode(el, o.mode || "hide"), 10928 show = mode === "show", 10929 hide = mode === "hide", 10930 size = o.size || 15, 10931 percent = /([0-9]+)%/.exec(size), 10932 horizFirst = !!o.horizFirst, 10933 widthFirst = show !== horizFirst, 10934 ref = widthFirst ? ["width", "height"] : ["height", "width"], 10935 duration = o.duration / 2, 10936 wrapper, distance, 10937 animation1 = {}, 10938 animation2 = {}; 10939 10940 $.effects.save(el, props); 10941 el.show(); 10942 10943 // Create Wrapper 10944 wrapper = $.effects.createWrapper(el).css({ 10945 overflow: "hidden" 10946 }); 10947 distance = widthFirst ? 10948 [wrapper.width(), wrapper.height()] : 10949 [wrapper.height(), wrapper.width()]; 10950 10951 if (percent) { 10952 size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1]; 10953 } 10954 if (show) { 10955 wrapper.css(horizFirst ? { 10956 height: 0, 10957 width: size 10958 } : { 10959 height: size, 10960 width: 0 10961 }); 10962 } 10963 10964 // Animation 10965 animation1[ref[0]] = show ? distance[0] : size; 10966 animation2[ref[1]] = show ? distance[1] : 0; 10967 10968 // Animate 10969 wrapper 10970 .animate(animation1, duration, o.easing) 10971 .animate(animation2, duration, o.easing, function () { 10972 if (hide) { 10973 el.hide(); 10974 } 10975 $.effects.restore(el, props); 10976 $.effects.removeWrapper(el); 10977 done(); 10978 }); 10979 }; 10980 10981 /*! 10982 * jQuery UI Effects Highlight 1.11.4 10983 * http://jqueryui.com 10984 * 10985 * Copyright jQuery Foundation and other contributors 10986 * Released under the MIT license. 10987 * http://jquery.org/license 10988 * 10989 * http://api.jqueryui.com/highlight-effect/ 10990 */ 10991 10992 var effectHighlight = $.effects.effect.highlight = function (o, done) { 10993 var elem = $(this), 10994 props = ["backgroundImage", "backgroundColor", "opacity"], 10995 mode = $.effects.setMode(elem, o.mode || "show"), 10996 animation = { 10997 backgroundColor: elem.css("backgroundColor") 10998 }; 10999 11000 if (mode === "hide") { 11001 animation.opacity = 0; 11002 } 11003 11004 $.effects.save(elem, props); 11005 11006 elem 11007 .show() 11008 .css({ 11009 backgroundImage: "none", 11010 backgroundColor: o.color || "#ffff99" 11011 }) 11012 .animate(animation, { 11013 queue: false, 11014 duration: o.duration, 11015 easing: o.easing, 11016 complete: function () { 11017 if (mode === "hide") { 11018 elem.hide(); 11019 } 11020 $.effects.restore(elem, props); 11021 done(); 11022 } 11023 }); 11024 }; 11025 11026 /*! 11027 * jQuery UI Effects Size 1.11.4 11028 * http://jqueryui.com 11029 * 11030 * Copyright jQuery Foundation and other contributors 11031 * Released under the MIT license. 11032 * http://jquery.org/license 11033 * 11034 * http://api.jqueryui.com/size-effect/ 11035 */ 11036 11037 var effectSize = $.effects.effect.size = function (o, done) { 11038 // Create element 11039 var original, baseline, factor, 11040 el = $(this), 11041 props0 = ["position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity"], 11042 11043 // Always restore 11044 props1 = ["position", "top", "bottom", "left", "right", "overflow", "opacity"], 11045 11046 // Copy for children 11047 props2 = ["width", "height", "overflow"], 11048 cProps = ["fontSize"], 11049 vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 11050 hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"], 11051 11052 // Set options 11053 mode = $.effects.setMode(el, o.mode || "effect"), 11054 restore = o.restore || mode !== "effect", 11055 scale = o.scale || "both", 11056 origin = o.origin || ["middle", "center"], 11057 position = el.css("position"), 11058 props = restore ? props0 : props1, 11059 zero = { 11060 height: 0, 11061 width: 0, 11062 outerHeight: 0, 11063 outerWidth: 0 11064 }; 11065 11066 if (mode === "show") { 11067 el.show(); 11068 } 11069 original = { 11070 height: el.height(), 11071 width: el.width(), 11072 outerHeight: el.outerHeight(), 11073 outerWidth: el.outerWidth() 11074 }; 11075 11076 if (o.mode === "toggle" && mode === "show") { 11077 el.from = o.to || zero; 11078 el.to = o.from || original; 11079 } else { 11080 el.from = o.from || (mode === "show" ? zero : original); 11081 el.to = o.to || (mode === "hide" ? zero : original); 11082 } 11083 11084 // Set scaling factor 11085 factor = { 11086 from: { 11087 y: el.from.height / original.height, 11088 x: el.from.width / original.width 11089 }, 11090 to: { 11091 y: el.to.height / original.height, 11092 x: el.to.width / original.width 11093 } 11094 }; 11095 11096 // Scale the css box 11097 if (scale === "box" || scale === "both") { 11098 // Vertical props scaling 11099 if (factor.from.y !== factor.to.y) { 11100 props = props.concat(vProps); 11101 el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from); 11102 el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to); 11103 } 11104 11105 // Horizontal props scaling 11106 if (factor.from.x !== factor.to.x) { 11107 props = props.concat(hProps); 11108 el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from); 11109 el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to); 11110 } 11111 } 11112 11113 // Scale the content 11114 if (scale === "content" || scale === "both") { 11115 // Vertical props scaling 11116 if (factor.from.y !== factor.to.y) { 11117 props = props.concat(cProps).concat(props2); 11118 el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from); 11119 el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to); 11120 } 11121 } 11122 11123 $.effects.save(el, props); 11124 el.show(); 11125 $.effects.createWrapper(el); 11126 el.css("overflow", "hidden").css(el.from); 11127 11128 // Adjust 11129 if (origin) { // Calculate baseline shifts 11130 baseline = $.effects.getBaseline(origin, original); 11131 el.from.top = (original.outerHeight - el.outerHeight()) * baseline.y; 11132 el.from.left = (original.outerWidth - el.outerWidth()) * baseline.x; 11133 el.to.top = (original.outerHeight - el.to.outerHeight) * baseline.y; 11134 el.to.left = (original.outerWidth - el.to.outerWidth) * baseline.x; 11135 } 11136 el.css(el.from); // set top & left 11137 11138 // Animate 11139 if (scale === "content" || scale === "both") { // Scale the children 11140 // Add margins/font-size 11141 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 11142 hProps = hProps.concat(["marginLeft", "marginRight"]); 11143 props2 = props0.concat(vProps).concat(hProps); 11144 11145 el.find("*[width]").each(function () { 11146 var child = $(this), 11147 c_original = { 11148 height: child.height(), 11149 width: child.width(), 11150 outerHeight: child.outerHeight(), 11151 outerWidth: child.outerWidth() 11152 }; 11153 if (restore) { 11154 $.effects.save(child, props2); 11155 } 11156 11157 child.from = { 11158 height: c_original.height * factor.from.y, 11159 width: c_original.width * factor.from.x, 11160 outerHeight: c_original.outerHeight * factor.from.y, 11161 outerWidth: c_original.outerWidth * factor.from.x 11162 }; 11163 child.to = { 11164 height: c_original.height * factor.to.y, 11165 width: c_original.width * factor.to.x, 11166 outerHeight: c_original.height * factor.to.y, 11167 outerWidth: c_original.width * factor.to.x 11168 }; 11169 11170 // Vertical props scaling 11171 if (factor.from.y !== factor.to.y) { 11172 child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from); 11173 child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to); 11174 } 11175 11176 // Horizontal props scaling 11177 if (factor.from.x !== factor.to.x) { 11178 child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from); 11179 child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to); 11180 } 11181 11182 // Animate children 11183 child.css(child.from); 11184 child.animate(child.to, o.duration, o.easing, function () { 11185 // Restore children 11186 if (restore) { 11187 $.effects.restore(child, props2); 11188 } 11189 }); 11190 }); 11191 } 11192 11193 // Animate 11194 el.animate(el.to, { 11195 queue: false, 11196 duration: o.duration, 11197 easing: o.easing, 11198 complete: function () { 11199 if (el.to.opacity === 0) { 11200 el.css("opacity", el.from.opacity); 11201 } 11202 if (mode === "hide") { 11203 el.hide(); 11204 } 11205 $.effects.restore(el, props); 11206 if (!restore) { 11207 // we need to calculate our new positioning based on the scaling 11208 if (position === "static") { 11209 el.css({ 11210 position: "relative", 11211 top: el.to.top, 11212 left: el.to.left 11213 }); 11214 } else { 11215 $.each(["top", "left"], function (idx, pos) { 11216 el.css(pos, function (_, str) { 11217 var val = parseInt(str, 10), 11218 toRef = idx ? el.to.left : el.to.top; 11219 11220 // if original was "auto", recalculate the new value from wrapper 11221 if (str === "auto") { 11222 return toRef + "px"; 11223 } 11224 11225 return val + toRef + "px"; 11226 }); 11227 }); 11228 } 11229 } 11230 11231 $.effects.removeWrapper(el); 11232 done(); 11233 } 11234 }); 11235 }; 11236 11237 /*! 11238 * jQuery UI Effects Scale 1.11.4 11239 * http://jqueryui.com 11240 * 11241 * Copyright jQuery Foundation and other contributors 11242 * Released under the MIT license. 11243 * http://jquery.org/license 11244 * 11245 * http://api.jqueryui.com/scale-effect/ 11246 */ 11247 11248 var effectScale = $.effects.effect.scale = function (o, done) { 11249 // Create element 11250 var el = $(this), 11251 options = $.extend(true, {}, o), 11252 mode = $.effects.setMode(el, o.mode || "effect"), 11253 percent = parseInt(o.percent, 10) || 11254 (parseInt(o.percent, 10) === 0 ? 0 : (mode === "hide" ? 0 : 100)), 11255 direction = o.direction || "both", 11256 origin = o.origin, 11257 original = { 11258 height: el.height(), 11259 width: el.width(), 11260 outerHeight: el.outerHeight(), 11261 outerWidth: el.outerWidth() 11262 }, 11263 factor = { 11264 y: direction !== "horizontal" ? (percent / 100) : 1, 11265 x: direction !== "vertical" ? (percent / 100) : 1 11266 }; 11267 11268 // We are going to pass this effect to the size effect: 11269 options.effect = "size"; 11270 options.queue = false; 11271 options.complete = done; 11272 11273 // Set default origin and restore for show/hide 11274 if (mode !== "effect") { 11275 options.origin = origin || ["middle", "center"]; 11276 options.restore = true; 11277 } 11278 11279 options.from = o.from || (mode === "show" ? { 11280 height: 0, 11281 width: 0, 11282 outerHeight: 0, 11283 outerWidth: 0 11284 } : original); 11285 options.to = { 11286 height: original.height * factor.y, 11287 width: original.width * factor.x, 11288 outerHeight: original.outerHeight * factor.y, 11289 outerWidth: original.outerWidth * factor.x 11290 }; 11291 11292 // Fade option to support puff 11293 if (options.fade) { 11294 if (mode === "show") { 11295 options.from.opacity = 0; 11296 options.to.opacity = 1; 11297 } 11298 if (mode === "hide") { 11299 options.from.opacity = 1; 11300 options.to.opacity = 0; 11301 } 11302 } 11303 11304 // Animate 11305 el.effect(options); 11306 }; 11307 11308 /*! 11309 * jQuery UI Effects Puff 1.11.4 11310 * http://jqueryui.com 11311 * 11312 * Copyright jQuery Foundation and other contributors 11313 * Released under the MIT license. 11314 * http://jquery.org/license 11315 * 11316 * http://api.jqueryui.com/puff-effect/ 11317 */ 11318 11319 var effectPuff = $.effects.effect.puff = function (o, done) { 11320 var elem = $(this), 11321 mode = $.effects.setMode(elem, o.mode || "hide"), 11322 hide = mode === "hide", 11323 percent = parseInt(o.percent, 10) || 150, 11324 factor = percent / 100, 11325 original = { 11326 height: elem.height(), 11327 width: elem.width(), 11328 outerHeight: elem.outerHeight(), 11329 outerWidth: elem.outerWidth() 11330 }; 11331 11332 $.extend(o, { 11333 effect: "scale", 11334 queue: false, 11335 fade: true, 11336 mode: mode, 11337 complete: done, 11338 percent: hide ? percent : 100, 11339 from: hide ? 11340 original : 11341 { 11342 height: original.height * factor, 11343 width: original.width * factor, 11344 outerHeight: original.outerHeight * factor, 11345 outerWidth: original.outerWidth * factor 11346 } 11347 }); 11348 11349 elem.effect(o); 11350 }; 11351 11352 /*! 11353 * jQuery UI Effects Pulsate 1.11.4 11354 * http://jqueryui.com 11355 * 11356 * Copyright jQuery Foundation and other contributors 11357 * Released under the MIT license. 11358 * http://jquery.org/license 11359 * 11360 * http://api.jqueryui.com/pulsate-effect/ 11361 */ 11362 11363 var effectPulsate = $.effects.effect.pulsate = function (o, done) { 11364 var elem = $(this), 11365 mode = $.effects.setMode(elem, o.mode || "show"), 11366 show = mode === "show", 11367 hide = mode === "hide", 11368 showhide = (show || mode === "hide"), 11369 11370 // showing or hiding leaves of the "last" animation 11371 anims = ((o.times || 5) * 2) + (showhide ? 1 : 0), 11372 duration = o.duration / anims, 11373 animateTo = 0, 11374 queue = elem.queue(), 11375 queuelen = queue.length, 11376 i; 11377 11378 if (show || !elem.is(":visible")) { 11379 elem.css("opacity", 0).show(); 11380 animateTo = 1; 11381 } 11382 11383 // anims - 1 opacity "toggles" 11384 for (i = 1; i < anims; i++) { 11385 elem.animate({ 11386 opacity: animateTo 11387 }, duration, o.easing); 11388 animateTo = 1 - animateTo; 11389 } 11390 11391 elem.animate({ 11392 opacity: animateTo 11393 }, duration, o.easing); 11394 11395 elem.queue(function () { 11396 if (hide) { 11397 elem.hide(); 11398 } 11399 done(); 11400 }); 11401 11402 // We just queued up "anims" animations, we need to put them next in the queue 11403 if (queuelen > 1) { 11404 queue.splice.apply(queue, 11405 [1, 0].concat(queue.splice(queuelen, anims + 1))); 11406 } 11407 elem.dequeue(); 11408 }; 11409 11410 /*! 11411 * jQuery UI Effects Shake 1.11.4 11412 * http://jqueryui.com 11413 * 11414 * Copyright jQuery Foundation and other contributors 11415 * Released under the MIT license. 11416 * http://jquery.org/license 11417 * 11418 * http://api.jqueryui.com/shake-effect/ 11419 */ 11420 11421 var effectShake = $.effects.effect.shake = function (o, done) { 11422 var el = $(this), 11423 props = ["position", "top", "bottom", "left", "right", "height", "width"], 11424 mode = $.effects.setMode(el, o.mode || "effect"), 11425 direction = o.direction || "left", 11426 distance = o.distance || 20, 11427 times = o.times || 3, 11428 anims = times * 2 + 1, 11429 speed = Math.round(o.duration / anims), 11430 ref = (direction === "up" || direction === "down") ? "top" : "left", 11431 positiveMotion = (direction === "up" || direction === "left"), 11432 animation = {}, 11433 animation1 = {}, 11434 animation2 = {}, 11435 i, 11436 11437 // we will need to re-assemble the queue to stack our animations in place 11438 queue = el.queue(), 11439 queuelen = queue.length; 11440 11441 $.effects.save(el, props); 11442 el.show(); 11443 $.effects.createWrapper(el); 11444 11445 // Animation 11446 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 11447 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 11448 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 11449 11450 // Animate 11451 el.animate(animation, speed, o.easing); 11452 11453 // Shakes 11454 for (i = 1; i < times; i++) { 11455 el.animate(animation1, speed, o.easing).animate(animation2, speed, o.easing); 11456 } 11457 el 11458 .animate(animation1, speed, o.easing) 11459 .animate(animation, speed / 2, o.easing) 11460 .queue(function () { 11461 if (mode === "hide") { 11462 el.hide(); 11463 } 11464 $.effects.restore(el, props); 11465 $.effects.removeWrapper(el); 11466 done(); 11467 }); 11468 11469 // inject all the animations we just queued to be first in line (after "inprogress") 11470 if (queuelen > 1) { 11471 queue.splice.apply(queue, 11472 [1, 0].concat(queue.splice(queuelen, anims + 1))); 11473 } 11474 el.dequeue(); 11475 }; 11476 11477 /*! 11478 * jQuery UI Effects Slide 1.11.4 11479 * http://jqueryui.com 11480 * 11481 * Copyright jQuery Foundation and other contributors 11482 * Released under the MIT license. 11483 * http://jquery.org/license 11484 * 11485 * http://api.jqueryui.com/slide-effect/ 11486 */ 11487 11488 var effectSlide = $.effects.effect.slide = function (o, done) { 11489 // Create element 11490 var el = $(this), 11491 props = ["position", "top", "bottom", "left", "right", "width", "height"], 11492 mode = $.effects.setMode(el, o.mode || "show"), 11493 show = mode === "show", 11494 direction = o.direction || "left", 11495 ref = (direction === "up" || direction === "down") ? "top" : "left", 11496 positiveMotion = (direction === "up" || direction === "left"), 11497 distance, 11498 animation = {}; 11499 11500 // Adjust 11501 $.effects.save(el, props); 11502 el.show(); 11503 distance = o.distance || el[ref === "top" ? "outerHeight" : "outerWidth"](true); 11504 11505 $.effects.createWrapper(el).css({ 11506 overflow: "hidden" 11507 }); 11508 11509 if (show) { 11510 el.css(ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance); 11511 } 11512 11513 // Animation 11514 animation[ref] = (show ? 11515 (positiveMotion ? "+=" : "-=") : 11516 (positiveMotion ? "-=" : "+=")) + 11517 distance; 11518 11519 // Animate 11520 el.animate(animation, { 11521 queue: false, 11522 duration: o.duration, 11523 easing: o.easing, 11524 complete: function () { 11525 if (mode === "hide") { 11526 el.hide(); 11527 } 11528 $.effects.restore(el, props); 11529 $.effects.removeWrapper(el); 11530 done(); 11531 } 11532 }); 11533 }; 11534 11535 /*! 11536 * jQuery UI Effects Transfer 1.11.4 11537 * http://jqueryui.com 11538 * 11539 * Copyright jQuery Foundation and other contributors 11540 * Released under the MIT license. 11541 * http://jquery.org/license 11542 * 11543 * http://api.jqueryui.com/transfer-effect/ 11544 */ 11545 11546 var effectTransfer = $.effects.effect.transfer = function (o, done) { 11547 var elem = $(this), 11548 target = $(o.to), 11549 targetFixed = target.css("position") === "fixed", 11550 body = $("body"), 11551 fixTop = targetFixed ? body.scrollTop() : 0, 11552 fixLeft = targetFixed ? body.scrollLeft() : 0, 11553 endPosition = target.offset(), 11554 animation = { 11555 top: endPosition.top - fixTop, 11556 left: endPosition.left - fixLeft, 11557 height: target.innerHeight(), 11558 width: target.innerWidth() 11559 }, 11560 startPosition = elem.offset(), 11561 transfer = $("<div class='ui-effects-transfer'></div>") 11562 .appendTo(document.body) 11563 .addClass(o.className) 11564 .css({ 11565 top: startPosition.top - fixTop, 11566 left: startPosition.left - fixLeft, 11567 height: elem.innerHeight(), 11568 width: elem.innerWidth(), 11569 position: targetFixed ? "fixed" : "absolute" 11570 }) 11571 .animate(animation, o.duration, o.easing, function () { 11572 transfer.remove(); 11573 done(); 11574 }); 11575 }; 11576 11577 /*! 11578 * jQuery UI Progressbar 1.11.4 11579 * http://jqueryui.com 11580 * 11581 * Copyright jQuery Foundation and other contributors 11582 * Released under the MIT license. 11583 * http://jquery.org/license 11584 * 11585 * http://api.jqueryui.com/progressbar/ 11586 */ 11587 11588 var progressbar = $.widget("ui.progressbar", { 11589 version: "1.11.4", 11590 options: { 11591 max: 100, 11592 value: 0, 11593 11594 change: null, 11595 complete: null 11596 }, 11597 11598 min: 0, 11599 11600 _create: function () { 11601 // Constrain initial value 11602 this.oldValue = this.options.value = this._constrainedValue(); 11603 11604 this.element 11605 .addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all") 11606 .attr({ 11607 // Only set static values, aria-valuenow and aria-valuemax are 11608 // set inside _refreshValue() 11609 role: "progressbar", 11610 "aria-valuemin": this.min 11611 }); 11612 11613 this.valueDiv = $("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>") 11614 .appendTo(this.element); 11615 11616 this._refreshValue(); 11617 }, 11618 11619 _destroy: function () { 11620 this.element 11621 .removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all") 11622 .removeAttr("role") 11623 .removeAttr("aria-valuemin") 11624 .removeAttr("aria-valuemax") 11625 .removeAttr("aria-valuenow"); 11626 11627 this.valueDiv.remove(); 11628 }, 11629 11630 value: function (newValue) { 11631 if (newValue === undefined) { 11632 return this.options.value; 11633 } 11634 11635 this.options.value = this._constrainedValue(newValue); 11636 this._refreshValue(); 11637 }, 11638 11639 _constrainedValue: function (newValue) { 11640 if (newValue === undefined) { 11641 newValue = this.options.value; 11642 } 11643 11644 this.indeterminate = newValue === false; 11645 11646 // sanitize value 11647 if (typeof newValue !== "number") { 11648 newValue = 0; 11649 } 11650 11651 return this.indeterminate ? false : 11652 Math.min(this.options.max, Math.max(this.min, newValue)); 11653 }, 11654 11655 _setOptions: function (options) { 11656 // Ensure "value" option is set after other values (like max) 11657 var value = options.value; 11658 delete options.value; 11659 11660 this._super(options); 11661 11662 this.options.value = this._constrainedValue(value); 11663 this._refreshValue(); 11664 }, 11665 11666 _setOption: function (key, value) { 11667 if (key === "max") { 11668 // Don't allow a max less than min 11669 value = Math.max(this.min, value); 11670 } 11671 if (key === "disabled") { 11672 this.element 11673 .toggleClass("ui-state-disabled", !!value) 11674 .attr("aria-disabled", value); 11675 } 11676 this._super(key, value); 11677 }, 11678 11679 _percentage: function () { 11680 return this.indeterminate ? 100 : 100 * (this.options.value - this.min) / (this.options.max - this.min); 11681 }, 11682 11683 _refreshValue: function () { 11684 var value = this.options.value, 11685 percentage = this._percentage(); 11686 11687 this.valueDiv 11688 .toggle(this.indeterminate || value > this.min) 11689 .toggleClass("ui-corner-right", value === this.options.max) 11690 .width(percentage.toFixed(0) + "%"); 11691 11692 this.element.toggleClass("ui-progressbar-indeterminate", this.indeterminate); 11693 11694 if (this.indeterminate) { 11695 this.element.removeAttr("aria-valuenow"); 11696 if (!this.overlayDiv) { 11697 this.overlayDiv = $("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv); 11698 } 11699 } else { 11700 this.element.attr({ 11701 "aria-valuemax": this.options.max, 11702 "aria-valuenow": value 11703 }); 11704 if (this.overlayDiv) { 11705 this.overlayDiv.remove(); 11706 this.overlayDiv = null; 11707 } 11708 } 11709 11710 if (this.oldValue !== value) { 11711 this.oldValue = value; 11712 this._trigger("change"); 11713 } 11714 if (value === this.options.max) { 11715 this._trigger("complete"); 11716 } 11717 } 11718 }); 11719 11720 /*! 11721 * jQuery UI Selectable 1.11.4 11722 * http://jqueryui.com 11723 * 11724 * Copyright jQuery Foundation and other contributors 11725 * Released under the MIT license. 11726 * http://jquery.org/license 11727 * 11728 * http://api.jqueryui.com/selectable/ 11729 */ 11730 11731 var selectable = $.widget("ui.selectable", $.ui.mouse, { 11732 version: "1.11.4", 11733 options: { 11734 appendTo: "body", 11735 autoRefresh: true, 11736 distance: 0, 11737 filter: "*", 11738 tolerance: "touch", 11739 11740 // callbacks 11741 selected: null, 11742 selecting: null, 11743 start: null, 11744 stop: null, 11745 unselected: null, 11746 unselecting: null 11747 }, 11748 _create: function () { 11749 var selectees, 11750 that = this; 11751 11752 this.element.addClass("ui-selectable"); 11753 11754 this.dragged = false; 11755 11756 // cache selectee children based on filter 11757 this.refresh = function () { 11758 selectees = $(that.options.filter, that.element[0]); 11759 selectees.addClass("ui-selectee"); 11760 selectees.each(function () { 11761 var $this = $(this), 11762 pos = $this.offset(); 11763 $.data(this, "selectable-item", { 11764 element: this, 11765 $element: $this, 11766 left: pos.left, 11767 top: pos.top, 11768 right: pos.left + $this.outerWidth(), 11769 bottom: pos.top + $this.outerHeight(), 11770 startselected: false, 11771 selected: $this.hasClass("ui-selected"), 11772 selecting: $this.hasClass("ui-selecting"), 11773 unselecting: $this.hasClass("ui-unselecting") 11774 }); 11775 }); 11776 }; 11777 this.refresh(); 11778 11779 this.selectees = selectees.addClass("ui-selectee"); 11780 11781 this._mouseInit(); 11782 11783 this.helper = $("<div class='ui-selectable-helper'></div>"); 11784 }, 11785 11786 _destroy: function () { 11787 this.selectees 11788 .removeClass("ui-selectee") 11789 .removeData("selectable-item"); 11790 this.element 11791 .removeClass("ui-selectable ui-selectable-disabled"); 11792 this._mouseDestroy(); 11793 }, 11794 11795 _mouseStart: function (event) { 11796 var that = this, 11797 options = this.options; 11798 11799 this.opos = [event.pageX, event.pageY]; 11800 11801 if (this.options.disabled) { 11802 return; 11803 } 11804 11805 this.selectees = $(options.filter, this.element[0]); 11806 11807 this._trigger("start", event); 11808 11809 $(options.appendTo).append(this.helper); 11810 // position helper (lasso) 11811 this.helper.css({ 11812 "left": event.pageX, 11813 "top": event.pageY, 11814 "width": 0, 11815 "height": 0 11816 }); 11817 11818 if (options.autoRefresh) { 11819 this.refresh(); 11820 } 11821 11822 this.selectees.filter(".ui-selected").each(function () { 11823 var selectee = $.data(this, "selectable-item"); 11824 selectee.startselected = true; 11825 if (!event.metaKey && !event.ctrlKey) { 11826 selectee.$element.removeClass("ui-selected"); 11827 selectee.selected = false; 11828 selectee.$element.addClass("ui-unselecting"); 11829 selectee.unselecting = true; 11830 // selectable UNSELECTING callback 11831 that._trigger("unselecting", event, { 11832 unselecting: selectee.element 11833 }); 11834 } 11835 }); 11836 11837 $(event.target).parents().addBack().each(function () { 11838 var doSelect, 11839 selectee = $.data(this, "selectable-item"); 11840 if (selectee) { 11841 doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected"); 11842 selectee.$element 11843 .removeClass(doSelect ? "ui-unselecting" : "ui-selected") 11844 .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); 11845 selectee.unselecting = !doSelect; 11846 selectee.selecting = doSelect; 11847 selectee.selected = doSelect; 11848 // selectable (UN)SELECTING callback 11849 if (doSelect) { 11850 that._trigger("selecting", event, { 11851 selecting: selectee.element 11852 }); 11853 } else { 11854 that._trigger("unselecting", event, { 11855 unselecting: selectee.element 11856 }); 11857 } 11858 return false; 11859 } 11860 }); 11861 }, 11862 11863 _mouseDrag: function (event) { 11864 this.dragged = true; 11865 11866 if (this.options.disabled) { 11867 return; 11868 } 11869 11870 var tmp, 11871 that = this, 11872 options = this.options, 11873 x1 = this.opos[0], 11874 y1 = this.opos[1], 11875 x2 = event.pageX, 11876 y2 = event.pageY; 11877 11878 if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } 11879 if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } 11880 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 11881 11882 this.selectees.each(function () { 11883 var selectee = $.data(this, "selectable-item"), 11884 hit = false; 11885 11886 //prevent helper from being selected if appendTo: selectable 11887 if (!selectee || selectee.element === that.element[0]) { 11888 return; 11889 } 11890 11891 if (options.tolerance === "touch") { 11892 hit = (!(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1)); 11893 } else if (options.tolerance === "fit") { 11894 hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); 11895 } 11896 11897 if (hit) { 11898 // SELECT 11899 if (selectee.selected) { 11900 selectee.$element.removeClass("ui-selected"); 11901 selectee.selected = false; 11902 } 11903 if (selectee.unselecting) { 11904 selectee.$element.removeClass("ui-unselecting"); 11905 selectee.unselecting = false;
vendor: 11,146 bytes, lines 11906-12374
11906 } 11907 if (!selectee.selecting) { 11908 selectee.$element.addClass("ui-selecting"); 11909 selectee.selecting = true; 11910 // selectable SELECTING callback 11911 that._trigger("selecting", event, { 11912 selecting: selectee.element 11913 }); 11914 } 11915 } else { 11916 // UNSELECT 11917 if (selectee.selecting) { 11918 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 11919 selectee.$element.removeClass("ui-selecting"); 11920 selectee.selecting = false; 11921 selectee.$element.addClass("ui-selected"); 11922 selectee.selected = true; 11923 } else { 11924 selectee.$element.removeClass("ui-selecting"); 11925 selectee.selecting = false; 11926 if (selectee.startselected) { 11927 selectee.$element.addClass("ui-unselecting"); 11928 selectee.unselecting = true; 11929 } 11930 // selectable UNSELECTING callback 11931 that._trigger("unselecting", event, { 11932 unselecting: selectee.element 11933 }); 11934 } 11935 } 11936 if (selectee.selected) { 11937 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 11938 selectee.$element.removeClass("ui-selected"); 11939 selectee.selected = false; 11940 11941 selectee.$element.addClass("ui-unselecting"); 11942 selectee.unselecting = true; 11943 // selectable UNSELECTING callback 11944 that._trigger("unselecting", event, { 11945 unselecting: selectee.element 11946 }); 11947 } 11948 } 11949 } 11950 }); 11951 11952 return false; 11953 }, 11954 11955 _mouseStop: function (event) { 11956 var that = this; 11957 11958 this.dragged = false; 11959 11960 $(".ui-unselecting", this.element[0]).each(function () { 11961 var selectee = $.data(this, "selectable-item"); 11962 selectee.$element.removeClass("ui-unselecting"); 11963 selectee.unselecting = false; 11964 selectee.startselected = false; 11965 that._trigger("unselected", event, { 11966 unselected: selectee.element 11967 }); 11968 }); 11969 $(".ui-selecting", this.element[0]).each(function () { 11970 var selectee = $.data(this, "selectable-item"); 11971 selectee.$element.removeClass("ui-selecting").addClass("ui-selected"); 11972 selectee.selecting = false; 11973 selectee.selected = true; 11974 selectee.startselected = true; 11975 that._trigger("selected", event, { 11976 selected: selectee.element 11977 }); 11978 }); 11979 this._trigger("stop", event); 11980 11981 this.helper.remove(); 11982 11983 return false; 11984 } 11985 }); 11986 11987 /*! 11988 * jQuery UI Selectmenu 1.11.4 11989 * http://jqueryui.com 11990 * 11991 * Copyright jQuery Foundation and other contributors 11992 * Released under the MIT license. 11993 * http://jquery.org/license 11994 * 11995 * http://api.jqueryui.com/selectmenu 11996 */ 11997 11998 var selectmenu = $.widget("ui.selectmenu", { 11999 version: "1.11.4", 12000 defaultElement: "<select>", 12001 options: { 12002 appendTo: null, 12003 disabled: null, 12004 icons: { 12005 button: "ui-icon-triangle-1-s" 12006 }, 12007 position: { 12008 my: "left top", 12009 at: "left bottom", 12010 collision: "none" 12011 }, 12012 width: null, 12013 12014 // callbacks 12015 change: null, 12016 close: null, 12017 focus: null, 12018 open: null, 12019 select: null 12020 }, 12021 12022 _create: function () { 12023 var selectmenuId = this.element.uniqueId().attr("id"); 12024 this.ids = { 12025 element: selectmenuId, 12026 button: selectmenuId + "-button", 12027 menu: selectmenuId + "-menu" 12028 }; 12029 12030 this._drawButton(); 12031 this._drawMenu(); 12032 12033 if (this.options.disabled) { 12034 this.disable(); 12035 } 12036 }, 12037 12038 _drawButton: function () { 12039 var that = this; 12040 12041 // Associate existing label with the new button 12042 this.label = $("label[for='" + this.ids.element + "']").attr("for", this.ids.button); 12043 this._on(this.label, { 12044 click: function (event) { 12045 this.button.focus(); 12046 event.preventDefault(); 12047 } 12048 }); 12049 12050 // Hide original select element 12051 this.element.hide(); 12052 12053 // Create button 12054 this.button = $("<span>", { 12055 "class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all", 12056 tabindex: this.options.disabled ? -1 : 0, 12057 id: this.ids.button, 12058 role: "combobox", 12059 "aria-expanded": "false", 12060 "aria-autocomplete": "list", 12061 "aria-owns": this.ids.menu, 12062 "aria-haspopup": "true" 12063 }) 12064 .insertAfter(this.element); 12065 12066 $("<span>", { 12067 "class": "ui-icon " + this.options.icons.button 12068 }) 12069 .prependTo(this.button); 12070 12071 this.buttonText = $("<span>", { 12072 "class": "ui-selectmenu-text" 12073 }) 12074 .appendTo(this.button); 12075 12076 this._setText(this.buttonText, this.element.find("option:selected").text()); 12077 this._resizeButton(); 12078 12079 this._on(this.button, this._buttonEvents); 12080 this.button.one("focusin", function () { 12081 // Delay rendering the menu items until the button receives focus. 12082 // The menu may have already been rendered via a programmatic open. 12083 if (!that.menuItems) { 12084 that._refreshMenu(); 12085 } 12086 }); 12087 this._hoverable(this.button); 12088 this._focusable(this.button); 12089 }, 12090 12091 _drawMenu: function () { 12092 var that = this; 12093 12094 // Create menu 12095 this.menu = $("<ul>", { 12096 "aria-hidden": "true", 12097 "aria-labelledby": this.ids.button, 12098 id: this.ids.menu 12099 }); 12100 12101 // Wrap menu 12102 this.menuWrap = $("<div>", { 12103 "class": "ui-selectmenu-menu ui-front" 12104 }) 12105 .append(this.menu) 12106 .appendTo(this._appendTo()); 12107 12108 // Initialize menu widget 12109 this.menuInstance = this.menu 12110 .menu({ 12111 role: "listbox", 12112 select: function (event, ui) { 12113 event.preventDefault(); 12114 12115 // support: IE8 12116 // If the item was selected via a click, the text selection 12117 // will be destroyed in IE 12118 that._setSelection(); 12119 12120 that._select(ui.item.data("ui-selectmenu-item"), event); 12121 }, 12122 focus: function (event, ui) { 12123 var item = ui.item.data("ui-selectmenu-item"); 12124 12125 // Prevent inital focus from firing and check if its a newly focused item 12126 if (that.focusIndex != null && item.index !== that.focusIndex) { 12127 that._trigger("focus", event, { item: item }); 12128 if (!that.isOpen) { 12129 that._select(item, event); 12130 } 12131 } 12132 that.focusIndex = item.index; 12133 12134 that.button.attr("aria-activedescendant", 12135 that.menuItems.eq(item.index).attr("id")); 12136 } 12137 }) 12138 .menu("instance"); 12139 12140 // Adjust menu styles to dropdown 12141 this.menu 12142 .addClass("ui-corner-bottom") 12143 .removeClass("ui-corner-all"); 12144 12145 // Don't close the menu on mouseleave 12146 this.menuInstance._off(this.menu, "mouseleave"); 12147 12148 // Cancel the menu's collapseAll on document click 12149 this.menuInstance._closeOnDocumentClick = function () { 12150 return false; 12151 }; 12152 12153 // Selects often contain empty items, but never contain dividers 12154 this.menuInstance._isDivider = function () { 12155 return false; 12156 }; 12157 }, 12158 12159 refresh: function () { 12160 this._refreshMenu(); 12161 this._setText(this.buttonText, this._getSelectedItem().text()); 12162 if (!this.options.width) { 12163 this._resizeButton(); 12164 } 12165 }, 12166 12167 _refreshMenu: function () { 12168 this.menu.empty(); 12169 12170 var item, 12171 options = this.element.find("option"); 12172 12173 if (!options.length) { 12174 return; 12175 } 12176 12177 this._parseOptions(options); 12178 this._renderMenu(this.menu, this.items); 12179 12180 this.menuInstance.refresh(); 12181 this.menuItems = this.menu.find("li").not(".ui-selectmenu-optgroup"); 12182 12183 item = this._getSelectedItem(); 12184 12185 // Update the menu to have the correct item focused 12186 this.menuInstance.focus(null, item); 12187 this._setAria(item.data("ui-selectmenu-item")); 12188 12189 // Set disabled state 12190 this._setOption("disabled", this.element.prop("disabled")); 12191 }, 12192 12193 open: function (event) { 12194 if (this.options.disabled) { 12195 return; 12196 } 12197 12198 // If this is the first time the menu is being opened, render the items 12199 if (!this.menuItems) { 12200 this._refreshMenu(); 12201 } else { 12202 // Menu clears focus on close, reset focus to selected item 12203 this.menu.find(".ui-state-focus").removeClass("ui-state-focus"); 12204 this.menuInstance.focus(null, this._getSelectedItem()); 12205 } 12206 12207 this.isOpen = true; 12208 this._toggleAttr(); 12209 this._resizeMenu(); 12210 this._position(); 12211 12212 this._on(this.document, this._documentClick); 12213 12214 this._trigger("open", event); 12215 }, 12216 12217 _position: function () { 12218 this.menuWrap.position($.extend({ of: this.button }, this.options.position)); 12219 }, 12220 12221 close: function (event) { 12222 if (!this.isOpen) { 12223 return; 12224 } 12225 12226 this.isOpen = false; 12227 this._toggleAttr(); 12228 12229 this.range = null; 12230 this._off(this.document); 12231 12232 this._trigger("close", event); 12233 }, 12234 12235 widget: function () { 12236 return this.button; 12237 }, 12238 12239 menuWidget: function () { 12240 return this.menu; 12241 }, 12242 12243 _renderMenu: function (ul, items) { 12244 var that = this, 12245 currentOptgroup = ""; 12246 12247 $.each(items, function (index, item) { 12248 if (item.optgroup !== currentOptgroup) { 12249 $("<li>", { 12250 "class": "ui-selectmenu-optgroup ui-menu-divider" + 12251 (item.element.parent("optgroup").prop("disabled") ? 12252 " ui-state-disabled" : 12253 ""), 12254 text: item.optgroup 12255 }) 12256 .appendTo(ul); 12257 12258 currentOptgroup = item.optgroup; 12259 } 12260 12261 that._renderItemData(ul, item); 12262 }); 12263 }, 12264 12265 _renderItemData: function (ul, item) { 12266 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 12267 }, 12268 12269 _renderItem: function (ul, item) { 12270 var li = $("<li>"); 12271 12272 if (item.disabled) { 12273 li.addClass("ui-state-disabled"); 12274 } 12275 this._setText(li, item.label); 12276 12277 return li.appendTo(ul); 12278 }, 12279 12280 _setText: function (element, value) { 12281 if (value) { 12282 element.text(value); 12283 } else { 12284 element.html(" "); 12285 } 12286 }, 12287 12288 _move: function (direction, event) { 12289 var item, next, 12290 filter = ".ui-menu-item"; 12291 12292 if (this.isOpen) { 12293 item = this.menuItems.eq(this.focusIndex); 12294 } else { 12295 item = this.menuItems.eq(this.element[0].selectedIndex); 12296 filter += ":not(.ui-state-disabled)"; 12297 } 12298 12299 if (direction === "first" || direction === "last") { 12300 next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 12301 } else { 12302 next = item[direction + "All"](filter).eq(0); 12303 } 12304 12305 if (next.length) { 12306 this.menuInstance.focus(event, next); 12307 } 12308 }, 12309 12310 _getSelectedItem: function () { 12311 return this.menuItems.eq(this.element[0].selectedIndex); 12312 }, 12313 12314 _toggle: function (event) { 12315 this[this.isOpen ? "close" : "open"](event); 12316 }, 12317 12318 _setSelection: function () { 12319 var selection; 12320 12321 if (!this.range) { 12322 return; 12323 } 12324 12325 if (window.getSelection) { 12326 selection = window.getSelection(); 12327 selection.removeAllRanges(); 12328 selection.addRange(this.range); 12329 12330 // support: IE8 12331 } else { 12332 this.range.select(); 12333 } 12334 12335 // support: IE 12336 // Setting the text selection kills the button focus in IE, but 12337 // restoring the focus doesn't kill the selection. 12338 this.button.focus(); 12339 }, 12340 12341 _documentClick: { 12342 mousedown: function (event) { 12343 if (!this.isOpen) { 12344 return; 12345 } 12346 12347 if (!$(event.target).closest(".ui-selectmenu-menu, #" + this.ids.button).length) { 12348 this.close(event); 12349 } 12350 } 12351 }, 12352 12353 _buttonEvents: { 12354 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 12355 mousedown: function () { 12356 var selection; 12357 12358 if (window.getSelection) { 12359 selection = window.getSelection(); 12360 if (selection.rangeCount) { 12361 this.range = selection.getRangeAt(0); 12362 } 12363 12364 // support: IE8 12365 } else { 12366 this.range = document.selection.createRange(); 12367 } 12368 }, 12369 12370 click: function (event) { 12371 this._setSelection(); 12372 this._toggle(event); 12373 }, 12374
vendor: 1,238 bytes, lines 12375-12425
12375 keydown: function (event) { 12376 var preventDefault = true; 12377 switch (event.keyCode) { 12378 case $.ui.keyCode.TAB: 12379 case $.ui.keyCode.ESCAPE: 12380 this.close(event); 12381 preventDefault = false; 12382 break; 12383 case $.ui.keyCode.ENTER: 12384 if (this.isOpen) { 12385 this._selectFocusedItem(event); 12386 } 12387 break; 12388 case $.ui.keyCode.UP: 12389 if (event.altKey) { 12390 this._toggle(event); 12391 } else { 12392 this._move("prev", event); 12393 } 12394 break; 12395 case $.ui.keyCode.DOWN: 12396 if (event.altKey) { 12397 this._toggle(event); 12398 } else { 12399 this._move("next", event); 12400 } 12401 break; 12402 case $.ui.keyCode.SPACE: 12403 if (this.isOpen) { 12404 this._selectFocusedItem(event); 12405 } else { 12406 this._toggle(event); 12407 } 12408 break; 12409 case $.ui.keyCode.LEFT: 12410 this._move("prev", event); 12411 break; 12412 case $.ui.keyCode.RIGHT: 12413 this._move("next", event); 12414 break; 12415 case $.ui.keyCode.HOME: 12416 case $.ui.keyCode.PAGE_UP: 12417 this._move("first", event); 12418 break; 12419 case $.ui.keyCode.END: 12420 case $.ui.keyCode.PAGE_DOWN: 12421 this._move("last", event); 12422 break; 12423 default: 12424 this.menu.trigger(event); 12425 preventDefault = false;
vendor: 13,177 bytes, lines 12426-12954
12426 } 12427 12428 if (preventDefault) { 12429 event.preventDefault(); 12430 } 12431 } 12432 }, 12433 12434 _selectFocusedItem: function (event) { 12435 var item = this.menuItems.eq(this.focusIndex); 12436 if (!item.hasClass("ui-state-disabled")) { 12437 this._select(item.data("ui-selectmenu-item"), event); 12438 } 12439 }, 12440 12441 _select: function (item, event) { 12442 var oldIndex = this.element[0].selectedIndex; 12443 12444 // Change native select element 12445 this.element[0].selectedIndex = item.index; 12446 this._setText(this.buttonText, item.label); 12447 this._setAria(item); 12448 this._trigger("select", event, { item: item }); 12449 12450 if (item.index !== oldIndex) { 12451 this._trigger("change", event, { item: item }); 12452 } 12453 12454 this.close(event); 12455 }, 12456 12457 _setAria: function (item) { 12458 var id = this.menuItems.eq(item.index).attr("id"); 12459 12460 this.button.attr({ 12461 "aria-labelledby": id, 12462 "aria-activedescendant": id 12463 }); 12464 this.menu.attr("aria-activedescendant", id); 12465 }, 12466 12467 _setOption: function (key, value) { 12468 if (key === "icons") { 12469 this.button.find("span.ui-icon") 12470 .removeClass(this.options.icons.button) 12471 .addClass(value.button); 12472 } 12473 12474 this._super(key, value); 12475 12476 if (key === "appendTo") { 12477 this.menuWrap.appendTo(this._appendTo()); 12478 } 12479 12480 if (key === "disabled") { 12481 this.menuInstance.option("disabled", value); 12482 this.button 12483 .toggleClass("ui-state-disabled", value) 12484 .attr("aria-disabled", value); 12485 12486 this.element.prop("disabled", value); 12487 if (value) { 12488 this.button.attr("tabindex", -1); 12489 this.close(); 12490 } else { 12491 this.button.attr("tabindex", 0); 12492 } 12493 } 12494 12495 if (key === "width") { 12496 this._resizeButton(); 12497 } 12498 }, 12499 12500 _appendTo: function () { 12501 var element = this.options.appendTo; 12502 12503 if (element) { 12504 element = element.jquery || element.nodeType ? 12505 $(element) : 12506 this.document.find(element).eq(0); 12507 } 12508 12509 if (!element || !element[0]) { 12510 element = this.element.closest(".ui-front"); 12511 } 12512 12513 if (!element.length) { 12514 element = this.document[0].body; 12515 } 12516 12517 return element; 12518 }, 12519 12520 _toggleAttr: function () { 12521 this.button 12522 .toggleClass("ui-corner-top", this.isOpen) 12523 .toggleClass("ui-corner-all", !this.isOpen) 12524 .attr("aria-expanded", this.isOpen); 12525 this.menuWrap.toggleClass("ui-selectmenu-open", this.isOpen); 12526 this.menu.attr("aria-hidden", !this.isOpen); 12527 }, 12528 12529 _resizeButton: function () { 12530 var width = this.options.width; 12531 12532 if (!width) { 12533 width = this.element.show().outerWidth(); 12534 this.element.hide(); 12535 } 12536 12537 this.button.outerWidth(width); 12538 }, 12539 12540 _resizeMenu: function () { 12541 this.menu.outerWidth(Math.max( 12542 this.button.outerWidth(), 12543 12544 // support: IE10 12545 // IE10 wraps long text (possibly a rounding bug) 12546 // so we add 1px to avoid the wrapping 12547 this.menu.width("").outerWidth() + 1 12548 )); 12549 }, 12550 12551 _getCreateOptions: function () { 12552 return { disabled: this.element.prop("disabled") }; 12553 }, 12554 12555 _parseOptions: function (options) { 12556 var data = []; 12557 options.each(function (index, item) { 12558 var option = $(item), 12559 optgroup = option.parent("optgroup"); 12560 data.push({ 12561 element: option, 12562 index: index, 12563 value: option.val(), 12564 label: option.text(), 12565 optgroup: optgroup.attr("label") || "", 12566 disabled: optgroup.prop("disabled") || option.prop("disabled") 12567 }); 12568 }); 12569 this.items = data; 12570 }, 12571 12572 _destroy: function () { 12573 this.menuWrap.remove(); 12574 this.button.remove(); 12575 this.element.show(); 12576 this.element.removeUniqueId(); 12577 this.label.attr("for", this.ids.element); 12578 } 12579 }); 12580 12581 /*! 12582 * jQuery UI Slider 1.11.4 12583 * http://jqueryui.com 12584 * 12585 * Copyright jQuery Foundation and other contributors 12586 * Released under the MIT license. 12587 * http://jquery.org/license 12588 * 12589 * http://api.jqueryui.com/slider/ 12590 */ 12591 12592 var slider = $.widget("ui.slider", $.ui.mouse, { 12593 version: "1.11.4", 12594 widgetEventPrefix: "slide", 12595 12596 options: { 12597 animate: false, 12598 distance: 0, 12599 max: 100, 12600 min: 0, 12601 orientation: "horizontal", 12602 range: false, 12603 step: 1, 12604 value: 0, 12605 values: null, 12606 12607 // callbacks 12608 change: null, 12609 slide: null, 12610 start: null, 12611 stop: null 12612 }, 12613 12614 // number of pages in a slider 12615 // (how many times can you page up/down to go through the whole range) 12616 numPages: 5, 12617 12618 _create: function () { 12619 this._keySliding = false; 12620 this._mouseSliding = false; 12621 this._animateOff = true; 12622 this._handleIndex = null; 12623 this._detectOrientation(); 12624 this._mouseInit(); 12625 this._calculateNewMax(); 12626 12627 this.element 12628 .addClass("ui-slider" + 12629 " ui-slider-" + this.orientation + 12630 " ui-widget" + 12631 " ui-widget-content" + 12632 " ui-corner-all"); 12633 12634 this._refresh(); 12635 this._setOption("disabled", this.options.disabled); 12636 12637 this._animateOff = false; 12638 }, 12639 12640 _refresh: function () { 12641 this._createRange(); 12642 this._createHandles(); 12643 this._setupEvents(); 12644 this._refreshValue(); 12645 }, 12646 12647 _createHandles: function () { 12648 var i, handleCount, 12649 options = this.options, 12650 existingHandles = this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"), 12651 handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>", 12652 handles = []; 12653 12654 handleCount = (options.values && options.values.length) || 1; 12655 12656 if (existingHandles.length > handleCount) { 12657 existingHandles.slice(handleCount).remove(); 12658 existingHandles = existingHandles.slice(0, handleCount); 12659 } 12660 12661 for (i = existingHandles.length; i < handleCount; i++) { 12662 handles.push(handle); 12663 } 12664 12665 this.handles = existingHandles.add($(handles.join("")).appendTo(this.element)); 12666 12667 this.handle = this.handles.eq(0); 12668 12669 this.handles.each(function (i) { 12670 $(this).data("ui-slider-handle-index", i); 12671 }); 12672 }, 12673 12674 _createRange: function () { 12675 var options = this.options, 12676 classes = ""; 12677 12678 if (options.range) { 12679 if (options.range === true) { 12680 if (!options.values) { 12681 options.values = [this._valueMin(), this._valueMin()]; 12682 } else if (options.values.length && options.values.length !== 2) { 12683 options.values = [options.values[0], options.values[0]]; 12684 } else if ($.isArray(options.values)) { 12685 options.values = options.values.slice(0); 12686 } 12687 } 12688 12689 if (!this.range || !this.range.length) { 12690 this.range = $("<div></div>") 12691 .appendTo(this.element); 12692 12693 classes = "ui-slider-range" + 12694 // note: this isn't the most fittingly semantic framework class for this element, 12695 // but worked best visually with a variety of themes 12696 " ui-widget-header ui-corner-all"; 12697 } else { 12698 this.range.removeClass("ui-slider-range-min ui-slider-range-max") 12699 // Handle range switching from true to min/max 12700 .css({ 12701 "left": "", 12702 "bottom": "" 12703 }); 12704 } 12705 12706 this.range.addClass(classes + 12707 ((options.range === "min" || options.range === "max") ? " ui-slider-range-" + options.range : "")); 12708 } else { 12709 if (this.range) { 12710 this.range.remove(); 12711 } 12712 this.range = null; 12713 } 12714 }, 12715 12716 _setupEvents: function () { 12717 this._off(this.handles); 12718 this._on(this.handles, this._handleEvents); 12719 this._hoverable(this.handles); 12720 this._focusable(this.handles); 12721 }, 12722 12723 _destroy: function () { 12724 this.handles.remove(); 12725 if (this.range) { 12726 this.range.remove(); 12727 } 12728 12729 this.element 12730 .removeClass("ui-slider" + 12731 " ui-slider-horizontal" + 12732 " ui-slider-vertical" + 12733 " ui-widget" + 12734 " ui-widget-content" + 12735 " ui-corner-all"); 12736 12737 this._mouseDestroy(); 12738 }, 12739 12740 _mouseCapture: function (event) { 12741 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 12742 that = this, 12743 o = this.options; 12744 12745 if (o.disabled) { 12746 return false; 12747 } 12748 12749 this.elementSize = { 12750 width: this.element.outerWidth(), 12751 height: this.element.outerHeight() 12752 }; 12753 this.elementOffset = this.element.offset(); 12754 12755 position = { x: event.pageX, y: event.pageY }; 12756 normValue = this._normValueFromMouse(position); 12757 distance = this._valueMax() - this._valueMin() + 1; 12758 this.handles.each(function (i) { 12759 var thisDistance = Math.abs(normValue - that.values(i)); 12760 if ((distance > thisDistance) || 12761 (distance === thisDistance && 12762 (i === that._lastChangedValue || that.values(i) === o.min))) { 12763 distance = thisDistance; 12764 closestHandle = $(this); 12765 index = i; 12766 } 12767 }); 12768 12769 allowed = this._start(event, index); 12770 if (allowed === false) { 12771 return false; 12772 } 12773 this._mouseSliding = true; 12774 12775 this._handleIndex = index; 12776 12777 closestHandle 12778 .addClass("ui-state-active") 12779 .focus(); 12780 12781 offset = closestHandle.offset(); 12782 mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle"); 12783 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 12784 left: event.pageX - offset.left - (closestHandle.width() / 2), 12785 top: event.pageY - offset.top - 12786 (closestHandle.height() / 2) - 12787 (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - 12788 (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + 12789 (parseInt(closestHandle.css("marginTop"), 10) || 0) 12790 }; 12791 12792 if (!this.handles.hasClass("ui-state-hover")) { 12793 this._slide(event, index, normValue); 12794 } 12795 this._animateOff = true; 12796 return true; 12797 }, 12798 12799 _mouseStart: function () { 12800 return true; 12801 }, 12802 12803 _mouseDrag: function (event) { 12804 var position = { x: event.pageX, y: event.pageY }, 12805 normValue = this._normValueFromMouse(position); 12806 12807 this._slide(event, this._handleIndex, normValue); 12808 12809 return false; 12810 }, 12811 12812 _mouseStop: function (event) { 12813 this.handles.removeClass("ui-state-active"); 12814 this._mouseSliding = false; 12815 12816 this._stop(event, this._handleIndex); 12817 this._change(event, this._handleIndex); 12818 12819 this._handleIndex = null; 12820 this._clickOffset = null; 12821 this._animateOff = false; 12822 12823 return false; 12824 }, 12825 12826 _detectOrientation: function () { 12827 this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal"; 12828 }, 12829 12830 _normValueFromMouse: function (position) { 12831 var pixelTotal, 12832 pixelMouse, 12833 percentMouse, 12834 valueTotal, 12835 valueMouse; 12836 12837 if (this.orientation === "horizontal") { 12838 pixelTotal = this.elementSize.width; 12839 pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0); 12840 } else { 12841 pixelTotal = this.elementSize.height; 12842 pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0); 12843 } 12844 12845 percentMouse = (pixelMouse / pixelTotal); 12846 if (percentMouse > 1) { 12847 percentMouse = 1; 12848 } 12849 if (percentMouse < 0) { 12850 percentMouse = 0; 12851 } 12852 if (this.orientation === "vertical") { 12853 percentMouse = 1 - percentMouse; 12854 } 12855 12856 valueTotal = this._valueMax() - this._valueMin(); 12857 valueMouse = this._valueMin() + percentMouse * valueTotal; 12858 12859 return this._trimAlignValue(valueMouse); 12860 }, 12861 12862 _start: function (event, index) { 12863 var uiHash = { 12864 handle: this.handles[index], 12865 value: this.value() 12866 }; 12867 if (this.options.values && this.options.values.length) { 12868 uiHash.value = this.values(index); 12869 uiHash.values = this.values(); 12870 } 12871 return this._trigger("start", event, uiHash); 12872 }, 12873 12874 _slide: function (event, index, newVal) { 12875 var otherVal, 12876 newValues, 12877 allowed; 12878 12879 if (this.options.values && this.options.values.length) { 12880 otherVal = this.values(index ? 0 : 1); 12881 12882 if ((this.options.values.length === 2 && this.options.range === true) && 12883 ((index === 0 && newVal > otherVal) || (index === 1 && newVal < otherVal)) 12884 ) { 12885 newVal = otherVal; 12886 } 12887 12888 if (newVal !== this.values(index)) { 12889 newValues = this.values(); 12890 newValues[index] = newVal; 12891 // A slide can be canceled by returning false from the slide callback 12892 allowed = this._trigger("slide", event, { 12893 handle: this.handles[index], 12894 value: newVal, 12895 values: newValues 12896 }); 12897 otherVal = this.values(index ? 0 : 1); 12898 if (allowed !== false) { 12899 this.values(index, newVal); 12900 } 12901 } 12902 } else { 12903 if (newVal !== this.value()) { 12904 // A slide can be canceled by returning false from the slide callback 12905 allowed = this._trigger("slide", event, { 12906 handle: this.handles[index], 12907 value: newVal 12908 }); 12909 if (allowed !== false) { 12910 this.value(newVal); 12911 } 12912 } 12913 } 12914 }, 12915 12916 _stop: function (event, index) { 12917 var uiHash = { 12918 handle: this.handles[index], 12919 value: this.value() 12920 }; 12921 if (this.options.values && this.options.values.length) { 12922 uiHash.value = this.values(index); 12923 uiHash.values = this.values(); 12924 } 12925 12926 this._trigger("stop", event, uiHash); 12927 }, 12928 12929 _change: function (event, index) { 12930 if (!this._keySliding && !this._mouseSliding) { 12931 var uiHash = { 12932 handle: this.handles[index], 12933 value: this.value() 12934 }; 12935 if (this.options.values && this.options.values.length) { 12936 uiHash.value = this.values(index); 12937 uiHash.values = this.values(); 12938 } 12939 12940 //store the last changed value index for reference when handles overlap 12941 this._lastChangedValue = index; 12942 12943 this._trigger("change", event, uiHash); 12944 } 12945 }, 12946 12947 value: function (newValue) { 12948 if (arguments.length) { 12949 this.options.value = this._trimAlignValue(newValue); 12950 this._refreshValue(); 12951 this._change(null, 0); 12952 return; 12953 } 12954
vendor: 49,192 bytes, lines 12955-14389
12955 return this._value(); 12956 }, 12957 12958 values: function (index, newValue) { 12959 var vals, 12960 newValues, 12961 i; 12962 12963 if (arguments.length > 1) { 12964 this.options.values[index] = this._trimAlignValue(newValue); 12965 this._refreshValue(); 12966 this._change(null, index); 12967 return; 12968 } 12969 12970 if (arguments.length) { 12971 if ($.isArray(arguments[0])) { 12972 vals = this.options.values; 12973 newValues = arguments[0]; 12974 for (i = 0; i < vals.length; i += 1) { 12975 vals[i] = this._trimAlignValue(newValues[i]); 12976 this._change(null, i); 12977 } 12978 this._refreshValue(); 12979 } else { 12980 if (this.options.values && this.options.values.length) { 12981 return this._values(index); 12982 } else { 12983 return this.value(); 12984 } 12985 } 12986 } else { 12987 return this._values(); 12988 } 12989 }, 12990 12991 _setOption: function (key, value) { 12992 var i, 12993 valsLength = 0; 12994 12995 if (key === "range" && this.options.range === true) { 12996 if (value === "min") { 12997 this.options.value = this._values(0); 12998 this.options.values = null; 12999 } else if (value === "max") { 13000 this.options.value = this._values(this.options.values.length - 1); 13001 this.options.values = null; 13002 } 13003 } 13004 13005 if ($.isArray(this.options.values)) { 13006 valsLength = this.options.values.length; 13007 } 13008 13009 if (key === "disabled") { 13010 this.element.toggleClass("ui-state-disabled", !!value); 13011 } 13012 13013 this._super(key, value); 13014 13015 switch (key) { 13016 case "orientation": 13017 this._detectOrientation(); 13018 this.element 13019 .removeClass("ui-slider-horizontal ui-slider-vertical") 13020 .addClass("ui-slider-" + this.orientation); 13021 this._refreshValue(); 13022 13023 // Reset positioning from previous orientation 13024 this.handles.css(value === "horizontal" ? "bottom" : "left", ""); 13025 break; 13026 case "value": 13027 this._animateOff = true; 13028 this._refreshValue(); 13029 this._change(null, 0); 13030 this._animateOff = false; 13031 break; 13032 case "values": 13033 this._animateOff = true; 13034 this._refreshValue(); 13035 for (i = 0; i < valsLength; i += 1) { 13036 this._change(null, i); 13037 } 13038 this._animateOff = false; 13039 break; 13040 case "step": 13041 case "min": 13042 case "max": 13043 this._animateOff = true; 13044 this._calculateNewMax(); 13045 this._refreshValue(); 13046 this._animateOff = false; 13047 break; 13048 case "range": 13049 this._animateOff = true; 13050 this._refresh(); 13051 this._animateOff = false; 13052 break; 13053 } 13054 }, 13055 13056 //internal value getter 13057 // _value() returns value trimmed by min and max, aligned by step 13058 _value: function () { 13059 var val = this.options.value; 13060 val = this._trimAlignValue(val); 13061 13062 return val; 13063 }, 13064 13065 //internal values getter 13066 // _values() returns array of values trimmed by min and max, aligned by step 13067 // _values( index ) returns single value trimmed by min and max, aligned by step 13068 _values: function (index) { 13069 var val, 13070 vals, 13071 i; 13072 13073 if (arguments.length) { 13074 val = this.options.values[index]; 13075 val = this._trimAlignValue(val); 13076 13077 return val; 13078 } else if (this.options.values && this.options.values.length) { 13079 // .slice() creates a copy of the array 13080 // this copy gets trimmed by min and max and then returned 13081 vals = this.options.values.slice(); 13082 for (i = 0; i < vals.length; i += 1) { 13083 vals[i] = this._trimAlignValue(vals[i]); 13084 } 13085 13086 return vals; 13087 } else { 13088 return []; 13089 } 13090 }, 13091 13092 // returns the step-aligned value that val is closest to, between (inclusive) min and max 13093 _trimAlignValue: function (val) { 13094 if (val <= this._valueMin()) { 13095 return this._valueMin(); 13096 } 13097 if (val >= this._valueMax()) { 13098 return this._valueMax(); 13099 } 13100 var step = (this.options.step > 0) ? this.options.step : 1, 13101 valModStep = (val - this._valueMin()) % step, 13102 alignValue = val - valModStep; 13103 13104 if (Math.abs(valModStep) * 2 >= step) { 13105 alignValue += (valModStep > 0) ? step : (-step); 13106 } 13107 13108 // Since JavaScript has problems with large floats, round 13109 // the final value to 5 digits after the decimal point (see #4124) 13110 return parseFloat(alignValue.toFixed(5)); 13111 }, 13112 13113 _calculateNewMax: function () { 13114 var max = this.options.max, 13115 min = this._valueMin(), 13116 step = this.options.step, 13117 aboveMin = Math.floor((+(max - min).toFixed(this._precision())) / step) * step; 13118 max = aboveMin + min; 13119 this.max = parseFloat(max.toFixed(this._precision())); 13120 }, 13121 13122 _precision: function () { 13123 var precision = this._precisionOf(this.options.step); 13124 if (this.options.min !== null) { 13125 precision = Math.max(precision, this._precisionOf(this.options.min)); 13126 } 13127 return precision; 13128 }, 13129 13130 _precisionOf: function (num) { 13131 var str = num.toString(), 13132 decimal = str.indexOf("."); 13133 return decimal === -1 ? 0 : str.length - decimal - 1; 13134 }, 13135 13136 _valueMin: function () { 13137 return this.options.min; 13138 }, 13139 13140 _valueMax: function () { 13141 return this.max; 13142 }, 13143 13144 _refreshValue: function () { 13145 var lastValPercent, valPercent, value, valueMin, valueMax, 13146 oRange = this.options.range, 13147 o = this.options, 13148 that = this, 13149 animate = (!this._animateOff) ? o.animate : false, 13150 _set = {}; 13151 13152 if (this.options.values && this.options.values.length) { 13153 this.handles.each(function (i) { 13154 valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100; 13155 _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 13156 $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 13157 if (that.options.range === true) { 13158 if (that.orientation === "horizontal") { 13159 if (i === 0) { 13160 that.range.stop(1, 1)[animate ? "animate" : "css"]({ left: valPercent + "%" }, o.animate); 13161 } 13162 if (i === 1) { 13163 that.range[animate ? "animate" : "css"]({ width: (valPercent - lastValPercent) + "%" }, { queue: false, duration: o.animate }); 13164 } 13165 } else { 13166 if (i === 0) { 13167 that.range.stop(1, 1)[animate ? "animate" : "css"]({ bottom: (valPercent) + "%" }, o.animate); 13168 } 13169 if (i === 1) { 13170 that.range[animate ? "animate" : "css"]({ height: (valPercent - lastValPercent) + "%" }, { queue: false, duration: o.animate }); 13171 } 13172 } 13173 } 13174 lastValPercent = valPercent; 13175 }); 13176 } else { 13177 value = this.value(); 13178 valueMin = this._valueMin(); 13179 valueMax = this._valueMax(); 13180 valPercent = (valueMax !== valueMin) ? 13181 (value - valueMin) / (valueMax - valueMin) * 100 : 13182 0; 13183 _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 13184 this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 13185 13186 if (oRange === "min" && this.orientation === "horizontal") { 13187 this.range.stop(1, 1)[animate ? "animate" : "css"]({ width: valPercent + "%" }, o.animate); 13188 } 13189 if (oRange === "max" && this.orientation === "horizontal") { 13190 this.range[animate ? "animate" : "css"]({ width: (100 - valPercent) + "%" }, { queue: false, duration: o.animate }); 13191 } 13192 if (oRange === "min" && this.orientation === "vertical") { 13193 this.range.stop(1, 1)[animate ? "animate" : "css"]({ height: valPercent + "%" }, o.animate); 13194 } 13195 if (oRange === "max" && this.orientation === "vertical") { 13196 this.range[animate ? "animate" : "css"]({ height: (100 - valPercent) + "%" }, { queue: false, duration: o.animate }); 13197 } 13198 } 13199 }, 13200 13201 _handleEvents: { 13202 keydown: function (event) { 13203 var allowed, curVal, newVal, step, 13204 index = $(event.target).data("ui-slider-handle-index"); 13205 13206 switch (event.keyCode) { 13207 case $.ui.keyCode.HOME: 13208 case $.ui.keyCode.END: 13209 case $.ui.keyCode.PAGE_UP: 13210 case $.ui.keyCode.PAGE_DOWN: 13211 case $.ui.keyCode.UP: 13212 case $.ui.keyCode.RIGHT: 13213 case $.ui.keyCode.DOWN: 13214 case $.ui.keyCode.LEFT: 13215 event.preventDefault(); 13216 if (!this._keySliding) { 13217 this._keySliding = true; 13218 $(event.target).addClass("ui-state-active"); 13219 allowed = this._start(event, index); 13220 if (allowed === false) { 13221 return; 13222 } 13223 } 13224 break; 13225 } 13226 13227 step = this.options.step; 13228 if (this.options.values && this.options.values.length) { 13229 curVal = newVal = this.values(index); 13230 } else { 13231 curVal = newVal = this.value(); 13232 } 13233 13234 switch (event.keyCode) { 13235 case $.ui.keyCode.HOME: 13236 newVal = this._valueMin(); 13237 break; 13238 case $.ui.keyCode.END: 13239 newVal = this._valueMax(); 13240 break; 13241 case $.ui.keyCode.PAGE_UP: 13242 newVal = this._trimAlignValue( 13243 curVal + ((this._valueMax() - this._valueMin()) / this.numPages) 13244 ); 13245 break; 13246 case $.ui.keyCode.PAGE_DOWN: 13247 newVal = this._trimAlignValue( 13248 curVal - ((this._valueMax() - this._valueMin()) / this.numPages)); 13249 break; 13250 case $.ui.keyCode.UP: 13251 case $.ui.keyCode.RIGHT: 13252 if (curVal === this._valueMax()) { 13253 return; 13254 } 13255 newVal = this._trimAlignValue(curVal + step); 13256 break; 13257 case $.ui.keyCode.DOWN: 13258 case $.ui.keyCode.LEFT: 13259 if (curVal === this._valueMin()) { 13260 return; 13261 } 13262 newVal = this._trimAlignValue(curVal - step); 13263 break; 13264 } 13265 13266 this._slide(event, index, newVal); 13267 }, 13268 keyup: function (event) { 13269 var index = $(event.target).data("ui-slider-handle-index"); 13270 13271 if (this._keySliding) { 13272 this._keySliding = false; 13273 this._stop(event, index); 13274 this._change(event, index); 13275 $(event.target).removeClass("ui-state-active"); 13276 } 13277 } 13278 } 13279 }); 13280 13281 /*! 13282 * jQuery UI Sortable 1.11.4 13283 * http://jqueryui.com 13284 * 13285 * Copyright jQuery Foundation and other contributors 13286 * Released under the MIT license. 13287 * http://jquery.org/license 13288 * 13289 * http://api.jqueryui.com/sortable/ 13290 */ 13291 13292 var sortable = $.widget("ui.sortable", $.ui.mouse, { 13293 version: "1.11.4", 13294 widgetEventPrefix: "sort", 13295 ready: false, 13296 options: { 13297 appendTo: "parent", 13298 axis: false, 13299 connectWith: false, 13300 containment: false, 13301 cursor: "auto", 13302 cursorAt: false, 13303 dropOnEmpty: true, 13304 forcePlaceholderSize: false, 13305 forceHelperSize: false, 13306 grid: false, 13307 handle: false, 13308 helper: "original", 13309 items: "> *", 13310 opacity: false, 13311 placeholder: false, 13312 revert: false, 13313 scroll: true, 13314 scrollSensitivity: 20, 13315 scrollSpeed: 20, 13316 scope: "default", 13317 tolerance: "intersect", 13318 zIndex: 1000, 13319 13320 // callbacks 13321 activate: null, 13322 beforeStop: null, 13323 change: null, 13324 deactivate: null, 13325 out: null, 13326 over: null, 13327 receive: null, 13328 remove: null, 13329 sort: null, 13330 start: null, 13331 stop: null, 13332 update: null 13333 }, 13334 13335 _isOverAxis: function (x, reference, size) { 13336 return (x >= reference) && (x < (reference + size)); 13337 }, 13338 13339 _isFloating: function (item) { 13340 return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display")); 13341 }, 13342 13343 _create: function () { 13344 this.containerCache = {}; 13345 this.element.addClass("ui-sortable"); 13346 13347 //Get the items 13348 this.refresh(); 13349 13350 //Let's determine the parent's offset 13351 this.offset = this.element.offset(); 13352 13353 //Initialize mouse events for interaction 13354 this._mouseInit(); 13355 13356 this._setHandleClassName(); 13357 13358 //We're ready to go 13359 this.ready = true; 13360 }, 13361 13362 _setOption: function (key, value) { 13363 this._super(key, value); 13364 13365 if (key === "handle") { 13366 this._setHandleClassName(); 13367 } 13368 }, 13369 13370 _setHandleClassName: function () { 13371 this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"); 13372 $.each(this.items, function () { 13373 (this.instance.options.handle ? 13374 this.item.find(this.instance.options.handle) : this.item) 13375 .addClass("ui-sortable-handle"); 13376 }); 13377 }, 13378 13379 _destroy: function () { 13380 this.element 13381 .removeClass("ui-sortable ui-sortable-disabled") 13382 .find(".ui-sortable-handle") 13383 .removeClass("ui-sortable-handle"); 13384 this._mouseDestroy(); 13385 13386 for (var i = this.items.length - 1; i >= 0; i--) { 13387 this.items[i].item.removeData(this.widgetName + "-item"); 13388 } 13389 13390 return this; 13391 }, 13392 13393 _mouseCapture: function (event, overrideHandle) { 13394 var currentItem = null, 13395 validHandle = false, 13396 that = this; 13397 13398 if (this.reverting) { 13399 return false; 13400 } 13401 13402 if (this.options.disabled || this.options.type === "static") { 13403 return false; 13404 } 13405 13406 //We have to refresh the items data once first 13407 this._refreshItems(event); 13408 13409 //Find out if the clicked node (or one of its parents) is a actual item in this.items 13410 $(event.target).parents().each(function () { 13411 if ($.data(this, that.widgetName + "-item") === that) { 13412 currentItem = $(this); 13413 return false; 13414 } 13415 }); 13416 if ($.data(event.target, that.widgetName + "-item") === that) { 13417 currentItem = $(event.target); 13418 } 13419 13420 if (!currentItem) { 13421 return false; 13422 } 13423 if (this.options.handle && !overrideHandle) { 13424 $(this.options.handle, currentItem).find("*").addBack().each(function () { 13425 if (this === event.target) { 13426 validHandle = true; 13427 } 13428 }); 13429 if (!validHandle) { 13430 return false; 13431 } 13432 } 13433 13434 this.currentItem = currentItem; 13435 this._removeCurrentsFromItems(); 13436 return true; 13437 }, 13438 13439 _mouseStart: function (event, overrideHandle, noActivation) { 13440 var i, body, 13441 o = this.options; 13442 13443 this.currentContainer = this; 13444 13445 //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture 13446 this.refreshPositions(); 13447 13448 //Create and append the visible helper 13449 this.helper = this._createHelper(event); 13450 13451 //Cache the helper size 13452 this._cacheHelperProportions(); 13453 13454 /* 13455 * - Position generation - 13456 * This block generates everything position related - it's the core of draggables. 13457 */ 13458 13459 //Cache the margins of the original element 13460 this._cacheMargins(); 13461 13462 //Get the next scrolling parent 13463 this.scrollParent = this.helper.scrollParent(); 13464 13465 //The element's absolute position on the page minus margins 13466 this.offset = this.currentItem.offset(); 13467 this.offset = { 13468 top: this.offset.top - this.margins.top, 13469 left: this.offset.left - this.margins.left 13470 }; 13471 13472 $.extend(this.offset, { 13473 click: { //Where the click happened, relative to the element 13474 left: event.pageX - this.offset.left, 13475 top: event.pageY - this.offset.top 13476 }, 13477 parent: this._getParentOffset(), 13478 relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper 13479 }); 13480 13481 // Only after we got the offset, we can change the helper's position to absolute 13482 // TODO: Still need to figure out a way to make relative sorting possible 13483 this.helper.css("position", "absolute"); 13484 this.cssPosition = this.helper.css("position"); 13485 13486 //Generate the original position 13487 this.originalPosition = this._generatePosition(event); 13488 this.originalPageX = event.pageX; 13489 this.originalPageY = event.pageY; 13490 13491 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 13492 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 13493 13494 //Cache the former DOM position 13495 this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; 13496 13497 //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way 13498 if (this.helper[0] !== this.currentItem[0]) { 13499 this.currentItem.hide(); 13500 } 13501 13502 //Create the placeholder 13503 this._createPlaceholder(); 13504 13505 //Set a containment if given in the options 13506 if (o.containment) { 13507 this._setContainment(); 13508 } 13509 13510 if (o.cursor && o.cursor !== "auto") { // cursor option 13511 body = this.document.find("body"); 13512 13513 // support: IE 13514 this.storedCursor = body.css("cursor"); 13515 body.css("cursor", o.cursor); 13516 13517 this.storedStylesheet = $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body); 13518 } 13519 13520 if (o.opacity) { // opacity option 13521 if (this.helper.css("opacity")) { 13522 this._storedOpacity = this.helper.css("opacity"); 13523 } 13524 this.helper.css("opacity", o.opacity); 13525 } 13526 13527 if (o.zIndex) { // zIndex option 13528 if (this.helper.css("zIndex")) { 13529 this._storedZIndex = this.helper.css("zIndex"); 13530 } 13531 this.helper.css("zIndex", o.zIndex); 13532 } 13533 13534 //Prepare scrolling 13535 if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") { 13536 this.overflowOffset = this.scrollParent.offset(); 13537 } 13538 13539 //Call callbacks 13540 this._trigger("start", event, this._uiHash()); 13541 13542 //Recache the helper size 13543 if (!this._preserveHelperProportions) { 13544 this._cacheHelperProportions(); 13545 } 13546 13547 //Post "activate" events to possible containers 13548 if (!noActivation) { 13549 for (i = this.containers.length - 1; i >= 0; i--) { 13550 this.containers[i]._trigger("activate", event, this._uiHash(this)); 13551 } 13552 } 13553 13554 //Prepare possible droppables 13555 if ($.ui.ddmanager) { 13556 $.ui.ddmanager.current = this; 13557 } 13558 13559 if ($.ui.ddmanager && !o.dropBehaviour) { 13560 $.ui.ddmanager.prepareOffsets(this, event); 13561 } 13562 13563 this.dragging = true; 13564 13565 this.helper.addClass("ui-sortable-helper"); 13566 this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position 13567 return true; 13568 }, 13569 13570 _mouseDrag: function (event) { 13571 var i, item, itemElement, intersection, 13572 o = this.options, 13573 scrolled = false; 13574 13575 //Compute the helpers position 13576 this.position = this._generatePosition(event); 13577 this.positionAbs = this._convertPositionTo("absolute"); 13578 13579 if (!this.lastPositionAbs) { 13580 this.lastPositionAbs = this.positionAbs; 13581 } 13582 13583 //Do scrolling 13584 if (this.options.scroll) { 13585 if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") { 13586 if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { 13587 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 13588 } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 13589 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 13590 } 13591 13592 if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { 13593 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; 13594 } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 13595 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; 13596 } 13597 } else { 13598 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 13599 scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); 13600 } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) { 13601 scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); 13602 } 13603 13604 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 13605 scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed); 13606 } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) { 13607 scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed); 13608 } 13609 } 13610 13611 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 13612 $.ui.ddmanager.prepareOffsets(this, event); 13613 } 13614 } 13615 13616 //Regenerate the absolute position used for position checks 13617 this.positionAbs = this._convertPositionTo("absolute"); 13618 13619 //Set the helper position 13620 if (!this.options.axis || this.options.axis !== "y") { 13621 this.helper[0].style.left = this.position.left + "px"; 13622 } 13623 if (!this.options.axis || this.options.axis !== "x") { 13624 this.helper[0].style.top = this.position.top + "px"; 13625 } 13626 13627 //Rearrange 13628 for (i = this.items.length - 1; i >= 0; i--) { 13629 //Cache variables and intersection, continue if no intersection 13630 item = this.items[i]; 13631 itemElement = item.item[0]; 13632 intersection = this._intersectsWithPointer(item); 13633 if (!intersection) { 13634 continue; 13635 } 13636 13637 // Only put the placeholder inside the current Container, skip all 13638 // items from other containers. This works because when moving 13639 // an item from one container to another the 13640 // currentContainer is switched before the placeholder is moved. 13641 // 13642 // Without this, moving items in "sub-sortables" can cause 13643 // the placeholder to jitter between the outer and inner container. 13644 if (item.instance !== this.currentContainer) { 13645 continue; 13646 } 13647 13648 // cannot intersect with itself 13649 // no useless actions that have been done before 13650 // no action if the item moved is the parent of the item checked 13651 if (itemElement !== this.currentItem[0] && 13652 this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && 13653 !$.contains(this.placeholder[0], itemElement) && 13654 (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true) 13655 ) { 13656 this.direction = intersection === 1 ? "down" : "up"; 13657 13658 if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { 13659 this._rearrange(event, item); 13660 } else { 13661 break; 13662 } 13663 13664 this._trigger("change", event, this._uiHash()); 13665 break; 13666 } 13667 } 13668 13669 //Post events to containers 13670 this._contactContainers(event); 13671 13672 //Interconnect with droppables 13673 if ($.ui.ddmanager) { 13674 $.ui.ddmanager.drag(this, event); 13675 } 13676 13677 //Call callbacks 13678 this._trigger("sort", event, this._uiHash()); 13679 13680 this.lastPositionAbs = this.positionAbs; 13681 return false; 13682 }, 13683 13684 _mouseStop: function (event, noPropagation) { 13685 if (!event) { 13686 return; 13687 } 13688 13689 //If we are using droppables, inform the manager about the drop 13690 if ($.ui.ddmanager && !this.options.dropBehaviour) { 13691 $.ui.ddmanager.drop(this, event); 13692 } 13693 13694 if (this.options.revert) { 13695 var that = this, 13696 cur = this.placeholder.offset(), 13697 axis = this.options.axis, 13698 animation = {}; 13699 13700 if (!axis || axis === "x") { 13701 animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft); 13702 } 13703 if (!axis || axis === "y") { 13704 animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop); 13705 } 13706 this.reverting = true; 13707 $(this.helper).animate(animation, parseInt(this.options.revert, 10) || 500, function () { 13708 that._clear(event); 13709 }); 13710 } else { 13711 this._clear(event, noPropagation); 13712 } 13713 13714 return false; 13715 }, 13716 13717 cancel: function () { 13718 if (this.dragging) { 13719 this._mouseUp({ target: null }); 13720 13721 if (this.options.helper === "original") { 13722 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 13723 } else { 13724 this.currentItem.show(); 13725 } 13726 13727 //Post deactivating events to containers 13728 for (var i = this.containers.length - 1; i >= 0; i--) { 13729 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 13730 if (this.containers[i].containerCache.over) { 13731 this.containers[i]._trigger("out", null, this._uiHash(this)); 13732 this.containers[i].containerCache.over = 0; 13733 } 13734 } 13735 } 13736 13737 if (this.placeholder) { 13738 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 13739 if (this.placeholder[0].parentNode) { 13740 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 13741 } 13742 if (this.options.helper !== "original" && this.helper && this.helper[0].parentNode) { 13743 this.helper.remove(); 13744 } 13745 13746 $.extend(this, { 13747 helper: null, 13748 dragging: false, 13749 reverting: false, 13750 _noFinalSort: null 13751 }); 13752 13753 if (this.domPosition.prev) { 13754 $(this.domPosition.prev).after(this.currentItem); 13755 } else { 13756 $(this.domPosition.parent).prepend(this.currentItem); 13757 } 13758 } 13759 13760 return this; 13761 }, 13762 13763 serialize: function (o) { 13764 var items = this._getItemsAsjQuery(o && o.connected), 13765 str = []; 13766 o = o || {}; 13767 13768 $(items).each(function () { 13769 var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/)); 13770 if (res) { 13771 str.push((o.key || res[1] + "[]") + "=" + (o.key && o.expression ? res[1] : res[2])); 13772 } 13773 }); 13774 13775 if (!str.length && o.key) { 13776 str.push(o.key + "="); 13777 } 13778 13779 return str.join("&"); 13780 }, 13781 13782 toArray: function (o) { 13783 var items = this._getItemsAsjQuery(o && o.connected), 13784 ret = []; 13785 13786 o = o || {}; 13787 13788 items.each(function () { ret.push($(o.item || this).attr(o.attribute || "id") || ""); }); 13789 return ret; 13790 }, 13791 13792 /* Be careful with the following core functions */ 13793 _intersectsWith: function (item) { 13794 var x1 = this.positionAbs.left, 13795 x2 = x1 + this.helperProportions.width, 13796 y1 = this.positionAbs.top, 13797 y2 = y1 + this.helperProportions.height, 13798 l = item.left, 13799 r = l + item.width, 13800 t = item.top, 13801 b = t + item.height, 13802 dyClick = this.offset.click.top, 13803 dxClick = this.offset.click.left, 13804 isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && (y1 + dyClick) < b), 13805 isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && (x1 + dxClick) < r), 13806 isOverElement = isOverElementHeight && isOverElementWidth; 13807 13808 if (this.options.tolerance === "pointer" || 13809 this.options.forcePointerForContainers || 13810 (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"]) 13811 ) { 13812 return isOverElement; 13813 } else { 13814 return (l < x1 + (this.helperProportions.width / 2) && // Right Half 13815 x2 - (this.helperProportions.width / 2) < r && // Left Half 13816 t < y1 + (this.helperProportions.height / 2) && // Bottom Half 13817 y2 - (this.helperProportions.height / 2) < b); // Top Half 13818 } 13819 }, 13820 13821 _intersectsWithPointer: function (item) { 13822 var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), 13823 isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), 13824 isOverElement = isOverElementHeight && isOverElementWidth, 13825 verticalDirection = this._getDragVerticalDirection(), 13826 horizontalDirection = this._getDragHorizontalDirection(); 13827 13828 if (!isOverElement) { 13829 return false; 13830 } 13831 13832 return this.floating ? 13833 (((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1) 13834 : (verticalDirection && (verticalDirection === "down" ? 2 : 1)); 13835 }, 13836 13837 _intersectsWithSides: function (item) { 13838 var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height / 2), item.height), 13839 isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width / 2), item.width), 13840 verticalDirection = this._getDragVerticalDirection(), 13841 horizontalDirection = this._getDragHorizontalDirection(); 13842 13843 if (this.floating && horizontalDirection) { 13844 return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf)); 13845 } else { 13846 return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf)); 13847 } 13848 }, 13849 13850 _getDragVerticalDirection: function () { 13851 var delta = this.positionAbs.top - this.lastPositionAbs.top; 13852 return delta !== 0 && (delta > 0 ? "down" : "up"); 13853 }, 13854 13855 _getDragHorizontalDirection: function () { 13856 var delta = this.positionAbs.left - this.lastPositionAbs.left; 13857 return delta !== 0 && (delta > 0 ? "right" : "left"); 13858 }, 13859 13860 refresh: function (event) { 13861 this._refreshItems(event); 13862 this._setHandleClassName(); 13863 this.refreshPositions(); 13864 return this; 13865 }, 13866 13867 _connectWith: function () { 13868 var options = this.options; 13869 return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith; 13870 }, 13871 13872 _getItemsAsjQuery: function (connected) { 13873 var i, j, cur, inst, 13874 items = [], 13875 queries = [], 13876 connectWith = this._connectWith(); 13877 13878 if (connectWith && connected) { 13879 for (i = connectWith.length - 1; i >= 0; i--) { 13880 cur = $(connectWith[i], this.document[0]); 13881 for (j = cur.length - 1; j >= 0; j--) { 13882 inst = $.data(cur[j], this.widgetFullName); 13883 if (inst && inst !== this && !inst.options.disabled) { 13884 queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]); 13885 } 13886 } 13887 } 13888 } 13889 13890 queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]); 13891 13892 function addItems() { 13893 items.push(this); 13894 } 13895 for (i = queries.length - 1; i >= 0; i--) { 13896 queries[i][0].each(addItems); 13897 } 13898 13899 return $(items); 13900 }, 13901 13902 _removeCurrentsFromItems: function () { 13903 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 13904 13905 this.items = $.grep(this.items, function (item) { 13906 for (var j = 0; j < list.length; j++) { 13907 if (list[j] === item.item[0]) { 13908 return false; 13909 } 13910 } 13911 return true; 13912 }); 13913 }, 13914 13915 _refreshItems: function (event) { 13916 this.items = []; 13917 this.containers = [this]; 13918 13919 var i, j, cur, inst, targetData, _queries, item, queriesLength, 13920 items = this.items, 13921 queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]], 13922 connectWith = this._connectWith(); 13923 13924 if (connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down 13925 for (i = connectWith.length - 1; i >= 0; i--) { 13926 cur = $(connectWith[i], this.document[0]); 13927 for (j = cur.length - 1; j >= 0; j--) { 13928 inst = $.data(cur[j], this.widgetFullName); 13929 if (inst && inst !== this && !inst.options.disabled) { 13930 queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); 13931 this.containers.push(inst); 13932 } 13933 } 13934 } 13935 } 13936 13937 for (i = queries.length - 1; i >= 0; i--) { 13938 targetData = queries[i][1]; 13939 _queries = queries[i][0]; 13940 13941 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 13942 item = $(_queries[j]); 13943 13944 item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager) 13945 13946 items.push({ 13947 item: item, 13948 instance: targetData, 13949 width: 0, height: 0, 13950 left: 0, top: 0 13951 }); 13952 } 13953 } 13954 }, 13955 13956 refreshPositions: function (fast) { 13957 // Determine whether items are being displayed horizontally 13958 this.floating = this.items.length ? 13959 this.options.axis === "x" || this._isFloating(this.items[0].item) : 13960 false; 13961 13962 //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change 13963 if (this.offsetParent && this.helper) { 13964 this.offset.parent = this._getParentOffset(); 13965 } 13966 13967 var i, item, t, p; 13968 13969 for (i = this.items.length - 1; i >= 0; i--) { 13970 item = this.items[i]; 13971 13972 //We ignore calculating positions of all connected containers when we're not over them 13973 if (item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) { 13974 continue; 13975 } 13976 13977 t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; 13978 13979 if (!fast) { 13980 item.width = t.outerWidth(); 13981 item.height = t.outerHeight(); 13982 } 13983 13984 p = t.offset(); 13985 item.left = p.left; 13986 item.top = p.top; 13987 } 13988 13989 if (this.options.custom && this.options.custom.refreshContainers) { 13990 this.options.custom.refreshContainers.call(this); 13991 } else { 13992 for (i = this.containers.length - 1; i >= 0; i--) { 13993 p = this.containers[i].element.offset(); 13994 this.containers[i].containerCache.left = p.left; 13995 this.containers[i].containerCache.top = p.top; 13996 this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); 13997 this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); 13998 } 13999 } 14000 14001 return this; 14002 }, 14003 14004 _createPlaceholder: function (that) { 14005 that = that || this; 14006 var className, 14007 o = that.options; 14008 14009 if (!o.placeholder || o.placeholder.constructor === String) { 14010 className = o.placeholder; 14011 o.placeholder = { 14012 element: function () { 14013 var nodeName = that.currentItem[0].nodeName.toLowerCase(), 14014 element = $("<" + nodeName + ">", that.document[0]) 14015 .addClass(className || that.currentItem[0].className + " ui-sortable-placeholder") 14016 .removeClass("ui-sortable-helper"); 14017 14018 if (nodeName === "tbody") { 14019 that._createTrPlaceholder( 14020 that.currentItem.find("tr").eq(0), 14021 $("<tr>", that.document[0]).appendTo(element) 14022 ); 14023 } else if (nodeName === "tr") { 14024 that._createTrPlaceholder(that.currentItem, element); 14025 } else if (nodeName === "img") { 14026 element.attr("src", that.currentItem.attr("src")); 14027 } 14028 14029 if (!className) { 14030 element.css("visibility", "hidden"); 14031 } 14032 14033 return element; 14034 }, 14035 update: function (container, p) { 14036 // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that 14037 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified 14038 if (className && !o.forcePlaceholderSize) { 14039 return; 14040 } 14041 14042 //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item 14043 if (!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop") || 0, 10) - parseInt(that.currentItem.css("paddingBottom") || 0, 10)); } 14044 if (!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft") || 0, 10) - parseInt(that.currentItem.css("paddingRight") || 0, 10)); } 14045 } 14046 }; 14047 } 14048 14049 //Create the placeholder 14050 that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); 14051 14052 //Append it after the actual current item 14053 that.currentItem.after(that.placeholder); 14054 14055 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 14056 o.placeholder.update(that, that.placeholder); 14057 }, 14058 14059 _createTrPlaceholder: function (sourceTr, targetTr) { 14060 var that = this; 14061 14062 sourceTr.children().each(function () { 14063 $("<td> </td>", that.document[0]) 14064 .attr("colspan", $(this).attr("colspan") || 1) 14065 .appendTo(targetTr); 14066 }); 14067 }, 14068 14069 _contactContainers: function (event) { 14070 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis, 14071 innermostContainer = null, 14072 innermostIndex = null; 14073 14074 // get innermost container that intersects with item 14075 for (i = this.containers.length - 1; i >= 0; i--) { 14076 // never consider a container that's located within the item itself 14077 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 14078 continue; 14079 } 14080 14081 if (this._intersectsWith(this.containers[i].containerCache)) { 14082 // if we've already found a container and it's more "inner" than this, then continue 14083 if (innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) { 14084 continue; 14085 } 14086 14087 innermostContainer = this.containers[i]; 14088 innermostIndex = i; 14089 } else { 14090 // container doesn't intersect. trigger "out" event if necessary 14091 if (this.containers[i].containerCache.over) { 14092 this.containers[i]._trigger("out", event, this._uiHash(this)); 14093 this.containers[i].containerCache.over = 0; 14094 } 14095 } 14096 } 14097 14098 // if no intersecting containers found, return 14099 if (!innermostContainer) { 14100 return; 14101 } 14102 14103 // move the item into the container if it's not there already 14104 if (this.containers.length === 1) { 14105 if (!this.containers[innermostIndex].containerCache.over) { 14106 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 14107 this.containers[innermostIndex].containerCache.over = 1; 14108 } 14109 } else { 14110 //When entering a new container, we will find the item with the least distance and append our item near it 14111 dist = 10000; 14112 itemWithLeastDistance = null; 14113 floating = innermostContainer.floating || this._isFloating(this.currentItem); 14114 posProperty = floating ? "left" : "top"; 14115 sizeProperty = floating ? "width" : "height"; 14116 axis = floating ? "clientX" : "clientY"; 14117 14118 for (j = this.items.length - 1; j >= 0; j--) { 14119 if (!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) { 14120 continue; 14121 } 14122 if (this.items[j].item[0] === this.currentItem[0]) { 14123 continue; 14124 } 14125 14126 cur = this.items[j].item.offset()[posProperty]; 14127 nearBottom = false; 14128 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 14129 nearBottom = true; 14130 } 14131 14132 if (Math.abs(event[axis] - cur) < dist) { 14133 dist = Math.abs(event[axis] - cur); 14134 itemWithLeastDistance = this.items[j]; 14135 this.direction = nearBottom ? "up" : "down"; 14136 } 14137 } 14138 14139 //Check if dropOnEmpty is enabled 14140 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 14141 return; 14142 } 14143 14144 if (this.currentContainer === this.containers[innermostIndex]) { 14145 if (!this.currentContainer.containerCache.over) { 14146 this.containers[innermostIndex]._trigger("over", event, this._uiHash()); 14147 this.currentContainer.containerCache.over = 1; 14148 } 14149 return; 14150 } 14151 14152 itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); 14153 this._trigger("change", event, this._uiHash()); 14154 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 14155 this.currentContainer = this.containers[innermostIndex]; 14156 14157 //Update the placeholder 14158 this.options.placeholder.update(this.currentContainer, this.placeholder); 14159 14160 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 14161 this.containers[innermostIndex].containerCache.over = 1; 14162 } 14163 }, 14164 14165 _createHelper: function (event) { 14166 var o = this.options, 14167 helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 14168 14169 //Add the helper to the DOM if that didn't happen already 14170 if (!helper.parents("body").length) { 14171 $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); 14172 } 14173 14174 if (helper[0] === this.currentItem[0]) { 14175 this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; 14176 } 14177 14178 if (!helper[0].style.width || o.forceHelperSize) { 14179 helper.width(this.currentItem.width()); 14180 } 14181 if (!helper[0].style.height || o.forceHelperSize) { 14182 helper.height(this.currentItem.height()); 14183 } 14184 14185 return helper; 14186 }, 14187 14188 _adjustOffsetFromHelper: function (obj) { 14189 if (typeof obj === "string") { 14190 obj = obj.split(" "); 14191 } 14192 if ($.isArray(obj)) { 14193 obj = { left: +obj[0], top: +obj[1] || 0 }; 14194 } 14195 if ("left" in obj) { 14196 this.offset.click.left = obj.left + this.margins.left; 14197 } 14198 if ("right" in obj) { 14199 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 14200 } 14201 if ("top" in obj) { 14202 this.offset.click.top = obj.top + this.margins.top; 14203 } 14204 if ("bottom" in obj) { 14205 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 14206 } 14207 }, 14208 14209 _getParentOffset: function () { 14210 //Get the offsetParent and cache its position 14211 this.offsetParent = this.helper.offsetParent(); 14212 var po = this.offsetParent.offset(); 14213 14214 // This is a special case where we need to modify a offset calculated on start, since the following happened: 14215 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 14216 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 14217 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 14218 if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) { 14219 po.left += this.scrollParent.scrollLeft(); 14220 po.top += this.scrollParent.scrollTop(); 14221 } 14222 14223 // This needs to be actually done for all browsers, since pageX/pageY includes this information 14224 // with an ugly IE fix 14225 if (this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 14226 po = { top: 0, left: 0 }; 14227 } 14228 14229 return { 14230 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 14231 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 14232 }; 14233 }, 14234 14235 _getRelativeOffset: function () { 14236 if (this.cssPosition === "relative") { 14237 var p = this.currentItem.position(); 14238 return { 14239 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), 14240 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft() 14241 }; 14242 } else { 14243 return { top: 0, left: 0 }; 14244 } 14245 }, 14246 14247 _cacheMargins: function () { 14248 this.margins = { 14249 left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), 14250 top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) 14251 }; 14252 }, 14253 14254 _cacheHelperProportions: function () { 14255 this.helperProportions = { 14256 width: this.helper.outerWidth(), 14257 height: this.helper.outerHeight() 14258 }; 14259 }, 14260 14261 _setContainment: function () { 14262 var ce, co, over, 14263 o = this.options; 14264 if (o.containment === "parent") { 14265 o.containment = this.helper[0].parentNode; 14266 } 14267 if (o.containment === "document" || o.containment === "window") { 14268 this.containment = [ 14269 0 - this.offset.relative.left - this.offset.parent.left, 14270 0 - this.offset.relative.top - this.offset.parent.top, 14271 o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, 14272 (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 14273 ]; 14274 } 14275 14276 if (!(/^(document|window|parent)$/).test(o.containment)) { 14277 ce = $(o.containment)[0]; 14278 co = $(o.containment).offset(); 14279 over = ($(ce).css("overflow") !== "hidden"); 14280 14281 this.containment = [ 14282 co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, 14283 co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, 14284 co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - (parseInt($(ce).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, 14285 co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"), 10) || 0) - (parseInt($(ce).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top 14286 ]; 14287 } 14288 }, 14289 14290 _convertPositionTo: function (d, pos) { 14291 if (!pos) { 14292 pos = this.position; 14293 } 14294 var mod = d === "absolute" ? 1 : -1, 14295 scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, 14296 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 14297 14298 return { 14299 top: ( 14300 pos.top + // The absolute mouse position 14301 this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent 14302 this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) 14303 ((this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod) 14304 ), 14305 left: ( 14306 pos.left + // The absolute mouse position 14307 this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent 14308 this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) 14309 ((this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft()) * mod) 14310 ) 14311 }; 14312 }, 14313 14314 _generatePosition: function (event) { 14315 var top, left, 14316 o = this.options, 14317 pageX = event.pageX, 14318 pageY = event.pageY, 14319 scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 14320 14321 // This is another very weird special case that only happens for relative elements: 14322 // 1. If the css position is relative 14323 // 2. and the scroll parent is the document or similar to the offset parent 14324 // we have to refresh the relative offset during the scroll so there are no jumps 14325 if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) { 14326 this.offset.relative = this._getRelativeOffset(); 14327 } 14328 14329 /* 14330 * - Position constraining - 14331 * Constrain the position to a mix of grid, containment. 14332 */ 14333 14334 if (this.originalPosition) { //If we are not dragging yet, we won't check for options 14335 if (this.containment) { 14336 if (event.pageX - this.offset.click.left < this.containment[0]) { 14337 pageX = this.containment[0] + this.offset.click.left; 14338 } 14339 if (event.pageY - this.offset.click.top < this.containment[1]) { 14340 pageY = this.containment[1] + this.offset.click.top; 14341 } 14342 if (event.pageX - this.offset.click.left > this.containment[2]) { 14343 pageX = this.containment[2] + this.offset.click.left; 14344 } 14345 if (event.pageY - this.offset.click.top > this.containment[3]) { 14346 pageY = this.containment[3] + this.offset.click.top; 14347 } 14348 } 14349 14350 if (o.grid) { 14351 top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; 14352 pageY = this.containment ? ((top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; 14353 14354 left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; 14355 pageX = this.containment ? ((left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; 14356 } 14357 } 14358 14359 return { 14360 top: ( 14361 pageY - // The absolute mouse position 14362 this.offset.click.top - // Click offset (relative to the element) 14363 this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent 14364 this.offset.parent.top + // The offsetParent's offset without borders (offset + border) 14365 ((this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : (scrollIsRootNode ? 0 : scroll.scrollTop()))) 14366 ), 14367 left: ( 14368 pageX - // The absolute mouse position 14369 this.offset.click.left - // Click offset (relative to the element) 14370 this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent 14371 this.offset.parent.left + // The offsetParent's offset without borders (offset + border) 14372 ((this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft())) 14373 ) 14374 }; 14375 }, 14376 14377 _rearrange: function (event, i, a, hardRefresh) { 14378 a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 14379 14380 //Various things done here to improve the performance: 14381 // 1. we create a setTimeout, that calls refreshPositions 14382 // 2. on the instance, we have a counter variable, that get's higher after every append 14383 // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same 14384 // 4. this lets only the last addition to the timeout stack through 14385 this.counter = this.counter ? ++this.counter : 1; 14386 var counter = this.counter; 14387 14388 this._delay(function () { 14389 if (counter === this.counter) {
vendor: 3,755 bytes, lines 14390-14488
14390 this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove 14391 } 14392 }); 14393 }, 14394 14395 _clear: function (event, noPropagation) { 14396 this.reverting = false; 14397 // We delay all events that have to be triggered to after the point where the placeholder has been removed and 14398 // everything else normalized again 14399 var i, 14400 delayedTriggers = []; 14401 14402 // We first have to update the dom position of the actual currentItem 14403 // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) 14404 if (!this._noFinalSort && this.currentItem.parent().length) { 14405 this.placeholder.before(this.currentItem); 14406 } 14407 this._noFinalSort = null; 14408 14409 if (this.helper[0] === this.currentItem[0]) { 14410 for (i in this._storedCSS) { 14411 if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 14412 this._storedCSS[i] = ""; 14413 } 14414 } 14415 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 14416 } else { 14417 this.currentItem.show(); 14418 } 14419 14420 if (this.fromOutside && !noPropagation) { 14421 delayedTriggers.push(function (event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); 14422 } 14423 if ((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 14424 delayedTriggers.push(function (event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed 14425 } 14426 14427 // Check if the items Container has Changed and trigger appropriate 14428 // events. 14429 if (this !== this.currentContainer) { 14430 if (!noPropagation) { 14431 delayedTriggers.push(function (event) { this._trigger("remove", event, this._uiHash()); }); 14432 delayedTriggers.push((function (c) { return function (event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); 14433 delayedTriggers.push((function (c) { return function (event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); 14434 } 14435 } 14436 14437 //Post events to containers 14438 function delayEvent(type, instance, container) { 14439 return function (event) { 14440 container._trigger(type, event, instance._uiHash(instance)); 14441 }; 14442 } 14443 for (i = this.containers.length - 1; i >= 0; i--) { 14444 if (!noPropagation) { 14445 delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])); 14446 } 14447 if (this.containers[i].containerCache.over) { 14448 delayedTriggers.push(delayEvent("out", this, this.containers[i])); 14449 this.containers[i].containerCache.over = 0; 14450 } 14451 } 14452 14453 //Do what was originally in plugins 14454 if (this.storedCursor) { 14455 this.document.find("body").css("cursor", this.storedCursor); 14456 this.storedStylesheet.remove(); 14457 } 14458 if (this._storedOpacity) { 14459 this.helper.css("opacity", this._storedOpacity); 14460 } 14461 if (this._storedZIndex) { 14462 this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 14463 } 14464 14465 this.dragging = false; 14466 14467 if (!noPropagation) { 14468 this._trigger("beforeStop", event, this._uiHash()); 14469 } 14470 14471 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 14472 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 14473 14474 if (!this.cancelHelperRemoval) { 14475 if (this.helper[0] !== this.currentItem[0]) { 14476 this.helper.remove(); 14477 } 14478 this.helper = null; 14479 } 14480 14481 if (!noPropagation) { 14482 for (i = 0; i < delayedTriggers.length; i++) { 14483 delayedTriggers[i].call(this, event); 14484 } //Trigger all delayed events 14485 this._trigger("stop", event, this._uiHash()); 14486 } 14487 14488 this.fromOutside = false;
vendor: 14,555 bytes, lines 14489-15067
14489 return !this.cancelHelperRemoval; 14490 }, 14491 14492 _trigger: function () { 14493 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 14494 this.cancel(); 14495 } 14496 }, 14497 14498 _uiHash: function (_inst) { 14499 var inst = _inst || this; 14500 return { 14501 helper: inst.helper, 14502 placeholder: inst.placeholder || $([]), 14503 position: inst.position, 14504 originalPosition: inst.originalPosition, 14505 offset: inst.positionAbs, 14506 item: inst.currentItem, 14507 sender: _inst ? _inst.element : null 14508 }; 14509 } 14510 }); 14511 14512 /*! 14513 * jQuery UI Spinner 1.11.4 14514 * http://jqueryui.com 14515 * 14516 * Copyright jQuery Foundation and other contributors 14517 * Released under the MIT license. 14518 * http://jquery.org/license 14519 * 14520 * http://api.jqueryui.com/spinner/ 14521 */ 14522 14523 function spinner_modifier(fn) { 14524 return function () { 14525 var previous = this.element.val(); 14526 fn.apply(this, arguments); 14527 this._refresh(); 14528 if (previous !== this.element.val()) { 14529 this._trigger("change"); 14530 } 14531 }; 14532 } 14533 14534 var spinner = $.widget("ui.spinner", { 14535 version: "1.11.4", 14536 defaultElement: "<input>", 14537 widgetEventPrefix: "spin", 14538 options: { 14539 culture: null, 14540 icons: { 14541 down: "ui-icon-triangle-1-s", 14542 up: "ui-icon-triangle-1-n" 14543 }, 14544 incremental: true, 14545 max: null, 14546 min: null, 14547 numberFormat: null, 14548 page: 10, 14549 step: 1, 14550 14551 change: null, 14552 spin: null, 14553 start: null, 14554 stop: null 14555 }, 14556 14557 _create: function () { 14558 // handle string values that need to be parsed 14559 this._setOption("max", this.options.max); 14560 this._setOption("min", this.options.min); 14561 this._setOption("step", this.options.step); 14562 14563 // Only format if there is a value, prevents the field from being marked 14564 // as invalid in Firefox, see #9573. 14565 if (this.value() !== "") { 14566 // Format the value, but don't constrain. 14567 this._value(this.element.val(), true); 14568 } 14569 14570 this._draw(); 14571 this._on(this._events); 14572 this._refresh(); 14573 14574 // turning off autocomplete prevents the browser from remembering the 14575 // value when navigating through history, so we re-enable autocomplete 14576 // if the page is unloaded before the widget is destroyed. #7790 14577 this._on(this.window, { 14578 beforeunload: function () { 14579 this.element.removeAttr("autocomplete"); 14580 } 14581 }); 14582 }, 14583 14584 _getCreateOptions: function () { 14585 var options = {}, 14586 element = this.element; 14587 14588 $.each(["min", "max", "step"], function (i, option) { 14589 var value = element.attr(option); 14590 if (value !== undefined && value.length) { 14591 options[option] = value; 14592 } 14593 }); 14594 14595 return options; 14596 }, 14597 14598 _events: { 14599 keydown: function (event) { 14600 if (this._start(event) && this._keydown(event)) { 14601 event.preventDefault(); 14602 } 14603 }, 14604 keyup: "_stop", 14605 focus: function () { 14606 this.previous = this.element.val(); 14607 }, 14608 blur: function (event) { 14609 if (this.cancelBlur) { 14610 delete this.cancelBlur; 14611 return; 14612 } 14613 14614 this._stop(); 14615 this._refresh(); 14616 if (this.previous !== this.element.val()) { 14617 this._trigger("change", event); 14618 } 14619 }, 14620 mousewheel: function (event, delta) { 14621 if (!delta) { 14622 return; 14623 } 14624 if (!this.spinning && !this._start(event)) { 14625 return false; 14626 } 14627 14628 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 14629 clearTimeout(this.mousewheelTimer); 14630 this.mousewheelTimer = this._delay(function () { 14631 if (this.spinning) { 14632 this._stop(event); 14633 } 14634 }, 100); 14635 event.preventDefault(); 14636 }, 14637 "mousedown .ui-spinner-button": function (event) { 14638 var previous; 14639 14640 // We never want the buttons to have focus; whenever the user is 14641 // interacting with the spinner, the focus should be on the input. 14642 // If the input is focused then this.previous is properly set from 14643 // when the input first received focus. If the input is not focused 14644 // then we need to set this.previous based on the value before spinning. 14645 previous = this.element[0] === this.document[0].activeElement ? 14646 this.previous : this.element.val(); 14647 function checkFocus() { 14648 var isActive = this.element[0] === this.document[0].activeElement; 14649 if (!isActive) { 14650 this.element.focus(); 14651 this.previous = previous; 14652 // support: IE 14653 // IE sets focus asynchronously, so we need to check if focus 14654 // moved off of the input because the user clicked on the button. 14655 this._delay(function () { 14656 this.previous = previous; 14657 }); 14658 } 14659 } 14660 14661 // ensure focus is on (or stays on) the text field 14662 event.preventDefault(); 14663 checkFocus.call(this); 14664 14665 // support: IE 14666 // IE doesn't prevent moving focus even with event.preventDefault() 14667 // so we set a flag to know when we should ignore the blur event 14668 // and check (again) if focus moved off of the input. 14669 this.cancelBlur = true; 14670 this._delay(function () { 14671 delete this.cancelBlur; 14672 checkFocus.call(this); 14673 }); 14674 14675 if (this._start(event) === false) { 14676 return; 14677 } 14678 14679 this._repeat(null, $(event.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, event); 14680 }, 14681 "mouseup .ui-spinner-button": "_stop", 14682 "mouseenter .ui-spinner-button": function (event) { 14683 // button will add ui-state-active if mouse was down while mouseleave and kept down 14684 if (!$(event.currentTarget).hasClass("ui-state-active")) { 14685 return; 14686 } 14687 14688 if (this._start(event) === false) { 14689 return false; 14690 } 14691 this._repeat(null, $(event.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, event); 14692 }, 14693 // TODO: do we really want to consider this a stop? 14694 // shouldn't we just stop the repeater and wait until mouseup before 14695 // we trigger the stop event? 14696 "mouseleave .ui-spinner-button": "_stop" 14697 }, 14698 14699 _draw: function () { 14700 var uiSpinner = this.uiSpinner = this.element 14701 .addClass("ui-spinner-input") 14702 .attr("autocomplete", "off") 14703 .wrap(this._uiSpinnerHtml()) 14704 .parent() 14705 // add buttons 14706 .append(this._buttonHtml()); 14707 14708 this.element.attr("role", "spinbutton"); 14709 14710 // button bindings 14711 this.buttons = uiSpinner.find(".ui-spinner-button") 14712 .attr("tabIndex", -1) 14713 .button() 14714 .removeClass("ui-corner-all"); 14715 14716 // IE 6 doesn't understand height: 50% for the buttons 14717 // unless the wrapper has an explicit height 14718 if (this.buttons.height() > Math.ceil(uiSpinner.height() * 0.5) && 14719 uiSpinner.height() > 0) { 14720 uiSpinner.height(uiSpinner.height()); 14721 } 14722 14723 // disable spinner if element was already disabled 14724 if (this.options.disabled) { 14725 this.disable(); 14726 } 14727 }, 14728 14729 _keydown: function (event) { 14730 var options = this.options, 14731 keyCode = $.ui.keyCode; 14732 14733 switch (event.keyCode) { 14734 case keyCode.UP: 14735 this._repeat(null, 1, event); 14736 return true; 14737 case keyCode.DOWN: 14738 this._repeat(null, -1, event); 14739 return true; 14740 case keyCode.PAGE_UP: 14741 this._repeat(null, options.page, event); 14742 return true; 14743 case keyCode.PAGE_DOWN: 14744 this._repeat(null, -options.page, event); 14745 return true; 14746 } 14747 14748 return false; 14749 }, 14750 14751 _uiSpinnerHtml: function () { 14752 return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"; 14753 }, 14754 14755 _buttonHtml: function () { 14756 return "" + 14757 "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" + 14758 "<span class='ui-icon " + this.options.icons.up + "'>▲</span>" + 14759 "</a>" + 14760 "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" + 14761 "<span class='ui-icon " + this.options.icons.down + "'>▼</span>" + 14762 "</a>"; 14763 }, 14764 14765 _start: function (event) { 14766 if (!this.spinning && this._trigger("start", event) === false) { 14767 return false; 14768 } 14769 14770 if (!this.counter) { 14771 this.counter = 1; 14772 } 14773 this.spinning = true; 14774 return true; 14775 }, 14776 14777 _repeat: function (i, steps, event) { 14778 i = i || 500; 14779 14780 clearTimeout(this.timer); 14781 this.timer = this._delay(function () { 14782 this._repeat(40, steps, event); 14783 }, i); 14784 14785 this._spin(steps * this.options.step, event); 14786 }, 14787 14788 _spin: function (step, event) { 14789 var value = this.value() || 0; 14790 14791 if (!this.counter) { 14792 this.counter = 1; 14793 } 14794 14795 value = this._adjustValue(value + step * this._increment(this.counter)); 14796 14797 if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) { 14798 this._value(value); 14799 this.counter++; 14800 } 14801 }, 14802 14803 _increment: function (i) { 14804 var incremental = this.options.incremental; 14805 14806 if (incremental) { 14807 return $.isFunction(incremental) ? 14808 incremental(i) : 14809 Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1); 14810 } 14811 14812 return 1; 14813 }, 14814 14815 _precision: function () { 14816 var precision = this._precisionOf(this.options.step); 14817 if (this.options.min !== null) { 14818 precision = Math.max(precision, this._precisionOf(this.options.min)); 14819 } 14820 return precision; 14821 }, 14822 14823 _precisionOf: function (num) { 14824 var str = num.toString(), 14825 decimal = str.indexOf("."); 14826 return decimal === -1 ? 0 : str.length - decimal - 1; 14827 }, 14828 14829 _adjustValue: function (value) { 14830 var base, aboveMin, 14831 options = this.options; 14832 14833 // make sure we're at a valid step 14834 // - find out where we are relative to the base (min or 0) 14835 base = options.min !== null ? options.min : 0; 14836 aboveMin = value - base; 14837 // - round to the nearest step 14838 aboveMin = Math.round(aboveMin / options.step) * options.step; 14839 // - rounding is based on 0, so adjust back to our base 14840 value = base + aboveMin; 14841 14842 // fix precision from bad JS floating point math 14843 value = parseFloat(value.toFixed(this._precision())); 14844 14845 // clamp the value 14846 if (options.max !== null && value > options.max) { 14847 return options.max; 14848 } 14849 if (options.min !== null && value < options.min) { 14850 return options.min; 14851 } 14852 14853 return value; 14854 }, 14855 14856 _stop: function (event) { 14857 if (!this.spinning) { 14858 return; 14859 } 14860 14861 clearTimeout(this.timer); 14862 clearTimeout(this.mousewheelTimer); 14863 this.counter = 0; 14864 this.spinning = false; 14865 this._trigger("stop", event); 14866 }, 14867 14868 _setOption: function (key, value) { 14869 if (key === "culture" || key === "numberFormat") { 14870 var prevValue = this._parse(this.element.val()); 14871 this.options[key] = value; 14872 this.element.val(this._format(prevValue)); 14873 return; 14874 } 14875 14876 if (key === "max" || key === "min" || key === "step") { 14877 if (typeof value === "string") { 14878 value = this._parse(value); 14879 } 14880 } 14881 if (key === "icons") { 14882 this.buttons.first().find(".ui-icon") 14883 .removeClass(this.options.icons.up) 14884 .addClass(value.up); 14885 this.buttons.last().find(".ui-icon") 14886 .removeClass(this.options.icons.down) 14887 .addClass(value.down); 14888 } 14889 14890 this._super(key, value); 14891 14892 if (key === "disabled") { 14893 this.widget().toggleClass("ui-state-disabled", !!value); 14894 this.element.prop("disabled", !!value); 14895 this.buttons.button(value ? "disable" : "enable"); 14896 } 14897 }, 14898 14899 _setOptions: spinner_modifier(function (options) { 14900 this._super(options); 14901 }), 14902 14903 _parse: function (val) { 14904 if (typeof val === "string" && val !== "") { 14905 val = window.Globalize && this.options.numberFormat ? 14906 Globalize.parseFloat(val, 10, this.options.culture) : +val; 14907 } 14908 return val === "" || isNaN(val) ? null : val; 14909 }, 14910 14911 _format: function (value) { 14912 if (value === "") { 14913 return ""; 14914 } 14915 return window.Globalize && this.options.numberFormat ? 14916 Globalize.format(value, this.options.numberFormat, this.options.culture) : 14917 value; 14918 }, 14919 14920 _refresh: function () { 14921 this.element.attr({ 14922 "aria-valuemin": this.options.min, 14923 "aria-valuemax": this.options.max, 14924 // TODO: what should we do with values that can't be parsed? 14925 "aria-valuenow": this._parse(this.element.val()) 14926 }); 14927 }, 14928 14929 isValid: function () { 14930 var value = this.value(); 14931 14932 // null is invalid 14933 if (value === null) { 14934 return false; 14935 } 14936 14937 // if value gets adjusted, it's invalid 14938 return value === this._adjustValue(value); 14939 }, 14940 14941 // update the value without triggering change 14942 _value: function (value, allowAny) { 14943 var parsed; 14944 if (value !== "") { 14945 parsed = this._parse(value); 14946 if (parsed !== null) { 14947 if (!allowAny) { 14948 parsed = this._adjustValue(parsed); 14949 } 14950 value = this._format(parsed); 14951 } 14952 } 14953 this.element.val(value); 14954 this._refresh(); 14955 }, 14956 14957 _destroy: function () { 14958 this.element 14959 .removeClass("ui-spinner-input") 14960 .prop("disabled", false) 14961 .removeAttr("autocomplete") 14962 .removeAttr("role") 14963 .removeAttr("aria-valuemin") 14964 .removeAttr("aria-valuemax") 14965 .removeAttr("aria-valuenow"); 14966 this.uiSpinner.replaceWith(this.element); 14967 }, 14968 14969 stepUp: spinner_modifier(function (steps) { 14970 this._stepUp(steps); 14971 }), 14972 _stepUp: function (steps) { 14973 if (this._start()) { 14974 this._spin((steps || 1) * this.options.step); 14975 this._stop(); 14976 } 14977 }, 14978 14979 stepDown: spinner_modifier(function (steps) { 14980 this._stepDown(steps); 14981 }), 14982 _stepDown: function (steps) { 14983 if (this._start()) { 14984 this._spin((steps || 1) * -this.options.step); 14985 this._stop(); 14986 } 14987 }, 14988 14989 pageUp: spinner_modifier(function (pages) { 14990 this._stepUp((pages || 1) * this.options.page); 14991 }), 14992 14993 pageDown: spinner_modifier(function (pages) { 14994 this._stepDown((pages || 1) * this.options.page); 14995 }), 14996 14997 value: function (newVal) { 14998 if (!arguments.length) { 14999 return this._parse(this.element.val()); 15000 } 15001 spinner_modifier(this._value).call(this, newVal); 15002 }, 15003 15004 widget: function () { 15005 return this.uiSpinner; 15006 } 15007 }); 15008 15009 /*! 15010 * jQuery UI Tabs 1.11.4 15011 * http://jqueryui.com 15012 * 15013 * Copyright jQuery Foundation and other contributors 15014 * Released under the MIT license. 15015 * http://jquery.org/license 15016 * 15017 * http://api.jqueryui.com/tabs/ 15018 */ 15019 15020 var tabs = $.widget("ui.tabs", { 15021 version: "1.11.4", 15022 delay: 300, 15023 options: { 15024 active: null, 15025 collapsible: false, 15026 event: "click", 15027 heightStyle: "content", 15028 hide: null, 15029 show: null, 15030 15031 // callbacks 15032 activate: null, 15033 beforeActivate: null, 15034 beforeLoad: null, 15035 load: null 15036 }, 15037 15038 _isLocal: (function () { 15039 var rhash = /#.*$/; 15040 15041 return function (anchor) { 15042 var anchorUrl, locationUrl; 15043 15044 // support: IE7 15045 // IE7 doesn't normalize the href property when set via script (#9317) 15046 anchor = anchor.cloneNode(false); 15047 15048 anchorUrl = anchor.href.replace(rhash, ""); 15049 locationUrl = location.href.replace(rhash, ""); 15050 15051 // decoding may throw an error if the URL isn't UTF-8 (#9518) 15052 try { 15053 anchorUrl = decodeURIComponent(anchorUrl); 15054 } catch (error) { } 15055 try { 15056 locationUrl = decodeURIComponent(locationUrl); 15057 } catch (error) { } 15058 15059 return anchor.hash.length > 1 && anchorUrl === locationUrl; 15060 }; 15061 })(), 15062 15063 _create: function () { 15064 var that = this, 15065 options = this.options; 15066 15067 this.running = false;
vendor: 34,428 bytes, lines 15068-16330
15068 15069 this.element 15070 .addClass("ui-tabs ui-widget ui-widget-content ui-corner-all") 15071 .toggleClass("ui-tabs-collapsible", options.collapsible); 15072 15073 this._processTabs(); 15074 options.active = this._initialActive(); 15075 15076 // Take disabling tabs via class attribute from HTML 15077 // into account and update option properly. 15078 if ($.isArray(options.disabled)) { 15079 options.disabled = $.unique(options.disabled.concat( 15080 $.map(this.tabs.filter(".ui-state-disabled"), function (li) { 15081 return that.tabs.index(li); 15082 }) 15083 )).sort(); 15084 } 15085 15086 // check for length avoids error when initializing empty list 15087 if (this.options.active !== false && this.anchors.length) { 15088 this.active = this._findActive(options.active); 15089 } else { 15090 this.active = $(); 15091 } 15092 15093 this._refresh(); 15094 15095 if (this.active.length) { 15096 this.load(options.active); 15097 } 15098 }, 15099 15100 _initialActive: function () { 15101 var active = this.options.active, 15102 collapsible = this.options.collapsible, 15103 locationHash = location.hash.substring(1); 15104 15105 if (active === null) { 15106 // check the fragment identifier in the URL 15107 if (locationHash) { 15108 this.tabs.each(function (i, tab) { 15109 if ($(tab).attr("aria-controls") === locationHash) { 15110 active = i; 15111 return false; 15112 } 15113 }); 15114 } 15115 15116 // check for a tab marked active via a class 15117 if (active === null) { 15118 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 15119 } 15120 15121 // no active tab, set to false 15122 if (active === null || active === -1) { 15123 active = this.tabs.length ? 0 : false; 15124 } 15125 } 15126 15127 // handle numbers: negative, out of range 15128 if (active !== false) { 15129 active = this.tabs.index(this.tabs.eq(active)); 15130 if (active === -1) { 15131 active = collapsible ? false : 0; 15132 } 15133 } 15134 15135 // don't allow collapsible: false and active: false 15136 if (!collapsible && active === false && this.anchors.length) { 15137 active = 0; 15138 } 15139 15140 return active; 15141 }, 15142 15143 _getCreateEventData: function () { 15144 return { 15145 tab: this.active, 15146 panel: !this.active.length ? $() : this._getPanelForTab(this.active) 15147 }; 15148 }, 15149 15150 _tabKeydown: function (event) { 15151 var focusedTab = $(this.document[0].activeElement).closest("li"), 15152 selectedIndex = this.tabs.index(focusedTab), 15153 goingForward = true; 15154 15155 if (this._handlePageNav(event)) { 15156 return; 15157 } 15158 15159 switch (event.keyCode) { 15160 case $.ui.keyCode.RIGHT: 15161 case $.ui.keyCode.DOWN: 15162 selectedIndex++; 15163 break; 15164 case $.ui.keyCode.UP: 15165 case $.ui.keyCode.LEFT: 15166 goingForward = false; 15167 selectedIndex--; 15168 break; 15169 case $.ui.keyCode.END: 15170 selectedIndex = this.anchors.length - 1; 15171 break; 15172 case $.ui.keyCode.HOME: 15173 selectedIndex = 0; 15174 break; 15175 case $.ui.keyCode.SPACE: 15176 // Activate only, no collapsing 15177 event.preventDefault(); 15178 clearTimeout(this.activating); 15179 this._activate(selectedIndex); 15180 return; 15181 case $.ui.keyCode.ENTER: 15182 // Toggle (cancel delayed activation, allow collapsing) 15183 event.preventDefault(); 15184 clearTimeout(this.activating); 15185 // Determine if we should collapse or activate 15186 this._activate(selectedIndex === this.options.active ? false : selectedIndex); 15187 return; 15188 default: 15189 return; 15190 } 15191 15192 // Focus the appropriate tab, based on which key was pressed 15193 event.preventDefault(); 15194 clearTimeout(this.activating); 15195 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 15196 15197 // Navigating with control/command key will prevent automatic activation 15198 if (!event.ctrlKey && !event.metaKey) { 15199 // Update aria-selected immediately so that AT think the tab is already selected. 15200 // Otherwise AT may confuse the user by stating that they need to activate the tab, 15201 // but the tab will already be activated by the time the announcement finishes. 15202 focusedTab.attr("aria-selected", "false"); 15203 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 15204 15205 this.activating = this._delay(function () { 15206 this.option("active", selectedIndex); 15207 }, this.delay); 15208 } 15209 }, 15210 15211 _panelKeydown: function (event) { 15212 if (this._handlePageNav(event)) { 15213 return; 15214 } 15215 15216 // Ctrl+up moves focus to the current tab 15217 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 15218 event.preventDefault(); 15219 this.active.focus(); 15220 } 15221 }, 15222 15223 // Alt+page up/down moves focus to the previous/next tab (and activates) 15224 _handlePageNav: function (event) { 15225 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 15226 this._activate(this._focusNextTab(this.options.active - 1, false)); 15227 return true; 15228 } 15229 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 15230 this._activate(this._focusNextTab(this.options.active + 1, true)); 15231 return true; 15232 } 15233 }, 15234 15235 _findNextTab: function (index, goingForward) { 15236 var lastTabIndex = this.tabs.length - 1; 15237 15238 function constrain() { 15239 if (index > lastTabIndex) { 15240 index = 0; 15241 } 15242 if (index < 0) { 15243 index = lastTabIndex; 15244 } 15245 return index; 15246 } 15247 15248 while ($.inArray(constrain(), this.options.disabled) !== -1) { 15249 index = goingForward ? index + 1 : index - 1; 15250 } 15251 15252 return index; 15253 }, 15254 15255 _focusNextTab: function (index, goingForward) { 15256 index = this._findNextTab(index, goingForward); 15257 this.tabs.eq(index).focus(); 15258 return index; 15259 }, 15260 15261 _setOption: function (key, value) { 15262 if (key === "active") { 15263 // _activate() will handle invalid values and update this.options 15264 this._activate(value); 15265 return; 15266 } 15267 15268 if (key === "disabled") { 15269 // don't use the widget factory's disabled handling 15270 this._setupDisabled(value); 15271 return; 15272 } 15273 15274 this._super(key, value); 15275 15276 if (key === "collapsible") { 15277 this.element.toggleClass("ui-tabs-collapsible", value); 15278 // Setting collapsible: false while collapsed; open first panel 15279 if (!value && this.options.active === false) { 15280 this._activate(0); 15281 } 15282 } 15283 15284 if (key === "event") { 15285 this._setupEvents(value); 15286 } 15287 15288 if (key === "heightStyle") { 15289 this._setupHeightStyle(value); 15290 } 15291 }, 15292 15293 _sanitizeSelector: function (hash) { 15294 return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : ""; 15295 }, 15296 15297 refresh: function () { 15298 var options = this.options, 15299 lis = this.tablist.children(":has(a[href])"); 15300 15301 // get disabled tabs from class attribute from HTML 15302 // this will get converted to a boolean if needed in _refresh() 15303 options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) { 15304 return lis.index(tab); 15305 }); 15306 15307 this._processTabs(); 15308 15309 // was collapsed or no tabs 15310 if (options.active === false || !this.anchors.length) { 15311 options.active = false; 15312 this.active = $(); 15313 // was active, but active tab is gone 15314 } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) { 15315 // all remaining tabs are disabled 15316 if (this.tabs.length === options.disabled.length) { 15317 options.active = false; 15318 this.active = $(); 15319 // activate previous tab 15320 } else { 15321 this._activate(this._findNextTab(Math.max(0, options.active - 1), false)); 15322 } 15323 // was active, active tab still exists 15324 } else { 15325 // make sure active index is correct 15326 options.active = this.tabs.index(this.active); 15327 } 15328 15329 this._refresh(); 15330 }, 15331 15332 _refresh: function () { 15333 this._setupDisabled(this.options.disabled); 15334 this._setupEvents(this.options.event); 15335 this._setupHeightStyle(this.options.heightStyle); 15336 15337 this.tabs.not(this.active).attr({ 15338 "aria-selected": "false", 15339 "aria-expanded": "false", 15340 tabIndex: -1 15341 }); 15342 this.panels.not(this._getPanelForTab(this.active)) 15343 .hide() 15344 .attr({ 15345 "aria-hidden": "true" 15346 }); 15347 15348 // Make sure one tab is in the tab order 15349 if (!this.active.length) { 15350 this.tabs.eq(0).attr("tabIndex", 0); 15351 } else { 15352 this.active 15353 .addClass("ui-tabs-active ui-state-active") 15354 .attr({ 15355 "aria-selected": "true", 15356 "aria-expanded": "true", 15357 tabIndex: 0 15358 }); 15359 this._getPanelForTab(this.active) 15360 .show() 15361 .attr({ 15362 "aria-hidden": "false" 15363 }); 15364 } 15365 }, 15366 15367 _processTabs: function () { 15368 var that = this, 15369 prevTabs = this.tabs, 15370 prevAnchors = this.anchors, 15371 prevPanels = this.panels; 15372 15373 this.tablist = this._getList() 15374 .addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all") 15375 .attr("role", "tablist") 15376 15377 // Prevent users from focusing disabled tabs via click 15378 .delegate("> li", "mousedown" + this.eventNamespace, function (event) { 15379 if ($(this).is(".ui-state-disabled")) { 15380 event.preventDefault(); 15381 } 15382 }) 15383 15384 // support: IE <9 15385 // Preventing the default action in mousedown doesn't prevent IE 15386 // from focusing the element, so if the anchor gets focused, blur. 15387 // We don't have to worry about focusing the previously focused 15388 // element since clicking on a non-focusable element should focus 15389 // the body anyway. 15390 .delegate(".ui-tabs-anchor", "focus" + this.eventNamespace, function () { 15391 if ($(this).closest("li").is(".ui-state-disabled")) { 15392 this.blur(); 15393 } 15394 }); 15395 15396 this.tabs = this.tablist.find("> li:has(a[href])") 15397 .addClass("ui-state-default ui-corner-top") 15398 .attr({ 15399 role: "tab", 15400 tabIndex: -1 15401 }); 15402 15403 this.anchors = this.tabs.map(function () { 15404 return $("a", this)[0]; 15405 }) 15406 .addClass("ui-tabs-anchor") 15407 .attr({ 15408 role: "presentation", 15409 tabIndex: -1 15410 }); 15411 15412 this.panels = $(); 15413 15414 this.anchors.each(function (i, anchor) { 15415 var selector, panel, panelId, 15416 anchorId = $(anchor).uniqueId().attr("id"), 15417 tab = $(anchor).closest("li"), 15418 originalAriaControls = tab.attr("aria-controls"); 15419 15420 // inline tab 15421 if (that._isLocal(anchor)) { 15422 selector = anchor.hash; 15423 panelId = selector.substring(1); 15424 panel = that.element.find(that._sanitizeSelector(selector)); 15425 // remote tab 15426 } else { 15427 // If the tab doesn't already have aria-controls, 15428 // generate an id by using a throw-away element 15429 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 15430 selector = "#" + panelId; 15431 panel = that.element.find(selector); 15432 if (!panel.length) { 15433 panel = that._createPanel(panelId); 15434 panel.insertAfter(that.panels[i - 1] || that.tablist); 15435 } 15436 panel.attr("aria-live", "polite"); 15437 } 15438 15439 if (panel.length) { 15440 that.panels = that.panels.add(panel); 15441 } 15442 if (originalAriaControls) { 15443 tab.data("ui-tabs-aria-controls", originalAriaControls); 15444 } 15445 tab.attr({ 15446 "aria-controls": panelId, 15447 "aria-labelledby": anchorId 15448 }); 15449 panel.attr("aria-labelledby", anchorId); 15450 }); 15451 15452 this.panels 15453 .addClass("ui-tabs-panel ui-widget-content ui-corner-bottom") 15454 .attr("role", "tabpanel"); 15455 15456 // Avoid memory leaks (#10056) 15457 if (prevTabs) { 15458 this._off(prevTabs.not(this.tabs)); 15459 this._off(prevAnchors.not(this.anchors)); 15460 this._off(prevPanels.not(this.panels)); 15461 } 15462 }, 15463 15464 // allow overriding how to find the list for rare usage scenarios (#7715) 15465 _getList: function () { 15466 return this.tablist || this.element.find("ol,ul").eq(0); 15467 }, 15468 15469 _createPanel: function (id) { 15470 return $("<div>") 15471 .attr("id", id) 15472 .addClass("ui-tabs-panel ui-widget-content ui-corner-bottom") 15473 .data("ui-tabs-destroy", true); 15474 }, 15475 15476 _setupDisabled: function (disabled) { 15477 if ($.isArray(disabled)) { 15478 if (!disabled.length) { 15479 disabled = false; 15480 } else if (disabled.length === this.anchors.length) { 15481 disabled = true; 15482 } 15483 } 15484 15485 // disable tabs 15486 for (var i = 0, li; (li = this.tabs[i]) ; i++) { 15487 if (disabled === true || $.inArray(i, disabled) !== -1) { 15488 $(li) 15489 .addClass("ui-state-disabled") 15490 .attr("aria-disabled", "true"); 15491 } else { 15492 $(li) 15493 .removeClass("ui-state-disabled") 15494 .removeAttr("aria-disabled"); 15495 } 15496 } 15497 15498 this.options.disabled = disabled; 15499 }, 15500 15501 _setupEvents: function (event) { 15502 var events = {}; 15503 if (event) { 15504 $.each(event.split(" "), function (index, eventName) { 15505 events[eventName] = "_eventHandler"; 15506 }); 15507 } 15508 15509 this._off(this.anchors.add(this.tabs).add(this.panels)); 15510 // Always prevent the default action, even when disabled 15511 this._on(true, this.anchors, { 15512 click: function (event) { 15513 event.preventDefault(); 15514 } 15515 }); 15516 this._on(this.anchors, events); 15517 this._on(this.tabs, { keydown: "_tabKeydown" }); 15518 this._on(this.panels, { keydown: "_panelKeydown" }); 15519 15520 this._focusable(this.tabs); 15521 this._hoverable(this.tabs); 15522 }, 15523 15524 _setupHeightStyle: function (heightStyle) { 15525 var maxHeight, 15526 parent = this.element.parent(); 15527 15528 if (heightStyle === "fill") { 15529 maxHeight = parent.height(); 15530 maxHeight -= this.element.outerHeight() - this.element.height(); 15531 15532 this.element.siblings(":visible").each(function () { 15533 var elem = $(this), 15534 position = elem.css("position"); 15535 15536 if (position === "absolute" || position === "fixed") { 15537 return; 15538 } 15539 maxHeight -= elem.outerHeight(true); 15540 }); 15541 15542 this.element.children().not(this.panels).each(function () { 15543 maxHeight -= $(this).outerHeight(true); 15544 }); 15545 15546 this.panels.each(function () { 15547 $(this).height(Math.max(0, maxHeight - 15548 $(this).innerHeight() + $(this).height())); 15549 }) 15550 .css("overflow", "auto"); 15551 } else if (heightStyle === "auto") { 15552 maxHeight = 0; 15553 this.panels.each(function () { 15554 maxHeight = Math.max(maxHeight, $(this).height("").height()); 15555 }).height(maxHeight); 15556 } 15557 }, 15558 15559 _eventHandler: function (event) { 15560 var options = this.options, 15561 active = this.active, 15562 anchor = $(event.currentTarget), 15563 tab = anchor.closest("li"), 15564 clickedIsActive = tab[0] === active[0], 15565 collapsing = clickedIsActive && options.collapsible, 15566 toShow = collapsing ? $() : this._getPanelForTab(tab), 15567 toHide = !active.length ? $() : this._getPanelForTab(active), 15568 eventData = { 15569 oldTab: active, 15570 oldPanel: toHide, 15571 newTab: collapsing ? $() : tab, 15572 newPanel: toShow 15573 }; 15574 15575 event.preventDefault(); 15576 15577 if (tab.hasClass("ui-state-disabled") || 15578 // tab is already loading 15579 tab.hasClass("ui-tabs-loading") || 15580 // can't switch durning an animation 15581 this.running || 15582 // click on active header, but not collapsible 15583 (clickedIsActive && !options.collapsible) || 15584 // allow canceling activation 15585 (this._trigger("beforeActivate", event, eventData) === false)) { 15586 return; 15587 } 15588 15589 options.active = collapsing ? false : this.tabs.index(tab); 15590 15591 this.active = clickedIsActive ? $() : tab; 15592 if (this.xhr) { 15593 this.xhr.abort(); 15594 } 15595 15596 if (!toHide.length && !toShow.length) { 15597 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 15598 } 15599 15600 if (toShow.length) { 15601 this.load(this.tabs.index(tab), event); 15602 } 15603 this._toggle(event, eventData); 15604 }, 15605 15606 // handles show/hide for selecting tabs 15607 _toggle: function (event, eventData) { 15608 var that = this, 15609 toShow = eventData.newPanel, 15610 toHide = eventData.oldPanel; 15611 15612 this.running = true; 15613 15614 function complete() { 15615 that.running = false; 15616 that._trigger("activate", event, eventData); 15617 } 15618 15619 function show() { 15620 eventData.newTab.closest("li").addClass("ui-tabs-active ui-state-active"); 15621 15622 if (toShow.length && that.options.show) { 15623 that._show(toShow, that.options.show, complete); 15624 } else { 15625 toShow.show(); 15626 complete(); 15627 } 15628 } 15629 15630 // start out by hiding, then showing, then completing 15631 if (toHide.length && this.options.hide) { 15632 this._hide(toHide, this.options.hide, function () { 15633 eventData.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"); 15634 show(); 15635 }); 15636 } else { 15637 eventData.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"); 15638 toHide.hide(); 15639 show(); 15640 } 15641 15642 toHide.attr("aria-hidden", "true"); 15643 eventData.oldTab.attr({ 15644 "aria-selected": "false", 15645 "aria-expanded": "false" 15646 }); 15647 // If we're switching tabs, remove the old tab from the tab order. 15648 // If we're opening from collapsed state, remove the previous tab from the tab order. 15649 // If we're collapsing, then keep the collapsing tab in the tab order. 15650 if (toShow.length && toHide.length) { 15651 eventData.oldTab.attr("tabIndex", -1); 15652 } else if (toShow.length) { 15653 this.tabs.filter(function () { 15654 return $(this).attr("tabIndex") === 0; 15655 }) 15656 .attr("tabIndex", -1); 15657 } 15658 15659 toShow.attr("aria-hidden", "false"); 15660 eventData.newTab.attr({ 15661 "aria-selected": "true", 15662 "aria-expanded": "true", 15663 tabIndex: 0 15664 }); 15665 }, 15666 15667 _activate: function (index) { 15668 var anchor, 15669 active = this._findActive(index); 15670 15671 // trying to activate the already active panel 15672 if (active[0] === this.active[0]) { 15673 return; 15674 } 15675 15676 // trying to collapse, simulate a click on the current active header 15677 if (!active.length) { 15678 active = this.active; 15679 } 15680 15681 anchor = active.find(".ui-tabs-anchor")[0]; 15682 this._eventHandler({ 15683 target: anchor, 15684 currentTarget: anchor, 15685 preventDefault: $.noop 15686 }); 15687 }, 15688 15689 _findActive: function (index) { 15690 return index === false ? $() : this.tabs.eq(index); 15691 }, 15692 15693 _getIndex: function (index) { 15694 // meta-function to give users option to provide a href string instead of a numerical index. 15695 if (typeof index === "string") { 15696 index = this.anchors.index(this.anchors.filter("[href$='" + index + "']")); 15697 } 15698 15699 return index; 15700 }, 15701 15702 _destroy: function () { 15703 if (this.xhr) { 15704 this.xhr.abort(); 15705 } 15706 15707 this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"); 15708 15709 this.tablist 15710 .removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all") 15711 .removeAttr("role"); 15712 15713 this.anchors 15714 .removeClass("ui-tabs-anchor") 15715 .removeAttr("role") 15716 .removeAttr("tabIndex") 15717 .removeUniqueId(); 15718 15719 this.tablist.unbind(this.eventNamespace); 15720 15721 this.tabs.add(this.panels).each(function () { 15722 if ($.data(this, "ui-tabs-destroy")) { 15723 $(this).remove(); 15724 } else { 15725 $(this) 15726 .removeClass("ui-state-default ui-state-active ui-state-disabled " + 15727 "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel") 15728 .removeAttr("tabIndex") 15729 .removeAttr("aria-live") 15730 .removeAttr("aria-busy") 15731 .removeAttr("aria-selected") 15732 .removeAttr("aria-labelledby") 15733 .removeAttr("aria-hidden") 15734 .removeAttr("aria-expanded") 15735 .removeAttr("role"); 15736 } 15737 }); 15738 15739 this.tabs.each(function () { 15740 var li = $(this), 15741 prev = li.data("ui-tabs-aria-controls"); 15742 if (prev) { 15743 li 15744 .attr("aria-controls", prev) 15745 .removeData("ui-tabs-aria-controls"); 15746 } else { 15747 li.removeAttr("aria-controls"); 15748 } 15749 }); 15750 15751 this.panels.show(); 15752 15753 if (this.options.heightStyle !== "content") { 15754 this.panels.css("height", ""); 15755 } 15756 }, 15757 15758 enable: function (index) { 15759 var disabled = this.options.disabled; 15760 if (disabled === false) { 15761 return; 15762 } 15763 15764 if (index === undefined) { 15765 disabled = false; 15766 } else { 15767 index = this._getIndex(index); 15768 if ($.isArray(disabled)) { 15769 disabled = $.map(disabled, function (num) { 15770 return num !== index ? num : null; 15771 }); 15772 } else { 15773 disabled = $.map(this.tabs, function (li, num) { 15774 return num !== index ? num : null; 15775 }); 15776 } 15777 } 15778 this._setupDisabled(disabled); 15779 }, 15780 15781 disable: function (index) { 15782 var disabled = this.options.disabled; 15783 if (disabled === true) { 15784 return; 15785 } 15786 15787 if (index === undefined) { 15788 disabled = true; 15789 } else { 15790 index = this._getIndex(index); 15791 if ($.inArray(index, disabled) !== -1) { 15792 return; 15793 } 15794 if ($.isArray(disabled)) { 15795 disabled = $.merge([index], disabled).sort(); 15796 } else { 15797 disabled = [index]; 15798 } 15799 } 15800 this._setupDisabled(disabled); 15801 }, 15802 15803 load: function (index, event) { 15804 index = this._getIndex(index); 15805 var that = this, 15806 tab = this.tabs.eq(index), 15807 anchor = tab.find(".ui-tabs-anchor"), 15808 panel = this._getPanelForTab(tab), 15809 eventData = { 15810 tab: tab, 15811 panel: panel 15812 }, 15813 complete = function (jqXHR, status) { 15814 if (status === "abort") { 15815 that.panels.stop(false, true); 15816 } 15817 15818 tab.removeClass("ui-tabs-loading"); 15819 panel.removeAttr("aria-busy"); 15820 15821 if (jqXHR === that.xhr) { 15822 delete that.xhr; 15823 } 15824 }; 15825 15826 // not remote 15827 if (this._isLocal(anchor[0])) { 15828 return; 15829 } 15830 15831 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 15832 15833 // support: jQuery <1.8 15834 // jQuery <1.8 returns false if the request is canceled in beforeSend, 15835 // but as of 1.8, $.ajax() always returns a jqXHR object. 15836 if (this.xhr && this.xhr.statusText !== "canceled") { 15837 tab.addClass("ui-tabs-loading"); 15838 panel.attr("aria-busy", "true"); 15839 15840 this.xhr 15841 .done(function (response, status, jqXHR) { 15842 // support: jQuery <1.8 15843 // http://bugs.jquery.com/ticket/11778 15844 setTimeout(function () { 15845 panel.html(response); 15846 that._trigger("load", event, eventData); 15847 15848 complete(jqXHR, status); 15849 }, 1); 15850 }) 15851 .fail(function (jqXHR, status) { 15852 // support: jQuery <1.8 15853 // http://bugs.jquery.com/ticket/11778 15854 setTimeout(function () { 15855 complete(jqXHR, status); 15856 }, 1); 15857 }); 15858 } 15859 }, 15860 15861 _ajaxSettings: function (anchor, event, eventData) { 15862 var that = this; 15863 return { 15864 url: anchor.attr("href"), 15865 beforeSend: function (jqXHR, settings) { 15866 return that._trigger("beforeLoad", event, 15867 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData)); 15868 } 15869 }; 15870 }, 15871 15872 _getPanelForTab: function (tab) { 15873 var id = $(tab).attr("aria-controls"); 15874 return this.element.find(this._sanitizeSelector("#" + id)); 15875 } 15876 }); 15877 15878 /*! 15879 * jQuery UI Tooltip 1.11.4 15880 * http://jqueryui.com 15881 * 15882 * Copyright jQuery Foundation and other contributors 15883 * Released under the MIT license. 15884 * http://jquery.org/license 15885 * 15886 * http://api.jqueryui.com/tooltip/ 15887 */ 15888 15889 var tooltip = $.widget("ui.tooltip", { 15890 version: "1.11.4", 15891 options: { 15892 content: function () { 15893 // support: IE<9, Opera in jQuery <1.7 15894 // .text() can't accept undefined, so coerce to a string 15895 var title = $(this).attr("title") || ""; 15896 // Escape title, since we're going from an attribute to raw HTML 15897 return $("<a>").text(title).html(); 15898 }, 15899 hide: true, 15900 // Disabled elements have inconsistent behavior across browsers (#8661) 15901 items: "[title]:not([disabled])", 15902 position: { 15903 my: "left top+15", 15904 at: "left bottom", 15905 collision: "flipfit flip" 15906 }, 15907 show: true, 15908 tooltipClass: null, 15909 track: false, 15910 15911 // callbacks 15912 close: null, 15913 open: null 15914 }, 15915 15916 _addDescribedBy: function (elem, id) { 15917 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 15918 describedby.push(id); 15919 elem 15920 .data("ui-tooltip-id", id) 15921 .attr("aria-describedby", $.trim(describedby.join(" "))); 15922 }, 15923 15924 _removeDescribedBy: function (elem) { 15925 var id = elem.data("ui-tooltip-id"), 15926 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 15927 index = $.inArray(id, describedby); 15928 15929 if (index !== -1) { 15930 describedby.splice(index, 1); 15931 } 15932 15933 elem.removeData("ui-tooltip-id"); 15934 describedby = $.trim(describedby.join(" ")); 15935 if (describedby) { 15936 elem.attr("aria-describedby", describedby); 15937 } else { 15938 elem.removeAttr("aria-describedby"); 15939 } 15940 }, 15941 15942 _create: function () { 15943 this._on({ 15944 mouseover: "open", 15945 focusin: "open" 15946 }); 15947 15948 // IDs of generated tooltips, needed for destroy 15949 this.tooltips = {}; 15950 15951 // IDs of parent tooltips where we removed the title attribute 15952 this.parents = {}; 15953 15954 if (this.options.disabled) { 15955 this._disable(); 15956 } 15957 15958 // Append the aria-live region so tooltips announce correctly 15959 this.liveRegion = $("<div>") 15960 .attr({ 15961 role: "log", 15962 "aria-live": "assertive", 15963 "aria-relevant": "additions" 15964 }) 15965 .addClass("ui-helper-hidden-accessible") 15966 .appendTo(this.document[0].body); 15967 }, 15968 15969 _setOption: function (key, value) { 15970 var that = this; 15971 15972 if (key === "disabled") { 15973 this[value ? "_disable" : "_enable"](); 15974 this.options[key] = value; 15975 // disable element style changes 15976 return; 15977 } 15978 15979 this._super(key, value); 15980 15981 if (key === "content") { 15982 $.each(this.tooltips, function (id, tooltipData) { 15983 that._updateContent(tooltipData.element); 15984 }); 15985 } 15986 }, 15987 15988 _disable: function () { 15989 var that = this; 15990 15991 // close open tooltips 15992 $.each(this.tooltips, function (id, tooltipData) { 15993 var event = $.Event("blur"); 15994 event.target = event.currentTarget = tooltipData.element[0]; 15995 that.close(event, true); 15996 }); 15997 15998 // remove title attributes to prevent native tooltips 15999 this.element.find(this.options.items).addBack().each(function () { 16000 var element = $(this); 16001 if (element.is("[title]")) { 16002 element 16003 .data("ui-tooltip-title", element.attr("title")) 16004 .removeAttr("title"); 16005 } 16006 }); 16007 }, 16008 16009 _enable: function () { 16010 // restore title attributes 16011 this.element.find(this.options.items).addBack().each(function () { 16012 var element = $(this); 16013 if (element.data("ui-tooltip-title")) { 16014 element.attr("title", element.data("ui-tooltip-title")); 16015 } 16016 }); 16017 }, 16018 16019 open: function (event) { 16020 var that = this, 16021 target = $(event ? event.target : this.element) 16022 // we need closest here due to mouseover bubbling, 16023 // but always pointing at the same event target 16024 .closest(this.options.items); 16025 16026 // No element to show a tooltip for or the tooltip is already open 16027 if (!target.length || target.data("ui-tooltip-id")) { 16028 return; 16029 } 16030 16031 if (target.attr("title")) { 16032 target.data("ui-tooltip-title", target.attr("title")); 16033 } 16034 16035 target.data("ui-tooltip-open", true); 16036 16037 // kill parent tooltips, custom or native, for hover 16038 if (event && event.type === "mouseover") { 16039 target.parents().each(function () { 16040 var parent = $(this), 16041 blurEvent; 16042 if (parent.data("ui-tooltip-open")) { 16043 blurEvent = $.Event("blur"); 16044 blurEvent.target = blurEvent.currentTarget = this; 16045 that.close(blurEvent, true); 16046 } 16047 if (parent.attr("title")) { 16048 parent.uniqueId(); 16049 that.parents[this.id] = { 16050 element: this, 16051 title: parent.attr("title") 16052 }; 16053 parent.attr("title", ""); 16054 } 16055 }); 16056 } 16057 16058 this._registerCloseHandlers(event, target); 16059 this._updateContent(target, event); 16060 }, 16061 16062 _updateContent: function (target, event) { 16063 var content, 16064 contentOption = this.options.content, 16065 that = this, 16066 eventType = event ? event.type : null; 16067 16068 if (typeof contentOption === "string") { 16069 return this._open(event, target, contentOption); 16070 } 16071 16072 content = contentOption.call(target[0], function (response) { 16073 // IE may instantly serve a cached response for ajax requests 16074 // delay this call to _open so the other call to _open runs first 16075 that._delay(function () { 16076 // Ignore async response if tooltip was closed already 16077 if (!target.data("ui-tooltip-open")) { 16078 return; 16079 } 16080 16081 // jQuery creates a special event for focusin when it doesn't 16082 // exist natively. To improve performance, the native event 16083 // object is reused and the type is changed. Therefore, we can't 16084 // rely on the type being correct after the event finished 16085 // bubbling, so we set it back to the previous value. (#8740) 16086 if (event) { 16087 event.type = eventType; 16088 } 16089 this._open(event, target, response); 16090 }); 16091 }); 16092 if (content) { 16093 this._open(event, target, content); 16094 } 16095 }, 16096 16097 _open: function (event, target, content) { 16098 var tooltipData, tooltip, delayedShow, a11yContent, 16099 positionOption = $.extend({}, this.options.position); 16100 16101 if (!content) { 16102 return; 16103 } 16104 16105 // Content can be updated multiple times. If the tooltip already 16106 // exists, then just update the content and bail. 16107 tooltipData = this._find(target); 16108 if (tooltipData) { 16109 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 16110 return; 16111 } 16112 16113 // if we have a title, clear it to prevent the native tooltip 16114 // we have to check first to avoid defining a title if none exists 16115 // (we don't want to cause an element to start matching [title]) 16116 // 16117 // We use removeAttr only for key events, to allow IE to export the correct 16118 // accessible attributes. For mouse events, set to empty string to avoid 16119 // native tooltip showing up (happens only when removing inside mouseover). 16120 if (target.is("[title]")) { 16121 if (event && event.type === "mouseover") { 16122 target.attr("title", ""); 16123 } else { 16124 target.removeAttr("title"); 16125 } 16126 } 16127 16128 tooltipData = this._tooltip(target); 16129 tooltip = tooltipData.tooltip; 16130 this._addDescribedBy(target, tooltip.attr("id")); 16131 tooltip.find(".ui-tooltip-content").html(content); 16132 16133 // Support: Voiceover on OS X, JAWS on IE <= 9 16134 // JAWS announces deletions even when aria-relevant="additions" 16135 // Voiceover will sometimes re-read the entire log region's contents from the beginning 16136 this.liveRegion.children().hide(); 16137 if (content.clone) { 16138 a11yContent = content.clone(); 16139 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 16140 } else { 16141 a11yContent = content; 16142 } 16143 $("<div>").html(a11yContent).appendTo(this.liveRegion); 16144 16145 function position(event) { 16146 positionOption.of = event; 16147 if (tooltip.is(":hidden")) { 16148 return; 16149 } 16150 tooltip.position(positionOption); 16151 } 16152 if (this.options.track && event && /^mouse/.test(event.type)) { 16153 this._on(this.document, { 16154 mousemove: position 16155 }); 16156 // trigger once to override element-relative positioning 16157 position(event); 16158 } else { 16159 tooltip.position($.extend({ 16160 of: target 16161 }, this.options.position)); 16162 } 16163 16164 tooltip.hide(); 16165 16166 this._show(tooltip, this.options.show); 16167 // Handle tracking tooltips that are shown with a delay (#8644). As soon 16168 // as the tooltip is visible, position the tooltip using the most recent 16169 // event. 16170 if (this.options.show && this.options.show.delay) { 16171 delayedShow = this.delayedShow = setInterval(function () { 16172 if (tooltip.is(":visible")) { 16173 position(positionOption.of); 16174 clearInterval(delayedShow); 16175 } 16176 }, $.fx.interval); 16177 } 16178 16179 this._trigger("open", event, { tooltip: tooltip }); 16180 }, 16181 16182 _registerCloseHandlers: function (event, target) { 16183 var events = { 16184 keyup: function (event) { 16185 if (event.keyCode === $.ui.keyCode.ESCAPE) { 16186 var fakeEvent = $.Event(event); 16187 fakeEvent.currentTarget = target[0]; 16188 this.close(fakeEvent, true); 16189 } 16190 } 16191 }; 16192 16193 // Only bind remove handler for delegated targets. Non-delegated 16194 // tooltips will handle this in destroy. 16195 if (target[0] !== this.element[0]) { 16196 events.remove = function () { 16197 this._removeTooltip(this._find(target).tooltip); 16198 }; 16199 } 16200 16201 if (!event || event.type === "mouseover") { 16202 events.mouseleave = "close"; 16203 } 16204 if (!event || event.type === "focusin") { 16205 events.focusout = "close"; 16206 } 16207 this._on(true, target, events); 16208 }, 16209 16210 close: function (event) { 16211 var tooltip, 16212 that = this, 16213 target = $(event ? event.currentTarget : this.element), 16214 tooltipData = this._find(target); 16215 16216 // The tooltip may already be closed 16217 if (!tooltipData) { 16218 // We set ui-tooltip-open immediately upon open (in open()), but only set the 16219 // additional data once there's actually content to show (in _open()). So even if the 16220 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 16221 // the period between open() and _open(). 16222 target.removeData("ui-tooltip-open"); 16223 return; 16224 } 16225 16226 tooltip = tooltipData.tooltip; 16227 16228 // disabling closes the tooltip, so we need to track when we're closing 16229 // to avoid an infinite loop in case the tooltip becomes disabled on close 16230 if (tooltipData.closing) { 16231 return; 16232 } 16233 16234 // Clear the interval for delayed tracking tooltips 16235 clearInterval(this.delayedShow); 16236 16237 // only set title if we had one before (see comment in _open()) 16238 // If the title attribute has changed since open(), don't restore 16239 if (target.data("ui-tooltip-title") && !target.attr("title")) { 16240 target.attr("title", target.data("ui-tooltip-title")); 16241 } 16242 16243 this._removeDescribedBy(target); 16244 16245 tooltipData.hiding = true; 16246 tooltip.stop(true); 16247 this._hide(tooltip, this.options.hide, function () { 16248 that._removeTooltip($(this)); 16249 }); 16250 16251 target.removeData("ui-tooltip-open"); 16252 this._off(target, "mouseleave focusout keyup"); 16253 16254 // Remove 'remove' binding only on delegated targets 16255 if (target[0] !== this.element[0]) { 16256 this._off(target, "remove"); 16257 } 16258 this._off(this.document, "mousemove"); 16259 16260 if (event && event.type === "mouseleave") { 16261 $.each(this.parents, function (id, parent) { 16262 $(parent.element).attr("title", parent.title); 16263 delete that.parents[id]; 16264 }); 16265 } 16266 16267 tooltipData.closing = true; 16268 this._trigger("close", event, { tooltip: tooltip }); 16269 if (!tooltipData.hiding) { 16270 tooltipData.closing = false; 16271 } 16272 }, 16273 16274 _tooltip: function (element) { 16275 var tooltip = $("<div>") 16276 .attr("role", "tooltip") 16277 .addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content " + 16278 (this.options.tooltipClass || "")), 16279 id = tooltip.uniqueId().attr("id"); 16280 16281 $("<div>") 16282 .addClass("ui-tooltip-content") 16283 .appendTo(tooltip); 16284 16285 tooltip.appendTo(this.document[0].body); 16286 16287 return this.tooltips[id] = { 16288 element: element, 16289 tooltip: tooltip 16290 }; 16291 }, 16292 16293 _find: function (target) { 16294 var id = target.data("ui-tooltip-id"); 16295 return id ? this.tooltips[id] : null; 16296 }, 16297 16298 _removeTooltip: function (tooltip) { 16299 tooltip.remove(); 16300 delete this.tooltips[tooltip.attr("id")]; 16301 }, 16302 16303 _destroy: function () { 16304 var that = this; 16305 16306 // close open tooltips 16307 $.each(this.tooltips, function (id, tooltipData) { 16308 // Delegate to close method to handle common cleanup 16309 var event = $.Event("blur"), 16310 element = tooltipData.element; 16311 event.target = event.currentTarget = element[0]; 16312 that.close(event, true); 16313 16314 // Remove immediately; destroying an open tooltip doesn't use the 16315 // hide animation 16316 $("#" + id).remove(); 16317 16318 // Restore the title 16319 if (element.data("ui-tooltip-title")) { 16320 // If the title attribute has changed since open(), don't restore 16321 if (!element.attr("title")) { 16322 element.attr("title", element.data("ui-tooltip-title")); 16323 } 16324 element.removeData("ui-tooltip-title"); 16325 } 16326 }); 16327 this.liveRegion.remove(); 16328 } 16329 }); 16330}));
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.