https://www.fundaciogrifols.org/combo?browserId=other&minifierType…/aui/widget-child/widget-child.js
1YUI.add('widget-uievents', function (Y, NAME) { 2 3/** 4 * Support for Widget UI Events (Custom Events fired by the widget, which wrap the underlying DOM events - e.g. widget:click, widget:mousedown) 5 * 6 * @module widget 7 * @submodule widget-uievents 8 */ 9 10var BOUNDING_BOX = "boundingBox", 11 Widget = Y.Widget, 12 RENDER = "render", 13 L = Y.Lang, 14 EVENT_PREFIX_DELIMITER = ":", 15 16 // Map of Node instances serving as a delegation containers for a specific 17 // event type to Widget instances using that delegation container. 18 _uievts = Y.Widget._uievts = Y.Widget._uievts || {}; 19 20Y.mix(Widget.prototype, { 21 22 /** 23 * Destructor logic for UI event infrastructure, 24 * invoked during Widget destruction. 25 * 26 * @method _destroyUIEvents 27 * @for Widget 28 * @private 29 */ 30 _destroyUIEvents: function() { 31 32 var widgetGuid = Y.stamp(this, true); 33 34 Y.each(_uievts, function (info, key) { 35 if (info.instances[widgetGuid]) { 36 // Unregister this Widget instance as needing this delegated 37 // event listener. 38 delete info.instances[widgetGuid]; 39 40 // There are no more Widget instances using this delegated 41 // event listener, so detach it. 42 43 if (Y.Object.isEmpty(info.instances)) { 44 info.handle.detach(); 45 46 if (_uievts[key]) { 47 delete _uievts[key]; 48 } 49 } 50 } 51 }); 52 }, 53 54 /** 55 * Map of DOM events that should be fired as Custom Events by the 56 * Widget instance. 57 * 58 * @property UI_EVENTS 59 * @for Widget 60 * @type Object 61 */ 62 UI_EVENTS: Y.Node.DOM_EVENTS, 63 64 /** 65 * Returns the node on which to bind delegate listeners. 66 * 67 * @method _getUIEventNode 68 * @for Widget 69 * @protected 70 */ 71 _getUIEventNode: function () { 72 return this.get(BOUNDING_BOX); 73 }, 74 75 /** 76 * Binds a delegated DOM event listener of the specified type to the 77 * Widget's outtermost DOM element to facilitate the firing of a Custom 78 * Event of the same type for the Widget instance. 79 * 80 * @method _createUIEvent 81 * @for Widget 82 * @param type {String} String representing the name of the event 83 * @private 84 */ 85 _createUIEvent: function (type) { 86 87 var uiEvtNode = this._getUIEventNode(), 88 key = (Y.stamp(uiEvtNode) + type), 89 info = _uievts[key], 90 handle; 91 92 // For each Node instance: Ensure that there is only one delegated 93 // event listener used to fire Widget UI events. 94 95 if (!info) { 96 97 handle = uiEvtNode.delegate(type, function (evt) { 98 99 var widget = Widget.getByNode(this); 100
101 // Widget could be null if node instance belongs to 102 // another Y instance. 103 104 if (widget) { 105 if (widget._filterUIEvent(evt)) { 106 widget.fire(evt.type, { domEvent: evt }); 107 } 108 } 109 110 }, "." + Y.Widget.getClassName()); 111 112 _uievts[key] = info = { instances: {}, handle: handle }; 113 } 114 115 // Register this Widget as using this Node as a delegation container. 116 info.instances[Y.stamp(this)] = 1; 117 }, 118 119 /** 120 * This method is used to determine if we should fire 121 * the UI Event or not. The default implementation makes sure 122 * that for nested delegates (nested unrelated widgets), we don't 123 * fire the UI event listener more than once at each level. 124 * 125 * <p>For example, without the additional filter, if you have nested 126 * widgets, each widget will have a delegate listener. If you 127 * click on the inner widget, the inner delegate listener's 128 * filter will match once, but the outer will match twice 129 * (based on delegate's design) - once for the inner widget, 130 * and once for the outer.</p> 131 * 132 * @method _filterUIEvent 133 * @for Widget 134 * @param {DOMEventFacade} evt 135 * @return {boolean} true if it's OK to fire the custom UI event, false if not. 136 * @private 137 * 138 */ 139 _filterUIEvent: function(evt) { 140 // Either it's hitting this widget's delegate container (and not some other widget's), 141 // or the container it's hitting is handling this widget's ui events. 142 return (evt.currentTarget.compareTo(evt.container) || evt.container.compareTo(this._getUIEventNode())); 143 }, 144 145 /** 146 * Determines if the specified event is a UI event. 147 * 148 * @private 149 * @method _isUIEvent 150 * @for Widget 151 * @param type {String} String representing the name of the event 152 * @return {String} Event Returns the name of the UI Event, otherwise 153 * undefined. 154 */ 155 _getUIEvent: function (type) { 156 157 if (L.isString(type)) { 158 var sType = this.parseType(type)[1], 159 iDelim, 160 returnVal; 161 162 if (sType) { 163 // TODO: Get delimiter from ET, or have ET support this. 164 iDelim = sType.indexOf(EVENT_PREFIX_DELIMITER); 165 if (iDelim > -1) { 166 sType = sType.substring(iDelim + EVENT_PREFIX_DELIMITER.length); 167 } 168 169 if (this.UI_EVENTS[sType]) { 170 returnVal = sType; 171 } 172 } 173 174 return returnVal; 175 } 176 }, 177 178 /** 179 * Sets up infrastructure required to fire a UI event. 180 * 181 * @private 182 * @method _initUIEvent 183 * @for Widget 184 * @param type {String} String representing the name of the event 185 * @return {String} 186 */ 187 _initUIEvent: function (type) { 188 var sType = this._getUIEvent(type), 189 queue = this._uiEvtsInitQueue || {}; 190 191 if (sType && !queue[sType]) { 192 193 this._uiEvtsInitQueue = queue[sType] = 1; 194 195 this.after(RENDER, function() { 196 this._createUIEvent(sType); 197 delete this._uiEvtsInitQueue[sType]; 198 }); 199 } 200 }, 201 202 // Override of "on" from Base to facilitate the firing of Widget events 203 // based on DOM events of the same name/type (e.g. "click", "mouseover"). 204 // Temporary solution until we have the ability to listen to when 205 // someone adds an event listener (bug 2528230) 206 on: function (type) { 207 this._initUIEvent(type); 208 return Widget.superclass.on.apply(this, arguments); 209 }, 210 211 // Override of "publish" from Base to facilitate the firing of Widget events 212 // based on DOM events of the same name/type (e.g. "click", "mouseover"). 213 // Temporary solution until we have the ability to listen to when 214 // someone publishes an event (bug 2528230) 215 publish: function (type, config) { 216 var sType = this._getUIEvent(type); 217 if (sType && config && config.defaultFn) { 218 this._initUIEvent(sType); 219 } 220 return Widget.superclass.publish.apply(this, arguments); 221 } 222 223}, true); // overwrite existing EventTarget methods 224 225 226}, 'patched-v3.18.3', {"requires": ["node-event-delegate", "widget-base"]}); 227 228YUI.add('yui-throttle', function (Y, NAME) { 229 230/** 231Throttles a call to a method based on the time between calls. This method is attached 232to the `Y` object and is <a href="../classes/YUI.html#method_throttle">documented there</a>. 233 234 var fn = Y.throttle(function() { 235 counter++; 236 }); 237 238 for (i; i< 35000; i++) { 239 out++; 240 fn(); 241 } 242 243 244@module yui 245@submodule yui-throttle 246*/ 247 248/*! Based on work by Simon Willison: http://gist.github.com/292562 */ 249/** 250 * Throttles a call to a method based on the time between calls. 251 * @method throttle 252 * @for YUI 253 * @param fn {function} The function call to throttle. 254 * @param ms {Number} The number of milliseconds to throttle the method call. 255 * Can set globally with Y.config.throttleTime or by call. Passing a -1 will 256 * disable the throttle. Defaults to 150. 257 * @return {function} Returns a wrapped function that calls fn throttled. 258 * @since 3.1.0 259 */ 260Y.throttle = function(fn, ms) { 261 ms = (ms) ? ms : (Y.config.throttleTime || 150); 262 263 if (ms === -1) { 264 return function() { 265 fn.apply(this, arguments); 266 }; 267 } 268 269 var last = Y.Lang.now(); 270 271 return function() { 272 var now = Y.Lang.now(); 273 if (now - last > ms) { 274 last = now; 275 fn.apply(this, arguments); 276 } 277 }; 278}; 279 280 281}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 282 283YUI.add('aui-base-core', function (A, NAME) { 284 285var Y = A; 286YUI.Env.aliases = YUI.Env.aliases || {}; 287Y.mix(YUI.Env.aliases, { 288 "aui-autosize": ["aui-autosize-iframe"], 289 "aui-base": ["oop","yui-throttle","aui-classnamemanager","aui-debounce","aui-base-core","aui-base-lang","aui-node-base"], 290 "aui-base-deprecated": ["aui-base","aui-node","aui-component","aui-delayed-task-deprecated","aui-selector","aui-event-base"], 291 "aui-button": ["aui-button-core"], 292 "aui-collection": ["aui-map","aui-set","aui-linkedset"], 293 "aui-color-picker-deprecated": ["aui-color-picker-base-deprecated","aui-color-picker-grid-plugin-deprecated"], 294 "aui-datasource-control-deprecated": ["aui-datasource-control-base-deprecated","aui-input-text-control-deprecated"], 295 "aui-datatable": ["aui-datatable-edit","aui-datatable-highlight","aui-datatable-selection","aui-datatable-property-list"], 296 "aui-datatable-edit": ["datatable-base","calendar","overlay","sortable","aui-datatype","aui-toolbar","aui-form-validator","aui-datatable-base-cell-editor","aui-datatable-base-options-cell-editor","aui-datatable-cell-editor-support","aui-datatable-core","aui-datatable-checkbox-cell-editor","aui-datatable-date-cell-editor","aui-datatable-dropdown-cell-editor","aui-datatable-radio-cell-editor","aui-datatable-text-cell-editor","aui-datatable-text-area-cell-editor"], 297 "aui-datepicker-deprecated": ["aui-datepicker-base-deprecated","aui-datepicker-select-deprecated"], 298 "aui-event": ["aui-event-base"], 299 "aui-form-deprecated": ["aui-form-base-deprecated","aui-form-combobox-deprecated","aui-form-field-deprecated","aui-form-select-deprecated","aui-form-textarea-deprecated","aui-form-textfield-deprecated"], 300 "aui-io": ["aui-io-request"], 301 "aui-io-deprecated": ["aui-io-request","aui-io-plugin-deprecated"], 302 "aui-node": ["aui-node-base"], 303 "aui-overlay-deprecated": ["aui-overlay-base-deprecated","aui-overlay-context-deprecated","aui-overlay-context-panel-deprecated","aui-overlay-manager-deprecated","aui-overlay-mask-deprecated"], 304 "aui-rating": ["aui-rating-base","aui-rating-thumb"], 305 "aui-resize-deprecated": ["aui-resize-base-deprecated","aui-resize-constrain-deprecated"], 306 "aui-scheduler": ["event-gestures","aui-scheduler-base","aui-scheduler-event-recorder","aui-scheduler-view-agenda","aui-scheduler-view-day","aui-scheduler-view-month","aui-scheduler-view-table-dd","aui-scheduler-view-table","aui-scheduler-view-week","aui-viewport"], 307 "aui-search": ["aui-search-tst"], 308 "aui-sortable": ["aui-sortable-layout","aui-sortable-list"], 309 "aui-surface": ["aui-surface-app","aui-surface-screen"], 310 "aui-toggler": ["aui-toggler-base","aui-toggler-delegate"], 311 "aui-tooltip": ["aui-tooltip-base","aui-tooltip-delegate"], 312 "aui-tpl-snippets-deprecated": ["aui-tpl-snippets-base-deprecated","aui-tpl-snippets-checkbox-deprecated","aui-tpl-snippets-input-deprecated","aui-tpl-snippets-select-deprecated","aui-tpl-snippets-textarea-deprecated"], 313 "aui-tree": ["aui-tree-data","aui-tree-io","aui-tree-node","aui-tree-paginator","aui-tree-view"], 314 "aui-widget": ["aui-widget-cssclass","aui-widget-toolbars"], 315 "aui-widget-core": ["aui-widget-cssclass"] 316}); 317/* This file is auto-generated by (yogi loader --yes --mix --js js/aui-loader.js --json js/aui-loader.json --start ../) */ 318 319/*jshint maxlen:900, eqeqeq: false */ 320 321/** 322 * YUI 3 module metadata 323 * @module loader 324 * @submodule loader-yui3 325 */ 326YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; 327Y.mix(YUI.Env[Y.version].modules, { 328 "aui-ace-autocomplete-base": { 329 "requires": [ 330 "aui-ace-editor" 331 ] 332 }, 333 "aui-ace-autocomplete-freemarker": { 334 "requires": [ 335 "aui-ace-autocomplete-templateprocessor" 336 ] 337 }, 338 "aui-ace-autocomplete-list": { 339 "requires": [ 340 "aui-ace-autocomplete-base", 341 "overlay", 342 "widget-autohide" 343 ], 344 "skinnable": true 345 }, 346 "aui-ace-autocomplete-plugin": { 347 "requires": [ 348 "aui-ace-autocomplete-list", 349 "plugin" 350 ] 351 }, 352 "aui-ace-autocomplete-templateprocessor": { 353 "requires": [ 354 "aui-ace-autocomplete-base" 355 ] 356 }, 357 "aui-ace-autocomplete-velocity": { 358 "requires": [ 359 "aui-ace-autocomplete-templateprocessor" 360 ] 361 }, 362 "aui-ace-editor": { 363 "requires": [ 364 "aui-node", 365 "aui-component" 366 ] 367 }, 368 "aui-affix": { 369 "requires": [ 370 "base", 371 "node-screen", 372 "aui-node" 373 ] 374 }, 375 "aui-alert": { 376 "requires": [ 377 "aui-aria", 378 "aui-classnamemanager", 379 "aui-widget-cssclass", 380 "aui-widget-transition", 381 "timers", 382 "widget", 383 "widget-stdmod" 384 ], 385 "skinnable": true 386 }, 387 "aui-aria": { 388 "requires": [ 389 "plugin", 390 "aui-component" 391 ] 392 }, 393 "aui-aria-table-sortable": { 394 "requires": [ 395 "aui-aria" 396 ] 397 }, 398 "aui-arraysort": { 399 "requires": [ 400 "arraysort" 401 ] 402 }, 403 "aui-audio": { 404 "requires": [ 405 "aui-aria", 406 "aui-node", 407 "aui-component", 408 "node-event-html5", 409 "querystring-stringify-simple" 410 ], 411 "skinnable": true 412 }, 413 "aui-autocomplete-deprecated": { 414 "requires": [ 415 "aui-base-deprecated", 416 "aui-overlay-base-deprecated", 417 "datasource", 418 "dataschema", 419 "aui-form-combobox-deprecated" 420 ], 421 "skinnable": true 422 }, 423 "aui-autosize": { 424 "use": [ 425 "aui-autosize-iframe" 426 ] 427 }, 428 "aui-autosize-deprecated": { 429 "requires": [ 430 "event-valuechange", 431 "plugin", 432 "aui-base-deprecated" 433 ], 434 "skinnable": true 435 }, 436 "aui-autosize-iframe": { 437 "requires": [ 438 "plugin", 439 "aui-component", 440 "aui-timer", 441 "aui-node-base" 442 ] 443 }, 444 "aui-base": { 445 "use": [ 446 "oop", 447 "yui-throttle", 448 "aui-classnamemanager", 449 "aui-debounce", 450 "aui-base-core", 451 "aui-base-lang", 452 "aui-node-base" 453 ] 454 }, 455 "aui-base-core": {}, 456 "aui-base-deprecated": { 457 "use": [ 458 "aui-base", 459 "aui-node", 460 "aui-component", 461 "aui-delayed-task-deprecated", 462 "aui-selector", 463 "aui-event-base" 464 ] 465 }, 466 "aui-base-html5-shiv": { 467 "condition": { 468 "name": "aui-base-html5-shiv", 469 "trigger": "node-base", 470 "ua": "ie" 471 } 472 }, 473 "aui-base-lang": {}, 474 "aui-boolean-data-editor": { 475 "requires": [ 476 "aui-button-switch", 477 "aui-data-editor" 478 ] 479 }, 480 "aui-button": { 481 "use": [ 482 "aui-button-core" 483 ] 484 }, 485 "aui-button-core": { 486 "requires": [ 487 "button", 488 "button-group", 489 "button-plugin", 490 "aui-component", 491 "aui-widget-cssclass", 492 "aui-widget-toggle" 493 ], 494 "skinnable": true 495 }, 496 "aui-button-item-deprecated": { 497 "requires": [ 498 "aui-base-deprecated", 499 "aui-state-interaction-deprecated", 500 "widget-child" 501 ], 502 "skinnable": true 503 }, 504 "aui-button-search-cancel": { 505 "requires": [ 506 "array-invoke", 507 "base", 508 "base-build", 509 "event-focus", 510 "event-move", 511 "event-resize", 512 "node-screen", 513 "node-event-delegate", 514 "aui-node-base", 515 "aui-classnamemanager", 516 "aui-event-input" 517 ] 518 }, 519 "aui-button-switch": { 520 "requires": [ 521 "aui-node-base", 522 "base-build", 523 "event-key", 524 "transition", 525 "widget" 526 ], 527 "skinnable": true 528 }, 529 "aui-carousel": { 530 "requires": [ 531 "anim", 532 "aui-event", 533 "aui-image-viewer-base", 534 "aui-image-viewer-slideshow", 535 "node-event-delegate", 536 "node-focusmanager" 537 ], 538 "skinnable": true 539 }, 540 "aui-carousel-mobile-touch": { 541 "condition": { 542 "name": "aui-carousel-mobile-touch", 543 "test": function(A) { 544 return A.UA.mobile && A.UA.touchEnabled; 545}, 546 "trigger": "aui-carousel" 547 }, 548 "requires": [ 549 "base-build", 550 "aui-carousel" 551 ] 552 }, 553 "aui-carousel-swipe": { 554 "condition": { 555 "name": "aui-carousel-swipe", 556 "trigger": "aui-carousel", 557 "ua": "touchEnabled" 558 }, 559 "requires": [ 560 "aui-carousel", 561 "aui-widget-swipe", 562 "base-build" 563 ], 564 "skinnable": true 565 },
566 "aui-char-counter": { 567 "requires": [ 568 "aui-aria", 569 "aui-node", 570 "aui-event-input", 571 "aui-component" 572 ] 573 }, 574 "aui-chart-deprecated": { 575 "requires": [ 576 "datasource", 577 "json", 578 "aui-swf-deprecated" 579 ] 580 }, 581 "aui-classnamemanager": { 582 "requires": [ 583 "classnamemanager" 584 ] 585 }, 586 "aui-collection": { 587 "use": [ 588 "aui-map", 589 "aui-set", 590 "aui-linkedset" 591 ] 592 }, 593 "aui-color-palette": { 594 "requires": [ 595 "array-extras", 596 "aui-palette", 597 "color-base", 598 "node-core", 599 "aui-widget-cssclass", 600 "aui-widget-toggle" 601 ], 602 "skinnable": true 603 }, 604 "aui-color-picker-base": { 605 "requires": [ 606 "aui-color-palette", 607 "aui-hsva-palette-modal", 608 "event-outside" 609 ], 610 "skinnable": true 611 }, 612 "aui-color-picker-base-deprecated": { 613 "requires": [ 614 "dd-drag", 615 "panel", 616 "slider", 617 "aui-button-item-deprecated", 618 "aui-color-util-deprecated", 619 "aui-form-base-deprecated", 620 "aui-overlay-context-deprecated" 621 ], 622 "skinnable": true 623 }, 624 "aui-color-picker-deprecated": { 625 "use": [ 626 "aui-color-picker-base-deprecated", 627 "aui-color-picker-grid-plugin-deprecated" 628 ] 629 }, 630 "aui-color-picker-grid-plugin-deprecated": { 631 "requires": [ 632 "plugin", 633 "aui-color-picker-base-deprecated" 634 ], 635 "skinnable": true 636 }, 637 "aui-color-picker-popover": { 638 "requires": [ 639 "aui-color-picker-base", 640 "aui-popover", 641 "aui-widget-cssclass", 642 "aui-widget-toggle" 643 ], 644 "skinnable": true 645 }, 646 "aui-color-util-deprecated": { 647 "requires": [] 648 }, 649 "aui-component": { 650 "requires": [ 651 "aui-classnamemanager", 652 "aui-widget-cssclass", 653 "aui-widget-toggle", 654 "base-build", 655 "widget-base" 656 ] 657 }, 658 "aui-css": { 659 "type": "css" 660 }, 661 "aui-data-editor": { 662 "requires": [ 663 "aui-classnamemanager", 664 "base-build", 665 "node-base" 666 ], 667 "skinnable": true 668 }, 669 "aui-data-set-deprecated": { 670 "requires": [ 671 "oop", 672 "collection", 673 "base" 674 ] 675 }, 676 "aui-datasource-control-base-deprecated": { 677 "requires": [ 678 "datasource", 679 "dataschema", 680 "aui-base-deprecated" 681 ] 682 }, 683 "aui-datasource-control-deprecated": { 684 "use": [ 685 "aui-datasource-control-base-deprecated", 686 "aui-input-text-control-deprecated" 687 ] 688 }, 689 "aui-datatable": { 690 "use": [ 691 "aui-datatable-edit", 692 "aui-datatable-highlight", 693 "aui-datatable-selection", 694 "aui-datatable-property-list" 695 ] 696 }, 697 "aui-datatable-base-cell-editor": { 698 "requires": [ 699 "datatable-base", 700 "overlay" 701 ], 702 "skinnable": true 703 }, 704 "aui-datatable-base-options-cell-editor": { 705 "requires": [ 706 "aui-datatable-base-cell-editor", 707 "escape" 708 ], 709 "skinnable": true 710 }, 711 "aui-datatable-body": { 712 "requires": [ 713 "aui-classnamemanager", 714 "datatable-base", 715 "event-key", 716 "aui-event-base" 717 ] 718 }, 719 "aui-datatable-cell-editor-support": { 720 "requires": [ 721 "datatable-base" 722 ] 723 }, 724 "aui-datatable-checkbox-cell-editor": { 725 "requires": [ 726 "aui-datatable-base-options-cell-editor" 727 ] 728 }, 729 "aui-datatable-core": { 730 "requires": [ 731 "aui-datatable-body", 732 "datatable-base", 733 "event-key", 734 "aui-event-base" 735 ], 736 "skinnable": true 737 }, 738 "aui-datatable-date-cell-editor": { 739 "requires": [ 740 "aui-datatable-base-options-cell-editor" 741 ] 742 }, 743 "aui-datatable-dropdown-cell-editor": { 744 "requires": [ 745 "aui-datatable-base-options-cell-editor" 746 ] 747 }, 748 "aui-datatable-edit": { 749 "use": [ 750 "datatable-base", 751 "calendar", 752 "overlay", 753 "sortable", 754 "aui-datatype", 755 "aui-toolbar", 756 "aui-form-validator", 757 "aui-datatable-base-cell-editor", 758 "aui-datatable-base-options-cell-editor", 759 "aui-datatable-cell-editor-support", 760 "aui-datatable-core", 761 "aui-datatable-checkbox-cell-editor", 762 "aui-datatable-date-cell-editor", 763 "aui-datatable-dropdown-cell-editor", 764 "aui-datatable-radio-cell-editor", 765 "aui-datatable-text-cell-editor", 766 "aui-datatable-text-area-cell-editor" 767 ] 768 }, 769 "aui-datatable-highlight": { 770 "requires": [ 771 "aui-datatable-selection" 772 ], 773 "skinnable": true 774 }, 775 "aui-datatable-property-list": { 776 "requires": [ 777 "datatable-scroll", 778 "datatable-sort", 779 "aui-datatable-core", 780 "aui-datatable-edit", 781 "aui-datatable-highlight", 782 "aui-datatable-selection", 783 "aui-widget-cssclass", 784 "aui-widget-toggle" 785 ], 786 "skinnable": true 787 }, 788 "aui-datatable-radio-cell-editor": { 789 "requires": [ 790 "aui-datatable-base-options-cell-editor" 791 ] 792 }, 793 "aui-datatable-selection": { 794 "requires": [ 795 "aui-datatable-core" 796 ], 797 "skinnable": true 798 }, 799 "aui-datatable-text-area-cell-editor": { 800 "requires": [ 801 "aui-datatable-base-options-cell-editor" 802 ] 803 }, 804 "aui-datatable-text-cell-editor": { 805 "requires": [ 806 "aui-datatable-base-options-cell-editor" 807 ] 808 }, 809 "aui-datatype": { 810 "requires": [ 811 "datatype", 812 "aui-datatype-date-parse" 813 ] 814 }, 815 "aui-datatype-date-parse": { 816 "requires": [ 817 "aui-base-lang", 818 "datatype-date-format", 819 "datatype-date-parse", 820 "intl" 821 ] 822 }, 823 "aui-datepicker": { 824 "requires": [ 825 "aui-aria", 826 "aui-datepicker-delegate", 827 "aui-datepicker-popover", 828 "base", 829 "base-build", 830 "calendar" 831 ], 832 "skinnable": true 833 }, 834 "aui-datepicker-base-deprecated": { 835 "requires": [ 836 "calendar", 837 "aui-datatype", 838 "aui-overlay-context-deprecated" 839 ], 840 "skinnable": true 841 }, 842 "aui-datepicker-delegate": { 843 "requires": [ 844 "aui-datatype-date-parse", 845 "aui-event-input", 846 "event-focus", 847 "node-event-delegate" 848 ] 849 }, 850 "aui-datepicker-deprecated": { 851 "skinnable": true, 852 "use": [ 853 "aui-datepicker-base-deprecated", 854 "aui-datepicker-select-deprecated" 855 ] 856 }, 857 "aui-datepicker-native": { 858 "requires": [ 859 "aui-datepicker-delegate", 860 "aui-node-base", 861 "base", 862 "base-build" 863 ] 864 }, 865 "aui-datepicker-popover": { 866 "requires": [ 867 "aui-classnamemanager", 868 "aui-popover" 869 ] 870 }, 871 "aui-datepicker-select-deprecated": { 872 "requires": [ 873 "aui-datepicker-base-deprecated", 874 "aui-button-item-deprecated" 875 ], 876 "skinnable": true 877 }, 878 "aui-debounce": {}, 879 "aui-delayed-task-deprecated": { 880 "requires": [ 881 "yui-base" 882 ] 883 }, 884 "aui-diagram-builder": { 885 "requires": [ 886 "aui-aria", 887 "aui-map", 888 "aui-property-builder",
889 "aui-diagram-builder-connector", 890 "aui-property-builder-settings", 891 "aui-diagram-node-condition", 892 "aui-diagram-node-end", 893 "aui-diagram-node-fork", 894 "aui-diagram-node-join", 895 "aui-diagram-node-start", 896 "aui-diagram-node-state", 897 "aui-diagram-node-task", 898 "overlay" 899 ], 900 "skinnable": true 901 }, 902 "aui-diagram-builder-connector": { 903 "requires": [ 904 "arraylist-add", 905 "arraylist-filter", 906 "escape", 907 "json", 908 "graphics", 909 "dd" 910 ], 911 "skinnable": true 912 }, 913 "aui-diagram-node": { 914 "requires": [ 915 "aui-aria", 916 "aui-diagram-node-manager-base", 917 "escape", 918 "overlay" 919 ] 920 }, 921 "aui-diagram-node-condition": { 922 "requires": [ 923 "aui-diagram-node-state" 924 ] 925 }, 926 "aui-diagram-node-end": { 927 "requires": [ 928 "aui-diagram-node-state" 929 ] 930 }, 931 "aui-diagram-node-fork": { 932 "requires": [ 933 "aui-diagram-node-state" 934 ] 935 }, 936 "aui-diagram-node-join": { 937 "requires": [ 938 "aui-diagram-node-state" 939 ] 940 }, 941 "aui-diagram-node-manager-base": { 942 "requires": [ 943 "base" 944 ] 945 }, 946 "aui-diagram-node-start": { 947 "requires": [ 948 "aui-diagram-node-state" 949 ] 950 }, 951 "aui-diagram-node-state": { 952 "requires": [ 953 "aui-diagram-node" 954 ] 955 }, 956 "aui-diagram-node-task": { 957 "requires": [ 958 "aui-diagram-node-state" 959 ] 960 }, 961 "aui-dialog-iframe-deprecated": { 962 "requires": [ 963 "plugin", 964 "array-invoke", 965 "aui-base-deprecated", 966 "aui-loading-mask-deprecated" 967 ], 968 "skinnable": true 969 }, 970 "aui-dropdown": { 971 "requires": [ 972 "event-delegate", 973 "event-key", 974 "event-outside", 975 "node-focusmanager", 976 "widget", 977 "widget-stack", 978 "aui-classnamemanager", 979 "aui-node", 980 "aui-widget-cssclass", 981 "aui-widget-toggle", 982 "aui-widget-trigger" 983 ], 984 "skinnable": true 985 }, 986 "aui-editable-deprecated": { 987 "requires": [ 988 "aui-base-deprecated", 989 "aui-form-combobox-deprecated", 990 "escape", 991 "event-resize" 992 ], 993 "skinnable": true 994 }, 995 "aui-event": { 996 "use": [ 997 "aui-event-base" 998 ] 999 }, 1000 "aui-event-base": { 1001 "requires": [ 1002 "event-base" 1003 ] 1004 }, 1005 "aui-event-delegate-change": { 1006 "condition": { 1007 "name": "aui-event-delegate-change", 1008 "trigger": "event-base-ie", 1009 "ua": "ie" 1010 }, 1011 "requires": [ 1012 "aui-event-base", 1013 "event-delegate", 1014 "event-synthetic" 1015 ] 1016 }, 1017 "aui-event-delegate-submit": { 1018 "condition": { 1019 "name": "aui-event-delegate-submit", 1020 "trigger": "event-base-ie", 1021 "ua": "ie" 1022 }, 1023 "requires": [ 1024 "aui-event-base", 1025 "event-delegate", 1026 "event-synthetic" 1027 ] 1028 }, 1029 "aui-event-input": { 1030 "condition": { 1031 "name": "aui-event-input", 1032 "test": function(A) { 1033 var supportsDOMEvent = A.supportsDOMEvent, 1034 testFeature = A.Features.test, 1035 addFeature = A.Features.add; 1036 1037 if (testFeature('event', 'input') === undefined) { 1038 addFeature('event', 'input', { 1039 test: function() { 1040 return supportsDOMEvent(document.createElement('textarea'), 'input') && (!A.UA.ie || A.UA.ie > 9); 1041 } 1042 }); 1043 } 1044 1045 return !testFeature('event', 'input'); 1046}, 1047 "trigger": "aui-event-base" 1048 }, 1049 "requires": [ 1050 "aui-event-base", 1051 "event-delegate", 1052 "event-synthetic", 1053 "timers" 1054 ] 1055 }, 1056 "aui-form-base-deprecated": { 1057 "requires": [ 1058 "io-form", 1059 "querystring-parse", 1060 "aui-base-deprecated", 1061 "aui-data-set-deprecated", 1062 "aui-form-field-deprecated" 1063 ] 1064 }, 1065 "aui-form-builder": { 1066 "requires": [ 1067 "aui-modal", 1068 "aui-layout",
1069 "aui-form-builder-field-list", 1070 "aui-form-builder-field-toolbar", 1071 "aui-form-builder-field-type", 1072 "aui-form-builder-field-types", 1073 "aui-form-builder-layout-builder", 1074 "aui-form-builder-page-manager", 1075 "aui-form-builder-settings-modal", 1076 "event-focus", 1077 "event-tap" 1078 ], 1079 "skinnable": true 1080 }, 1081 "aui-form-builder-available-field-deprecated": { 1082 "requires": [ 1083 "aui-property-builder-available-field" 1084 ] 1085 }, 1086 "aui-form-builder-deprecated": { 1087 "requires": [ 1088 "aui-button", 1089 "aui-collection", 1090 "aui-form-builder-available-field-deprecated", 1091 "aui-form-builder-field-deprecated", 1092 "aui-form-builder-field-button-deprecated", 1093 "aui-form-builder-field-checkbox-deprecated", 1094 "aui-form-builder-field-fieldset-deprecated", 1095 "aui-form-builder-field-file-upload-deprecated", 1096 "aui-form-builder-field-multiple-choice-deprecated", 1097 "aui-form-builder-field-radio-deprecated", 1098 "aui-form-builder-field-select-deprecated", 1099 "aui-form-builder-field-text-deprecated", 1100 "aui-form-builder-field-textarea-deprecated", 1101 "aui-property-builder", 1102 "aui-property-builder-settings", 1103 "aui-sortable-list", 1104 "aui-tabview", 1105 "aui-tooltip-base", 1106 "escape", 1107 "transition" 1108 ], 1109 "skinnable": true 1110 }, 1111 "aui-form-builder-field-base": { 1112 "requires": [ 1113 "aui-classnamemanager", 1114 "aui-node-base", 1115 "aui-text-data-editor", 1116 "aui-toggler", 1117 "base", 1118 "node-base" 1119 ], 1120 "skinnable": true 1121 }, 1122 "aui-form-builder-field-button-deprecated": { 1123 "requires": [ 1124 "aui-form-builder-field-deprecated" 1125 ] 1126 }, 1127 "aui-form-builder-field-checkbox-deprecated": { 1128 "requires": [ 1129 "aui-form-builder-field-deprecated" 1130 ] 1131 }, 1132 "aui-form-builder-field-choice": { 1133 "requires": [ 1134 "aui-boolean-data-editor", 1135 "aui-options-data-editor", 1136 "aui-tabs-data-editor", 1137 "aui-form-builder-field-base", 1138 "aui-form-field-choice" 1139 ] 1140 }, 1141 "aui-form-builder-field-deprecated": { 1142 "requires": [ 1143 "panel", 1144 "aui-datatype", 1145 "aui-datatable-edit", 1146 "aui-property-builder-field-support" 1147 ], 1148 "skinnable": true 1149 }, 1150 "aui-form-builder-field-fieldset-deprecated": { 1151 "requires": [ 1152 "aui-form-builder-field-deprecated" 1153 ] 1154 }, 1155 "aui-form-builder-field-file-upload-deprecated": { 1156 "requires": [ 1157 "aui-form-builder-field-deprecated" 1158 ] 1159 }, 1160 "aui-form-builder-field-list": { 1161 "requires": [ 1162 "aui-form-builder-field-type", 1163 "aui-form-builder-field-types", 1164 "aui-form-builder-layout-builder" 1165 ], 1166 "skinnable": true 1167 }, 1168 "aui-form-builder-field-multiple-choice-deprecated": { 1169 "requires": [ 1170 "aui-form-builder-field-deprecated" 1171 ] 1172 }, 1173 "aui-form-builder-field-radio-deprecated": { 1174 "requires": [ 1175 "aui-form-builder-field-deprecated" 1176 ] 1177 }, 1178 "aui-form-builder-field-select-deprecated": { 1179 "requires": [ 1180 "aui-form-builder-field-deprecated" 1181 ] 1182 }, 1183 "aui-form-builder-field-sentence": { 1184 "requires": [ 1185 "aui-form-builder-field-base", 1186 "aui-form-field" 1187 ] 1188 }, 1189 "aui-form-builder-field-text": { 1190 "requires": [ 1191 "aui-boolean-data-editor", 1192 "aui-radio-group-data-editor", 1193 "aui-form-builder-field-base", 1194 "aui-form-field-text" 1195 ] 1196 }, 1197 "aui-form-builder-field-text-deprecated": { 1198 "requires": [ 1199 "aui-form-builder-field-deprecated" 1200 ] 1201 },
1202 "aui-form-builder-field-textarea-deprecated": { 1203 "requires": [ 1204 "aui-form-builder-field-deprecated" 1205 ] 1206 }, 1207 "aui-form-builder-field-toolbar": { 1208 "requires": [ 1209 "aui-classnamemanager", 1210 "base", 1211 "node-base" 1212 ], 1213 "skinnable": true 1214 }, 1215 "aui-form-builder-field-type": { 1216 "requires": [ 1217 "base", 1218 "node-base" 1219 ], 1220 "skinnable": true 1221 }, 1222 "aui-form-builder-field-types": { 1223 "requires": [ 1224 "aui-classnamemanager", 1225 "aui-form-builder-field-types-modal", 1226 "base", 1227 "node-base" 1228 ], 1229 "skinnable": true 1230 }, 1231 "aui-form-builder-field-types-modal": { 1232 "requires": [ 1233 "aui-modal" 1234 ], 1235 "skinnable": true 1236 }, 1237 "aui-form-builder-layout-builder": { 1238 "requires": [ 1239 "aui-classnamemanager", 1240 "aui-layout-builder", 1241 "aui-modal", 1242 "base", 1243 "node-base" 1244 ], 1245 "skinnable": true 1246 }, 1247 "aui-form-builder-page-manager": { 1248 "requires": [ 1249 "aui-pagination", 1250 "aui-popover", 1251 "aui-tabview", 1252 "base", 1253 "event-valuechange", 1254 "node-base" 1255 ], 1256 "skinnable": true 1257 }, 1258 "aui-form-builder-settings-modal": { 1259 "requires": [ 1260 "aui-classnamemanager", 1261 "aui-modal", 1262 "base", 1263 "node-base" 1264 ], 1265 "skinnable": true 1266 }, 1267 "aui-form-combobox-deprecated": { 1268 "requires": [ 1269 "aui-form-textarea-deprecated", 1270 "aui-toolbar" 1271 ], 1272 "skinnable": true 1273 }, 1274 "aui-form-deprecated": { 1275 "use": [ 1276 "aui-form-base-deprecated", 1277 "aui-form-combobox-deprecated", 1278 "aui-form-field-deprecated", 1279 "aui-form-select-deprecated", 1280 "aui-form-textarea-deprecated", 1281 "aui-form-textfield-deprecated" 1282 ] 1283 }, 1284 "aui-form-field": { 1285 "requires": [ 1286 "aui-classnamemanager", 1287 "aui-node-base", 1288 "base-build" 1289 ], 1290 "skinnable": true 1291 }, 1292 "aui-form-field-choice": { 1293 "requires": [ 1294 "aui-form-field-required" 1295 ], 1296 "skinnable": true 1297 }, 1298 "aui-form-field-deprecated": { 1299 "requires": [ 1300 "aui-base-deprecated", 1301 "aui-component" 1302 ] 1303 }, 1304 "aui-form-field-required": { 1305 "requires": [ 1306 "aui-form-field" 1307 ] 1308 }, 1309 "aui-form-field-text": { 1310 "requires": [ 1311 "aui-form-field-required" 1312 ], 1313 "skinnable": true 1314 }, 1315 "aui-form-select-deprecated": { 1316 "requires": [ 1317 "aui-form-field-deprecated" 1318 ] 1319 }, 1320 "aui-form-textarea-deprecated": { 1321 "requires": [ 1322 "node-pluginhost", 1323 "aui-autosize-deprecated", 1324 "aui-form-textfield-deprecated" 1325 ] 1326 }, 1327 "aui-form-textfield-deprecated": { 1328 "requires": [ 1329 "aui-form-field-deprecated" 1330 ] 1331 }, 1332 "aui-form-validator": { 1333 "requires": [ 1334 "escape", 1335 "selector-css3", 1336 "node-event-delegate", 1337 "aui-node", 1338 "aui-component", 1339 "aui-event-input" 1340 ] 1341 }, 1342 "aui-hsv-palette": { 1343 "requires": [ 1344 "aui-classnamemanager", 1345 "aui-widget-cssclass", 1346 "aui-widget-toggle", 1347 "aui-event-input", 1348 "base-build", 1349 "clickable-rail", 1350 "color-hsv", 1351 "dd-constrain", 1352 "slider", 1353 "widget" 1354 ], 1355 "skinnable": true 1356 }, 1357 "aui-hsva-palette": { 1358 "requires": [ 1359 "aui-hsv-palette" 1360 ], 1361 "skinnable": true 1362 }, 1363 "aui-hsva-palette-modal": { 1364 "requires": [ 1365 "aui-hsva-palette", 1366 "aui-modal" 1367 ], 1368 "skinnable": true 1369 }, 1370 "aui-image-cropper": { 1371 "requires": [ 1372 "resize-base", 1373 "resize-constrain", 1374 "dd-constrain", 1375 "aui-node-base", 1376 "aui-component" 1377 ], 1378 "skinnable": true 1379 }, 1380 "aui-image-viewer": { 1381 "requires": [ 1382 "widget", 1383 "widget-modality", 1384 "widget-position", 1385 "widget-position-align", 1386 "widget-position-constrain", 1387 "widget-stack", 1388 "widget-stdmod", 1389 "aui-event", 1390 "aui-image-viewer-base", 1391 "aui-image-viewer-multiple", 1392 "aui-image-viewer-slideshow", 1393 "aui-node-base", 1394 "aui-widget-cssclass", 1395 "aui-widget-toggle" 1396 ], 1397 "skinnable": true 1398 }, 1399 "aui-image-viewer-base": { 1400 "requires": [ 1401 "anim", 1402 "aui-aria", 1403 "aui-classnamemanager", 1404 "aui-node", 1405 "aui-widget-responsive", 1406 "base-build", 1407 "imageloader", 1408 "node-base", 1409 "widget", 1410 "widget-stack" 1411 ], 1412 "skinnable": true 1413 }, 1414 "aui-image-viewer-media": { 1415 "requires": [ 1416 "plugin", 1417 "aui-component", 1418 "aui-image-viewer" 1419 ] 1420 }, 1421 "aui-image-viewer-multiple": { 1422 "requires": [ 1423 "base-build", 1424 "node-base", 1425 "aui-classnamemanager", 1426 "aui-image-viewer-base" 1427 ], 1428 "skinnable": true 1429 }, 1430 "aui-image-viewer-multiple-swipe": { 1431 "condition": { 1432 "name": "aui-image-viewer-multiple-swipe", 1433 "trigger": "aui-image-viewer-multiple", 1434 "ua": "touchEnabled" 1435 }, 1436 "requires": [ 1437 "aui-image-viewer-multiple",
1438 "aui-image-viewer-swipe" 1439 ] 1440 }, 1441 "aui-image-viewer-slideshow": { 1442 "requires": [ 1443 "node", 1444 "aui-classnamemanager" 1445 ] 1446 }, 1447 "aui-image-viewer-swipe": { 1448 "condition": { 1449 "name": "aui-image-viewer-swipe", 1450 "trigger": "aui-image-viewer-base", 1451 "ua": "touchEnabled" 1452 }, 1453 "requires": [ 1454 "event-resize", 1455 "aui-image-viewer-base", 1456 "aui-widget-swipe" 1457 ] 1458 }, 1459 "aui-input-text-control-deprecated": { 1460 "requires": [ 1461 "aui-base-deprecated", 1462 "aui-datasource-control-base-deprecated", 1463 "aui-form-combobox-deprecated" 1464 ] 1465 }, 1466 "aui-io": { 1467 "use": [ 1468 "aui-io-request" 1469 ] 1470 }, 1471 "aui-io-deprecated": { 1472 "use": [ 1473 "aui-io-request", 1474 "aui-io-plugin-deprecated" 1475 ] 1476 }, 1477 "aui-io-plugin-deprecated": { 1478 "requires": [ 1479 "aui-overlay-base-deprecated", 1480 "aui-parse-content", 1481 "aui-io-request", 1482 "aui-loading-mask-deprecated" 1483 ] 1484 }, 1485 "aui-io-request": { 1486 "requires": [ 1487 "io-base", 1488 "json", 1489 "plugin", 1490 "querystring-stringify", 1491 "aui-component" 1492 ] 1493 }, 1494 "aui-io-request-deprecated": { 1495 "requires": [ 1496 "io-base", 1497 "json", 1498 "plugin", 1499 "querystring-stringify", 1500 "aui-base-deprecated" 1501 ] 1502 }, 1503 "aui-layout": { 1504 "requires": [ 1505 "aui-layout-col", 1506 "aui-layout-row", 1507 "aui-node-base", 1508 "base-build", 1509 "datatype-number-parse", 1510 "event-resize" 1511 ] 1512 }, 1513 "aui-layout-builder": { 1514 "requires": [ 1515 "aui-classnamemanager", 1516 "aui-layout", 1517 "aui-layout-builder-add-col", 1518 "aui-layout-builder-add-row", 1519 "aui-layout-builder-move", 1520 "aui-layout-builder-remove-row", 1521 "aui-layout-builder-resize-col", 1522 "aui-node-base", 1523 "base-build", 1524 "node-event-delegate", 1525 "node-screen", 1526 "node-style" 1527 ] 1528 }, 1529 "aui-layout-builder-add-col": { 1530 "requires": [ 1531 "event-key", 1532 "node-base" 1533 ], 1534 "skinnable": true 1535 }, 1536 "aui-layout-builder-add-row": { 1537 "requires": [ 1538 "aui-node-base", 1539 "base-build", 1540 "node-scroll-info" 1541 ], 1542 "skinnable": true 1543 }, 1544 "aui-layout-builder-move": { 1545 "requires": [ 1546 "aui-node-base", 1547 "base-build" 1548 ], 1549 "skinnable": true 1550 }, 1551 "aui-layout-builder-remove-row": { 1552 "requires": [ 1553 "aui-node-base", 1554 "base-build" 1555 ], 1556 "skinnable": true 1557 }, 1558 "aui-layout-builder-resize-col": { 1559 "requires": [ 1560 "dd-constrain", 1561 "dd-delegate", 1562 "dd-drop-plugin", 1563 "dd-proxy", 1564 "event-mouseenter", 1565 "node-base" 1566 ], 1567 "skinnable": true 1568 }, 1569 "aui-layout-col": { 1570 "requires": [ 1571 "aui-classnamemanager", 1572 "aui-node-base", 1573 "base-build" 1574 ], 1575 "skinnable": true 1576 }, 1577 "aui-layout-row": { 1578 "requires": [ 1579 "array-invoke", 1580 "aui-node-base", 1581 "base-build" 1582 ], 1583 "skinnable": true 1584 }, 1585 "aui-linkedset": { 1586 "requires": [ 1587 "aui-set" 1588 ] 1589 }, 1590 "aui-live-search-deprecated": { 1591 "requires": [ 1592 "aui-base-deprecated" 1593 ] 1594 }, 1595 "aui-loading-mask-deprecated": { 1596 "requires": [ 1597 "plugin", 1598 "aui-overlay-mask-deprecated" 1599 ], 1600 "skinnable": true 1601 }, 1602 "aui-map": { 1603 "requires": [ 1604 "base-build" 1605 ] 1606 }, 1607 "aui-menu": { 1608 "requires": [ 1609 "base-build", 1610 "event-mouseenter", 1611 "event-resize", 1612 "widget", 1613 "widget-position", 1614 "widget-position-align", 1615 "widget-position-constrain", 1616 "widget-stack", 1617 "aui-classnamemanager", 1618 "aui-debounce", 1619 "aui-dropdown", 1620 "aui-menu-item" 1621 ], 1622 "skinnable": true 1623 }, 1624 "aui-menu-item": { 1625 "requires": [ 1626 "base-build", 1627 "node-base", 1628 "aui-classnamemanager", 1629 "aui-node", 1630 "aui-widget-shortcut" 1631 ] 1632 }, 1633 "aui-messaging": { 1634 "requires": [ 1635 "querystring", 1636 "aui-timer" 1637 ] 1638 }, 1639 "aui-modal": { 1640 "requires": [ 1641 "widget", 1642 "widget-autohide", 1643 "widget-buttons", 1644 "widget-modality", 1645 "widget-position", 1646 "widget-position-align", 1647 "widget-position-constrain", 1648 "widget-stack", 1649 "widget-stdmod", 1650 "dd-plugin", 1651 "dd-constrain", 1652 "timers", 1653 "aui-classnamemanager", 1654 "aui-widget-cssclass", 1655 "aui-widget-toggle", 1656 "aui-widget-toolbars" 1657 ], 1658 "skinnable": true 1659 }, 1660 "aui-modal-resize": { 1661 "condition": { 1662 "name": "aui-modal-resize", 1663 "test": function(A) { 1664 return !A.UA.mobile; 1665}, 1666 "trigger": "aui-modal" 1667 }, 1668 "requires": [ 1669 "aui-modal", 1670 "resize-plugin" 1671 ] 1672 }, 1673 "aui-node": { 1674 "use": [ 1675 "aui-node-base" 1676 ] 1677 }, 1678 "aui-node-accessible": { 1679 "requires": [ 1680 "aui-node-base", 1681 "event-custom-base" 1682 ] 1683 }, 1684 "aui-node-base": { 1685 "requires": [ 1686 "array-extras", 1687 "aui-base-lang", 1688 "aui-classnamemanager", 1689 "aui-debounce", 1690 "node" 1691 ] 1692 }, 1693 "aui-node-html5": { 1694 "condition": { 1695 "name": "aui-node-html5", 1696 "trigger": "aui-node", 1697 "ua": "ie" 1698 }, 1699 "requires": [ 1700 "collection", 1701 "aui-node-base" 1702 ] 1703 }, 1704 "aui-options-data-editor": { 1705 "requires": [ 1706 "aui-data-editor", 1707 "dd-constrain", 1708 "dd-delegate", 1709 "dd-drop-plugin", 1710 "dd-proxy", 1711 "event-valuechange", 1712 "node-event-delegate" 1713 ], 1714 "skinnable": true 1715 }, 1716 "aui-overlay-base-deprecated": { 1717 "requires": [ 1718 "widget-position", 1719 "widget-stack", 1720 "widget-position-align", 1721 "widget-position-constrain", 1722 "widget-stdmod", 1723 "aui-component" 1724 ] 1725 }, 1726 "aui-overlay-context-deprecated": { 1727 "requires": [ 1728 "aui-overlay-manager-deprecated", 1729 "aui-delayed-task-deprecated", 1730 "aui-aria" 1731 ] 1732 }, 1733 "aui-overlay-context-panel-deprecated": { 1734 "requires": [ 1735 "anim", 1736 "aui-overlay-context-deprecated" 1737 ], 1738 "skinnable": true 1739 }, 1740 "aui-overlay-deprecated": { 1741 "use": [ 1742 "aui-overlay-base-deprecated", 1743 "aui-overlay-context-deprecated", 1744 "aui-overlay-context-panel-deprecated", 1745 "aui-overlay-manager-deprecated", 1746 "aui-overlay-mask-deprecated" 1747 ] 1748 }, 1749 "aui-overlay-manager-deprecated": { 1750 "requires": [ 1751 "overlay", 1752 "plugin", 1753 "aui-base-deprecated", 1754 "aui-overlay-base-deprecated" 1755 ] 1756 }, 1757 "aui-overlay-mask-deprecated": { 1758 "requires": [ 1759 "event-resize", 1760 "aui-base-deprecated", 1761 "aui-overlay-base-deprecated" 1762 ], 1763 "skinnable": true 1764 }, 1765 "aui-pagination": { 1766 "requires": [ 1767 "node-event-delegate", 1768 "aui-node", 1769 "aui-component", 1770 "widget-htmlparser" 1771 ], 1772 "skinnable": true 1773 }, 1774 "aui-palette": { 1775 "requires": [ 1776 "base-build", 1777 "event-hover", 1778 "widget", 1779 "aui-classnamemanager", 1780 "aui-base", 1781 "aui-widget-cssclass", 1782 "aui-widget-toggle" 1783 ], 1784 "skinnable": true 1785 }, 1786 "aui-parse-content": { 1787 "requires": [ 1788 "async-queue", 1789 "plugin", 1790 "io-base", 1791 "aui-component", 1792 "aui-node-base" 1793 ] 1794 }, 1795 "aui-popover": { 1796 "requires": [ 1797 "event-resize", 1798 "widget", 1799 "widget-autohide", 1800 "widget-buttons", 1801 "widget-modality", 1802 "widget-position", 1803 "widget-position-align", 1804 "widget-position-constrain", 1805 "widget-stack", 1806 "widget-stdmod", 1807 "aui-classnamemanager", 1808 "aui-widget-cssclass", 1809 "aui-widget-toggle", 1810 "aui-widget-toolbars", 1811 "aui-widget-transition", 1812 "aui-widget-trigger", 1813 "aui-widget-position-align-suggestion", 1814 "aui-component", 1815 "aui-node-base" 1816 ], 1817 "skinnable": true 1818 }, 1819 "aui-progressbar": { 1820 "requires": [ 1821 "aui-node", 1822 "aui-component", 1823 "aui-aria" 1824 ], 1825 "skinnable": true 1826 }, 1827 "aui-promise": { 1828 "requires": [ 1829 "array-invoke", 1830 "promise", 1831 "oop" 1832 ] 1833 }, 1834 "aui-property-builder": { 1835 "requires": [ 1836 "dd", 1837 "collection", 1838 "aui-property-builder-available-field", 1839 "aui-property-builder-field-support", 1840 "aui-property-builder-settings", 1841 "aui-tabview" 1842 ], 1843 "skinnable": true 1844 }, 1845 "aui-property-builder-available-field": { 1846 "requires": [ 1847 "base", 1848 "aui-component", 1849 "aui-node" 1850 ] 1851 }, 1852 "aui-property-builder-field-support": {}, 1853 "aui-property-builder-settings": { 1854 "requires": [ 1855 "aui-tabview", 1856 "aui-datatable-property-list" 1857 ] 1858 }, 1859 "aui-radio-group-data-editor": { 1860 "requires": [ 1861 "aui-data-editor", 1862 "node-event-delegate" 1863 ], 1864 "skinnable": true 1865 }, 1866 "aui-rating": { 1867 "use": [ 1868 "aui-rating-base", 1869 "aui-rating-thumb" 1870 ] 1871 }, 1872 "aui-rating-base": { 1873 "requires": [ 1874 "aui-component", 1875 "aui-node-base", 1876 "widget-htmlparser", 1877 "widget-uievents" 1878 ], 1879 "skinnable": true 1880 }, 1881 "aui-rating-thumb": { 1882 "requires": [ 1883 "aui-rating-base" 1884 ] 1885 }, 1886 "aui-resize-base-deprecated": { 1887 "requires": [ 1888 "dd-drag", 1889 "dd-delegate", 1890 "dd-drop", 1891 "aui-base-deprecated" 1892 ], 1893 "skinnable": true 1894 }, 1895 "aui-resize-constrain-deprecated": { 1896 "requires": [ 1897 "dd-constrain", 1898 "plugin", 1899 "aui-resize-base-deprecated" 1900 ] 1901 }, 1902 "aui-resize-deprecated": { 1903 "skinnable": true, 1904 "use": [ 1905 "aui-resize-base-deprecated", 1906 "aui-resize-constrain-deprecated" 1907 ] 1908 }, 1909 "aui-scale-data-editor": { 1910 "requires": [ 1911 "aui-classnamemanager", 1912 "aui-data-editor", 1913 "event-valuechange" 1914 ] 1915 }, 1916 "aui-scheduler": { 1917 "use": [ 1918 "event-gestures", 1919 "aui-scheduler-base", 1920 "aui-scheduler-event-recorder", 1921 "aui-scheduler-view-agenda", 1922 "aui-scheduler-view-day", 1923 "aui-scheduler-view-month", 1924 "aui-scheduler-view-table-dd", 1925 "aui-scheduler-view-table", 1926 "aui-scheduler-view-week", 1927 "aui-viewport" 1928 ] 1929 }, 1930 "aui-scheduler-base": { 1931 "requires": [ 1932 "model", 1933 "model-list", 1934 "widget-stdmod", 1935 "color-hsl", 1936 "aui-event-base", 1937 "aui-node-base", 1938 "aui-component", 1939 "aui-datatype", 1940 "aui-button", 1941 "node-focusmanager" 1942 ], 1943 "skinnable": true 1944 }, 1945 "aui-scheduler-event-recorder": { 1946 "requires": [ 1947 "querystring", 1948 "io-form", 1949 "overlay", 1950 "aui-scheduler-base", 1951 "aui-popover" 1952 ], 1953 "skinnable": true 1954 }, 1955 "aui-scheduler-touch": { 1956 "condition": { 1957 "name": "aui-scheduler-touch", 1958 "trigger": "aui-scheduler", 1959 "ua": "touchEnabled" 1960 }, 1961 "requires": [ 1962 "base-build", 1963 "aui-scheduler" 1964 ], 1965 "skinnable": true 1966 }, 1967 "aui-scheduler-view-agenda": { 1968 "requires": [ 1969 "aui-scheduler-base" 1970 ], 1971 "skinnable": true 1972 }, 1973 "aui-scheduler-view-day": { 1974 "requires": [ 1975 "dd-drag", 1976 "dd-delegate", 1977 "dd-drop", 1978 "dd-constrain", 1979 "aui-scheduler-view-table" 1980 ], 1981 "skinnable": true 1982 }, 1983 "aui-scheduler-view-month": { 1984 "requires": [ 1985 "aui-scheduler-view-table" 1986 ], 1987 "skinnable": true 1988 }, 1989 "aui-scheduler-view-table": { 1990 "requires": [ 1991 "overlay", 1992 "aui-scheduler-base" 1993 ], 1994 "skinnable": true 1995 }, 1996 "aui-scheduler-view-table-dd": { 1997 "requires": [ 1998 "dd-drag", 1999 "dd-delegate", 2000 "dd-drop", 2001 "aui-scheduler-view-table" 2002 ] 2003 }, 2004 "aui-scheduler-view-week": { 2005 "requires": [ 2006 "aui-scheduler-view-day" 2007 ], 2008 "skinnable": true 2009 }, 2010 "aui-scroller-deprecated": { 2011 "requires": [ 2012 "event-mouseenter", 2013 "aui-base-deprecated", 2014 "aui-simple-anim-deprecated" 2015 ], 2016 "skinnable": true 2017 }, 2018 "aui-scrollspy": { 2019 "requires": [ 2020 "base-build", 2021 "node-screen", 2022 "aui-classnamemanager" 2023 ] 2024 }, 2025 "aui-search": { 2026 "use": [ 2027 "aui-search-tst" 2028 ] 2029 }, 2030 "aui-search-tst": { 2031 "requires": [ 2032 "aui-component" 2033 ] 2034 }, 2035 "aui-selector": { 2036 "requires": [ 2037 "selector-css3", 2038 "aui-classnamemanager" 2039 ] 2040 }, 2041 "aui-set": { 2042 "requires": [ 2043 "aui-map" 2044 ] 2045 }, 2046 "aui-simple-anim-deprecated": { 2047 "requires": [ 2048 "aui-base-deprecated" 2049 ] 2050 }, 2051 "aui-skin-deprecated": { 2052 "type": "css" 2053 }, 2054 "aui-sortable": { 2055 "use": [ 2056 "aui-sortable-layout", 2057 "aui-sortable-list" 2058 ] 2059 }, 2060 "aui-sortable-layout": { 2061 "requires": [ 2062 "dd-delegate", 2063 "dd-drag", 2064 "dd-drop", 2065 "dd-proxy", 2066 "aui-node", 2067 "aui-component" 2068 ], 2069 "skinnable": true 2070 }, 2071 "aui-sortable-list": { 2072 "requires": [ 2073 "dd-drag", 2074 "dd-drop", 2075 "dd-proxy", 2076 "dd-scroll", 2077 "aui-node", 2078 "aui-component" 2079 ] 2080 }, 2081 "aui-state-interaction-deprecated": { 2082 "requires": [ 2083 "aui-base-deprecated", 2084 "plugin" 2085 ] 2086 }, 2087 "aui-surface": { 2088 "use": [ 2089 "aui-surface-app", 2090 "aui-surface-screen" 2091 ] 2092 }, 2093 "aui-surface-app": { 2094 "requires": [ 2095 "event-delegate", 2096 "node-event-html5", 2097 "aui-surface-base", 2098 "aui-surface-screen", 2099 "aui-surface-screen-route" 2100 ] 2101 }, 2102 "aui-surface-base": { 2103 "requires": [ 2104 "base-build", 2105 "node-style", 2106 "timers", 2107 "aui-debounce", 2108 "aui-promise", 2109 "aui-parse-content" 2110 ] 2111 }, 2112 "aui-surface-screen": { 2113 "requires": [ 2114 "base-build" 2115 ] 2116 }, 2117 "aui-surface-screen-html": { 2118 "requires": [ 2119 "aui-base", 2120 "aui-io-request", 2121 "aui-promise", 2122
2122 "aui-surface-screen", 2123 "aui-url" 2124 ] 2125 }, 2126 "aui-surface-screen-route": { 2127 "requires": [ 2128 "base-build" 2129 ] 2130 }, 2131 "aui-swf-deprecated": { 2132 "requires": [ 2133 "querystring-parse-simple", 2134 "querystring-stringify-simple", 2135 "aui-base-deprecated" 2136 ] 2137 }, 2138 "aui-tabs-data-editor": { 2139 "requires": [ 2140 "aui-data-editor", 2141 "aui-tabview" 2142 ] 2143 }, 2144 "aui-tabview": { 2145 "requires": [ 2146 "selector-css3", 2147 "tabview", 2148 "aui-component", 2149 "aui-widget-css" 2150 ], 2151 "skinnable": true 2152 }, 2153 "aui-template-deprecated": { 2154 "requires": [ 2155 "aui-base-deprecated" 2156 ] 2157 }, 2158 "aui-text-data-editor": { 2159 "requires": [ 2160 "aui-data-editor", 2161 "event-valuechange" 2162 ], 2163 "skinnable": true 2164 }, 2165 "aui-text-data-unicode": { 2166 "requires": [ 2167 "text" 2168 ] 2169 }, 2170 "aui-text-unicode": { 2171 "requires": [ 2172 "aui-text-data-unicode" 2173 ] 2174 }, 2175 "aui-textboxlist-deprecated": { 2176 "requires": [ 2177 "anim-node-plugin", 2178 "aui-autocomplete-deprecated", 2179 "aui-button-item-deprecated", 2180 "aui-data-set-deprecated", 2181 "escape", 2182 "node-focusmanager" 2183 ], 2184 "skinnable": true 2185 }, 2186 "aui-timepicker": { 2187 "requires": [ 2188 "autocomplete", 2189 "aui-datepicker-delegate", 2190 "aui-datepicker-popover" 2191 ], 2192 "skinnable": true 2193 }, 2194 "aui-timepicker-native": { 2195 "requires": [ 2196 "base", 2197 "base-build", 2198 "aui-node-base", 2199 "aui-datepicker-delegate", 2200 "aui-datepicker-native" 2201 ] 2202 }, 2203 "aui-timer": { 2204 "requires": [ 2205 "oop" 2206 ] 2207 }, 2208 "aui-toggler": { 2209 "use": [ 2210 "aui-toggler-base", 2211 "aui-toggler-delegate" 2212 ] 2213 }, 2214 "aui-toggler-accessibility": { 2215 "requires": [ 2216 "aui-toggler-base" 2217 ] 2218 }, 2219 "aui-toggler-base": { 2220 "requires": [ 2221 "transition", 2222 "aui-selector", 2223 "aui-event-base", 2224 "aui-node", 2225 "aui-component", 2226 "event-tap" 2227 ], 2228 "skinnable": true 2229 }, 2230 "aui-toggler-delegate": { 2231 "requires": [ 2232 "array-invoke", 2233 "node-event-delegate", 2234 "aui-toggler-base" 2235 ] 2236 }, 2237 "aui-toolbar": { 2238 "requires": [ 2239 "arraylist", 2240 "arraylist-add", 2241 "aui-component", 2242 "aui-button-core" 2243 ] 2244 }, 2245 "aui-tooltip": { 2246 "use": [ 2247 "aui-tooltip-base", 2248 "aui-tooltip-delegate" 2249 ] 2250 }, 2251 "aui-tooltip-base": { 2252 "requires": [ 2253 "aui-aria", 2254 "aui-classnamemanager", 2255 "aui-component", 2256 "aui-debounce", 2257 "aui-node-base", 2258 "aui-widget-cssclass", 2259 "aui-widget-toggle", 2260 "aui-widget-transition", 2261 "aui-widget-trigger", 2262 "aui-widget-position-align-suggestion", 2263 "event-hover", 2264 "event-resize", 2265 "escape", 2266 "widget", 2267 "widget-autohide", 2268 "widget-position", 2269 "widget-position-align", 2270 "widget-position-constrain", 2271 "widget-stack", 2272 "widget-stdmod" 2273 ], 2274 "skinnable": true 2275 }, 2276 "aui-tooltip-delegate": { 2277 "requires": [ 2278 "aui-tooltip-base", 2279 "node-event-delegate" 2280 ] 2281 }, 2282 "aui-tooltip-deprecated": { 2283 "requires": [ 2284 "aui-overlay-context-panel-deprecated" 2285 ], 2286 "skinnable": true 2287 }, 2288 "aui-tpl-snippets-base-deprecated": { 2289 "requires": [ 2290 "aui-template-deprecated" 2291 ] 2292 }, 2293 "aui-tpl-snippets-checkbox-deprecated": { 2294 "requires": [ 2295 "aui-tpl-snippets-base-deprecated" 2296 ] 2297 }, 2298 "aui-tpl-snippets-deprecated": { 2299 "use": [ 2300 "aui-tpl-snippets-base-deprecated", 2301 "aui-tpl-snippets-checkbox-deprecated", 2302 "aui-tpl-snippets-input-deprecated", 2303 "aui-tpl-snippets-select-deprecated", 2304 "aui-tpl-snippets-textarea-deprecated" 2305 ] 2306 }, 2307 "aui-tpl-snippets-input-deprecated": { 2308 "requires": [ 2309 "aui-tpl-snippets-base-deprecated" 2310 ] 2311 }, 2312 "aui-tpl-snippets-select-deprecated": { 2313 "requires": [ 2314 "aui-tpl-snippets-base-deprecated" 2315 ] 2316 }, 2317 "aui-tpl-snippets-textarea-deprecated": { 2318 "requires": [ 2319 "aui-tpl-snippets-base-deprecated" 2320 ] 2321 }, 2322 "aui-tree": { 2323 "use": [ 2324 "aui-tree-data", 2325 "aui-tree-io", 2326 "aui-tree-node", 2327 "aui-tree-paginator", 2328 "aui-tree-view" 2329 ] 2330 }, 2331 "aui-tree-data": { 2332 "requires": [ 2333 "aui-base-core", 2334 "aui-base-lang", 2335 "aui-node-base", 2336 "aui-timer", 2337 "aui-component" 2338 ] 2339 }, 2340 "aui-tree-io": { 2341 "requires": [ 2342 "aui-component", 2343 "aui-io" 2344 ] 2345 }, 2346 "aui-tree-node": { 2347 "requires": [ 2348 "json", 2349 "querystring-stringify", 2350 "aui-tree-data", 2351 "aui-tree-io", 2352 "aui-tree-paginator", 2353 "event-key" 2354 ] 2355 }, 2356 "aui-tree-paginator": { 2357 "requires": [ 2358 "yui-base" 2359 ] 2360 }, 2361 "aui-tree-view": { 2362 "requires": [ 2363 "dd-delegate", 2364 "dd-proxy", 2365 "widget", 2366 "aui-tree-node", 2367 "aui-tree-paginator", 2368 "aui-tree-io" 2369 ], 2370 "skinnable": true 2371 }, 2372 "aui-undo-redo": { 2373 "requires": [ 2374 "aui-base", 2375 "base", 2376 "base-build", 2377 "event-key", 2378 "promise" 2379 ] 2380 }, 2381 "aui-url": { 2382 "requires": [ 2383 "oop", 2384 "querystring-parse", 2385 "querystring-stringify" 2386 ] 2387 }, 2388 "aui-video": { 2389 "requires": [ 2390 "event-resize", 2391 "node-event-html5", 2392 "querystring-stringify-simple", 2393 "aui-aria", 2394 "aui-node", 2395 "aui-component", 2396 "aui-debounce" 2397 ], 2398 "skinnable": true 2399 }, 2400 "aui-viewport": { 2401 "requires": [ 2402 "aui-node", 2403 "aui-component" 2404 ] 2405 }, 2406 "aui-widget": { 2407 "use": [ 2408 "aui-widget-cssclass", 2409 "aui-widget-toolbars" 2410 ] 2411 }, 2412 "aui-widget-core": { 2413 "use": [ 2414 "aui-widget-cssclass" 2415 ] 2416 }, 2417 "aui-widget-cssclass": { 2418 "requires": [ 2419 "widget-base" 2420 ] 2421 }, 2422 "aui-widget-position-align-suggestion": { 2423 "requires": [ 2424 "widget-position-align", 2425 "widget-stdmod" 2426 ] 2427 }, 2428 "aui-widget-responsive": { 2429 "requires": [ 2430 "event-resize", 2431 "widget-base" 2432 ] 2433 }, 2434 "aui-widget-shortcut": { 2435 "requires": [ 2436 "base" 2437 ] 2438 }, 2439 "aui-widget-swipe": { 2440 "requires": [ 2441 "classnamemanager", 2442 "scrollview-base", 2443 "scrollview-paginator", 2444 "timers" 2445 ] 2446 }, 2447 "aui-widget-toggle": {}, 2448 "aui-widget-toolbars": { 2449 "requires": [ 2450 "widget-stdmod", 2451 "aui-toolbar" 2452 ] 2453 }, 2454 "aui-widget-transition": { 2455 "requires": [ 2456 "transition" 2457 ] 2458 }, 2459 "aui-widget-trigger": { 2460 "requires": [ 2461 "node" 2462 ] 2463 } 2464}); 2465YUI.Env[Y.version].md5 = 'd7c627eb00edd6b6f054d8f6e7147480'; 2466/* 2467 * Alloy JavaScript Library 2468 * http://alloy.liferay.com/ 2469 * 2470 * Copyright (c) 2010 Liferay Inc. 2471 * http://alloy.liferay.com/LICENSE.txt 2472 * 2473 * Nate Cavanaugh ([email protected]) 2474 * Eduardo Lundgren ([email protected]) 2475 * 2476 * Attribution/Third-party licenses 2477 * http://alloy.liferay.com/ATTRIBUTION.txt 2478 */ 2479 2480// Simple version of 2481// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ 2482 2483A.UA.edge = (function() { 2484 var edgeVersion = A.UA.userAgent.match(/Edge\/(.[0-9.]+)/); 2485 2486 if (edgeVersion) { 2487 return edgeVersion[1]; 2488 } 2489 2490 return 0; 2491})(); 2492 2493A.supportsDOMEvent = function(domNode, eventName) { 2494 eventName = 'on' + eventName; 2495 2496 if (!(eventName in domNode)) { 2497 if (!domNode.setAttribute) { 2498 domNode = A.config.doc.createElement('div'); 2499 } 2500 2501 if (domNode.setAttribute) { 2502 domNode.setAttribute(eventName, ''); 2503 return (typeof domNode[eventName] === 'function'); 2504 } 2505 } 2506 2507 domNode = null; 2508 2509 return true; 2510}; 2511(function() { 2512 var slice = Array.prototype.slice; 2513 2514 YUI.prototype.ready = function() { 2515 var instance = this, 2516 xargs = arguments, 2517 index = xargs.length - 1, 2518 modules = slice.call(arguments, 0, index); 2519 2520 modules.unshift('event-base'); 2521 modules.push(function(instance) { 2522 var args = arguments; 2523 2524 instance.on('domready', function() { 2525 xargs[index].apply(this, args); 2526 }); 2527 }); 2528 instance.use.apply(instance, modules); 2529 }; 2530}()); 2531 2532 2533}, '3.1.0-deprecated.95'); 2534 2535YUI.add('aui-base-lang', function (A, NAME) { 2536 2537(function() { 2538 var Lang = A.Lang, 2539 aArray = A.Array, 2540 AObject = A.Object, 2541 2542 isArray = Lang.isArray, 2543 isNumber = Lang.isNumber, 2544 isString = Lang.isString, 2545 isUndefined = Lang.isUndefined, 2546 2547 owns = AObject.owns; 2548
2549 A.fn = function(fn, context, args) { 2550 var wrappedFn, 2551 dynamicLookup; 2552 2553 // Explicitly set function arguments 2554 if (!isNumber(fn)) { 2555 var xargs = arguments; 2556 2557 if (xargs.length > 2) { 2558 xargs = aArray(xargs, 2, true); 2559 } 2560 2561 dynamicLookup = (isString(fn) && context); 2562 2563 wrappedFn = function() { 2564 var method = (!dynamicLookup) ? fn : context[fn]; 2565 2566 return method.apply(context || fn, xargs); 2567 }; 2568 } 2569 else { 2570 // Set function arity 2571 var argLength = fn; 2572 2573 fn = context; 2574 context = args; 2575 dynamicLookup = (isString(fn) && context); 2576 2577 wrappedFn = function() { 2578 var method = (!dynamicLookup) ? fn : context[fn], 2579 returnValue; 2580 2581 context = context || method; 2582 2583 if (argLength > 0) { 2584 returnValue = method.apply(context, aArray(arguments, 0, true).slice(0, argLength)); 2585 } 2586 else { 2587 returnValue = method.call(context); 2588 } 2589 2590 return returnValue; 2591 }; 2592 } 2593 2594 return wrappedFn; 2595 }; 2596 2597 A.mix(Lang, { 2598 constrain: function(num, min, max) { 2599 return Math.min(Math.max(num, min), max); 2600 }, 2601 2602 emptyFn: function() {}, 2603 2604 emptyFnFalse: function() { 2605 return false; 2606 }, 2607 2608 emptyFnTrue: function() { 2609 return true; 2610 }, 2611 2612 isGuid: function(id) { 2613 return String(id).indexOf(A.Env._guidp) === 0; 2614 }, 2615 2616 isInteger: function(val) { 2617 return typeof val === 'number' && 2618 isFinite(val) && 2619 val > -9007199254740992 && 2620 val < 9007199254740992 && 2621 Math.floor(val) === val; 2622 }, 2623 2624 isNode: function(val) { 2625 return A.instanceOf(val, A.Node); 2626 }, 2627 2628 isNodeList: function(val) { 2629 return A.instanceOf(val, A.NodeList); 2630 }, 2631 2632 toFloat: function(value, defaultValue) { 2633 return parseFloat(value) || defaultValue || 0; 2634 }, 2635 2636 toInt: function(value, radix, defaultValue) { 2637 return parseInt(value, radix || 10) || defaultValue || 0; 2638 } 2639 }); 2640 2641 A.mix(aArray, { 2642 remove: function(a, from, to) { 2643 var rest = a.slice((to || from) + 1 || a.length); 2644 a.length = (from < 0) ? (a.length + from) : from; 2645 2646 return a.push.apply(a, rest); 2647 }, 2648 2649 removeItem: function(a, item) { 2650 var index = aArray.indexOf(a, item); 2651 2652 if (index > -1) { 2653 return aArray.remove(a, index); 2654 } 2655 2656 return a; 2657 } 2658 }); 2659 2660 var LString = A.namespace('Lang.String'), 2661 2662 DOC = A.config.doc, 2663 REGEX_DASH = /-([a-z])/gi, 2664 REGEX_ESCAPE_REGEX = /([.*+?^$(){}|[\]\/\\])/g, 2665 REGEX_NL2BR = /\r?\n/g, 2666 REGEX_STRIP_SCRIPTS = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/gi, 2667 REGEX_STRIP_TAGS = /<\/?[^>]+>/gi, 2668 REGEX_UNCAMELIZE = /([a-zA-Z][a-zA-Z])([A-Z])([a-z])/g, 2669 REGEX_UNCAMELIZE_REPLACE_SEPARATOR = /([a-z])([A-Z])/g, 2670 STR_ELLIPSIS = '...', 2671 2672 htmlUnescapedValues = [], 2673 2674 MAP_HTML_CHARS_ESCAPED = { 2675 '&': '&', 2676 '<': '<', 2677 '>': '>', 2678 '"': '"', 2679 '\'': ''', 2680 '/': '/', 2681 '`': '`' 2682 }, 2683 htmlChar, 2684 MAP_HTML_CHARS_UNESCAPED = {}; 2685 2686 for (htmlChar in MAP_HTML_CHARS_ESCAPED) { 2687 if (MAP_HTML_CHARS_ESCAPED.hasOwnProperty(htmlChar)) { 2688 var escapedValue = MAP_HTML_CHARS_ESCAPED[htmlChar]; 2689 2690 MAP_HTML_CHARS_UNESCAPED[escapedValue] = htmlChar; 2691 2692 htmlUnescapedValues.push(htmlChar); 2693 } 2694 } 2695 2696 var REGEX_HTML_ESCAPE = new RegExp('[' + htmlUnescapedValues.join('') + ']', 'g'), 2697 REGEX_HTML_UNESCAPE = /&([^;]+);/g; 2698 2699 A.mix(LString, { 2700 camelize: A.cached( 2701 function(str, separator) { 2702 var regex = REGEX_DASH; 2703 2704 str = String(str); 2705 2706 if (separator) { 2707 regex = new RegExp(separator + '([a-z])', 'gi'); 2708 } 2709 2710 return str.replace(regex, LString._camelize); 2711 } 2712 ), 2713 2714 capitalize: A.cached( 2715 function(str) { 2716 if (str) { 2717 str = String(str); 2718 2719 str = str.charAt(0).toUpperCase() + str.substr(1).toLowerCase(); 2720 } 2721 2722 return str; 2723 } 2724 ), 2725 2726 contains: function(str, searchString) { 2727 return str.indexOf(searchString) !== -1; 2728 }, 2729 2730 defaultValue: function(str, defaultValue) { 2731 if (isUndefined(str) || str === '') { 2732 if (isUndefined(defaultValue)) { 2733 defaultValue = ''; 2734 } 2735 2736 str = defaultValue; 2737 } 2738 2739 return str; 2740 }, 2741
2742 endsWith: function(str, suffix) { 2743 var length = (str.length - suffix.length); 2744 2745 return ((length >= 0) && (str.indexOf(suffix, length) === length)); 2746 }, 2747 2748 escapeHTML: function(str) { 2749 return str.replace(REGEX_HTML_ESCAPE, LString._escapeHTML); 2750 }, 2751 2752 // Courtesy of: http://simonwillison.net/2006/Jan/20/escape/ 2753 escapeRegEx: function(str) { 2754 return str.replace(REGEX_ESCAPE_REGEX, '\\$1'); 2755 }, 2756 2757 nl2br: function(str) { 2758 return String(str).replace(REGEX_NL2BR, '<br />'); 2759 }, 2760 2761 padNumber: function(num, length, precision) { 2762 var str = precision ? Number(num).toFixed(precision) : String(num); 2763 var index = str.indexOf('.'); 2764 2765 if (index === -1) { 2766 index = str.length; 2767 } 2768 2769 return LString.repeat('0', Math.max(0, length - index)) + str; 2770 }, 2771 2772 pluralize: function(count, singularVersion, pluralVersion) { 2773 var suffix; 2774 2775 if (count === 1) { 2776 suffix = singularVersion; 2777 } 2778 else { 2779 suffix = pluralVersion || singularVersion + 's'; 2780 } 2781 2782 return count + ' ' + suffix; 2783 }, 2784 2785 prefix: function(prefix, str) { 2786 str = String(str); 2787 2788 if (str.indexOf(prefix) !== 0) { 2789 str = prefix + str; 2790 } 2791 2792 return str; 2793 }, 2794 2795 remove: function(str, substitute, all) { 2796 var re = new RegExp(LString.escapeRegEx(substitute), all ? 'g' : ''); 2797 2798 return str.replace(re, ''); 2799 }, 2800 2801 removeAll: function(str, substitute) { 2802 return LString.remove(str, substitute, true); 2803 }, 2804 2805 repeat: function(str, length) { 2806 return new Array(length + 1).join(str); 2807 }, 2808 2809 round: function(value, precision) { 2810 value = Number(value); 2811 2812 if (isNumber(precision)) { 2813 precision = Math.pow(10, precision); 2814 value = Math.round(value * precision) / precision; 2815 } 2816 2817 return value; 2818 }, 2819 2820 startsWith: function(str, prefix) { 2821 return (str.lastIndexOf(prefix, 0) === 0); 2822 }, 2823 2824 stripScripts: function(str) { 2825 if (str) { 2826 str = String(str).replace(REGEX_STRIP_SCRIPTS, ''); 2827 } 2828 2829 return str; 2830 }, 2831 2832 stripTags: function(str) { 2833 if (str) { 2834 str = String(str).replace(REGEX_STRIP_TAGS, ''); 2835 } 2836 2837 return str; 2838 }, 2839 2840 substr: function(str, start, length) { 2841 return String(str).substr(start, length); 2842 }, 2843 2844 uncamelize: A.cached( 2845 function(str, separator) { 2846 separator = separator || ' '; 2847 2848 str = String(str); 2849 2850 str = str.replace(REGEX_UNCAMELIZE, '$1' + separator + '$2$3'); 2851 str = str.replace(REGEX_UNCAMELIZE_REPLACE_SEPARATOR, '$1' + separator + '$2'); 2852 2853 return str; 2854 } 2855 ), 2856 2857 toLowerCase: function(str) { 2858 return String(str).toLowerCase(); 2859 }, 2860 2861 toUpperCase: function(str) { 2862 return String(str).toUpperCase(); 2863 }, 2864 2865 trim: Lang.trim, 2866 2867 truncate: function(str, length, where) { 2868 str = String(str); 2869 2870 var ellipsisLength = STR_ELLIPSIS.length, 2871 strLength = str.length; 2872 2873 if (length > 3) { 2874 if (str && (strLength > length)) { 2875 where = where || 'end'; 2876 2877 if (where === 'end') { 2878 str = str.substr(0, (length - ellipsisLength)) + STR_ELLIPSIS; 2879 } 2880 else if (where === 'middle') { 2881 var middlePointA = Math.floor((length - ellipsisLength) / 2), 2882 middlePointB = middlePointA; 2883 2884 if (length % 2 === 0) {
2885 middlePointA = Math.ceil((length - ellipsisLength) / 2); 2886 middlePointB = Math.floor((length - ellipsisLength) / 2); 2887 } 2888 2889 str = str.substr(0, middlePointA) + STR_ELLIPSIS + str.substr(strLength - middlePointB); 2890 } 2891 else if (where === 'start') { 2892 str = STR_ELLIPSIS + str.substr(strLength - length + ellipsisLength); 2893 } 2894 } 2895 } 2896 else { 2897 str = STR_ELLIPSIS; 2898 } 2899 2900 return str; 2901 }, 2902 2903 undef: function(str) { 2904 if (isUndefined(str)) { 2905 str = ''; 2906 } 2907 2908 return str; 2909 }, 2910 2911 // inspired from Google unescape entities 2912 unescapeEntities: function(str) { 2913 if (LString.contains(str, '&')) { 2914 if (DOC && !LString.contains(str, '<')) { 2915 str = LString._unescapeEntitiesUsingDom(str); 2916 } 2917 else { 2918 str = LString.unescapeHTML(str); 2919 } 2920 } 2921 2922 return str; 2923 }, 2924 2925 unescapeHTML: function(str) { 2926 return str.replace(REGEX_HTML_UNESCAPE, LString._unescapeHTML); 2927 }, 2928 2929 _camelize: function(match0, match1) { 2930 return match1.toUpperCase(); 2931 }, 2932 2933 _escapeHTML: function(match) { 2934 return MAP_HTML_CHARS_ESCAPED[match]; 2935 }, 2936 2937 _unescapeHTML: function(match, entity) { 2938 var value = MAP_HTML_CHARS_UNESCAPED[match] || match; 2939 2940 if (!value && entity.charAt(0) === '#') { 2941 var charCode = Number('0' + value.substr(1)); 2942 2943 if (!isNaN(charCode)) { 2944 value = String.fromCharCode(charCode); 2945 } 2946 } 2947 2948 return value; 2949 }, 2950 2951 _unescapeEntitiesUsingDom: function(str) { 2952 var el = DOC.createElement('a'); 2953 2954 el.innerHTML = str; 2955 2956 if (el.normalize) { 2957 el.normalize(); 2958 } 2959 2960 str = el.firstChild.nodeValue; 2961 2962 el.innerHTML = ''; 2963 2964 return str; 2965 } 2966 }); 2967 2968 /* 2969 * Maps an object to an array, using the return value of fn as the values 2970 * for the new array. 2971 */ 2972 AObject.map = function(obj, fn, context) { 2973 var map = [], 2974 i; 2975 2976 for (i in obj) { 2977 if (owns(obj, i)) { 2978 map[map.length] = fn.call(context, obj[i], i, obj); 2979 } 2980 } 2981 2982 return map; 2983 }; 2984 2985 /* 2986 * Maps an array or object to a resulting array, using the return value of 2987 * fn as the values for the new array. Like A.each, this function can accept 2988 * an object or an array. 2989 */ 2990 A.map = function(obj) { 2991 var module = AObject; 2992 2993 if (isArray(obj)) { 2994 module = aArray; 2995 } 2996 2997 return module.map.apply(this, arguments); 2998 }; 2999}()); 3000 3001 3002}, '3.1.0-deprecated.95'); 3003 3004YUI.add('aui-classnamemanager', function (A, NAME) { 3005 3006var ClassNameManager = A.ClassNameManager, 3007 _getClassName = ClassNameManager.getClassName; 3008 3009A.getClassName = A.cached( 3010 function() { 3011 var args = A.Array(arguments, 0, true); 3012 3013 args[args.length] = true; 3014 3015 return _getClassName.apply(ClassNameManager, args); 3016 } 3017); 3018 3019 3020}, '3.1.0-deprecated.95', {"requires": ["classnamemanager"]}); 3021 3022YUI.add('aui-component', function (A, NAME) { 3023 3024/** 3025 * The Component Utility 3026 * 3027 * @module aui-component 3028 */ 3029 3030var Lang = A.Lang, 3031 AArray = A.Array, 3032 3033 concat = function(arr, arr2) { 3034 return (arr || []).concat(arr2 || []); 3035 }, 3036 3037 _INSTANCES = {}, 3038 _CONSTRUCTOR_OBJECT = A.config.win.Object.prototype.constructor, 3039 3040 ClassNameManager = A.ClassNameManager, 3041 3042 _getClassName = ClassNameManager.getClassName, 3043 _getWidgetClassName = A.Widget.getClassName, 3044 3045 getClassName = A.getClassName, 3046 3047 CSS_HIDE = getClassName('hide'); 3048 3049/** 3050 * A base class for `A.Component`, providing: 3051 * 3052 * - Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor) 3053 * 3054 * @class A.Component 3055 * @extends Widget
3056 * @uses A.WidgetCssClass, A.WidgetToggle 3057 * @param {Object} config Object literal specifying widget configuration 3058 * properties. 3059 * @constructor 3060 */ 3061var Component = A.Base.create('component', A.Widget, [ 3062 A.WidgetCssClass, 3063 A.WidgetToggle 3064 ], { 3065 initializer: function(config) { 3066 var instance = this; 3067 3068 instance._originalConfig = config; 3069 3070 instance._setRender(config); 3071 3072 _INSTANCES[instance.get('id')] = instance; 3073 }, 3074 3075 /** 3076 * Clone the current `A.Component`. 3077 * 3078 * @method clone 3079 * @param {Object} config 3080 * @return {Widget} Cloned instance. 3081 */ 3082 clone: function(config) { 3083 var instance = this; 3084 3085 config = config || {}; 3086 3087 config.id = config.id || A.guid(); 3088 3089 A.mix(config, instance._originalConfig); 3090 3091 return new instance.constructor(config); 3092 }, 3093 3094 /** 3095 * Set the visibility on the UI. 3096 * 3097 * @method _uiSetVisible 3098 * @param value 3099 * @protected 3100 */ 3101 _uiSetVisible: function(value) { 3102 var instance = this; 3103 3104 var superUISetVisible = Component.superclass._uiSetVisible; 3105 3106 if (superUISetVisible) { 3107 superUISetVisible.apply(instance, arguments); 3108 } 3109 3110 var hideClass = instance.get('hideClass'); 3111 3112 if (hideClass !== false) { 3113 var boundingBox = instance.get('boundingBox'); 3114 3115 boundingBox.toggleClass(hideClass || CSS_HIDE, !value); 3116 } 3117 }, 3118 3119 /** 3120 * Applies standard class names to the `boundingBox` and `contentBox`. 3121 * 3122 * @method _renderBoxClassNames 3123 * @protected 3124 */ 3125 _renderBoxClassNames: function() { 3126 var instance = this; 3127 3128 var boundingBoxNode = instance.get('boundingBox')._node; 3129 var contentBoxNode = instance.get('contentBox')._node; 3130 3131 var boundingBoxNodeClassName = boundingBoxNode.className; 3132 var contentBoxNodeClassName = contentBoxNode.className; 3133 3134 var boundingBoxBuffer = (boundingBoxNodeClassName) ? boundingBoxNodeClassName.split(' ') : []; 3135 var contentBoxBuffer = (contentBoxNodeClassName) ? contentBoxNodeClassName.split(' ') : []; 3136 3137 var classes = instance._getClasses(); 3138 3139 var classLength = classes.length; 3140 3141 var auiClassesLength = classLength - 4; 3142 3143 var classItem; 3144 var classItemName; 3145 3146 boundingBoxBuffer.push(_getWidgetClassName()); 3147 3148 for (var i = classLength - 3; i >= 0; i--) { 3149 classItem = classes[i]; 3150 3151 classItemName = String(classItem.NAME).toLowerCase(); 3152 3153 boundingBoxBuffer.push(classItem.CSS_PREFIX || _getClassName(classItemName)); 3154 3155 if (i <= auiClassesLength) { 3156 classItemName = classItemName; 3157 3158 contentBoxBuffer.push(getClassName(classItemName, 'content')); 3159 } 3160 } 3161 3162 contentBoxBuffer.push(instance.getClassName('content')); 3163 3164 if (boundingBoxNode === contentBoxNode) { 3165 contentBoxNodeClassName = AArray.dedupe(contentBoxBuffer.concat(boundingBoxBuffer)).join(' '); 3166 } 3167 else { 3168 boundingBoxNode.className = AArray.dedupe(boundingBoxBuffer).join(' '); 3169 3170 contentBoxNodeClassName = AArray.dedupe(contentBoxBuffer).join(' '); 3171 } 3172 3173 contentBoxNode.className = contentBoxNodeClassName; 3174 }, 3175 3176 /** 3177 * Renders the `A.Component` based upon a passed in interaction. 3178 * 3179 * @method _renderInteraction 3180 * @param event 3181 * @param parentNode 3182 * @protected 3183 */ 3184 _renderInteraction: function(event, parentNode) { 3185 var instance = this; 3186 3187 instance.render(parentNode); 3188 3189 var renderHandles = instance._renderHandles; 3190 3191 for (var i = renderHandles.length - 1; i >= 0; i--) { 3192 var handle = renderHandles.pop(); 3193 3194 handle.detach(); 3195 } 3196 }, 3197 3198 /** 3199 * Sets the interaction and render behavior based upon an object (intercepts 3200 * the default rendering behavior). 3201 * 3202 * @method _setRender 3203 * @param config 3204 * @protected 3205 */ 3206 _setRender: function(config) { 3207 var instance = this; 3208 3209 var render = config && config.render; 3210 3211 if (render && render.constructor === _CONSTRUCTOR_OBJECT) { 3212 var eventType = render.eventType || 'mousemove'; 3213 var parentNode = render.parentNode; 3214 var selector = render.selector || parentNode; 3215 3216 if (selector) { 3217 instance._renderHandles = []; 3218 3219 var renderHandles = instance._renderHandles; 3220 3221 if (!Lang.isArray(eventType)) { 3222 eventType = [eventType]; 3223 } 3224 3225 var renderInteraction = A.rbind(instance._renderInteraction, instance, parentNode); 3226 3227 var interactionNode = A.one(selector); 3228 3229 for (var i = eventType.length - 1; i >= 0; i--) { 3230 renderHandles[i] = interactionNode.once(eventType[i], renderInteraction); 3231 } 3232 3233 delete config.render; 3234 } 3235 } 3236 } 3237}, { 3238 /** 3239 * Static property used to define the default attribute configuration for 3240 * the Component. 3241 * 3242 * @property ATTRS 3243 * @type Object 3244 * @static 3245 */ 3246 ATTRS: { 3247 /** 3248 * Indicates if use of the WAI-ARIA Roles and States should be enabled 3249 * for the Widget. 3250 * 3251 * @attribute useARIA 3252 * @default false 3253 * @type Boolean 3254 * @writeOnce 3255 */ 3256 useARIA: { 3257 writeOnce: true, 3258 value: false, 3259 validator: Lang.isBoolean 3260 }, 3261 3262 /** 3263 * CSS class added to hide the `boundingBox` when 3264 * [visible](A.Component.html#attr_visible) is set to `false`. 3265 * 3266 * @attribute hideClass 3267 * @default 'aui-hide'
3268 * @type String 3269 */ 3270 hideClass: { 3271 value: CSS_HIDE 3272 }, 3273 3274 /** 3275 * If `true` the render phase will be autimatically invoked preventing 3276 * the `.render()` manual call. 3277 * 3278 * @attribute render 3279 * @default false 3280 * @type Boolean | Node 3281 * @writeOnce 3282 */ 3283 render: { 3284 value: false, 3285 writeOnce: true 3286 } 3287 } 3288}); 3289 3290/** 3291 * Static property used to define the map to store Component instances by id. 3292 * 3293 * @property _INSTANCES 3294 * @type Object 3295 * @static 3296 */ 3297Component._INSTANCES = _INSTANCES; 3298 3299/** 3300 * Gets component's instance by id. 3301 * 3302 * @method getById 3303 * @param id 3304 */ 3305Component.getById = function(id) { 3306 return _INSTANCES[id]; 3307}; 3308 3309var DEFAULT_UI_ATTRS = A.Widget.prototype._UI_ATTRS; 3310 3311/** 3312 * Applies a CSS prefix on a component. 3313 * 3314 * @method _applyCssPrefix 3315 * @param component 3316 * @protected 3317 */ 3318Component._applyCssPrefix = function(component) { 3319 if (component && component.NAME && !('CSS_PREFIX' in component)) { 3320 component.CSS_PREFIX = A.getClassName(String(component.NAME).toLowerCase()); 3321 } 3322 3323 return component; 3324}; 3325 3326/** 3327 * Applies standard extensions from a given config to create a new class using 3328 * the static `Base.build` method. 3329 * 3330 * @method create 3331 * @param config 3332 */ 3333Component.create = function(config) { 3334 config = config || {}; 3335 3336 var extendsClass = config.EXTENDS || A.Component; 3337 3338 var component = config.constructor; 3339 3340 if (!A.Object.owns(config, 'constructor')) { 3341 component = function() { 3342 component.superclass.constructor.apply(this, arguments); 3343 }; 3344 } 3345 3346 var configProto = config.prototype; 3347 3348 if (configProto) { 3349 if (config.UI_ATTRS || config.BIND_UI_ATTRS || config.SYNC_UI_ATTRS) { 3350 var BIND_UI_ATTRS = concat(config.BIND_UI_ATTRS, config.UI_ATTRS); 3351 var SYNC_UI_ATTRS = concat(config.SYNC_UI_ATTRS, config.UI_ATTRS); 3352 3353 var extendsProto = extendsClass.prototype; 3354 var extendsUIAttrs = (extendsProto && extendsProto._UI_ATTRS) || DEFAULT_UI_ATTRS; 3355 3356 BIND_UI_ATTRS = concat(extendsUIAttrs.BIND, BIND_UI_ATTRS); 3357 SYNC_UI_ATTRS = concat(extendsUIAttrs.SYNC, SYNC_UI_ATTRS); 3358 3359 var configProtoUIAttrs = configProto._UI_ATTRS; 3360 3361 if (!configProtoUIAttrs) { 3362 configProtoUIAttrs = configProto._UI_ATTRS = {}; 3363 } 3364 3365 if (BIND_UI_ATTRS.length) { 3366 configProtoUIAttrs.BIND = BIND_UI_ATTRS; 3367 } 3368 3369 if (SYNC_UI_ATTRS.length) { 3370 configProtoUIAttrs.SYNC = SYNC_UI_ATTRS; 3371 } 3372 } 3373 } 3374 3375 var augmentsClasses = config.AUGMENTS; 3376 3377 if (augmentsClasses && !Lang.isArray(augmentsClasses)) { 3378 augmentsClasses = [augmentsClasses]; 3379 } 3380 3381 A.mix(component, config); 3382 3383 delete component.prototype; 3384 3385 A.extend(component, extendsClass, configProto); 3386 3387 if (augmentsClasses) { 3388 component = A.Base.build(config.NAME, component, augmentsClasses, { 3389 dynamic: false 3390 }); 3391 } 3392 3393 Component._applyCssPrefix(component); 3394 3395 return component; 3396}; 3397 3398/** 3399 * Static property provides a string to identify the CSS prefix. 3400 * 3401 * @property CSS_PREFIX 3402 * @type String 3403 * @static 3404 */ 3405Component.CSS_PREFIX = getClassName('component'); 3406 3407var Base = A.Base; 3408 3409/** 3410 * Applies extensions to a class using the static `Base.build` method. 3411 * 3412 * @method build 3413 */ 3414Component.build = function() { 3415 var component = Base.build.apply(Base, arguments); 3416 3417 Component._applyCssPrefix(component); 3418 3419 return component; 3420}; 3421 3422A.Component = Component; 3423 3424 3425}, '3.1.0-deprecated.95', { 3426 "requires": [ 3427 "aui-classnamemanager", 3428 "aui-widget-cssclass", 3429 "aui-widget-toggle", 3430 "base-build", 3431 "widget-base" 3432 ] 3433}); 3434 3435YUI.add('aui-debounce', function (A, NAME) { 3436 3437var Lang = A.Lang, 3438 aArray = A.Array, 3439 isString = Lang.isString, 3440 isUndefined = Lang.isUndefined, 3441 3442 DEFAULT_ARGS = []; 3443 3444var toArray = function(arr, fallback, index, arrayLike) { 3445 return !isUndefined(arr) ? aArray(arr, index || 0, (arrayLike !== false)) : fallback; 3446}; 3447
3448A.debounce = function(fn, delay, context, args) { 3449 var id; 3450 var tempArgs; 3451 var wrapped; 3452 3453 if (isString(fn) && context) { 3454 fn = A.bind(fn, context); 3455 } 3456 3457 delay = delay || 0; 3458 3459 args = toArray(arguments, DEFAULT_ARGS, 3); 3460 3461 var clearFn = function() { 3462 clearInterval(id); 3463 3464 id = null; 3465 }; 3466 3467 var base = function() { 3468 clearFn(); 3469 3470 var result = fn.apply(context, tempArgs || args || DEFAULT_ARGS); 3471 3472 tempArgs = null; 3473 3474 return result; 3475 }; 3476 3477 var delayFn = function(delayTime, newArgs, newContext, newFn) { 3478 wrapped.cancel(); 3479 3480 delayTime = !isUndefined(delayTime) ? delayTime : delay; 3481 3482 fn = newFn || fn; 3483 context = newContext || context; 3484 3485 if (newArgs !== args) { 3486 tempArgs = toArray(newArgs, DEFAULT_ARGS, 0, false).concat(args); 3487 } 3488 3489 if (delayTime > 0) { 3490 id = setInterval(base, delayTime); 3491 } 3492 else { 3493 return base(); 3494 } 3495 }; 3496 3497 var cancelFn = function() { 3498 if (id) { 3499 clearFn(); 3500 } 3501 }; 3502 3503 var setDelay = function(delay) { 3504 cancelFn(); 3505 3506 delay = delay || 0; 3507 }; 3508 3509 wrapped = function() { 3510 var currentArgs = arguments.length ? arguments : args; 3511 3512 return wrapped.delay(delay, currentArgs, context || this); 3513 }; 3514 3515 wrapped.cancel = cancelFn; 3516 wrapped.delay = delayFn; 3517 wrapped.setDelay = setDelay; 3518 3519 return wrapped; 3520}; 3521 3522 3523}, '3.1.0-deprecated.95'); 3524 3525YUI.add('aui-delayed-task-deprecated', function (A, NAME) { 3526 3527/** 3528 * The DelayedTask Utility - Executes the supplied function in the context of 3529 * the supplied object 'when' milliseconds later 3530 * 3531 * @module aui-delayed-task 3532 */ 3533 3534/** 3535 * A base class for DelayedTask, providing: 3536 * <ul> 3537 * <li>Executes the supplied function in the context of the supplied object 'when' milliseconds later</li> 3538 * </ul> 3539 * 3540 * Quick Example:<br/> 3541 * 3542 * <pre><code>var delayed = new A.DelayedTask({ 3543 * function() { 3544 * // This callback will be executed when the <code>DelayedTask</code> be invoked 3545 * }, 3546 * scope 3547 * }); 3548 * 3549 * // executes after 1000ms the callback 3550 * delayed.delay(1000); 3551 * </code></pre> 3552 * 3553 * Check the list of <a href="DelayedTask.html#configattributes">Configuration Attributes</a> available for 3554 * DelayedTask. 3555 * 3556 * @param config {Object} Object literal specifying widget configuration properties. 3557 * 3558 * @class DelayedTask 3559 * @param {function} fn Callback 3560 * @param {Object} scope Context object. Optional. 3561 * @param args 0..n additional arguments that should be provided to the listener. 3562 * @constructor 3563 */ 3564var DelayedTask = function(fn, scope, args) { 3565 var instance = this; 3566 3567 /** 3568 * Stores the passed <code>args</code> attribute. 3569 * 3570 * @property _args 3571 * @type Object 3572 * @protected 3573 */ 3574 instance._args = args; 3575 3576 /** 3577 * Stores the passed <code>delay</code> attribute. 3578 * 3579 * @property _delay 3580 * @default 0 3581 * @type Number 3582 * @protected 3583 */ 3584 instance._delay = 0; 3585 3586 /** 3587 * Stores the passed <code>fn</code> attribute. 3588 * 3589 * @property _fn 3590 * @type function 3591 * @protected 3592 */ 3593 instance._fn = fn; 3594 3595 /** 3596 * Stores the timer <code>id</code> given from the <code>setInterval</code>. 3597 * 3598 * @property _id 3599 * @default null 3600 * @type Number 3601 * @protected 3602 */ 3603 instance._id = null; 3604 3605 /** 3606 * Stores the passed <code>scope</code> attribute. 3607 * 3608 * @property _scope 3609 * @default instance 3610 * @type Object 3611 * @protected 3612 */ 3613 instance._scope = scope || instance; 3614 3615 /** 3616 * Stores the current timestamp given from 3617 * <a href="DelayedTask.html#method__getTime">_getTime</a>. 3618 * 3619 * @property _time 3620 * @default 0 3621 * @type Number 3622 * @protected 3623 */ 3624 instance._time = 0; 3625 3626 instance._base = function() { 3627 var now = instance._getTime(); 3628 3629 if (now - instance._time >= instance._delay) { 3630 clearInterval(instance._id); 3631 3632 instance._id = null; 3633 3634 instance._fn.apply(instance._scope, instance._args || []); 3635 } 3636 }; 3637}; 3638 3639DelayedTask.prototype = { 3640 /** 3641 * <p>This function is responsible to execute the user callback, passed in 3642 * the <code>constructor</code> after <code>delay</code> milliseconds.</p> 3643 * 3644 * Example: 3645 * 3646 * <pre><code>// executes after 1000ms the callback 3647 * delayed.delay(1000);</code></pre> 3648 * 3649 * @method delay 3650 * @param {Number} delay Delay in milliseconds. 3651 * @param {function} newFn Callback. 3652 * @param {Object} newScope Context object. Optional. 3653 * @param newArgs 0..n additional arguments that should be provided to the listener. 3654 */ 3655 delay: function(delay, newFn, newScope, newArgs) { 3656 var instance = this; 3657 3658 if (instance._id && instance._delay != delay) { 3659 instance.cancel(); 3660 } 3661 3662 instance._delay = delay || instance._delay; 3663 instance._time = instance._getTime(); 3664 3665 instance._fn = newFn || instance._fn; 3666 instance._scope = newScope || instance._scope; 3667 instance._args = newArgs || instance._args; 3668 3669 if (!A.Lang.isArray(instance._args)) { 3670 instance._args = [instance._args]; 3671 } 3672 3673 if (!instance._id) { 3674 if (instance._delay > 0) { 3675 instance._id = setInterval(instance._base, instance._delay); 3676 } 3677 else { 3678 instance._base(); 3679 } 3680 } 3681 }, 3682 3683 /** 3684 * Cancel the delayed task in case it's running (i.e., clearInterval from 3685 * the current running <a href="DelayedTask.html#property__id">_id</a>). 3686 * 3687 * @method cancel 3688 */ 3689 cancel: function() { 3690 var instance = this; 3691 3692 if (instance._id) { 3693 clearInterval(instance._id); 3694 3695 instance._id = null; 3696 } 3697 }, 3698 3699 /** 3700 * Get the current timestamp (i.e., now). 3701 * 3702 * @method _getTime 3703 * @protected 3704 * @return {Number} Current timestamp 3705 */ 3706 _getTime: function() { 3707 var instance = this; 3708 3709 return (+new Date()); 3710 } 3711}; 3712 3713A.DelayedTask = DelayedTask; 3714 3715 3716}, '3.1.0-deprecated.95', {"requires": ["yui-base"]}); 3717 3718YUI.add('aui-event-base', function (A, NAME) { 3719 3720/** 3721 * The Event Base. 3722 * 3723 * @module aui-event 3724 * @submodule aui-event-base 3725 */ 3726 3727var aArray = A.Array, 3728 DOMEventFacade = A.DOMEventFacade, 3729 DOMEventFacadeProto = DOMEventFacade.prototype; 3730 3731var KeyMap = { 3732 BACKSPACE: 8, 3733 TAB: 9, 3734 NUM_CENTER: 12, 3735
3736 ENTER: 13, 3737 RETURN: 13, 3738 3739 SHIFT: 16, 3740 CTRL: 17, 3741 ALT: 18, 3742 3743 PAUSE: 19, 3744 CAPS_LOCK: 20, 3745 ESC: 27, 3746 SPACE: 32, 3747 3748 PAGE_UP: 33, 3749 PAGE_DOWN: 34, 3750 3751 END: 35, 3752 HOME: 36, 3753 3754 LEFT: 37, 3755 UP: 38, 3756 RIGHT: 39, 3757 DOWN: 40, 3758 3759 PRINT_SCREEN: 44, 3760 INSERT: 45, 3761 DELETE: 46, 3762 3763 ZERO: 48, 3764 ONE: 49, 3765 TWO: 50, 3766 THREE: 51, 3767 FOUR: 52, 3768 FIVE: 53, 3769 SIX: 54, 3770 SEVEN: 55, 3771 EIGHT: 56, 3772 NINE: 57, 3773 3774 A: 65, 3775 B: 66, 3776 C: 67, 3777 D: 68, 3778 E: 69, 3779 F: 70, 3780 G: 71, 3781 H: 72, 3782 I: 73, 3783 J: 74, 3784 K: 75, 3785 L: 76, 3786 M: 77, 3787 N: 78, 3788 O: 79, 3789 P: 80, 3790 Q: 81, 3791 R: 82, 3792 S: 83, 3793 T: 84, 3794 U: 85, 3795 V: 86, 3796 W: 87, 3797 X: 88, 3798 Y: 89, 3799 Z: 90, 3800 3801 CONTEXT_MENU: 93, 3802 3803 NUM_ZERO: 96, 3804 NUM_ONE: 97, 3805 NUM_TWO: 98, 3806 NUM_THREE: 99, 3807 NUM_FOUR: 100, 3808 NUM_FIVE: 101, 3809 NUM_SIX: 102, 3810 NUM_SEVEN: 103, 3811 NUM_EIGHT: 104, 3812 NUM_NINE: 105, 3813 3814 NUM_MULTIPLY: 106, 3815 NUM_PLUS: 107, 3816 NUM_MINUS: 109, 3817 NUM_PERIOD: 110, 3818 NUM_DIVISION: 111, 3819 3820 F1: 112, 3821 F2: 113, 3822 F3: 114, 3823 F4: 115, 3824 F5: 116, 3825 F6: 117, 3826 F7: 118, 3827 F8: 119, 3828 F9: 120, 3829 F10: 121, 3830 F11: 122, 3831 F12: 123, 3832 3833 NUM_LOCK: 144, 3834 3835 WIN_KEY: 224, 3836 WIN_IME: 229, 3837 3838 NON_MODIFYING_KEYS: [ 3839 'ALT', 3840 'CAPS_LOCK', 3841 'CTRL', 3842 'DOWN', 3843 'END', 3844 'ESC', 3845 'F1', 3846 'F10', 3847 'F11', 3848 'F12', 3849 'F2', 3850 'F3', 3851 'F4', 3852 'F5', 3853 'F6', 3854 'F7', 3855 'F8', 3856 'F9', 3857 'HOME', 3858 'LEFT', 3859 'NUM_LOCK', 3860 'PAGE_DOWN', 3861 'PAGE_UP', 3862 'PAUSE', 3863 'PRINT_SCREEN', 3864 'RIGHT', 3865 'SHIFT', 3866 'SPACE', 3867 'UP', 3868 'WIN_KEY' 3869 ], 3870 3871 hasModifier: function(event) { 3872 return event && 3873 (event.ctrlKey || 3874 event.altKey || 3875 event.shiftKey || 3876 event.metaKey); 3877 }, 3878 3879 isKey: function(keyCode, name) { 3880 var instance = this; 3881 3882 return name && ((instance[name] || instance[name.toUpperCase()]) === keyCode); 3883 }, 3884 3885 isKeyInRange: function(keyCode, start, end) { 3886 var instance = this; 3887 3888 var result = false;
3889 3890 if (start && end) { 3891 var startKey = instance[start] || instance[start.toUpperCase()]; 3892 var endKey = instance[end] || instance[end.toUpperCase()]; 3893 3894 result = startKey && endKey && 3895 (keyCode >= startKey && keyCode <= endKey); 3896 } 3897 3898 return result; 3899 }, 3900 3901 isKeyInSet: function(keyCode) { 3902 var instance = this; 3903 3904 var args = aArray(arguments, 1, true); 3905 3906 return instance._isKeyInSet(keyCode, args); 3907 }, 3908 3909 isNavKey: function(keyCode) { 3910 var instance = this; 3911 3912 return instance.isKeyInRange(keyCode, 'PAGE_UP', 'DOWN') || instance.isKeyInSet(keyCode, 'ENTER', 'TAB', 'ESC'); 3913 }, 3914 3915 isSpecialKey: function(keyCode, eventType) { 3916 var instance = this; 3917 3918 var isCtrlPress = (eventType === 'keypress' && instance.ctrlKey); 3919 3920 return isCtrlPress || 3921 instance.isNavKey(keyCode) || 3922 instance.isKeyInRange(keyCode, 'SHIFT', 'CAPS_LOCK') || 3923 instance.isKeyInSet(keyCode, 'BACKSPACE', 'PRINT_SCREEN', 'INSERT', 'WIN_IME'); 3924 }, 3925 3926 isModifyingKey: function(keyCode) { 3927 var instance = this; 3928 3929 return !instance._isKeyInSet(keyCode, instance.NON_MODIFYING_KEYS); 3930 }, 3931 3932 _isKeyInSet: function(keyCode, arr) { 3933 var instance = this; 3934 3935 var i = arr.length; 3936 3937 var result = false;
3938 3939 var keyName; 3940 var key; 3941 3942 while (i--) { 3943 keyName = arr[i]; 3944 key = keyName && (instance[keyName] || instance[String(keyName).toUpperCase()]); 3945 3946 if (keyCode === key) { 3947 result = true; 3948 3949 break; 3950 } 3951 } 3952 3953 return result; 3954 } 3955}; 3956 3957A.mix( 3958 DOMEventFacadeProto, { 3959 /** 3960 * Checks if an event is triggered by a keyboard key like `CTRL`, `ALT` 3961 * or `SHIFT`. 3962 * 3963 * @method hasModifier 3964 * @return {Boolean} 3965 */ 3966 hasModifier: function() { 3967 var instance = this; 3968 3969 return KeyMap.hasModifier(instance); 3970 }, 3971 3972 /** 3973 * Checks if an event is triggered by a keyboard key. 3974 * 3975 * @method isKey 3976 * @param name 3977 * @return {Boolean} 3978 */ 3979 isKey: function(name) { 3980 var instance = this; 3981 3982 return KeyMap.isKey(instance.keyCode, name); 3983 }, 3984 3985 /** 3986 * Checks if an event is triggered by a keyboard key located between two 3987 * other keys. 3988 * 3989 * @method isKeyInRange 3990 * @param start 3991 * @param end 3992 * @return {Boolean} 3993 */ 3994 isKeyInRange: function(start, end) { 3995 var instance = this; 3996 3997 return KeyMap.isKeyInRange(instance.keyCode, start, end); 3998 }, 3999 4000 /** 4001 * Checks if an event is triggered by a keyboard key contained in the 4002 * key set. 4003 * 4004 * @method isKeyInSet 4005 * @return {Boolean} 4006 */ 4007 isKeyInSet: function() { 4008 var instance = this; 4009 4010 var args = aArray(arguments, 0, true); 4011 4012 return KeyMap._isKeyInSet(instance.keyCode, args); 4013 }, 4014 4015 /** 4016 * Checks if an event is triggered by `ENTER`, `TAB`, `ESC` keyboard 4017 * keys or by a key located between `PAGE UP` and `DOWN`. 4018 * 4019 * @method isModifyingKey 4020 */ 4021 isModifyingKey: function() { 4022 var instance = this; 4023 4024 return KeyMap.isModifyingKey(instance.keyCode); 4025 }, 4026 4027 /** 4028 * Checks if an event is triggered by navigation keys like `PAGE UP` 4029 * and `DOWN` keys. 4030 * 4031 * @method isNavKey 4032 * @return {Boolean} 4033 */ 4034 isNavKey: function() { 4035 var instance = this; 4036 4037 return KeyMap.isNavKey(instance.keyCode); 4038 }, 4039 4040 /** 4041 * Checks if an event is triggered by a special keyboard key like 4042 * `SHIFT`, `CAPS LOCK`, etc. 4043 * 4044 * @method isSpecialKey 4045 * @return {Boolean} 4046 */ 4047 isSpecialKey: function() { 4048 var instance = this; 4049 4050 return KeyMap.isSpecialKey(instance.keyCode, instance.type); 4051 } 4052 } 4053); 4054 4055A.Event.KeyMap = KeyMap; 4056 4057A.Event.supportsDOMEvent = A.supportsDOMEvent; 4058 4059 4060}, '3.1.0-deprecated.95', {"requires": ["event-base"]}); 4061 4062YUI.add('aui-event-input', function (A, NAME) { 4063 4064/** 4065 * An object that encapsulates text changed events for textareas and input 4066 * element of type text and password. This event only occurs when the element 4067 * is focused. 4068 * 4069 * @module aui-event 4070 * @submodule aui-event-input 4071 */ 4072 4073var DOM_EVENTS = A.Node.DOM_EVENTS; 4074 4075// Input event feature check should be done on textareas. WebKit before 4076// version 531 (3.0.182.2) did not support input events for textareas. 4077// See http://dev.chromium.org/developers/webkit-version-table 4078if (A.Features.test('event', 'input')) { 4079 // http://yuilibrary.com/projects/yui3/ticket/2533063 4080 DOM_EVENTS.input = 1; 4081 return; 4082} 4083 4084DOM_EVENTS.cut = 1; 4085DOM_EVENTS.dragend = 1; 4086DOM_EVENTS.paste = 1; 4087 4088var KeyMap = A.Event.KeyMap, 4089 4090 _HANDLER_DATA_KEY = '~~aui|input|event~~', 4091 _INPUT_EVENT_TYPE = ['keydown', 'paste', 'drop', 'cut'], 4092 _SKIP_FOCUS_CHECK_MAP = { 4093 cut: 1, 4094 drop: 1, 4095 paste: 1 4096 }; 4097 4098/** 4099 * Defines a new `input` event in the DOM event system. 4100 * 4101 * @event input 4102 */ 4103A.Event.define('input', { 4104 4105 /** 4106 * Implementation logic for event subscription. 4107 * 4108 * @method on 4109 * @param node 4110 * @param subscription 4111 * @param notifier 4112 */ 4113 on: function(node, subscription, notifier) { 4114 var instance = this; 4115 4116 subscription._handler = node.on( 4117 _INPUT_EVENT_TYPE, A.bind(instance._dispatchEvent, instance, subscription, notifier)); 4118 }, 4119 4120 /** 4121 * Implementation logic for subscription via `node.delegate`. 4122 * 4123 * @method delegate 4124 * @param node 4125 * @param subscription 4126 * @param notifier 4127 * @param filter 4128 */ 4129 delegate: function(node, subscription, notifier, filter) { 4130 var instance = this; 4131 4132 subscription._handles = []; 4133 subscription._handler = node.delegate('focus', function(event) { 4134 var element = event.target, 4135 handler = element.getData(_HANDLER_DATA_KEY); 4136 4137 if (!handler) { 4138 handler = element.on( 4139 _INPUT_EVENT_TYPE, 4140 A.bind(instance._dispatchEvent, instance, subscription, notifier)); 4141 4142 subscription._handles.push(handler); 4143 element.setData(_HANDLER_DATA_KEY, handler); 4144 } 4145 }, filter); 4146 }, 4147 4148 /** 4149 * Implementation logic for cleaning up a detached subscription. 4150 * 4151 * @method detach 4152 * @param node 4153 * @param subscription 4154 * @param notifier 4155 */ 4156 detach: function(node, subscription) { 4157 subscription._handler.detach(); 4158 }, 4159 4160 /** 4161 * Implementation logic for cleaning up a detached delegate subscription. 4162 * 4163 * @method detachDelegate 4164 * @param node 4165 * @param subscription 4166 * @param notifier 4167 */ 4168 detachDelegate: function(node, subscription) { 4169 A.Array.each(subscription._handles, function(handle) { 4170 var element = A.one(handle.evt.el); 4171 if (element) { 4172 element.setData(_HANDLER_DATA_KEY, null); 4173 } 4174 handle.detach(); 4175 }); 4176 subscription._handler.detach(); 4177 }, 4178 4179 /**
4180 * Dispatches an `input` event. 4181 * 4182 * @method _dispatchEvent 4183 * @param subscription 4184 * @param notifier 4185 * @param event 4186 * @protected 4187 */ 4188 _dispatchEvent: function(subscription, notifier, event) { 4189 var instance = this, 4190 input, 4191 valueBeforeKey; 4192 4193 input = event.target; 4194 4195 // Since cut, drop and paste events fires before the element is focused, 4196 // skip focus checking. 4197 if (_SKIP_FOCUS_CHECK_MAP[event.type] || 4198 (input.get('ownerDocument').get('activeElement') === input)) { 4199 4200 if (KeyMap.isModifyingKey(event.keyCode)) { 4201 if (subscription._timer) { 4202 subscription._timer.cancel(); 4203 subscription._timer = null; 4204 } 4205 4206 valueBeforeKey = KeyMap.isKey(event.keyCode, 'WIN_IME') ? null : input.get('value'); 4207 4208 subscription._timer = A.soon( 4209 A.bind('_fireEvent', instance, subscription, notifier, event, valueBeforeKey) 4210 ); 4211 } 4212 } 4213 }, 4214 4215 /** 4216 * Fires an event. 4217 * 4218 * @method _fireEvent 4219 * @param subscription 4220 * @param notifier 4221 * @param event 4222 * @param valueBeforeKey 4223 * @protected 4224 */ 4225 _fireEvent: function(subscription, notifier, event, valueBeforeKey) { 4226 var input = event.target; 4227 4228 subscription._timer = null; 4229 4230 if (input.get('value') !== valueBeforeKey) { 4231 notifier.fire(event); 4232 } 4233 } 4234}); 4235 4236 4237}, '3.1.0-deprecated.95', {"requires": ["aui-event-base", "event-delegate", "event-synthetic", "timers"]}); 4238 4239YUI.add('aui-form-validator', function (A, NAME) { 4240 4241/**
4242 * The Form Validator Component 4243 * 4244 * @module aui-form-validator 4245 */ 4246 4247// API inspired on the amazing jQuery Form Validation - 4248// http://jquery.bassistance.de/validate/ 4249 4250var Lang = A.Lang, 4251 AObject = A.Object, 4252 isBoolean = Lang.isBoolean, 4253 isDate = Lang.isDate, 4254 isEmpty = AObject.isEmpty, 4255 isFunction = Lang.isFunction, 4256 isNode = Lang.isNode, 4257 isObject = Lang.isObject, 4258 isString = Lang.isString, 4259 trim = Lang.trim, 4260 4261 defaults = A.namespace('config.FormValidator'), 4262 4263 getRegExp = A.DOM._getRegExp, 4264 4265 getCN = A.getClassName, 4266 4267 CSS_FORM_GROUP = getCN('form', 'group'), 4268 CSS_HAS_ERROR = getCN('has', 'error'), 4269 CSS_ERROR_FIELD = getCN('error', 'field'), 4270 CSS_HAS_SUCCESS = getCN('has', 'success'), 4271 CSS_SUCCESS_FIELD = getCN('success', 'field'), 4272 CSS_HELP_BLOCK = getCN('help', 'block'), 4273 CSS_STACK = getCN('form-validator', 'stack'), 4274 4275 TPL_MESSAGE = '<div role="alert"></div>', 4276 TPL_STACK_ERROR = '<div class="' + [CSS_STACK, CSS_HELP_BLOCK].join(' ') + '"></div>'; 4277 4278if (!Element.prototype.matches) { 4279 Element.prototype.matches = Element.prototype.msMatchesSelector; 4280} 4281 4282A.mix(defaults, { 4283 STRINGS: { 4284 DEFAULT: 'Please fix {field}.', 4285 acceptFiles: 'Please enter a value with a valid extension ({0}) in {field}.', 4286 alpha: 'Please enter only alpha characters in {field}.', 4287 alphanum: 'Please enter only alphanumeric characters in {field}.', 4288 date: 'Please enter a valid date in {field}.', 4289 digits: 'Please enter only digits in {field}.', 4290 email: 'Please enter a valid email address in {field}.', 4291 equalTo: 'Please enter the same value again in {field}.', 4292 iri: 'Please enter a valid IRI in {field}.', 4293 max: 'Please enter a value less than or equal to {0} in {field}.', 4294 maxLength: 'Please enter no more than {0} characters in {field}.', 4295 min: 'Please enter a value greater than or equal to {0} in {field}.', 4296 minLength: 'Please enter at least {0} characters in {field}.', 4297 number: 'Please enter a valid number in {field}.', 4298 range: 'Please enter a value between {0} and {1} in {field}.', 4299 rangeLength: 'Please enter a value between {0} and {1} characters long in {field}.', 4300 required: '{field} is required.', 4301 url: 'Please enter a valid URL in {field}.' 4302 }, 4303 4304 REGEX: { 4305 alpha: /^[a-z_]+$/i, 4306 4307 alphanum: /^\w+$/, 4308 4309 digits: /^\d+$/, 4310 4311 // Regex from Scott Gonzalez Email Address Validation: 4312 // http://projects.scottsplayground.com/email_address_validation/ 4313 email: new RegExp('^((([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|' + 4314 '[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#' + 4315 '\\$%&\'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF' + 4316 '\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20' + 4317 '|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\' + 4318 'x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])' + 4319 '|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-' + 4320 '\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\' + 4321 'x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\' + 4322 'uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\' + 4323 'uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\' + 4324 'uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\' + 4325 'uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\' + 4326 'uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\' + 4327 'uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\' + 4328 'u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\' + 4329 'u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$', 'i'), 4330 4331 // Regex from Scott Gonzalez IRI: 4332 // http://projects.scottsplayground.com/iri/demo/ 4333 iri: new RegExp('^([a-z]([a-z]|\\d|\\+|-|\\.)*):(\\/\\/(((([a-z]|\\d|' +
4334 '-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[' + 4335 '\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:)*@)?((\\[(|(v[\\da-f]{1' + 4336 ',}\\.(([a-z]|\\d|-|\\.|_|~)|[!\\$&\'\\(\\)\\*\\+,;=]|:)+))\\])' + 4337 '|((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1' + 4338 '\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d' + 4339 '|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|' + 4340 '(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-' + 4341 '\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=])*)(:\\d*)?)' + 4342 '(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\' + 4343 'uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)' + 4344 '*|(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\' + 4345 'uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)+' + 4346 '(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\' + 4347 'uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|' + 4348 '@)*)*)?)|((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\' + 4349 'uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\' + 4350 '+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\' + 4351 'uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\' + 4352 '(\\)\\*\\+,;=]|:|@)*)*)|((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\' + 4353 'uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\' + 4354 '$&\'\\(\\)\\*\\+,;=]|:|@)){0})(\\?((([a-z]|\\d|-|\\.|_|~|' + 4355 '[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]' + 4356 '{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|[\\uE000-\\uF8FF]|\\/|' + 4357 '\\?)*)?(\\#((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\' + 4358 'uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\' + 4359 '+,;=]|:|@)|\\/|\\?)*)?$', 'i'), 4360 4361 number: /^[+\-]?(\d+([.,]\d+)?)+([eE][+-]?\d+)?$/, 4362 4363 // Regex from Scott Gonzalez Common URL: 4364 // http://projects.scottsplayground.com/iri/demo/common.html 4365 url: new RegExp('^(https?|ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\' + 4366 'u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})' + 4367 '|[!\\$&\'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|' + 4368 '2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25' + 4369 '[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.' + 4370 '(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d' + 4371 '|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\' + 4372 'd|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|' + 4373 '-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*' + 4374 '([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\' + 4375 '.)*(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|' + 4376 '(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]' + 4377 '|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])' + 4378 '*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)' + 4379 '(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\' + 4380 'uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]' + 4381 '|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF' + 4382 '\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)' + 4383 '*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\' + 4384 'uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|' + 4385 ':|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|_|~|' + 4386 '[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})' + 4387 '|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$', 'i') 4388 }, 4389 4390 RULES: { 4391 acceptFiles: function(val, node, ruleValue) { 4392 var regex = null; 4393 4394 if (isString(ruleValue)) { 4395 var extensions = ruleValue.replace(/\./g, '').split(/,\s*|\b\s*/); 4396 4397 extensions = A.Array.map(extensions, A.Escape.regex); 4398 4399 regex = getRegExp('[.](' + extensions.join('|') + ')$', 'i'); 4400 } 4401 4402 return regex && regex.test(val); 4403 }, 4404 4405 date: function(val) { 4406 var date = new Date(val); 4407 4408 return (isDate(date) && (date !== 'Invalid Date') && !isNaN(date)); 4409 }, 4410 4411 equalTo: function(val, node, ruleValue) { 4412 var comparator = A.one(ruleValue); 4413 4414 return comparator && (trim(comparator.val()) === val); 4415 }, 4416 4417 hasValue: function(val, node) { 4418 var instance = this; 4419 4420 if (A.FormValidator.isCheckable(node)) { 4421 var name = node.get('name'), 4422 elements = A.all(instance.getFieldsByName(name)); 4423 4424 return (elements.filter(':checked').size() > 0); 4425 } 4426 else { 4427 return !!val; 4428 } 4429 }, 4430 4431 max: function(val, node, ruleValue) { 4432 return (Lang.toFloat(val) <= ruleValue); 4433 }, 4434 4435 maxLength: function(val, node, ruleValue) { 4436 return (val.length <= ruleValue); 4437 }, 4438 4439 min: function(val, node, ruleValue) { 4440 return (Lang.toFloat(val) >= ruleValue); 4441 }, 4442 4443 minLength: function(val, node, ruleValue) { 4444 return (val.length >= ruleValue); 4445 }, 4446 4447 range: function(val, node, ruleValue) { 4448 var num = Lang.toFloat(val); 4449 4450 return (num >= ruleValue[0]) && (num <= ruleValue[1]); 4451 }, 4452 4453 rangeLength: function(val, node, ruleValue) { 4454 var length = val.length; 4455 4456 return (length >= ruleValue[0]) && (length <= ruleValue[1]); 4457 }, 4458 4459 required: function(val, node, ruleValue) { 4460 var instance = this; 4461 4462 if (ruleValue === true) { 4463 return defaults.RULES.hasValue.apply(instance, [val, node]); 4464 } 4465 else { 4466 return true; 4467 } 4468 } 4469 } 4470}); 4471 4472/** 4473 * A base class for `A.FormValidator`. 4474 * 4475 * @class A.FormValidator 4476 * @extends Base 4477 * @param {Object} config Object literal specifying widget configuration 4478 * properties. 4479 * @constructor 4480 * @include http://alloyui.com/examples/form-validator/basic-markup.html 4481 * @include http://alloyui.com/examples/form-validator/basic.js 4482 */ 4483var FormValidator = A.Component.create({ 4484 4485 /** 4486 * Static property provides a string to identify the class. 4487 * 4488 * @property NAME
4489 * @type String 4490 * @static 4491 */ 4492 NAME: 'form-validator', 4493 4494 /** 4495 * Static property used to define the default attribute 4496 * configuration for the `A.FormValidator`. 4497 * 4498 * @property ATTRS 4499 * @type Object 4500 * @static 4501 */ 4502 ATTRS: { 4503 4504 /** 4505 * The widget's outermost node, used for sizing and positioning. 4506 * 4507 * @attribute boundingBox 4508 */ 4509 boundingBox: { 4510 setter: A.one 4511 }, 4512 4513 /** 4514 * Container for the CSS error class. 4515 * 4516 * @attribute containerErrorClass 4517 * @type String 4518 */ 4519 containerErrorClass: { 4520 value: CSS_HAS_ERROR, 4521 validator: isString 4522 }, 4523 4524 /** 4525 * Container for the CSS valid class. 4526 * 4527 * @attribute containerValidClass 4528 * @type String 4529 */ 4530 containerValidClass: { 4531 value: CSS_HAS_SUCCESS, 4532 validator: isString 4533 }, 4534 4535 /** 4536 * Defines the CSS error class. 4537 * 4538 * @attribute errorClass
4539 * @type String 4540 */ 4541 errorClass: { 4542 value: CSS_ERROR_FIELD, 4543 validator: isString 4544 }, 4545 4546 /** 4547 * If `true` the validation rules are extracted from the DOM. 4548 * 4549 * @attribute extractRules 4550 * @default true 4551 * @type Boolean 4552 */ 4553 extractRules: { 4554 value: true, 4555 validator: isBoolean 4556 }, 4557 4558 /** 4559 * Container for a field. 4560 * 4561 * @attribute fieldContainer 4562 * @type String 4563 */ 4564 fieldContainer: { 4565 value: '.' + CSS_FORM_GROUP 4566 }, 4567 4568 /** 4569 * Collection of strings used on a field. 4570 * 4571 * @attribute fieldStrings 4572 * @default {} 4573 * @type Object 4574 */ 4575 fieldStrings: { 4576 value: {}, 4577 validator: isObject 4578 }, 4579 4580 /** 4581 * The CSS class for `<label>`. 4582 * 4583 * @attribute labelCssClass 4584 * @default 'control-label' 4585 * @type Str
4585ing 4586 */ 4587 labelCssClass: { 4588 validator: isString, 4589 value: 'control-label' 4590 }, 4591 4592 /** 4593 * Container for the form message. 4594 * 4595 * @attribute messageContainer 4596 * @default '<div role="alert"></div>' 4597 */ 4598 messageContainer: { 4599 getter: function(val) { 4600 return A.Node.create(val).clone(); 4601 }, 4602 value: TPL_MESSAGE 4603 }, 4604 4605 /** 4606 * Collection of rules to validate fields. 4607 * 4608 * @attribute rules 4609 * @default {} 4610 * @type Object 4611 */ 4612 rules: { 4613 getter: function(val) { 4614 var instance = this; 4615 if (!instance._rulesAlreadyExtracted) { 4616 instance._extractRulesFromMarkup(val); 4617 } 4618 return val; 4619 }, 4620 validator: isObject, 4621 value: {} 4622 }, 4623 4624 /** 4625 * Defines if the text will be selected or not after validation. 4626 * 4627 * @attribute selectText 4628 * @default true 4629 * @type Boolean 4630 */ 4631 selectText: { 4632 value: true, 4633 validator: isBoolean 4634 }, 4635 4636 /** 4637 * Defines if the validation messages will be showed or not. 4638 * 4639 * @attribute showMessages 4640 * @default true 4641 * @type Boolean 4642 */ 4643 showMessages: { 4644 value: true, 4645 validator: isBoolean 4646 }, 4647 4648 /** 4649 * Defines if all validation messages will be showed or not. 4650 * 4651 * @attribute showAllMessages 4652 * @default false 4653 * @type Boolean 4654 */ 4655 showAllMessages: { 4656 value: false, 4657 validator: isBoolean 4658 }, 4659 4660 /** 4661 * List of CSS selectors for targets that will not get validated 4662 * 4663 * @attribute skipValidationTargetSelectors 4664 * @default 'a[class=btn-cancel' 4665 */ 4666 skipValidationTargetSelector: { 4667 value: 'a[class~=btn-cancel]' 4668 }, 4669 4670 /** 4671 * Defines a container for the stack errors. 4672 * 4673 * @attribute stackErrorContainer 4674 */ 4675 stackErrorContainer: { 4676 getter: function(val) { 4677 return A.Node.create(val).clone(); 4678 }, 4679 value: TPL_STACK_ERROR 4680 }, 4681 4682 /** 4683 * Collection of strings used to label elements of the UI. 4684 * 4685 * @attribute strings 4686 * @type Object 4687 */ 4688 strings: { 4689 valueFn: function() { 4690 return defaults.STRINGS; 4691 } 4692 }, 4693 4694 /** 4695 * If `true` the field will be validated on blur event. 4696 * 4697 * @attribute validateOnBlur 4698 * @default true 4699 * @type Boolean 4700 */ 4701 validateOnBlur: { 4702 value: true, 4703 validator: isBoolean 4704 }, 4705 4706 /** 4707 * If `true` the field will be validated on input event. 4708 * 4709 * @attribute validateOnInput 4710 * @default false 4711 * @type Boolean 4712 */ 4713 validateOnInput: { 4714 value: false, 4715 validator: isBoolean 4716 }, 4717 4718 /** 4719 * Defines the CSS valid class. 4720 * 4721 * @attribute validClass
4722 * @type String 4723 */ 4724 validClass: { 4725 value: CSS_SUCCESS_FIELD, 4726 validator: isString 4727 } 4728 }, 4729 4730 /** 4731 * Creates custom rules from user input. 4732 * 4733 * @method _setCustomRules 4734 * @param object 4735 * @protected 4736 */ 4737 _setCustomRules: function(object) { 4738 A.each( 4739 object, 4740 function(rule, fieldName) { 4741 A.config.FormValidator.RULES[fieldName] = rule.condition; 4742 A.config.FormValidator.STRINGS[fieldName] = rule.errorMessage; 4743 } 4744 ); 4745 }, 4746 4747 /** 4748 * Ability to add custom validation rules. 4749 * 4750 * @method customRules 4751 * @param object 4752 * @public 4753 * @static 4754 */ 4755 addCustomRules: function(object) { 4756 var instance = this; 4757 4758 if (isObject(object)) { 4759 instance._setCustomRules(object); 4760 } 4761 }, 4762 4763 /** 4764 * Checks if a node is a checkbox or radio input. 4765 * 4766 * @method isCheckable 4767 * @param node 4768 * @private 4769 * @return {Boolean} 4770 */ 4771 isCheckable: function(node) { 4772 var nodeType = node.get('type').toLowerCase(); 4773 4774 return (nodeType === 'checkbox' || nodeType === 'radio'); 4775 }, 4776 4777 /** 4778 * Static property used to define which component it extends. 4779 * 4780 * @property EXTENDS 4781 * @type Object 4782 * @static 4783 */ 4784 EXTENDS: A.Base, 4785 4786 prototype: { 4787 4788 /** 4789 * Construction logic executed during `A.FormValidator` instantiation. 4790 * Lifecycle. 4791 * 4792 * @method initializer 4793 * @protected 4794 */ 4795 initializer: function() { 4796 var instance = this; 4797 4798 instance.errors = {}; 4799 instance._blurHandlers = null; 4800 instance._fileBlurHandlers = null; 4801 instance._fileInputHandlers = null; 4802 instance._inputHandlers = null; 4803 instance._rulesAlreadyExtracted = false; 4804 instance._stackErrorContainers = {}; 4805 4806 instance.bindUI(); 4807 instance._uiSetValidateOnBlur(instance.get('validateOnBlur')); 4808 instance._uiSetValidateOnInput(instance.get('validateOnInput')); 4809 }, 4810 4811 /** 4812 * Bind the events on the `A.FormValidator` UI. Lifecycle. 4813 * 4814 * @method bindUI 4815 * @protected 4816 */ 4817 bindUI: function() { 4818 var instance = this, 4819 boundingBox = instance.get('boundingBox'); 4820 4821 var onceFocusHandler = boundingBox.delegate('focus', function() { 4822 instance._setARIARoles(); 4823 onceFocusHandler.detach(); 4824 }, 'input,select,textarea,button'); 4825 4826 instance.publish({ 4827 errorField: { 4828 defaultFn: instance._defErrorFieldFn 4829 }, 4830 validField: { 4831 defaultFn: instance._defValidFieldFn 4832 }, 4833 validateField: { 4834 defaultFn: instance._defValidateFieldFn 4835 } 4836 }); 4837 4838 boundingBox.on({ 4839 reset: A.bind(instance._onFormReset, instance), 4840 submit: A.bind(instance._onFormSubmit, instance) 4841 }); 4842 4843 instance.after({ 4844 extractRulesChange: instance._afterExtractRulesChange, 4845 validateOnBlurChange: instance._afterValidateOnBlurChange, 4846 validateOnInputChange: instance._afterValidateOnInputChange 4847 }); 4848 }, 4849 4850 /** 4851 * Adds a validation error in the field. 4852 * 4853 * @method addFieldError 4854 * @param {Node} field 4855 * @param ruleName 4856 */ 4857 addFieldError: function(field, ruleName) { 4858 var instance = this, 4859 errors = instance.errors, 4860 name = field.get('name'); 4861 4862 if (!errors[name]) { 4863 errors[name] = []; 4864 } 4865 4866 errors[name].push(ruleName); 4867 }, 4868 4869 /** 4870 * Deletes the field from the errors property object. 4871 * 4872 * @method clearFieldError 4873 * @param {Node|String} field 4874 */ 4875 clearFieldError: function(field) { 4876 var fieldName = isNode(field) ? field.get('name') : field; 4877 4878 if (isString(fieldName)) { 4879 delete this.errors[fieldName]; 4880 } 4881 }, 4882 4883 /** 4884 * Executes a function to each rule. 4885 * 4886 * @method eachRule 4887 * @param fn 4888 */ 4889 eachRule: function(fn) { 4890 var instance = this; 4891 4892 A.each( 4893 instance.get('rules'), 4894 function(rule, fieldName) { 4895 if (isFunction(fn)) { 4896 fn.apply(instance, [rule, fieldName]); 4897 } 4898 } 4899 ); 4900 }, 4901 4902 /** 4903 * Gets the ancestor of a given field. 4904 * 4905 * @method findFieldContainer 4906 * @param {Node} field 4907 * @return {Node} 4908 */ 4909 findFieldContainer: function(field) { 4910 var instance = this, 4911 fieldContainer = instance.get('fieldContainer'), 4912 retVal = field.ancestor(); 4913 4914 if (fieldContainer && field.ancestor(fieldContainer)) { 4915 retVal = field.ancestor(fieldContainer); 4916 } 4917 4918 return retVal; 4919 }, 4920 4921 /** 4922 * Focus on the invalid field. 4923 *
4924 * @method focusInvalidField 4925 */ 4926 focusInvalidField: function() { 4927 var instance = this, 4928 boundingBox = instance.get('boundingBox'), 4929 field = boundingBox.one('.' + CSS_ERROR_FIELD); 4930 4931 if (field) { 4932 field = instance.findFieldContainer(field); 4933 4934 if (instance.get('selectText')) { 4935 field.selectText(); 4936 } 4937 4938 field.focus(); 4939 4940 field.scrollIntoView(false); 4941 4942 window.scrollBy(0, field.getDOM().scrollHeight); 4943 } 4944 }, 4945 4946 /** 4947 * Gets a field from the form. 4948 * 4949 * @method getField 4950 * @param {Node|String} field 4951 * @return {Node} 4952 */ 4953 getField: function(field) { 4954 var instance = this; 4955 4956 if (isString(field)) { 4957 field = instance.getFieldsByName(field); 4958 4959 if (field && field.length && !field.name) { 4960 field = field[0]; 4961 } 4962 } 4963 4964 return A.one(field); 4965 }, 4966 4967 /** 4968 * Gets a list of fields based on its name. 4969 * 4970 * @method getFieldsByName 4971 * @param fieldName 4972 * @return {NodeList} 4973 */ 4974 getFieldsByName: function(fieldName) { 4975 var instance = this, 4976 domBoundingBox = instance.get('boundingBox').getDOM(); 4977 4978 return domBoundingBox.elements[fieldName]; 4979 }, 4980 4981 /** 4982 * Gets a list of fields with errors. 4983 * 4984 * @method getFieldError 4985 * @param {Node} field 4986 * @return {String} 4987 */ 4988 getFieldError: function(field) { 4989 var instance = this; 4990 4991 return instance.errors[field.get('name')]; 4992 }, 4993 4994 /** 4995 * Gets the stack error container of a field. 4996 * 4997 * @method getFieldStackErrorContainer 4998 * @param {Node|String} field 4999 * @return {Node} 5000 */ 5001 getFieldStackErrorContainer: function(field) { 5002 var instance = this, 5003 name = isNode(field) ? field.get('name') : field, 5004 stackContainers = instance._stackErrorContainers; 5005 5006 if (!stackContainers[name]) { 5007 stackContainers[name] = instance.get('stackErrorContainer'); 5008 } 5009 5010 return stackContainers[name]; 5011 }, 5012 5013 /** 5014 * Gets the error message of a field. 5015 * 5016 * @method getFieldErrorMessage 5017 * @param {Node} field 5018 * @param rule 5019 * @return {String} 5020 */ 5021 getFieldErrorMessage: function(field, rule) { 5022 var instance = this, 5023 fieldName = field.get('name'), 5024 fieldStrings = instance.get('fieldStrings')[fieldName] || {}, 5025 fieldRules = instance.get('rules')[fieldName], 5026 fieldLabel = instance._findFieldLabel(field), 5027 strings = instance.get('strings'), 5028 substituteRulesMap = {}; 5029 5030 if (fieldLabel) { 5031 substituteRulesMap.field = fieldLabel; 5032 } 5033 5034 if (rule in fieldRules) { 5035 var ruleValue = A.Array(fieldRules[rule]); 5036 5037 A.each( 5038 ruleValue, 5039 function(value, index) { 5040 substituteRulesMap[index] = [value].join(''); 5041 } 5042 ); 5043 } 5044 5045 var message = (fieldStrings[rule] || strings[rule] || strings.DEFAULT); 5046 5047 return Lang.sub(message, substituteRulesMap); 5048 }, 5049 5050 /** 5051 * Returns `true` if there are errors. 5052 * 5053 * @method hasErrors 5054 * @return {Boolean} 5055 */ 5056 hasErrors: function() { 5057 var instance = this; 5058 5059 return !isEmpty(instance.errors); 5060 }, 5061 5062 /** 5063 * Highlights a field with error or success. 5064 * 5065 * @method highlight 5066 * @param {Node} field 5067 * @param valid 5068 */ 5069 highlight: function(field, valid) { 5070 var instance = this, 5071 fieldContainer, 5072 fieldName, 5073 namedFieldNodes; 5074 5075 if (field) { 5076 fieldContainer = instance.findFieldContainer(field); 5077 5078 fieldName = field.get('name'); 5079 5080 if (this.validatable(field)) { 5081 namedFieldNodes = A.all(instance.getFieldsByName(fieldName)); 5082 5083 namedFieldNodes.each( 5084 function(node) { 5085 instance._highlightHelper( 5086 node, 5087 instance.get('errorClass'), 5088 instance.get('validClass'),
5089 valid 5090 ); 5091 } 5092 ); 5093 5094 if (fieldContainer) { 5095 instance._highlightHelper( 5096 fieldContainer, 5097 instance.get('containerErrorClass'), 5098 instance.get('containerValidClass'), 5099 valid 5100 ); 5101 } 5102 } 5103 else if (!field.val()) { 5104 instance.resetField(fieldName); 5105 } 5106 } 5107 }, 5108 5109 /** 5110 * Normalizes rule value. 5111 * 5112 * @method normalizeRuleValue 5113 * @param ruleValue 5114 * @param {Node} field 5115 */ 5116 normalizeRuleValue: function(ruleValue, field) { 5117 var instance = this; 5118 5119 return isFunction(ruleValue) ? ruleValue.apply(instance, [field]) : ruleValue; 5120 }, 5121 5122 /** 5123 * Removes the highlight of a field. 5124 * 5125 * @method unhighlight 5126 * @param {Node} field 5127 */ 5128 unhighlight: function(field) { 5129 var instance = this; 5130 5131 instance.highlight(field, true); 5132 }, 5133 5134 /** 5135 * Prints the stack error messages into a container. 5136 * 5137 * @method printStackError 5138 * @param {Node} field 5139 * @param {Node} container 5140 * @param {Array} errors 5141 */ 5142 printStackError: function(field, container, errors) { 5143 var instance = this; 5144 5145 if (!instance.get('showAllMessages')) { 5146 if (A.Array.indexOf(errors, 'required') !== -1) { 5147 errors = ['required']; 5148 } 5149 else { 5150 errors = errors.slice(0, 1); 5151 } 5152 } 5153 5154 container.empty(); 5155 5156 A.Array.each( 5157 errors, 5158 function(error) { 5159 var message = instance.getFieldErrorMessage(field, error), 5160 messageEl = instance.get('messageContainer').addClass(error); 5161 5162 container.append( 5163 messageEl.html(message) 5164 ); 5165 } 5166 ); 5167 }, 5168 5169 /** 5170 * Resets the CSS class and content of all fields. 5171 * 5172 * @method resetAllFields 5173 */ 5174 resetAllFields: function() { 5175 var instance = this; 5176 5177 instance.eachRule( 5178 function(rule, fieldName) { 5179 instance.resetField(fieldName); 5180 } 5181 ); 5182 }, 5183 5184 /** 5185 * Resets the CSS class and error status of a field. 5186 * 5187 * @method resetField 5188 * @param {Node|String} field 5189 */ 5190 resetField: function(field) { 5191 var instance = this, 5192 fieldName, 5193 fieldRules, 5194 namedFieldNodes, 5195 stackContainer; 5196 5197 fieldName = isNode(field) ? field.get('name') : field; 5198 5199 if (fieldName) { 5200 fieldRules = instance.get('rules')[fieldName]; 5201 5202 if (fieldRules) { 5203 instance.clearFieldError(fieldName); 5204 5205 stackContainer = instance.getFieldStackErrorContainer(fieldName); 5206 5207 stackContainer.remove(); 5208 5209 namedFieldNodes = A.all(instance.getFieldsByName(fieldName)); 5210 5211 namedFieldNodes.each( 5212 function(node) { 5213 instance.resetFieldCss(node); 5214 node.removeAttribute('aria-errormessage'); 5215 node.removeAttribute('aria-invalid'); 5216 } 5217 ); 5218 } 5219 } 5220 }, 5221 5222 /** 5223 * Removes the CSS classes of a field. 5224 * 5225 * @method resetFieldCss 5226 * @param {Node} field 5227 */ 5228 resetFieldCss: function(field) { 5229 var instance = this, 5230 fieldContainer = instance.findFieldContainer(field); 5231 5232 var removeClasses = function(elem, classAttrs) { 5233 if (elem) { 5234 A.each(classAttrs, function(attrName) { 5235 elem.removeClass( 5236 instance.get(attrName) 5237 ); 5238 }); 5239 } 5240 }; 5241 5242 removeClasses(field, ['validClass', 'errorClass']); 5243 removeClasses(fieldContainer, ['containerValidClass', 'containerErrorClass']); 5244 }, 5245 5246 /** 5247 * Checks if a field can be validated or not. 5248 * 5249 * @method validatable 5250 * @param {Node} field 5251 * @return {Boolean} 5252 */ 5253 validatable: function(field) { 5254 var instance = this, 5255 validatable = false, 5256 fieldRules = instance.get('rules')[field.get('name')]; 5257 5258 if (fieldRules) { 5259 validatable = instance.normalizeRuleValue(fieldRules.required, field) || 5260 defaults.RULES.hasValue.apply(instance, [field.val(), field]); 5261 } 5262 5263 return !!validatable; 5264 }, 5265 5266 /** 5267 * Validates all fields. 5268 * 5269 * @method validate 5270 */ 5271 validate: function() { 5272 var instance = this; 5273 5274 instance.eachRule( 5275 function(rule, fieldName) { 5276 instance.validateField(fieldName); 5277 } 5278 ); 5279 5280 instance.focusInvalidField(); 5281 }, 5282 5283 /** 5284 * Validates a single field. 5285 * 5286 * @method validateField 5287 * @param {Node|String} field 5288 */ 5289 validateField: function(field) { 5290 var fieldNode, 5291 validatable; 5292 5293 this.resetField(field); 5294 fieldNode = isString(field) ? this.getField(field) : field; 5295 5296 if (isNode(fieldNode)) { 5297 validatable = this.validatable(fieldNode); 5298 5299 if (validatable) { 5300 this.fire('validateField', { 5301 validator: { 5302 field: fieldNode 5303 } 5304 }); 5305 } 5306 } 5307 }, 5308 5309 /** 5310 * Fires after `extractRules` attribute change. 5311 *
5312 * @method _afterExtractRulesChange 5313 * @param event 5314 * @protected 5315 */ 5316 _afterExtractRulesChange: function(event) { 5317 var instance = this; 5318 5319 instance._uiSetExtractRules(event.newVal); 5320 }, 5321 5322 /** 5323 * Fires after `validateOnBlur` attribute change. 5324 * 5325 * @method _afterValidateOnBlurChange 5326 * @param event 5327 * @protected 5328 */ 5329 _afterValidateOnBlurChange: function(event) { 5330 var instance = this; 5331 5332 instance._uiSetValidateOnBlur(event.newVal); 5333 }, 5334 5335 /** 5336 * Fires after `validateOnInput` attribute change. 5337 * 5338 * @method _afterValidateOnInputChange 5339 * @param event 5340 * @protected 5341 */ 5342 _afterValidateOnInputChange: function(event) { 5343 var instance = this; 5344 5345 instance._uiSetValidateOnInput(event.newVal); 5346 }, 5347 5348 /** 5349 * Defines an error field. 5350 * 5351 * @method _defErrorFieldFn 5352 * @param event 5353 * @protected 5354 */ 5355 _defErrorFieldFn: function(event) { 5356 var instance = this, 5357 field, 5358 label, 5359 stackContainer, 5360 target, 5361 validator; 5362 5363 label = instance.get('labelCssClass'); 5364 validator = event.validator; 5365 field = validator.field; 5366 5367 instance.highlight(field); 5368 5369 if (instance.get('showMessages')) { 5370 target = field; 5371 5372 stackContainer = instance.getFieldStackErrorContainer(field); 5373 5374 if (A.FormValidator.isCheckable(target)) { 5375 target = field.ancestor('.' + CSS_HAS_ERROR).get('lastChild'); 5376 } 5377 5378 var id = field.get('id') + 'Helper'; 5379 5380 stackContainer.set('id', id); 5381 5382 target.placeAfter(stackContainer); 5383 5384 instance.printStackError( 5385 field, 5386 stackContainer, 5387 validator.errors 5388 ); 5389 } 5390 }, 5391 5392 /** 5393 * Defines a valid field. 5394 * 5395 * @method _defValidFieldFn 5396 * @param event 5397 * @protected 5398 */ 5399 _defValidFieldFn: function(event) { 5400 var instance = this; 5401 5402 var field = event.validator.field; 5403 5404 instance.unhighlight(field); 5405 }, 5406 5407 /** 5408 * Defines the validation of a field. 5409 * 5410 * @method _defValidateFieldFn 5411 * @param event 5412 * @protected 5413 */ 5414 _defValidateFieldFn: function(event) { 5415 var instance = this; 5416 5417 var field = event.validator.field; 5418 var fieldRules = instance.get('rules')[field.get('name')]; 5419 5420 A.each( 5421 fieldRules, 5422 function(ruleValue, ruleName) { 5423 var rule = defaults.RULES[ruleName]; 5424 var fieldValue = trim(field.val()); 5425 5426 ruleValue = instance.normalizeRuleValue(ruleValue, field); 5427 5428 if (isFunction(rule) && !rule.apply(instance, [fieldValue, field, ruleValue])) { 5429 5430 instance.addFieldError(field, ruleName); 5431 } 5432 } 5433 ); 5434 5435 var fieldErrors = instance.getFieldError(field); 5436 5437 if (fieldErrors) { 5438 instance.fire('errorField', { 5439 validator: { 5440 field: field, 5441 errors: fieldErrors 5442 } 5443 }); 5444 } 5445 else { 5446 instance.fire('validField', { 5447 validator: { 5448 field: field 5449 } 5450 }); 5451 } 5452 }, 5453 5454 /** 5455 * Finds the label text of a field if existing. 5456 * 5457 * @method _findFieldLabel 5458 * @param {Node} field 5459 * @return {String} 5460 */ 5461 _findFieldLabel: function(field) { 5462 var labelCssClass = '.' + this.get('labelCssClass'),
5463 label = A.one('label[for=' + field.get('id') + ']') || 5464 field.ancestor().previous(labelCssClass); 5465 5466 if (!label) { 5467 label = field.ancestor('.' + CSS_HAS_ERROR); 5468 5469 if (label) { 5470 label = label.one(labelCssClass); 5471 } 5472 } 5473 5474 if (label) { 5475 return label.get('text'); 5476 } 5477 }, 5478 5479 /** 5480 * Sets the error/success CSS classes based on the validation of a 5481 * field. 5482 * 5483 * @method _highlightHelper 5484 * @param {Node} field 5485 * @param {String} errorClass 5486 * @param {String} validClass 5487 * @param {Boolean} valid 5488 * @protected 5489 */ 5490 _highlightHelper: function(field, errorClass, validClass, valid) { 5491 var instance = this; 5492 5493 if (valid) { 5494 field.removeClass(errorClass).addClass(validClass); 5495 5496 if (validClass === CSS_SUCCESS_FIELD) { 5497 field.removeAttribute('aria-errormessage'); 5498 field.removeAttribute('aria-invalid'); 5499 } 5500 } 5501 else { 5502 field.removeClass(validClass).addClass(errorClass); 5503 5504 if (errorClass === CSS_ERROR_FIELD) { 5505 field.set('aria-errormessage', field.get('id') + 'Helper'); 5506 field.set('aria-invalid', true); 5507 } 5508 } 5509 }, 5510 5511 /** 5512 * Extracts form rules from the DOM. 5513 * 5514 * @method _extractRulesFromMarkup 5515 * @param rules 5516 * @protected 5517 */ 5518 _extractRulesFromMarkup: function(rules) { 5519 var instance = this, 5520 domBoundingBox = instance.get('boundingBox').getDOM(), 5521 elements = domBoundingBox.elements, 5522 defaultRulesKeys = AObject.keys(defaults.RULES), 5523 defaultRulesJoin = defaultRulesKeys.join('|'), 5524 regex = getRegExp('field-(' + defaultRulesJoin + ')', 'g'), 5525 i, 5526 length, 5527 ruleNameMatch = [], 5528 ruleMatcher = function(m1, m2) { 5529 ruleNameMatch.push(m2); 5530 }; 5531 5532 for (i = 0, length = elements.length; i < length; i++) { 5533 var el = elements[i], 5534 fieldName = el.name; 5535 5536 el.className.replace(regex, ruleMatcher); 5537 5538 if (ruleNameMatch.length) { 5539 var fieldRules = rules[fieldName], 5540 j, 5541 ruleNameLength; 5542 5543 if (!fieldRules) { 5544 fieldRules = {}; 5545 rules[fieldName] = fieldRules; 5546 } 5547 for (j = 0, ruleNameLength = ruleNameMatch.length; j < ruleNameLength; j++) { 5548 var rule = ruleNameMatch[j]; 5549 5550 if (!(rule in fieldRules)) { 5551 fieldRules[rule] = true; 5552 } 5553 } 5554 ruleNameMatch.length = 0; 5555 } 5556 } 5557 5558 instance._rulesAlreadyExtracted = true; 5559 }, 5560 5561 /** 5562 * Triggers when there's an input in the field. 5563 * 5564 * @method _onFieldInput 5565 * @param event 5566 * @protected 5567 */ 5568 _onFieldInput: function(event) { 5569 var instance = this; 5570 5571 var skipValidationTargetSelector = instance.get('skipValidationTargetSelector'); 5572 5573 if (!event.relatedTarget || !event.relatedTarget.getDOMNode().matches(skipValidationTargetSelector)) { 5574 setTimeout( 5575 function() { 5576 instance.validateField(event.target); 5577 }, 5578 300 5579 ); 5580 } 5581 }, 5582 5583 /** 5584 * Triggers when the form is submitted. 5585 * 5586 * @method _onFormSubmit 5587 * @param event 5588 * @protected 5589 */ 5590 _onFormSubmit: function(event) { 5591 var instance = this; 5592 5593 var data = { 5594 validator: { 5595 formEvent: event 5596 } 5597 }; 5598 5599 instance.validate(); 5600 5601 if (instance.hasErrors()) { 5602 data.validator.errors = instance.errors; 5603 5604 instance.fire('submitError', data); 5605 5606 event.halt(); 5607 } 5608 else { 5609 instance.fire('submit', data); 5610 } 5611 }, 5612 5613 /** 5614 * Triggers when the form is reseted. 5615 * 5616 * @method _onFormReset 5617 * @param event 5618 * @protected 5619 */ 5620 _onFormReset: function() { 5621 var instance = this; 5622 5623 instance.resetAllFields(); 5624 }, 5625 5626 /** 5627 * Sets the aria roles. 5628 * 5629 * @method _setARIARoles 5630 * @protected 5631 */ 5632 _setARIARoles: function() { 5633 var instance = this; 5634 5635 instance.eachRule( 5636 function(rule, fieldName) { 5637 var field = instance.getField(fieldName); 5638 5639 var required = instance.normalizeRuleValue(rule.required, field); 5640 5641 if (required) { 5642 if (field && !field.attr('aria-required')) { 5643 field.attr('aria-required', true); 5644 } 5645 } 5646 } 5647 ); 5648 }, 5649 5650 /** 5651 * Sets the `extractRules` attribute on the UI. 5652 * 5653 * @method _uiSetExtractRules 5654 * @param val 5655 * @protected 5656 */ 5657 _uiSetExtractRules: function(val) { 5658 var instance = this; 5659 if (val) { 5660 instance._extractRulesFromMarkup(instance.get('rules')); 5661 } 5662 }, 5663 5664 /** 5665 * Sets the `validateOnInput` attribute on the UI. 5666 * 5667 * @method _uiSetValidateOnInput 5668 * @param val 5669 * @protected 5670 */ 5671 _uiSetValidateOnInput: function(val) { 5672 var instance = this, 5673 boundingBox = instance.get('boundingBox'); 5674 5675 if (val) { 5676 if (!instance._inputHandlers) { 5677 instance._inputHandlers = boundingBox.delegate('input', instance._onFieldInput, 5678 'input:not([type="file"]),select,textarea,button', instance); 5679 } 5680 5681 if (!instance._fileInputHandlers) { 5682 instance._fileInputHandlers = boundingBox.delegate('change', instance._onFieldInput, 5683 'input[type="file"]', instance); 5684 } 5685 } 5686 else { 5687 if (instance._inputHandlers) { 5688 instance._inputHandlers.detach(); 5689 } 5690 5691 if (instance._fileInputHandlers) { 5692 instance._fileInputHandlers.detach(); 5693 } 5694 } 5695 }, 5696 5697 /** 5698 * Sets the `validateOnBlur` attribute on the UI. 5699 * 5700 * @method _uiSetValidateOnBlur 5701 * @param val 5702 * @protected 5703 */ 5704 _uiSetValidateOnBlur: function(val) { 5705 var instance = this, 5706 boundingBox = instance.get('boundingBox'); 5707 5708 if (val) { 5709 if (!instance._blurHandlers) { 5710 instance._blurHandlers = boundingBox.delegate('blur', instance._onFieldInput, 5711 'input:not([type="file"]),select,textarea,button', instance); 5712 } 5713 5714 if (!instance._fileBlurHandlers) { 5715 instance._fileBlurHandlers = boundingBox.delegate('change', instance._onFieldInput, 5716 'input[type="file"]', instance); 5717 } 5718 } 5719 else { 5720 if (instance._blurHandlers) { 5721 instance._blurHandlers.detach(); 5722 } 5723 5724 if (instance._fileBlurHandlers) { 5725 instance._fileBlurHandlers.detach(); 5726 } 5727 } 5728 } 5729 } 5730}); 5731 5732A.each( 5733 defaults.REGEX, 5734 function(regex, key) { 5735 defaults.RULES[key] = function(val) { 5736 return defaults.REGEX[key].test(val); 5737 }; 5738 } 5739); 5740 5741A.FormValidator = FormValidator; 5742 5743}, '3.1.0-deprecated.95', { 5744 "requires": [ 5745 "escape", 5746 "selector-css3", 5747 "node-event-delegate", 5748 "aui-node", 5749 "aui-component", 5750 "aui-event-input" 5751 ] 5752}); 5753 5754YUI.add('aui-node-base', function (A, NAME) { 5755 5756/** 5757 * A set of utility methods to the Node. 5758 * 5759 * @module aui-node 5760 * @submodule aui-node-base 5761 */ 5762 5763var Lang = A.Lang, 5764 isArray = Lang.isArray, 5765 isFunction = Lang.isFunction, 5766 isObject = Lang.isObject, 5767 isString = Lang.isString, 5768 isUndefined = Lang.isUndefined, 5769 isValue = Lang.isValue, 5770 5771 AArray = A.Array, 5772 ANode = A.Node, 5773 ANodeList = A.NodeList, 5774 5775 getClassName = A.getClassName, 5776 getRegExp = A.DOM._getRegExp, 5777 5778 CONFIG = A.config, 5779 DOC = CONFIG.doc, 5780 WIN = CONFIG.win, 5781 5782 NODE_PROTO = ANode.prototype, 5783 NODE_PROTO_HIDE = NODE_PROTO._hide, 5784 NODE_PROTO_SHOW = NODE_PROTO._show, 5785 NODELIST_PROTO = ANodeList.prototype, 5786 5787 ARRAY_EMPTY_STRINGS = ['', ''], 5788 5789 CSS_HIDE = getClassName('hide'), 5790 CSS_UNSELECTABLE_VALUE = 'none', 5791 CSS_SELECTABLE_VALUE = 'text', 5792 5793 SUPPORT_CLONED_EVENTS = false, 5794 5795 MAP_BORDER = { 5796 b: 'borderBottomWidth', 5797 l: 'borderLeftWidth', 5798 r: 'borderRightWidth', 5799 t: 'borderTopWidth' 5800 }, 5801 MAP_MARGIN = { 5802 b: 'marginBottom', 5803 l: 'marginLeft', 5804 r: 'marginRight', 5805 t: 'marginTop' 5806 }, 5807 MAP_PADDING = { 5808 b: 'paddingBottom', 5809 l: 'paddingLeft', 5810 r: 'paddingRight', 5811 t: 'paddingTop' 5812 }; 5813 5814/* Parts of this file are used from jQuery (http://jquery.com) 5815 * Dual-licensed under MIT/GPL 5816 */ 5817var div = DOC.createElement('div'); 5818 5819div.style.display = 'none'; 5820div.innerHTML = ' <table></table> '; 5821 5822if (div.attachEvent && div.fireEvent) { 5823 div.attachEvent( 5824 'onclick', 5825 function detach() { 5826 SUPPORT_CLONED_EVENTS = true; 5827 5828 div.detachEvent('onclick', detach); 5829 } 5830 ); 5831 5832 div.cloneNode(true).fireEvent('onclick'); 5833} 5834 5835var SUPPORT_OPTIONAL_TBODY = !div.getElementsByTagName('tbody').length; 5836 5837var REGEX_LEADING_WHITE_SPACE = /^\s+/, 5838 REGEX_IE8_ACTION = /\=([^=\x27\x22>\s]+\/)>/g, 5839 REGEX_TAGNAME = /<([\w:]+)/; 5840 5841div = null; 5842 5843var _setUnselectable = function(element, unselectable, noRecurse) { 5844 var descendants, 5845 value = unselectable ? 'on' : '', 5846 i, 5847 descendant; 5848 5849 element.setAttribute('unselectable', value); 5850 5851 if (!noRecurse) { 5852 descendants = element.getElementsByTagName('*'); 5853 5854 for (i = 0;
5855 (descendant = descendants[i]); i++) { 5856 descendant.setAttribute('unselectable', value); 5857 } 5858 } 5859}; 5860 5861/** 5862 * Augments the [YUI3 Node](Node.html) with more util methods. 5863 * 5864 * Check the [live demo](http://alloyui.com/examples/node/). 5865 * 5866 * @class A.Node 5867 * @uses Node 5868 * @constructor 5869 * @include http://alloyui.com/examples/node/basic-markup.html 5870 * @include http://alloyui.com/examples/node/basic.js 5871 */ 5872A.mix(NODE_PROTO, { 5873 5874 /** 5875 * Returns the current ancestors of the node element filtered by a 5876 * className. This is an optimized method for finding ancestors by a 5877 * specific CSS class name. 5878 * 5879 * Example: 5880 * 5881 * ``` 5882 * A.one('#nodeId').ancestorsByClassName('aui-hide'); 5883 * ``` 5884 * 5885 * @method ancestorsByClassName 5886 * @param {String} className A selector to filter the ancestor elements 5887 * against. 5888 * @param {Boolean} testSelf optional Whether or not to include the element 5889 * in the scan 5890 * @return {NodeList} 5891 */ 5892 ancestorsByClassName: function(className, testSelf) { 5893 var instance = this; 5894 5895 var ancestors = []; 5896 var cssRE = new RegExp('\\b' + className + '\\b'); 5897 var currentEl = instance.getDOM(); 5898 5899 if (!testSelf) { 5900 currentEl = currentEl.parentNode; 5901 } 5902 5903 while (currentEl && currentEl.nodeType !== 9) { 5904 if (currentEl.nodeType === 1 && cssRE.test(currentEl.className)) { 5905 ancestors.push(currentEl); 5906 } 5907 5908 currentEl = currentEl.parentNode; 5909 } 5910 5911 return A.all(ancestors); 5912 }, 5913 5914 /** 5915 * Gets or sets the value of an attribute for the first element in the set 5916 * of matched elements. If only the `name` is passed it works as a getter. 5917 * 5918 * Example: 5919 * 5920 * ``` 5921 * var node = A.one('#nodeId'); 5922 * node.attr('title', 'Setting a new title attribute'); 5923 * // Alert the value of the title attribute: 'Setting a new title attribute' 5924 * alert( node.attr('title') ); 5925 * ``` 5926 * 5927 * @method attr 5928 * @param {String} name The name of the attribute 5929 * @param {String} value The value of the attribute to be set. Optional. 5930 * @return {String} 5931 */ 5932 attr: function(name, value) { 5933 var instance = this, 5934 i; 5935 5936 if (!isUndefined(value)) { 5937 var el = instance.getDOM(); 5938 5939 if (name in el) { 5940 instance.set(name, value); 5941 } 5942 else { 5943 instance.setAttribute(name, value); 5944 } 5945 5946 return instance; 5947 } 5948 else { 5949 if (isObject(name)) { 5950 for (i in name) { 5951 if (name.hasOwnProperty(i)) { 5952 instance.attr(i, name[i]); 5953 } 5954 } 5955 5956 return instance; 5957 } 5958 5959 var currentValue = instance.get(name); 5960 5961 if (!Lang.isValue(currentValue)) { 5962 currentValue = instance.getAttribute(name); 5963 } 5964 5965 return currentValue; 5966 } 5967 }, 5968 5969 /** 5970 * Normalizes the behavior of cloning a node, which by default should not 5971 * clone the events that are attached to it. 5972 * 5973 * Example: 5974 * 5975 * ``` 5976 * var node = A.one('#nodeId'); 5977 * node.clone().appendTo('body'); 5978 * ``` 5979 * 5980 * @method clone 5981 * @return {Node} 5982 */ 5983 clone: (function() { 5984 var clone; 5985 5986 if (SUPPORT_CLONED_EVENTS) { 5987 clone = function() { 5988 var el = this.getDOM(); 5989 var clone; 5990 5991 if (el.nodeType !== 3) { 5992 var outerHTML = this.outerHTML(); 5993 5994 outerHTML = outerHTML.replace(REGEX_IE8_ACTION, '="$1">').replace(REGEX_LEADING_WHITE_SPACE, 5995 ''); 5996 5997 clone = ANode.create(outerHTML); 5998 } 5999 else { 6000 clone = A.one(el.cloneNode()); 6001 } 6002 6003 return clone; 6004 }; 6005 } 6006 else { 6007 clone = function() { 6008 return this.cloneNode(true); 6009 }; 6010 } 6011 6012 return clone; 6013 }()), 6014 6015 /** 6016 * Centralizes the current Node instance with the passed `val` Array, Node, 6017 * String, or Region, if not specified, the body will be used. 6018 * 6019 * Example: 6020 * 6021 * ``` 6022 * var node = A.one('#nodeId'); 6023 * // Center the `node` with the `#container`. 6024 * node.center('#container'); 6025 * ``` 6026 * 6027 * @method center 6028 * @chainable 6029 * @param {Array|Node|Region|String} val Array, Node, String, or Region to 6030 * center with. 6031 */ 6032 center: function(val) { 6033 var instance = this, 6034 nodeRegion = instance.get('region'), 6035 x, 6036 y; 6037 6038 if (isArray(val)) { 6039 x = val[0]; 6040 y = val[1]; 6041 } 6042 else { 6043 var region; 6044 6045 if (isObject(val) && !A.instanceOf(val, ANode)) { 6046 region = val; 6047 } 6048 else { 6049 region = (A.one(val) || A.getBody()).get('region'); 6050 } 6051 6052 x = region.left + (region.width / 2); 6053 y = region.top + (region.height / 2); 6054 } 6055 6056 instance.setXY([x - (nodeRegion.width / 2), y - (nodeRegion.height / 2)]); 6057 }, 6058 6059 /** 6060 * Removes not only child (and other descendant) elements, but also any text 6061 * within the set of matched elements. This is because, according to the DOM 6062 * specification, any string of text within an element is considered a child 6063 * node of that element. 6064 * 6065 * Example: 6066 * 6067 * ``` 6068 * var node = A.one('#nodeId'); 6069 * node.empty(); 6070 * ``` 6071 * 6072 * @method empty 6073 * @chainable 6074 */ 6075 empty: function() { 6076 var instance = this; 6077 6078 instance.all('>*').remove().purge(); 6079 6080 var el = ANode.getDOMNode(instance); 6081 6082 while (el.firstChild) { 6083 el.removeChild(el.firstChild); 6084 } 6085 6086 return instance; 6087 }, 6088 6089 /** 6090 * Retrieves the DOM node bound to a Node instance. See 6091 * [getDOMNode](Node.html#method_getDOMNode). 6092 * 6093 * @method getDOM 6094 * @return {HTMLNode} The DOM node bound to the Node instance. 6095 */ 6096 getDOM: function() { 6097 var instance = this; 6098 6099 return ANode.getDOMNode(instance); 6100 }, 6101 6102 /** 6103 * Returns the combined width of the border for the specified sides. 6104 * 6105 * @method getBorderWidth 6106 * @param {String} sides Can be t, r, b, l or any combination of those to 6107 * represent the top, right, bottom, or left sides. 6108 * @return {Number} 6109 */ 6110 getBorderWidth: function(sides) { 6111 var instance = this; 6112 6113 return instance._getBoxStyleAsNumber(sides, MAP_BORDER); 6114 }, 6115 6116 /** 6117 * Gets the current center position of the node in page coordinates. 6118 * 6119 * @method getCenterXY 6120 * @for Node 6121 * @return {Array} The XY position of the node 6122 */ 6123 getCenterXY: function() { 6124 var instance = this; 6125 var region = instance.get('region'); 6126 6127 return [(region.left + region.width / 2), (region.top + region.height / 2)]; 6128 }, 6129 6130 /** 6131 * Returns the combined size of the margin for the specified sides. 6132 * 6133 * @method getMargin 6134 * @param {String} sides Can be t, r, b, l or any combination of those to 6135 * represent the top, right, bottom, or left sides. 6136 * @return {Number} 6137 */ 6138 getMargin: function(sides) { 6139 var instance = this; 6140 6141 return instance._getBoxStyleAsNumber(sides, MAP_MARGIN); 6142 }, 6143 6144 /** 6145 * Returns the combined width of the border for the specified sides. 6146 * 6147 * @method getPadding 6148 * @param {String} sides Can be t, r, b, l or any combination of those to 6149 * represent the top, right, bottom, or left sides. 6150 * @return {Number} 6151 */ 6152 getPadding: function(sides) { 6153 var instance = this; 6154 6155 return instance._getBoxStyleAsNumber(sides, MAP_PADDING); 6156 }, 6157 6158 /** 6159 * Sets the id of the Node instance if the object does not have one. The 6160 * generated id is based on a guid created by the 6161 * [stamp](YUI.html#method_stamp) method. 6162 * 6163 * @method guid 6164 * @return {String} The current id of the node 6165 */ 6166 guid: function() { 6167 var instance = this; 6168 var currentId = instance.get('id'); 6169 6170 if (!currentId) { 6171 currentId = A.stamp(instance); 6172 6173 instance.set('id', currentId); 6174 } 6175 6176 return currentId; 6177 }, 6178 6179 /** 6180 * Creates a hover interaction. 6181 * 6182 * @method hover 6183 * @param {String} overFn 6184 * @param {String} outFn 6185 * @return {Node} The current Node instance 6186 */ 6187 hover: function(overFn, outFn) { 6188 var instance = this; 6189 6190 var hoverOptions; 6191 var defaultHoverOptions = instance._defaultHoverOptions; 6192 6193 if (isObject(overFn, true)) { 6194 hoverOptions = overFn; 6195 6196 hoverOptions = A.mix(hoverOptions, defaultHoverOptions); 6197 6198 overFn = hoverOptions.over; 6199 outFn = hoverOptions.out; 6200 } 6201 else { 6202 hoverOptions = A.mix({ 6203 over: overFn, 6204 out: outFn 6205 }, 6206 defaultHoverOptions 6207 ); 6208 } 6209 6210 instance._hoverOptions = hoverOptions; 6211 6212 hoverOptions.overTask = A.debounce(instance._hoverOverTaskFn, null, instance); 6213 hoverOptions.outTask = A.debounce(instance._hoverOutTaskFn, null, instance); 6214 6215 return new A.EventHandle( 6216 [ 6217 instance.on(hoverOptions.overEventType, instance._hoverOverHandler, instance), 6218 instance.on(hoverOptions.outEventType, instance._hoverOutHandler, instance) 6219 ] 6220 ); 6221 }, 6222 6223 /** 6224 * Gets or sets the HTML contents of the node. If the `value` is passed it's 6225 * set the content of the element, otherwise it works as a getter for the 6226 * current content. 6227 * 6228 * Example: 6229 * 6230 * ``` 6231 * var node = A.one('#nodeId'); 6232 * node.html('Setting new HTML'); 6233 * // Alert the value of the current content
6234 * alert( node.html() ); 6235 * ``` 6236 * 6237 * @method html 6238 * @param {String} value A string of html to set as the content of the node 6239 * instance. 6240 */ 6241 html: function() { 6242 var args = arguments, 6243 length = args.length; 6244 6245 if (length) { 6246 this.set('innerHTML', args[0]); 6247 } 6248 else { 6249 return this.get('innerHTML'); 6250 } 6251 6252 return this; 6253 }, 6254 6255 /** 6256 * Gets the outerHTML of a node, which islike innerHTML, except that it 6257 * actually contains the HTML of the node itself. 6258 * 6259 * @method outerHTML 6260 * @return {string} The outerHTML of the given element. 6261 */ 6262 outerHTML: function() { 6263 var instance = this; 6264 var domEl = instance.getDOM(); 6265 6266 // IE, Opera and WebKit all have outerHTML. 6267 if ('outerHTML' in domEl) { 6268 return domEl.outerHTML; 6269 } 6270 6271 var temp = ANode.create('<div></div>').append( 6272 this.clone() 6273 ); 6274 6275 try { 6276 return temp.html(); 6277 } 6278 catch (e) {} 6279 finally { 6280 temp = null; 6281 } 6282 }, 6283 6284 /** 6285 * Inserts a `newNode` after the node instance (i.e., as the next sibling). 6286 * If the reference node has no parent, then does nothing. 6287 * 6288 * Example: 6289 * 6290 * ``` 6291 * var titleNode = A.one('#titleNode'); 6292 * var descriptionNode = A.one('#descriptionNode'); 6293 * // the description is usually shown after the title 6294 * titleNode.placeAfter(descriptionNode); 6295 * ``` 6296 * 6297 * @method placeAfter 6298 * @chainable 6299 * @param {Node} newNode Node to insert. 6300 */ 6301 placeAfter: function(newNode) { 6302 var instance = this; 6303 6304 return instance._place(newNode, instance.get('nextSibling')); 6305 }, 6306 6307 /** 6308 * Inserts a `newNode` before the node instance (i.e., as the previous 6309 * sibling). If the reference node has no parent, then does nothing. 6310 * 6311 * Example: 6312 * 6313 * ``` 6314 * var descriptionNode = A.one('#descriptionNode'); 6315 * var titleNode = A.one('#titleNode'); 6316 * // the title is usually shown before the description 6317 * descriptionNode.placeBefore(titleNode); 6318 * ``` 6319 * 6320 * @method placeBefore 6321 * @chainable 6322 * @param {Node} newNode Node to insert. 6323 */ 6324 placeBefore: function(newNode) { 6325 var instance = this; 6326 6327 return instance._place(newNode, instance); 6328 }, 6329 6330 /** 6331 * Inserts the node instance to the begining of the `selector` node (i.e., 6332 * insert before the `firstChild` of the `selector`). 6333 * 6334 * Example: 6335 * 6336 * ``` 6337 * var node = A.one('#nodeId'); 6338 * node.prependTo('body'); 6339 * ``` 6340 * 6341 * @method prependTo 6342 * @chainable 6343 * @param {Node|String} selector A selector, element, HTML string, Node 6344 */ 6345 prependTo: function(selector) { 6346 var instance = this; 6347 6348 A.one(selector).prepend(instance); 6349 6350 return instance; 6351 }, 6352 6353 /** 6354 * Adds one or more CSS classes to an element and remove the class(es) from 6355 * the siblings of the element. 6356 * 6357 * @method radioClass 6358 * @chainable 6359 * @param {String} cssClass 6360 */ 6361 radioClass: function(cssClass) { 6362 var instance = this; 6363 6364 var siblings = instance.siblings(); 6365 6366 if (isString(cssClass)) { 6367 siblings.removeClass(cssClass); 6368 6369 instance.addClass(cssClass); 6370 } 6371 else if (isArray(cssClass)) { 6372 var siblingNodes = siblings.getDOM(); 6373 6374 var regex = getRegExp('(?:^|\\s+)(?:' + cssClass.join('|') + ')(?=\\s+|$)', 'g'), 6375 node, 6376 i; 6377 6378 for (i = siblingNodes.length - 1; i >= 0; i--) { 6379 node = siblingNodes[i]; 6380 node.className = node.className.replace(regex, ''); 6381 } 6382 6383 instance.addClass(cssClass.join(' ')); 6384 } 6385 6386 return instance; 6387 }, 6388 6389 /** 6390 * Generates an unique identifier and reset the id attribute of the node 6391 * instance using the new value. Invokes the [guid](Node.html#method_guid). 6392 * 6393 * @method resetId 6394 * @chainable 6395 * @param {String} prefix Optional prefix for the guid. 6396 */ 6397 resetId: function(prefix) { 6398 var instance = this; 6399 6400 instance.attr('id', A.guid(prefix)); 6401 6402 return instance; 6403 }, 6404 6405 /** 6406 * Selects a substring of text inside of the input element. 6407 * 6408 * @method selectText 6409 * @param {Number} start The index to start the selection range from 6410 * @param {Number} end The index to end the selection range at 6411 */ 6412 selectText: function(start, end) { 6413 var instance = this; 6414 6415 var textField = instance.getDOM(); 6416 var length = instance.val().length; 6417 6418 end = isValue(end) ? end : length; 6419 start = isValue(start) ? start : 0; 6420 6421 // Some form elements could throw a (NS_ERROR_FAILURE) 6422 // [nsIDOMNSHTMLInputElement.setSelectionRange] error when invoke the 6423 // setSelectionRange on firefox. Wrapping in a try/catch to prevent the 6424 // error be thrown 6425 try { 6426 if (textField.setSelectionRange) { 6427 textField.setSelectionRange(start, end); 6428 } 6429 else if (textField.createTextRange) { 6430 var range = textField.createTextRange(); 6431 6432 range.moveStart('character', start); 6433 range.moveEnd('character', end - length); 6434 6435 range.select(); 6436 } 6437 else { 6438 textField.select(); 6439 } 6440 6441 if (textField !== DOC.activeElement) { 6442 textField.focus(); 6443 } 6444 } 6445 catch (e) {} 6446 6447 return instance; 6448 }, 6449 6450 /** 6451 * Enables text selection for this element (normalized across browsers). 6452 * 6453 * @method selectable 6454 * @param noRecurse 6455 * @chainable 6456 */ 6457 selectable: function(noRecurse) { 6458 var instance = this; 6459 6460 instance.setStyles({
6461 '-webkit-user-select': CSS_SELECTABLE_VALUE, 6462 '-khtml-user-select': CSS_SELECTABLE_VALUE, 6463 '-moz-user-select': CSS_SELECTABLE_VALUE, 6464 '-ms-user-select': CSS_SELECTABLE_VALUE, 6465 '-o-user-select': CSS_SELECTABLE_VALUE, 6466 'user-select': CSS_SELECTABLE_VALUE 6467 }); 6468 6469 if (A.UA.ie || A.UA.opera) { 6470 _setUnselectable(instance._node, false, noRecurse); 6471 } 6472 6473 return instance; 6474 }, 6475 6476 /** 6477 * Stops the specified event(s) from bubbling and optionally prevents the 6478 * default action. 6479 * 6480 * Example: 6481 * 6482 * ``` 6483 * var anchor = A.one('a#anchorId'); 6484 * anchor.swallowEvent('click'); 6485 * ``` 6486 * 6487 * @method swallowEvent 6488 * @chainable 6489 * @param {String|Array} eventName An event or array of events to stop from 6490 * bubbling 6491 * @param {Boolean} preventDefault (optional) true to prevent the default 6492 * action too 6493 */ 6494 swallowEvent: function(eventName, preventDefault) { 6495 var instance = this; 6496 6497 var fn = function(event) { 6498 event.stopPropagation(); 6499 6500 if (preventDefault) { 6501 event.preventDefault(); 6502 6503 event.halt(); 6504 } 6505 6506 return false; 6507 }; 6508 6509 if (isArray(eventName)) { 6510 AArray.each( 6511 eventName, 6512 function(name) { 6513 instance.on(name, fn); 6514 } 6515 ); 6516 6517 return this; 6518 } 6519 else { 6520 instance.on(eventName, fn); 6521 } 6522 6523 return instance; 6524 }, 6525 6526 /** 6527 * Gets or sets the combined text contents of the node instance, including 6528 * it's descendants. If the `text` is passed it's set the content of the 6529 * element, otherwise it works as a getter for the current content. 6530 * 6531 * Example: 6532 * 6533 * ``` 6534 * var node = A.one('#nodeId'); 6535 * node.text('Setting new text content'); 6536 * // Alert the value of the current content 6537 * alert( node.text() ); 6538 * ``` 6539 * 6540 * @method text 6541 * @param {String} text A string of text to set as the content of the node 6542 * instance. 6543 */ 6544 text: function(text) { 6545 var instance = this; 6546 var el = instance.getDOM(); 6547 6548 if (!isUndefined(text)) { 6549 text = A.DOM._getDoc(el).createTextNode(text); 6550 6551 return instance.empty().append(text); 6552 } 6553 6554 return instance._getText(el.childNodes); 6555 }, 6556 6557 /** 6558 * Displays or hide the node instance. 6559 * 6560 * NOTE: This method assume that your node were hidden because of the 6561 * 'aui-hide' css class were being used. This won't manipulate the inline 6562 * `style.display` property. 6563 * 6564 * @method toggle 6565 * @chainable 6566 * @param {Boolean} on Whether to force the toggle. Optional. 6567 * @param {Function} callback A function to run after the visibility change. 6568 * Optional. 6569 */ 6570 toggle: function() { 6571 var instance = this; 6572 6573 instance._toggleView.apply(instance, arguments); 6574 6575 return instance; 6576 }, 6577 6578 /** 6579 * Disables text selection for this element (normalized across browsers). 6580 * 6581 * @method unselectable 6582 * @param noRecurse 6583 * @chainable 6584 */ 6585 unselectable: function(noRecurse) { 6586 var instance = this; 6587 6588 instance.setStyles({ 6589 '-webkit-user-select': CSS_UNSELECTABLE_VALUE, 6590 '-khtml-user-select': CSS_UNSELECTABLE_VALUE, 6591 '-moz-user-select': CSS_UNSELECTABLE_VALUE, 6592 '-ms-user-select': CSS_UNSELECTABLE_VALUE, 6593 '-o-user-select': CSS_UNSELECTABLE_VALUE, 6594 'user-select': CSS_UNSELECTABLE_VALUE 6595 }); 6596 6597 if (A.UA.ie || A.UA.opera) { 6598 _setUnselectable(instance._node, true, noRecurse); 6599 } 6600 6601 return instance; 6602 }, 6603 6604 /** 6605 * Gets or sets the value attribute of the node instance. If the `value` is 6606 * passed it's set the value of the element, otherwise it works as a getter 6607 * for the current value. 6608 * 6609 * Example: 6610 * 6611 * ```
6612 * var input = A.one('#inputId'); 6613 * input.val('Setting new input value'); 6614 * // Alert the value of the input 6615 * alert( input.val() ); 6616 * ``` 6617 * 6618 * @method val 6619 * @param {String} value Value to be set. Optional. 6620 */ 6621 val: function(value) { 6622 var instance = this; 6623 6624 if (isUndefined(value)) { 6625 return instance.get('value'); 6626 } 6627 else { 6628 return instance.set('value', value); 6629 } 6630 }, 6631 6632 /** 6633 * Returns the combined size of the box style for the specified sides. 6634 * 6635 * @method _getBoxStyleAsNumber 6636 * @param {String} sides Can be t, r, b, l or any combination of 6637 * those to represent the top, right, bottom, or left sides. 6638 * @param {String} map An object mapping mapping the "sides" param to the a 6639 * CSS value to retrieve 6640 * @return {Number} 6641 * @private 6642 */ 6643 _getBoxStyleAsNumber: function(sides, map) { 6644 var instance = this; 6645 6646 var sidesArray = sides.match(/\w/g), 6647 value = 0, 6648 side, 6649 sideKey, 6650 i; 6651 6652 for (i = sidesArray.length - 1; i >= 0; i--) { 6653 sideKey = sidesArray[i]; 6654 side = 0; 6655 6656 if (sideKey) { 6657 side = parseFloat(instance.getComputedStyle(map[sideKey])); 6658 side = Math.abs(side); 6659 6660 value += side || 0; 6661 } 6662 } 6663 6664 return value; 6665 }, 6666 6667 /** 6668 * Extracts text content from the passed nodes. 6669 * 6670 * @method _getText 6671 * @private 6672 * @param {Native NodeList} childNodes 6673 */ 6674 _getText: function(childNodes) { 6675 var instance = this; 6676 6677 var length = childNodes.length, 6678 childNode, 6679 str = [], 6680 i; 6681 6682 for (i = 0; i < length; i++) { 6683 childNode = childNodes[i]; 6684 6685 if (childNode && childNode.nodeType !== 8) { 6686 if (childNode.nodeType !== 1) { 6687 str.push(childNode.nodeValue); 6688 } 6689 6690 if (childNode.childNodes) { 6691 str.push(instance._getText(childNode.childNodes)); 6692 } 6693 } 6694 } 6695 6696 return str.join(''); 6697 }, 6698 6699 /** 6700 * Overrides Y.Node._hide. Adds aui-hide to the node's cssClass 6701 * 6702 * @method _hide 6703 * @private 6704 */ 6705 _hide: function() { 6706 var instance = this; 6707 6708 instance.addClass(CSS_HIDE); 6709 6710 return NODE_PROTO_HIDE.apply(instance, arguments); 6711 }, 6712 6713 /** 6714 * The event handler for the "out" function that is fired for events 6715 * attached via the hover method. 6716 * 6717 * @method _hoverOutHandler 6718 * @private 6719 * @param {EventFacade} event 6720 */ 6721 _hoverOutHandler: function(event) { 6722 var instance = this; 6723 6724 var hoverOptions = instance._hoverOptions; 6725 6726 hoverOptions.outTask.delay(hoverOptions.outDelay, event); 6727 }, 6728 6729 /** 6730 * The event handler for the "over" function that is fired for events 6731 * attached via the hover method. 6732 * 6733 * @method _hoverOverHandler 6734 * @private 6735 * @param {EventFacade} event 6736 */ 6737 _hoverOverHandler: function(event) { 6738 var instance = this; 6739 6740 var hoverOptions = instance._hoverOptions; 6741 6742 hoverOptions.overTask.delay(hoverOptions.overDelay, event); 6743 }, 6744 6745 /** 6746 * Cancels the over task, and fires the users custom "out" function for the 6747 * hover method 6748 * 6749 * @method _hoverOverHandler 6750 * @private 6751 * @param {EventFacade} event 6752 */ 6753 _hoverOutTaskFn: function(event) { 6754 var instance = this; 6755 6756 var hoverOptions = instance._hoverOptions; 6757 6758 hoverOptions.overTask.cancel(); 6759 6760 hoverOptions.out.apply(hoverOptions.context || event.currentTarget, arguments); 6761 }, 6762 6763 /** 6764 * Cancels the out task, and fires the users custom "over" function for the 6765 * hover method 6766 * 6767 * @method _hoverOverHandler 6768 * @private 6769 * @param {EventFacade} event 6770 */ 6771 _hoverOverTaskFn: function(event) { 6772 var instance = this; 6773 6774 var hoverOptions = instance._hoverOptions; 6775 6776 hoverOptions.outTask.cancel(); 6777 6778 hoverOptions.over.apply(hoverOptions.context || event.currentTarget, arguments); 6779 }, 6780 6781 /** 6782 * Places a node or html string at a specific location 6783 * 6784 * @method _place 6785 * @private 6786 * @param {Node|String} newNode 6787 * @param {Node} refNode 6788 */ 6789 _place: function(newNode, refNode) { 6790 var instance = this; 6791 6792 var parent = instance.get('parentNode'); 6793 6794 if (parent) { 6795 if (isString(newNode)) { 6796 newNode = ANode.create(newNode); 6797 } 6798 6799 parent.insertBefore(newNode, refNode); 6800 } 6801 6802 return instance; 6803 }, 6804 6805 /** 6806 * Overrides Y.Node._show. Removes aui-hide from the node's cssClass 6807 * 6808 * @method _show 6809 * @private 6810 */ 6811 _show: function() { 6812 var instance = this; 6813 6814 instance.removeClass(CSS_HIDE); 6815 6816 return NODE_PROTO_SHOW.apply(instance, arguments); 6817 }, 6818 6819 _defaultHoverOptions: { 6820 overEventType: 'mouseenter', 6821 outEventType: 'mouseleave', 6822 overDelay: 0, 6823 outDelay: 0, 6824 over: Lang.emptyFn, 6825 out: Lang.emptyFn 6826 } 6827}, true); 6828 6829NODE_PROTO.__isHidden = NODE_PROTO._isHidden; 6830 6831NODE_PROTO._isHidden = function() { 6832 var instance = this; 6833 6834 return NODE_PROTO.__isHidden.call(instance) || instance.hasClass(instance._hideClass || CSS_HIDE); 6835}; 6836 6837/** 6838 * Returns the width of the content, not including the padding, border or 6839 * margin. If a width is passed, the node's overall width is set to that size. 6840 * 6841 * Example: 6842 * 6843 * ``` 6844 * var node = A.one('#nodeId'); 6845 * node.width(); //return content width
6846 * node.width(100); // sets box width 6847 * ``` 6848 * 6849 * @method width 6850 * @return {number} 6851 */ 6852 6853/** 6854 * Returns the height of the content, not including the padding, border or 6855 * margin. If a height is passed, the node's overall height is set to that size. 6856 * 6857 * Example: 6858 * 6859 * ``` 6860 * var node = A.one('#nodeId'); 6861 * node.height(); //return content height 6862 * node.height(100); // sets box height 6863 * ``` 6864 * 6865 * @method height 6866 * @return {number} 6867 */ 6868 6869/** 6870 * Returns the size of the box from inside of the border, which is the 6871 * `offsetWidth` plus the padding on the left and right. 6872 * 6873 * Example: 6874 * 6875 * ``` 6876 * var node = A.one('#nodeId'); 6877 * node.innerWidth(); 6878 * ``` 6879 * 6880 * @method innerWidth 6881 * @return {number} 6882 */ 6883 6884/** 6885 * Returns the size of the box from inside of the border, which is offsetHeight 6886 * plus the padding on the top and bottom. 6887 * 6888 * Example: 6889 * 6890 * ``` 6891 * var node = A.one('#nodeId'); 6892 * node.innerHeight(); 6893 * ``` 6894 * 6895 * @method innerHeight 6896 * @return {number} 6897 */ 6898 6899/** 6900 * Returns the outer width of the box including the border, if true is passed as 6901 * the first argument, the margin is included. 6902 * 6903 * Example: 6904 * 6905 * ``` 6906 * var node = A.one('#nodeId'); 6907 * node.outerWidth(); 6908 * node.outerWidth(true); // includes margin 6909 * ``` 6910 * 6911 * @method outerWidth 6912 * @return {number} 6913 */ 6914 6915/** 6916 * Returns the outer height of the box including the border, if true is passed 6917 * as the first argument, the margin is included. 6918 * 6919 * Example: 6920 * 6921 * ``` 6922 * var node = A.one('#nodeId'); 6923 * node.outerHeight(); 6924 * node.outerHeight(true); // includes margin 6925 * ``` 6926 * 6927 * @method outerHeight 6928 * @return {number} 6929 */ 6930 6931A.each( 6932 ['Height', 'Width'], 6933 function(item, index) { 6934 var sides = index ? 'lr' : 'tb'; 6935 6936 var dimensionType = item.toLowerCase(); 6937 6938 NODE_PROTO[dimensionType] = function(size) { 6939 var instance = this; 6940 6941 var returnValue = instance; 6942 6943 if (isUndefined(size)) { 6944 var node = instance._node; 6945 var dimension; 6946 6947 if (node) { 6948 if ((!node.tagName && node.nodeType === 9) || node.alert) { 6949 dimension = instance.get('region')[dimensionType]; 6950 } 6951 else { 6952 dimension = instance.get('offset' + item); 6953 6954 if (!dimension) { 6955 var originalDisplay = instance.getStyle('display'); 6956 var originalPosition = instance.getStyle('position'); 6957 var originalVisibility = instance.getStyle('visibility'); 6958 6959 instance.setStyles({ 6960 display: 'block !important', 6961 position: 'absolute !important', 6962 visibility: 'hidden !important' 6963 }); 6964 6965 dimension = instance.get('offset' + item); 6966 6967 instance.setStyles({ 6968 display: originalDisplay, 6969 position: originalPosition, 6970 visibility: originalVisibility 6971 }); 6972 } 6973 6974 if (dimension) { 6975 dimension -= (instance.getPadding(sides) + instance.getBorderWidth(sides)); 6976 } 6977 } 6978 } 6979 6980 returnValue = dimension; 6981 } 6982 else { 6983 instance.setStyle(dimensionType, size); 6984 } 6985 6986 return returnValue; 6987 }; 6988 6989 NODE_PROTO['inner' + item] = function() { 6990 var instance = this; 6991 6992 return instance[dimensionType]() + instance.getPadding(sides); 6993 }; 6994 6995 NODE_PROTO['outer' + item] = function(margin) { 6996 var instance = this; 6997 6998 var innerSize = instance['inner' + item](); 6999 var borderSize = instance.getBorderWidth(sides); 7000 7001 var size = innerSize + borderSize; 7002 7003 if (margin) { 7004 size += instance.getMargin(sides); 7005 } 7006 7007 return size; 7008 }; 7009 } 7010); 7011 7012if (!SUPPORT_OPTIONAL_TBODY) { 7013 A.DOM._ADD_HTML = A.DOM.addHTML; 7014 7015 A.DOM.addHTML = function(node, content, where) { 7016 var nodeName = (node.nodeName && node.nodeName.toLowerCase()) || ''; 7017 7018 var tagName = ''; 7019 7020 if (!isUndefined(content)) { 7021 if (isString(content)) { 7022 tagName = (REGEX_TAGNAME.exec(content) || ARRAY_EMPTY_STRINGS)[1]; 7023 } 7024 else if (content.nodeType && content.nodeType === 11 && content.childNodes.length) { // a doc frag 7025 tagName = content.childNodes[0].nodeName; 7026 }
7027 else if (content.nodeName) { // a node 7028 tagName = content.nodeName; 7029 } 7030 7031 tagName = tagName && tagName.toLowerCase(); 7032 } 7033 7034 if (nodeName === 'table' && tagName === 'tr') { 7035 node = node.getElementsByTagName('tbody')[0] || node.appendChild(node.ownerDocument.createElement('tbody')); 7036 7037 var whereNodeName = ((where && where.nodeName) || '').toLowerCase(); 7038 7039 // Assuming if the "where" is a tbody node, 7040 // we're trying to prepend to a table. Attempt to 7041 // grab the first child of the tbody. 7042 if (whereNodeName === 'tbody' && where.childNodes.length > 0) { 7043 where = where.firstChild; 7044 } 7045 } 7046 7047 return A.DOM._ADD_HTML(node, content, where); 7048 }; 7049} 7050 7051/** 7052 * Augments the [YUI3 NodeList](NodeList.html) with more util methods. 7053 * 7054 * Checks the list of [Methods](NodeList.html#methods) available for AUI 7055 * NodeList. 7056 * 7057 * @class A.NodeList 7058 * @constructor 7059 * @uses A.Node 7060 */ 7061ANodeList.importMethod( 7062 NODE_PROTO, [ 7063 'after', 7064 7065 'appendTo', 7066 7067 'attr', 7068 7069 'before', 7070 7071 'empty', 7072 7073 'getX', 7074 7075 'getXY', 7076 7077 'getY', 7078 7079 'hover', 7080 7081 'html', 7082 7083 'innerHeight', 7084 7085 'innerWidth', 7086 7087 'outerHeight', 7088 7089 'outerHTML', 7090 7091 'outerWidth', 7092 7093 'prepend', 7094 7095 'prependTo', 7096 7097 'purge', 7098 7099 'selectText', 7100 7101 'selectable', 7102 7103 'setX', 7104 7105 'setXY', 7106 7107 'setY', 7108 7109 'text', 7110 7111 'toggle', 7112 7113 'unselectable', 7114 7115 'val' 7116 ] 7117); 7118 7119A.mix( 7120 NODELIST_PROTO, { 7121 /** 7122 * See [Node all](Node.html#method_all). 7123 * 7124 * @method all 7125 */ 7126 all: function(selector) { 7127 var instance = this, 7128 newNodeList = [], 7129 nodes = instance._nodes, 7130 length = nodes.length, 7131 subList, 7132 i; 7133 7134 for (i = 0; i < length; i++) { 7135 subList = A.Selector.query(selector, nodes[i]); 7136 7137 if (subList && subList.length) { 7138 newNodeList.push.apply(newNodeList, subList); 7139 } 7140 } 7141 7142 newNodeList = AArray.unique(newNodeList); 7143 7144 return A.all(newNodeList); 7145 }, 7146 7147 /** 7148 * Returns the first element in the node list collection. 7149 * 7150 * @method first 7151 * @return {Node} 7152 */ 7153 first: function() { 7154 var instance = this; 7155 7156 return instance.item(0); 7157 }, 7158 7159 /** 7160 * See [Node getDOMNode](Node.html#method_getDOMNode). 7161 * 7162 * @method getDOM 7163 */ 7164 getDOM: function() { 7165 return ANodeList.getDOMNodes(this); 7166 }, 7167 7168 /** 7169 * Returns the last element in the node list collection. 7170 * 7171 * @method last 7172 * @return {Node} 7173 */ 7174 last: function() { 7175 var instance = this; 7176 7177 return instance.item(instance._nodes.length - 1); 7178 }, 7179 7180 /** 7181 * See [Node one](Node.html#method_one). 7182 * 7183 * @method one 7184 */ 7185 one: function(selector) { 7186 var instance = this, 7187 newNode = null, 7188 nodes = instance._nodes, 7189 length = nodes.length, 7190 i; 7191 7192 for (i = 0; i < length; i++) { 7193 newNode = A.Selector.query(selector, nodes[i], true); 7194 7195 if (newNode) { 7196 newNode = A.one(newNode); 7197 7198 break; 7199 } 7200 } 7201 7202 return newNode; 7203 } 7204 } 7205); 7206 7207NODELIST_PROTO.__filter = NODELIST_PROTO.filter; 7208 7209NODELIST_PROTO.filter = function(value, context) { 7210 var instance = this; 7211 7212 var newNodeList; 7213 7214 if (isFunction(value)) { 7215 var nodes = []; 7216 7217 instance.each( 7218 function(item, index, collection) { 7219 if (value.call(context || item, item, index, collection)) { 7220 nodes.push(item._node); 7221 } 7222 } 7223 ); 7224 7225 newNodeList = A.all(nodes); 7226 } 7227 else { 7228 newNodeList = NODELIST_PROTO.__filter.call(instance, value); 7229 } 7230 7231 return newNodeList; 7232}; 7233 7234A.mix( 7235 ANodeList, { 7236 /** 7237 * Converts the passed `html` into a `NodeList` and returns the result. 7238 * 7239 * @method create 7240 * @param {String} html 7241 * @return {NodeList} 7242 */ 7243 create: function(html) { 7244 var docFrag = A.getDoc().invoke('createDocumentFragment'); 7245 7246 return docFrag.append(html).get('childNodes'); 7247 } 7248 } 7249); 7250 7251A.mix( 7252 A, { 7253 /** 7254 * Gets the body node. Shortcut to `A.one('body')`. 7255 * 7256 * @method getBody 7257 */ 7258 getBody: function() { 7259 var instance = this; 7260 7261 if (!instance._bodyNode) { 7262 instance._bodyNode = A.one(DOC.body); 7263 } 7264 7265 return instance._bodyNode; 7266 }, 7267 7268 /** 7269 * Gets the document node. Shortcut to `A.one(document)`. 7270 * 7271 * @method getDoc 7272 */ 7273 getDoc: function() { 7274 var instance = this; 7275 7276 if (!instance._documentNode) { 7277 instance._documentNode = A.one(DOC); 7278 } 7279 7280 return instance._documentNode; 7281 }, 7282 7283 /** 7284 * Gets the window node. Shortcut to `A.one(window)`. 7285 * 7286 * @method getWin 7287 */ 7288 getWin: function() { 7289 var instance = this; 7290 7291 if (!instance._windowNode) { 7292 instance._windowNode = A.one(WIN); 7293 } 7294 7295 return instance._windowNode; 7296 } 7297 } 7298); 7299 7300 7301}, '3.1.0-deprecated.95', {"requires": ["array-extras", "aui-base-lang", "aui-classnamemanager", "aui-debounce", "node"]}); 7302 7303YUI.add('aui-node-html5', function (A, NAME) { 7304 7305/** 7306 * Provides support for HTML shiv natively on the Alloy DOM methods. The HTML5 7307 * shiv just affects IE. 7308 * 7309 * @module aui-node 7310 * @submodule aui-node-html5 7311 */ 7312 7313if (A.UA.ie) { 7314 /** 7315 * An object that encapsulates util methods for HTML5 shiving. 7316 * 7317 * **What is a "shiv"?** 7318 * 7319 * To the world, a shiv is a slang term for a sharp object used as a 7320 * knife-like weapon. To Internet Explorer, a shiv is a script that, when 7321 * executed, forces the browser to recognize HTML5 elements. 7322 * 7323 * @class A.HTML5 7324 */ 7325 var HTML5 = A.namespace('HTML5'), 7326 DOM_create = A.DOM._create; 7327 7328 if (!HTML5._fragHTML5Shived) { 7329 /** 7330 * A global DocumentFragment already HTML5 shived, for performance 7331 * reasons. (i.e., all nodes and its HTML5 children appended to this 7332 * fragment iherits the styles on IE). 7333 * 7334 * @property _fragHTML5Shived 7335 * @type {DocumentFragment} 7336 * @protected 7337 */ 7338 HTML5._fragHTML5Shived = A.html5shiv( 7339 A.config.doc.createDocumentFragment() 7340 ); 7341 } 7342 7343 A.mix( 7344 HTML5, { 7345 /** 7346 * Receives a `frag` and a HTML content. This method shivs the HTML5 7347 * nodes appended to a Node or fragment which is not on the document 7348 * yet. 7349 * 7350 * @method IECreateFix 7351 * @param {Node|DocumentFragment} frag Fragment to be fixed. 7352 * @param {String} content HTML to be set (using innerHTML) on the 7353 * `frag`. 7354 * @return {Node|DocumentFragment} 7355 */ 7356 IECreateFix: function(frag, content) { 7357 var shivedFrag = HTML5._fragHTML5Shived; 7358
7359 shivedFrag.appendChild(frag); 7360 7361 frag.innerHTML = content; 7362 7363 shivedFrag.removeChild(frag); 7364 7365 return frag; 7366 }, 7367 7368 /** 7369 * AOP listener to the A.DOM._create method. This method intercepts 7370 * all the calls to the A.DOM._create and append the generated 7371 * fragment to [A.HTML._fragHTML5Shived](A.HTML5.html#property__frag 7372 * HTML5Shived), this fixes the IE bug for painting the HTML5 nodes 7373 * on the HTML fragment. 7374 * 7375 * @method _doBeforeCreate 7376 * @param {String} html HTML content 7377 * @param {String} doc 7378 * @param {String} tag 7379 * @protected 7380 * @return {DocumentFragment} 7381 */ 7382 _doBeforeCreate: function(html) { 7383 var createdFrag = DOM_create.apply(this, arguments); 7384 7385 var shivedFrag = HTML5.IECreateFix(createdFrag, html); 7386 7387 return new A.Do.Halt(null, shivedFrag); 7388 } 7389 } 7390 ); 7391 7392 A.Do.before(HTML5._doBeforeCreate, A.DOM, '_create', A.DOM); 7393} 7394/** 7395 * The Node Utility. 7396 * 7397 * @module aui-node 7398 * @submodule aui-node-html5-print 7399 */ 7400 7401var CONFIG = A.config, 7402 DOC = CONFIG.doc, 7403 WIN = CONFIG.win, 7404 UA = A.UA, 7405 IE = UA.ie, 7406 7407 isShivDisabled = function() { 7408 return WIN.AUI_HTML5_IE === false; 7409 }; 7410 7411if (!IE || IE >= 9 || isShivDisabled()) { 7412 return; 7413} 7414 7415var BUFFER_CSS_TEXT = [], 7416 7417 LOCATION = WIN.location, 7418 7419 DOMAIN = LOCATION.protocol + '//' + LOCATION.host, 7420 7421 HTML = DOC.documentElement, 7422 7423 HTML5_ELEMENTS = A.HTML5_ELEMENTS, 7424 HTML5_ELEMENTS_LENGTH = HTML5_ELEMENTS.length, 7425 HTML5_ELEMENTS_LIST = HTML5_ELEMENTS.join('|'), 7426 7427 REGEX_CLONE_NODE_CLEANUP = new RegExp('<(/?):(' + HTML5_ELEMENTS_LIST + ')', 'gi'), 7428 REGEX_ELEMENTS = new RegExp('(' + HTML5_ELEMENTS_LIST + ')', 'gi'), 7429 REGEX_ELEMENTS_FAST = new RegExp('\\b(' + HTML5_ELEMENTS_LIST + ')\\b', 'i'), 7430 7431 REGEX_PRINT_MEDIA = /print|all/, 7432 7433 REGEX_RULE = new RegExp('(^|[^\\n{}]*?\\s)(' + HTML5_ELEMENTS_LIST + ').*?{([^}]*)}', 'gim'), 7434 REGEX_TAG = new RegExp('<(\/*)(' + HTML5_ELEMENTS_LIST + ')', 'gi'), 7435 7436 SELECTOR_REPLACE_RULE = '.' + 'printfix-' + '$1', 7437 7438 STR_EMPTY = '', 7439 7440 STR_URL_DOMAIN = 'url(' + DOMAIN, 7441 7442 TAG_REPLACE_ORIGINAL = '<$1$2', 7443 TAG_REPLACE_FONT = '<$1font'; 7444 7445var html5shiv = A.html5shiv, 7446 // Yes, IE does this wackiness; converting an object 7447 // to a string should never result in undefined, but 7448 // IE's styleSheet object sometimes becomes inaccessible 7449 // after trying to print the second time 7450 isStylesheetDefined = function(obj) { 7451 return obj && (obj + STR_EMPTY !== undefined); 7452 }, 7453 7454 toggleNode = function(node, origNode, prop) { 7455 var state = origNode[prop]; 7456 7457 if (state) { 7458 node.setAttribute(prop, state); 7459 } 7460 else { 7461 node.removeAttribute(prop); 7462 } 7463 }; 7464 7465html5shiv(DOC); 7466 7467var printFix = function() { 7468 var destroy; 7469 7470 var afterPrint = function() { 7471 if (isShivDisabled()) { 7472 destroy(); 7473 } 7474 else { 7475 printFix.onAfterPrint(); 7476 } 7477 }; 7478 7479 var beforePrint = function() { 7480 if (isShivDisabled()) { 7481 destroy(); 7482 } 7483 else { 7484 printFix.onBeforePrint(); 7485 } 7486 }; 7487 7488 destroy = function() { 7489 WIN.detachEvent('onafterprint', afterPrint); 7490 WIN.detachEvent('onbeforeprint', beforePrint); 7491 }; 7492 7493 var init = function() { 7494 WIN.attachEvent('onafterprint', afterPrint); 7495 WIN.attachEvent('onbeforeprint', beforePrint); 7496 }; 7497 7498 init(); 7499 7500 printFix.destroy = destroy; 7501 printFix.init = init; 7502}; 7503 7504A.mix( 7505 printFix, { 7506 /** 7507 * Fires after a print. 7508 * 7509 * @method onAfterPrint 7510 */ 7511 onAfterPrint: function() { 7512 var instance = this; 7513 7514 instance.restoreHTML(); 7515 7516 var styleSheet = instance._getStyleSheet(); 7517 7518 styleSheet.styleSheet.cssText = ''; 7519 }, 7520 7521 /** 7522 * Fires before a print. 7523 * 7524 * @method onBeforePrint 7525 */ 7526 onBeforePrint: function() { 7527 var instance = this; 7528 7529 var styleSheet = instance._getStyleSheet(); 7530 var cssRules = instance._getAllCSSText(); 7531 7532 styleSheet.styleSheet.cssText = instance.parseCSS(cssRules); 7533 7534 instance.writeHTML(); 7535 }, 7536 7537 /** 7538 * Navigates through the CSS joining rules and replacing content. 7539 * 7540 * @method parseCSS 7541 * @param cssText 7542 * @return {String} 7543 */ 7544 parseCSS: function(cssText) { 7545 var css = ''; 7546 var rules = cssText.match(REGEX_RULE); 7547 7548 if (rules) { 7549 css = rules.join('\n').replace(REGEX_ELEMENTS, SELECTOR_REPLACE_RULE); 7550 } 7551 7552 return css; 7553 }, 7554 7555 /** 7556 * Restores the HTML from the `bodyClone` and `bodyEl` attributes. 7557 * 7558 * @method restoreHTML 7559 */ 7560 restoreHTML: function() { 7561 var instance = this; 7562 7563 var bodyClone = instance._getBodyClone(); 7564 var bodyEl = instance._getBodyEl(); 7565 7566 var newNodes = bodyClone.getElementsByTagName('IFRAME'); 7567 var originalNodes = bodyEl.getElementsByTagName('IFRAME'); 7568 7569 var length = originalNodes.length; 7570 7571 // Moving IFRAME nodes back to their original position 7572 if (length === newNodes.length) { 7573 while (length--) { 7574 var newNode = newNodes[length]; 7575 var originalNode = originalNodes[length]; 7576 7577 originalNode.swapNode(newNode); 7578 } 7579 } 7580 7581 bodyClone.innerHTML = ''; 7582 7583 HTML.removeChild(bodyClone); 7584 HTML.appendChild(bodyEl); 7585 }, 7586 7587 /** 7588 * Generates the HTML for print. 7589 * 7590 * @method writeHTML 7591 */ 7592 writeHTML: function() { 7593 var instance = this; 7594 7595 var i = -1; 7596 var j; 7597 7598 var bodyEl = instance._getBodyEl(); 7599 7600 var html5Element; 7601 7602 var cssClass; 7603 7604 var nodeList; 7605 var nodeListLength; 7606 var node; 7607 var buffer = []; 7608 7609 while (++i < HTML5_ELEMENTS_LENGTH) { 7610 html5Element = HTML5_ELEMENTS[i]; 7611 7612 nodeList = DOC.getElementsByTagName(html5Element); 7613 nodeListLength = nodeList.length; 7614 7615 j = -1; 7616 7617 while (++j < nodeListLength) { 7618 node = nodeList[j]; 7619 7620 cssClass = node.className; 7621 7622 if (cssClass.indexOf('printfix-') === -1) { 7623 buffer[0] = 'printfix-' + html5Element; 7624 buffer[1] = cssClass; 7625 7626 node.className = buffer.join(' '); 7627 } 7628 } 7629 } 7630
7631 var docFrag = instance._getDocFrag(); 7632 var bodyClone = instance._getBodyClone(); 7633 7634 docFrag.appendChild(bodyEl); 7635 HTML.appendChild(bodyClone); 7636 7637 bodyClone.className = bodyEl.className; 7638 bodyClone.id = bodyEl.id; 7639 7640 var originalNodes = bodyEl.getElementsByTagName('*'); 7641 var length = originalNodes.length; 7642 7643 // IE will throw a mixed content warning when using https 7644 // and calling clone node if the body contains elements with 7645 // an inline background-image style that is relative to the domain. 7646 if (UA.secure) { 7647 var bodyElStyle = bodyEl.style; 7648 7649 var elStyle; 7650 var backgroundImage; 7651 7652 bodyElStyle.display = 'none'; 7653 7654 for (i = 0; i < length; i++) { 7655 elStyle = originalNodes[i].style; 7656 7657 backgroundImage = elStyle.backgroundImage; 7658 7659 if (backgroundImage && 7660 backgroundImage.indexOf('url
7660(') > -1 && 7661 backgroundImage.indexOf('https') === -1) { 7662 7663 elStyle.backgroundImage = backgroundImage.replace('url(', STR_URL_DOMAIN); 7664 } 7665 } 7666 7667 bodyElStyle.display = ''; 7668 } 7669 7670 var bodyElClone = bodyEl.cloneNode(true); 7671 7672 var newNodes = bodyElClone.getElementsByTagName('*'); 7673 7674 if (length === newNodes.length) { 7675 while (length--) { 7676 var newNode = newNodes[length]; 7677 var newNodeName = newNode.nodeName; 7678 7679 if (newNodeName === 'INPUT' || newNodeName === 'OPTION' || newNodeName === 'IFRAME') { 7680 var originalNode = originalNodes[length]; 7681 var originalNodeName = originalNode.nodeName; 7682 7683 if (originalNodeName === newNodeName) { 7684 var prop = null; 7685 7686 if (newNodeName === 'OPTION') { 7687 prop = 'selected'; 7688 } 7689 else if (newNodeName === 'INPUT' && (newNode.type === 'checkbox' || newNode.type === 7690 'radio')) { 7691 prop = 'checked'; 7692 } 7693 else if (newNodeName === 'IFRAME') { 7694 newNode.src = ''; 7695 } 7696 7697 if (prop !== null) { 7698 toggleNode(newNode, originalNode, prop); 7699 } 7700 } 7701 } 7702 } 7703 } 7704 7705 var bodyHTML = bodyElClone.innerHTML; 7706 7707 bodyHTML = bodyHTML.replace(REGEX_CLONE_NODE_CLEANUP, TAG_REPLACE_ORIGINAL).replace(REGEX_TAG, 7708 TAG_REPLACE_FONT); 7709 7710 bodyClone.innerHTML = bodyHTML; 7711 7712 // Post processing the DOM in order to move IFRAME nodes 7713 7714 newNodes = bodyClone.getElementsByTagName('IFRAME'); 7715 originalNodes = bodyEl.getElementsByTagName('IFRAME'); 7716 7717 length = originalNodes.length; 7718 7719 if (length === newNodes.length) { 7720 while (length--) { 7721 var newNodeIframe = newNodes[length]; 7722 var originalNodeIframe = originalNodes[length]; 7723 7724 // According to quirksmode.org, swapNode is supported on all major IE versions 7725 originalNodeIframe.swapNode(newNodeIframe); 7726 } 7727 } 7728 }, 7729 7730 /** 7731 * Gets all CSS text from all stylesheets. 7732 * 7733 * @method _getAllCSSText 7734 * @protected 7735 * @return {Array} 7736 */ 7737 _getAllCSSText: function() { 7738 var instance = this; 7739 7740 var buffer = []; 7741 var styleSheets = instance._getAllStyleSheets(DOC.styleSheets, 'all'); 7742 var rule; 7743 var cssText; 7744 var styleSheet; 7745 7746 for (var i = 0; styleSheet = styleSheets[i]; i++) { 7747 var rules = styleSheet.rules; 7748 7749 if (rules && rules.length) { 7750 for (var j = 0, ruleLength = rules.length; j < ruleLength; j++) { 7751 rule = rules[j]; 7752 7753 if (!rule.href) { 7754 cssText = instance._getCSSTextFromRule(rule); 7755 7756 buffer.push(cssText); 7757 } 7758 } 7759 } 7760 } 7761 7762 return buffer.join(' '); 7763 }, 7764 7765 /** 7766 * Extracts the CSS text from a rule. 7767 * 7768 * @method _getCSSTextFromRule 7769 * @param rule 7770 * @protected 7771 * @return {String} 7772 */ 7773 _getCSSTextFromRule: function(rule) { 7774 var cssText = ''; 7775 7776 var ruleStyle = rule.style; 7777 var ruleCSSText; 7778 var ruleSelectorText; 7779 7780 if (ruleStyle && (ruleCSSText = ruleStyle.cssText) && (ruleSelectorText = rule.selectorText) && 7781 REGEX_ELEMENTS_FAST.test(ruleSelectorText)) { 7782 BUFFER_CSS_TEXT.length = 0; 7783 7784 BUFFER_CSS_TEXT.push(ruleSelectorText, '{', ruleCSSText, '}'); 7785 7786 cssText = BUFFER_CSS_TEXT.join(' '); 7787 } 7788 7789 return cssText; 7790 }, 7791 7792 /** 7793 * Gets all stylesheets from a page. 7794 * 7795 * @method _getAllStyleSheets 7796 * @param styleSheet, mediaType, level, buffer 7797 * @protected 7798 * @return {Array} 7799 */ 7800 _getAllStyleSheets: function(styleSheet, mediaType, level, buffer) { 7801 var instance = this; 7802 7803 level = level || 1; 7804 7805 buffer = buffer || []; 7806 7807 var i; 7808 7809 if (isStylesheetDefined(styleSheet)) { 7810 var imports = styleSheet.imports; 7811 7812 mediaType = styleSheet.mediaType || mediaType; 7813 7814 if (REGEX_PRINT_MEDIA.test(mediaType)) { 7815 var length; 7816 7817 // IE can crash when trying to access imports more than 3 levels deep 7818 if (level <= 3 && isStylesheetDefined(imports) && imports.length) { 7819 for (i = 0, length = imports.length; i < length; i++) { 7820 instance._getAllStyleSheets(imports[i], mediaType, level + 1, buffer); 7821 } 7822 } 7823 else if (styleSheet.length) { 7824 for (i = 0, length = styleSheet.length; i < length; i++) { 7825 instance._getAllStyleSheets(styleSheet[i], mediaType, level, buffer); 7826 } 7827 } 7828 else { 7829 var rules = styleSheet.rules; 7830 var ruleStyleSheet; 7831 7832 if (rules && rules.length) { 7833 for (i = 0, length = rules.length; i < length; i++) { 7834 ruleStyleSheet = rules[i].styleSheet; 7835 7836 if (ruleStyleSheet) { 7837 instance._getAllStyleSheets(ruleStyleSheet, mediaType, level, buffer); 7838 } 7839 } 7840 } 7841 } 7842 7843 if (!styleSheet.disabled && styleSheet.rules) { 7844 buffer.push(styleSheet); 7845 } 7846 } 7847 } 7848 7849 mediaType = 'all'; 7850 7851 return buffer; 7852 }, 7853 7854 /** 7855 * Gets the `<body>` element. 7856 * 7857 * @method _getBodyEl 7858 * @protected 7859 * @return {Element} 7860 */ 7861 _getBodyEl: function() { 7862 var instance = this; 7863 7864 var bodyEl = instance._bodyEl; 7865 7866 if (!bodyEl) { 7867 bodyEl = DOC.body; 7868 7869 instance._bodyEl = bodyEl; 7870 } 7871 7872 return bodyEl; 7873 }, 7874 7875 /** 7876 * Gets a clone of the `<body>` element. 7877 * 7878 * @method _getBodyClone 7879 * @protected 7880 * @return {Element} 7881 */ 7882 _getBodyClone: function() { 7883 var instance = this; 7884 7885 var bodyClone = instance._bodyClone; 7886 7887 if (!bodyClone) { 7888 bodyClone = DOC.createElement('body'); 7889 7890 instance._bodyClone = bodyClone; 7891 } 7892 7893 return bodyClone; 7894 }, 7895 7896 /** 7897 * Gets a document fragment object. 7898 * 7899 * @method _getDocFrag 7900 * @protected 7901 * @return {DocumentFragment} 7902 */ 7903 _getDocFrag: function() { 7904 var instance = this; 7905 7906 var docFrag = instance._docFrag; 7907 7908 if (!docFrag) { 7909 docFrag = DOC.createDocumentFragment(); 7910 7911 html5shiv(docFrag); 7912 7913 instance._docFrag = docFrag; 7914 } 7915 7916 return docFrag; 7917 }, 7918 7919 /** 7920 * Gets the stylesheet from the DOM. 7921 * 7922 * @method _getStyleSheet 7923 * @protected 7924 * @return {Node} 7925 */ 7926 _getStyleSheet: function() { 7927 var instance = this; 7928 7929 var styleSheet = instance._styleSheet; 7930 7931 if (!styleSheet) { 7932 styleSheet = DOC.createElement('style'); 7933 7934 var head = DOC.documentElement.firstChild; 7935 7936 head.insertBefore(styleSheet, head.firstChild); 7937 7938 styleSheet.media = 'print'; 7939 styleSheet.className = 'printfix'; 7940 7941 instance._styleSheet = styleSheet; 7942 } 7943 7944 return styleSheet; 7945 } 7946 } 7947); 7948 7949A.namespace('HTML5').printFix = printFix; 7950 7951printFix(); 7952 7953 7954}, '3.1.0-deprecated.95', {"requires": ["collection", "aui-node-base"]}); 7955 7956YUI.add('aui-selector', function (A, NAME) { 7957 7958/** 7959 * The Selector Utility. 7960 * 7961 * @module aui-selector 7962 */ 7963 7964var SELECTOR = A.Selector, 7965 7966 CSS_BOOTSTRAP_SR_ONLY = A.getClassName('sr-only'), 7967 CSS_HIDE = A.getClassName('hide'), 7968 REGEX_CLIP_RECT_ZERO = new RegExp(/rect\((0(px)?(,)?(\s)?){4}\)/i), 7969 REGEX_HIDDEN_CLASSNAMES = new RegExp(CSS_HIDE), 7970 REGEX_SR_ONLY_CLASSNAMES = new RegExp(CSS_BOOTSTRAP_SR_ONLY); 7971 7972SELECTOR._isNodeHidden = function(node) { 7973 var width = node.offsetWidth; 7974 var height = node.offsetHeight; 7975 var ignore = node.nodeName.toLowerCase() === 'tr';
7976 var className = node.className; 7977 var nodeStyle = node.style; 7978 7979 var hidden = false; 7980 7981 if (!ignore) { 7982 if (width === 0 && height === 0) { 7983 hidden = true; 7984 } 7985 else if (width > 0 && height > 0) { 7986 hidden = false; 7987 } 7988 } 7989 7990 hidden = hidden || (nodeStyle.display === 'none' || nodeStyle.visibility === 'hidden') || 7991 (nodeStyle.position === 'absolute' && REGEX_CLIP_RECT_ZERO.test(nodeStyle.clip)) || 7992 REGEX_HIDDEN_CLASSNAMES.test(className) || REGEX_SR_ONLY_CLASSNAMES.test(className); 7993 7994 return hidden; 7995}; 7996 7997var testNodeType = function(type) { 7998 return function(node) { 7999 return node.type === type; 8000 }; 8001}; 8002 8003/** 8004 * Augment the [YUI3 Selector](Selector.html) with more util methods. 8005 * 8006 * @class A.Selector 8007 * @uses Selector 8008 * @constructor 8009 */ 8010A.mix( 8011 SELECTOR.pseudos, { 8012 /** 8013 * Checks if the node is a button element or contains `type="button"`. 8014 * 8015 * @method button 8016 * @param node 8017 * @return {Boolean} 8018 */ 8019 button: function(node) { 8020 return node.type === 'button' || node.nodeName.toLowerCase() === 'button'; 8021 }, 8022 8023 /** 8024 * Checks if the node contains `type="checkbox"`. 8025 * 8026 * @method checkbox 8027 * @return {Boolean} 8028 */ 8029 checkbox: testNodeType('checkbox'), 8030 8031 /** 8032 * Checks if the node is checked or not. 8033 * 8034 * @method checked 8035 * @param node 8036 * @return {Boolean} 8037 */ 8038 checked: function(node) { 8039 return node.checked === true; 8040 }, 8041 8042 /** 8043 * Checks if the node is disabled or not. 8044 * 8045 * @method disabled 8046 * @param node 8047 * @return {Boolean} 8048 */ 8049 disabled: function(node) { 8050 return node.disabled === true; 8051 }, 8052 8053 /** 8054 * Checks if the node is empty or not. 8055 * 8056 * @method empty 8057 * @param node 8058 * @return {Boolean} 8059 */ 8060 empty: function(node) { 8061 return !node.firstChild; 8062 }, 8063 8064 /** 8065 * Checks if the node is enabled or not. 8066 * 8067 * @method enabled 8068 * @param node 8069 * @return {Boolean} 8070 */ 8071 enabled: function(node) { 8072 return node.disabled === false && node.type !== 'hidden'; 8073 }, 8074 8075 /** 8076 * Checks if the node contains `type="file"`. 8077 * 8078 * @method file 8079 * @return {Boolean} 8080 */ 8081 file: testNodeType('file'), 8082 8083 /** 8084 * Checks if the node is a header (e.g. `<h1>`, `<h2>`, ...) or not. 8085 * 8086 * @method header 8087 * @param node 8088 * @return {Boolean} 8089 */ 8090 header: function(node) { 8091 return /h\d/i.test(node.nodeName); 8092 }, 8093 8094 /** 8095 * Checks if the node is hidden or not. 8096 * 8097 * @method hidden 8098 * @param node 8099 * @return {Boolean} 8100 */ 8101 hidden: function(node) { 8102 return SELECTOR._isNodeHidden(node); 8103 }, 8104 8105 /** 8106 * Checks if the node contains `type="image"`. 8107 * 8108 * @method image 8109 * @return {Boolean} 8110 */ 8111 image: testNodeType('image'), 8112 8113 /** 8114 * Checks if the node is an input (e.g. `<textarea>`, `<input>`, ...) or not. 8115 * 8116 * @method input 8117 * @param node 8118 * @return {Boolean} 8119 */ 8120 input: function(node) { 8121 return /input|select|textarea|button/i.test(node.nodeName); 8122 }, 8123 8124 /** 8125 * Checks if the node contains a child or not. 8126 * 8127 * @method parent 8128 * @param node 8129 * @return {Boolean} 8130 */ 8131 parent: function(node) { 8132 return !!node.firstChild; 8133 }, 8134 8135 /** 8136 * Checks if the node contains `type="password"`. 8137 * 8138 * @method password 8139 * @return {Boolean} 8140 */ 8141 password: testNodeType('password'), 8142 8143 /** 8144 * Checks if the node contains `type="radio"`. 8145 * 8146 * @method radio 8147 * @return {Boolean} 8148 */ 8149 radio: testNodeType('radio'), 8150 8151 /** 8152 * Checks if the node contains `type="reset"`. 8153 * 8154 * @method reset 8155 * @return {Boolean} 8156 */ 8157 reset: testNodeType('reset'), 8158 8159 /** 8160 * Checks if the node is selected or not. 8161 * 8162 * @method selected 8163 * @param node 8164 * @return {Boolean} 8165 */ 8166 selected: function(node) { 8167 node.parentNode.selectedIndex; 8168 return node.selected === true; 8169 }, 8170 8171 /** 8172 * Checks if the node contains `type="submit"`. 8173 * 8174 * @method submit 8175 * @return {Boolean} 8176 */ 8177 submit: testNodeType('submit'), 8178 8179 /** 8180 * Checks if the node contains `type="text"`. 8181 * 8182 * @method text 8183 * @return {Boolean} 8184 */ 8185 text: testNodeType('text'), 8186 8187 /** 8188 * Checks if the node is visible or not. 8189 * 8190 * @method visible 8191 * @param node 8192 * @return {Boolean} 8193 */ 8194 visible: function(node) { 8195 return !SELECTOR._isNodeHidden(node); 8196 } 8197 } 8198); 8199 8200 8201}, '3.1.0-deprecated.95', {"requires": ["selector-css3", "aui-classnamemanager"]}); 8202 8203YUI.add('aui-timer', function (A, NAME) { 8204 8205/** 8206 * Utility for timing logics used to manage [JavaScript Timer 8207 * Congestion](http://fitzgeraldnick.com/weblog/40/) problems. 8208 * 8209 * @module aui-timer 8210 */ 8211 8212var Lang = A.Lang, 8213 now = Lang.now, 8214 isEmpty = A.Object.isEmpty, 8215 8216 aArray = A.Array; 8217 8218/** 8219 * A base class for Timer. 8220 * 8221 * @class A.Timer 8222 * @constructor 8223 */ 8224var Timer = { 8225 8226 /** 8227 * Cancels repeated action which was set up using `setInterval` function. 8228 * 8229 * @method clearInterval 8230 * @param id 8231 */ 8232 clearInterval: function(id) { 8233 var instance = Timer; 8234 8235 instance.unregister(true, id); 8236 }, 8237 8238 /**
8239 * Clears the delay set by `setTimeout` function. 8240 * 8241 * @method clearTimeout 8242 * @param id 8243 */ 8244 clearTimeout: function(id) { 8245 var instance = Timer; 8246 8247 instance.unregister(false, id); 8248 }, 8249 8250 /** 8251 * Defines the fixed time delay between each interval. 8252 * 8253 * @method intervalTime 8254 * @param newInterval 8255 * @return {Number} 8256 */ 8257 intervalTime: function(newInterval) { 8258 var instance = Timer; 8259 8260 if (arguments.length) { 8261 instance._INTERVAL = newInterval; 8262 } 8263 8264 return instance._INTERVAL; 8265 }, 8266 8267 /** 8268 * Checks if the task is repeatable or not. 8269 * 8270 * @method isRepeatable 8271 * @param task 8272 * @return {Boolean} 8273 */ 8274 isRepeatable: function(task) { 8275 return task.repeats; 8276 }, 8277 8278 /** 8279 * Calls a function after a specified delay. 8280 * 8281 * @method setTimeout 8282 * @param fn 8283 * @param ms 8284 * @param context 8285 */ 8286 setTimeout: function(fn, ms, context) { 8287 var instance = Timer; 8288 8289 var args = aArray(arguments, 3, true); 8290 8291 return instance.register(false, fn, ms, context, args); 8292 }, 8293 8294 /** 8295 * Calls a function repeatedly, with a fixed time delay between each call to 8296 * that function. 8297 * 8298 * @method setInterval 8299 * @param fn 8300 * @param ms 8301 * @param context 8302 */ 8303 setInterval: function(fn, ms, context) { 8304 var instance = Timer; 8305 8306 var args = aArray(arguments, 3, true); 8307 8308 return instance.register(true, fn, ms, context, args); 8309 }, 8310 8311 /** 8312 * Adds a new task to the timer. 8313 * 8314 * @method register 8315 * @param repeats 8316 * @param fn 8317 * @param ms 8318 * @param context 8319 * @param args 8320 */ 8321 register: function(repeats, fn, ms, context, args) { 8322 var instance = Timer; 8323 8324 var id = (++A.Env._uidx); 8325 8326 args = args || []; 8327 8328 args.unshift(fn, context); 8329 8330 instance._TASKS[id] = instance._create( 8331 repeats, instance._getNearestInterval(ms), A.rbind.apply(A, args) 8332 ); 8333 8334 instance._lazyInit(); 8335 8336 return id; 8337 }, 8338 8339 /** 8340 * Runs the task function. 8341 * 8342 * @method run 8343 * @param task 8344 */ 8345 run: function(task) { 8346 task.lastRunTime = now(); 8347 8348 return task.fn(); 8349 }, 8350 8351 /** 8352 * Removes a task from the timer. 8353 * 8354 * @method unregister 8355 * @param repeats 8356 * @param id 8357 */ 8358 unregister: function(repeats, id) { 8359 var instance = Timer; 8360 8361 var tasks = instance._TASKS; 8362 8363 var task = tasks[id]; 8364 8365 instance._lazyDestroy(); 8366 8367 return task && task.repeats === repeats && delete tasks[id]; 8368 }, 8369 8370 /** 8371 * Creates a collection of timer definitions. 8372 * 8373 * @method _create 8374 * @param repeats 8375 * @param ms 8376 * @param fn 8377 * @protected 8378 * @return {Object} 8379 */ 8380 _create: function(repeats, ms, fn) { 8381 return { 8382 fn: fn, 8383 lastRunTime: now(), 8384 next: ms, 8385 repeats: repeats, 8386 timeout: ms 8387 }; 8388 }, 8389 8390 /** 8391 * Subtracts the current time with the last run time. The result of this 8392 * operation is subtracted with the task timeout. 8393 * 8394 * @method _decrementNextRunTime 8395 * @param tasks 8396 * @protected 8397 */ 8398 _decrementNextRunTime: function(task) { 8399 return task.next = task.timeout - (now() - task.lastRunTime); 8400 }, 8401 8402 /** 8403 * Calculates the nearest interval by using the modulus of the argument with 8404 * the interval as reference. 8405 * 8406 * @method _getNearestInterval 8407 * @param num 8408 * @protected 8409 * @return {Number} 8410 */ 8411 _getNearestInterval: function(num) { 8412 var instance = Timer; 8413 8414 var interval = instance._INTERVAL; 8415 8416 var delta = num % interval; 8417 8418 var nearestInterval; 8419 8420 if (delta < interval / 2) { 8421 nearestInterval = num - delta; 8422 } 8423 else { 8424 nearestInterval = num + interval - delta; 8425 } 8426 8427 return nearestInterval; 8428 }, 8429 8430 /** 8431 * Checks if the timer is initialized and empty, then calls the 8432 * `clearTimeout` function using the global interval id. 8433 * 8434 * @method _lazyDestroy 8435 * @protected 8436 */ 8437 _lazyDestroy: function() { 8438 var instance = Timer; 8439 8440 if (instance._initialized && isEmpty(instance._TASKS)) { 8441 clearTimeout(instance._globalIntervalId); 8442 8443 instance._initialized = false;
8444 } 8445 }, 8446 8447 /** 8448 * Checks if the timer is initialized and contains a task, then calls the 8449 * `setTimeout` function and stores the global interval id. 8450 * 8451 * @method _lazyInit 8452 * @protected 8453 */ 8454 _lazyInit: function() { 8455 var instance = Timer; 8456 8457 if (!instance._initialized && !isEmpty(instance._TASKS)) { 8458 instance._lastRunTime = now(); 8459 8460 instance._globalIntervalId = setTimeout( 8461 instance._runner, instance._INTERVAL 8462 ); 8463 8464 instance._initialized = true; 8465 } 8466 }, 8467 8468 /** 8469 * Goes through all pending tasks and initializes its timer or unregisters 8470 * it depending on the task status. 8471 * 8472 * @method _loop 8473 * @param i 8474 * @param pendingTasks 8475 * @param length 8476 * @protected 8477 */ 8478 _loop: function(i, pendingTasks, length) { 8479 var instance = Timer; 8480 8481 var interval = instance._INTERVAL; 8482 var tasks = instance._TASKS; 8483 8484 var halfInterval = interval / 2; 8485 8486 for (var start = now(); i < length && now() - start < 50; i++) { 8487 var taskId = pendingTasks[i]; 8488 var task = tasks[taskId]; 8489 8490 if (task && instance._decrementNextRunTime(task) < halfInterval) { 8491 instance.run(task); 8492 8493 if (instance.isRepeatable(task)) { 8494 instance._resetNextRunTime(task); 8495 } 8496 else { 8497 instance.unregister(false, taskId); 8498 } 8499 } 8500 } 8501 8502 if (instance._initialized) { 8503 if (i < length) { 8504 instance._globalIntervalId = setTimeout(instance._loop, 10); 8505 } 8506 else { 8507 instance._globalIntervalId = setTimeout( 8508 instance._runner, interval 8509 ); 8510 } 8511 } 8512 }, 8513 8514 /** 8515 * Gets the arguments to call the `_loop` method. 8516 * 8517 * @method _runner 8518 * @protected 8519 */ 8520 _runner: function() { 8521 var instance = Timer; 8522 8523 var i = 0; 8524 var pendingTasks = A.Object.keys(instance._TASKS); 8525 var length = pendingTasks.length; 8526 8527 instance._loop(i, pendingTasks, length); 8528 }, 8529 8530 /** 8531 * Resets the next run time. 8532 * 8533 * @method _resetNextRunTime 8534 * @param task 8535 * @protected 8536 */ 8537 _resetNextRunTime: function(task) { 8538 return task.next = task.timeout; 8539 }, 8540 8541 _INTERVAL: 50, 8542 _TASKS: {}, 8543 8544 _lastRunTime: 0, 8545 _globalIntervalId: 0, 8546 _initialized: false 8547}; 8548 8549/** 8550 * Cancels repeated action which was set up using `setInterval` function. 8551 * 8552 * @method A.clearInterval 8553 * @static 8554 * @param id 8555 */ 8556A.clearInterval = Timer.clearInterval; 8557 8558/** 8559 * Clears the delay set by `setTimeout` function. 8560 * 8561 * @method A.clearTimeout 8562 * @static 8563 * @param id 8564 */ 8565A.clearTimeout = Timer.clearTimeout; 8566 8567/** 8568 * Calls a function repeatedly, with a fixed time delay between each call to 8569 * that function. 8570 * 8571 * @method A.setInterval 8572 * @static 8573 * @param fn 8574 * @param ms 8575 * @param context 8576 */ 8577A.setInterval = Timer.setInterval; 8578 8579/** 8580 * Calls a function after a specified delay. 8581 * 8582 * @method A.setTimeout 8583 * @static 8584 * @param fn 8585 * @param ms 8586 * @param context 8587 */ 8588A.setTimeout = Timer.setTimeout; 8589 8590A.Timer = Timer; 8591 8592 8593}, '3.1.0-deprecated.95', {"requires": ["oop"]}); 8594 8595(function() { 8596 var A = AUI().use('oop'); 8597 8598 var usedModules = {}; 8599 8600 var Dependency = { 8601 provide: function(obj, methodName, methodFn, modules, proto) { 8602 if (!Array.isArray(modules)) { 8603 modules = [modules]; 8604 } 8605 8606 var before; 8607 8608 var guid = A.guid(); 8609 8610 if (A.Lang.isObject(methodFn, true)) { 8611 var config = methodFn; 8612 8613 methodFn = config.fn; 8614 before = config.before; 8615 8616 if (!A.Lang.isFunction(before)) { 8617 before = null; 8618 } 8619 } 8620 8621 if (proto && A.Lang.isFunction(obj)) { 8622 obj = obj.prototype; 8623 } 8624 8625 var AOP = Dependency._getAOP(obj, methodName); 8626 8627 if (AOP) { 8628 delete obj._yuiaop[methodName]; 8629 } 8630 8631 var proxy = function() { 8632 var args = arguments; 8633 8634 var context = obj; 8635 8636 if (proto) { 8637 context = this; 8638 } 8639 8640 if (modules.length == 1) { 8641 if (modules[0] in usedModules) { 8642 Dependency._replaceMethod(obj, methodName, methodFn, context); 8643
8644 methodFn.apply(context, args); 8645 8646 return; 8647 } 8648 } 8649 8650 var firstLoad = false; 8651 8652 var queue = Dependency._proxyLoaders[guid]; 8653 8654 if (!queue) { 8655 firstLoad = true; 8656 8657 Dependency._proxyLoaders[guid] = new A.Queue(); 8658 8659 queue = Dependency._proxyLoaders[guid]; 8660 } 8661 8662 queue.add(args); 8663 8664 if (firstLoad) { 8665 modules.push(A.bind(Dependency._proxy, Liferay, obj, methodName, methodFn, context, guid, modules)); 8666 8667 A.use.apply(A, modules); 8668 } 8669 }; 8670 8671 proxy.toString = function() { 8672 return methodFn.toString(); 8673 }; 8674 8675 obj[methodName] = proxy; 8676 }, 8677 8678 _getAOP: function(obj, methodName) { 8679 var instance = this; 8680 8681 return obj._yuiaop && obj._yuiaop[methodName]; 8682 }, 8683 8684 _proxy: function(obj, methodName, methodFn, context, guid, modules, A) { 8685 var args; 8686 8687 var queue = Dependency._proxyLoaders[guid]; 8688 8689 Dependency._replaceMethod(obj, methodName, methodFn, context); 8690 8691 while ((args = queue.next())) { 8692 methodFn.apply(context, args); 8693 } 8694 8695 for (var i = modules.length - 1; i >= 0; i--) { 8696 usedModules[modules[i]] = true; 8697 } 8698 }, 8699 8700 _replaceMethod: function(obj, methodName, methodFn, context) { 8701 var instance = this; 8702 8703 var AOP = Dependency._getAOP(obj, methodName); 8704 8705 var proxy = obj[methodName]; 8706 8707 if (AOP) { 8708 proxy = AOP.method; 8709 8710 AOP.method = methodFn; 8711 } 8712 else { 8713 obj[methodName] = methodFn; 8714 } 8715 8716 A.mix(methodFn, proxy); 8717 }, 8718 8719 _proxyLoaders: {} 8720 }; 8721 8722 Liferay.Dependency = Dependency; 8723 8724 Liferay.provide = Dependency.provide; 8725})(); 8726; 8727 8728(function (Liferay) { 8729 var DOMTaskRunner = { 8730 addTask: function addTask(task) { 8731 var instance = this; 8732 8733 instance._scheduledTasks.push(task); 8734 }, 8735 addTaskState: function addTaskState(state) { 8736 var instance = this; 8737 8738 instance._taskStates.push(state); 8739 }, 8740 reset: function reset() { 8741 var instance = this; 8742 instance._taskStates.length = 0; 8743 instance._scheduledTasks.length = 0; 8744 }, 8745 runTasks: function runTasks(node) { 8746 var instance = this; 8747 var scheduledTasks = instance._scheduledTasks; 8748 var taskStates = instance._taskStates; 8749 var tasksLength = scheduledTasks.length; 8750 var taskStatesLength = taskStates.length; 8751 8752 for (var i = 0; i < tasksLength; i++) { 8753 var task = scheduledTasks[i]; 8754 var taskParams = task.params; 8755 8756 for (var j = 0; j < taskStatesLength; j++) { 8757 var state = taskStates[j]; 8758 8759 if (task.condition(state, taskParams, node)) { 8760 task.action(state, taskParams, node); 8761 } 8762 } 8763 } 8764 }, 8765 _scheduledTasks: [], 8766 _taskStates: [] 8767 }; 8768 Liferay.DOMTaskRunner = DOMTaskRunner; 8769})(Liferay); 8770//# sourceMappingURL=dom_task_runner.js.map 8771Liferay.on = function () {}; 8772 8773Liferay.fire = function () {}; 8774 8775Liferay.detach = function () {}; 8776 8777; 8778 8779(function (A, Liferay) { 8780 var CLICK_EVENTS = {}; 8781 var DOC = A.config.doc; 8782 Liferay.provide(Liferay, 'delegateClick', function (id, fn) { 8783 var el = DOC.getElementById(id); 8784 8785 if (!el || el.id != id) { 8786 return; 8787 } 8788 8789 var guid = A.one(el).addClass('lfr-delegate-click').guid(); 8790 CLICK_EVENTS[guid] = fn; 8791 8792 if (!Liferay._baseDelegateHandle) { 8793 Liferay._baseDelegateHandle = A.getBody().delegate('click', Liferay._baseDelegate, '.lfr-delegate-click'); 8794 } 8795 }, ['aui-base']); 8796 8797 Liferay._baseDelegate = function (event) { 8798 var id = event.currentTarget.attr('id'); 8799 var fn = CLICK_EVENTS[id]; 8800 8801 if (fn) { 8802 fn.apply(this, arguments); 8803 } 8804 }; 8805 8806 Liferay._CLICK_EVENTS = CLICK_EVENTS; 8807 A.use('attribute', 'oop', function (A) { 8808 A.augment(Liferay, A.Attribute, true); 8809 }); 8810})(AUI(), Liferay); 8811//# sourceMappingURL=events.js.map 8812;(function(A, Liferay) { 8813 var Language = {}; 8814 8815 Language.get = function(key) { 8816 return key; 8817 }; 8818 8819 A.use( 8820 'io-base', 8821 function(A) { 8822 Language.get = A.cached( 8823 function(key, extraParams) { 8824 var instance = this; 8825 8826 var url = themeDisplay.getPathContext() + '/language/' + themeDisplay.getLanguageId() + '/' + key + '/'; 8827 8828 if (extraParams) { 8829 if (typeof extraParams == 'string') { 8830 url += extraParams; 8831 } 8832 else if (Array.isArray(extraParams)) { 8833 url += extraParams.join('/'); 8834 } 8835 } 8836 8837 var headers = { 8838 'X-CSRF-Token': Liferay.authToken 8839 }; 8840 8841 var value = ''; 8842 8843 A.io( 8844 url, 8845 { 8846 headers: headers, 8847 method: 'GET', 8848 on: { 8849 complete: function(i, o) { 8850 value = o.responseText; 8851 } 8852 }, 8853 sync: true 8854 } 8855 ); 8856 8857 return value; 8858 } 8859 ); 8860 } 8861 ); 8862 8863 Liferay.Language = Language; 8864})(AUI(), Liferay); 8865(function (Liferay) { 8866 Liferay.lazyLoad = function () { 8867 var failureCallback; 8868 8869 var isFunction = function isFunction(val) { 8870 return typeof val === 'function'; 8871 }; 8872 8873 var modules; 8874 var successCallback; 8875 8876 if (Array.isArray(arguments[0])) { 8877 modules = arguments[0]; 8878 successCallback = isFunction(arguments[1]) ? arguments[1] : null; 8879 failureCallback = isFunction(arguments[2]) ? arguments[2] : null; 8880 } else { 8881 modules = []; 8882 8883 for (var i = 0; i < arguments.length; ++i) { 8884 if (typeof arguments[i] === 'string') { 8885 modules[i] = arguments[i]; 8886 } else if (isFunction(arguments[i])) { 8887 successCallback = arguments[i]; 8888 failureCallback = isFunction(arguments[++i]) ? arguments[i] : null; 8889 break; 8890 } 8891 } 8892 } 8893 8894 return function () { 8895 var args = []; 8896 8897 for (var i = 0; i < arguments.length; ++i) { 8898 args.push(arguments[i]); 8899 } 8900 8901 Liferay.Loader.require(modules, function () { 8902 for (var i = 0; i < arguments.length; ++i) { 8903 args.splice(i, 0, arguments[i]); 8904 } 8905 8906 successCallback.apply(successCallback, args); 8907 }, failureCallback); 8908 }; 8909 }; 8910})(Liferay); 8911//# sourceMappingURL=lazy_load.js.map 8912function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 8913 8914Liferay = window.Liferay || {}; 8915 8916(function ($, Liferay) { 8917 var isFunction = function isFunction(val) { 8918 return typeof val === 'function'; 8919 }; 8920 8921 var isNode = function isNode(node) { 8922 return node && (node._node || node.jquery || node.nodeType); 8923 }; 8924 8925 var REGEX_METHOD_GET = /^get$/i; 8926 var STR_MULTIPART = 'multipart/form-data'; 8927 8928 Liferay.namespace = function namespace(obj, path) { 8929 if (path === undefined) { 8930 path = obj; 8931 obj = this; 8932 } 8933 8934 var parts = path.split('.'); 8935 8936 for (var part; parts.length && (part = parts.shift());) { 8937 if (obj[part] && obj[part] !== Object.prototype[part]) { 8938 obj = obj[part]; 8939 } else { 8940 obj = obj[part] = {}; 8941 } 8942 } 8943 8944 return obj; 8945 }; 8946 8947 $.ajaxSetup({ 8948 data: {}, 8949 type: 'POST' 8950 }); 8951 $.ajaxPrefilter(function (options) { 8952 if (options.crossDomain) { 8953 options.contents.script = false;
8954 } 8955 8956 if (options.url) { 8957 options.url = Liferay.Util.getURLWithSessionId(options.url); 8958 } 8959 }); 8960 var jqueryInit = $.prototype.init; 8961 8962 $.prototype.init = function (selector, context, root) { 8963 if (selector === '#') { 8964 selector = ''; 8965 } 8966 8967 return new jqueryInit(selector, context, root); 8968 }; 8969 8970 $(document).on('show.bs.collapse', function (event) { 8971 var target = $(event.target); 8972 var ancestor = target.parents('.panel-group'); 8973 8974 if (target.hasClass('panel-collapse') && ancestor.length) { 8975 var openChildren = ancestor.find('.panel-collapse.in').not(target); 8976 8977 if (openChildren.length && ancestor.find('[data-parent="#' + ancestor.attr('id') + '"]').length) { 8978 openChildren.removeClass('in'); 8979 } 8980 } 8981 8982 if (target.hasClass('in')) { 8983 target.addClass('show'); 8984 target.removeClass('in'); 8985 target.collapse('hide'); 8986 return false; 8987 } 8988 }); 8989 $(document).on('show.bs.dropdown', function () { 8990 Liferay.fire('dropdownShow', { 8991 src: 'BootstrapDropdown' 8992 }); 8993 }); 8994 Liferay.on('dropdownShow', function (event) { 8995 if (event.src !== 'BootstrapDropdown') { 8996 $('.dropdown.show .dropdown-toggle').dropdown('toggle'); 8997 } 8998 }); 8999 $(document).on('shown.bs.dropdown', function () { 9000 var dropdown = document.querySelector('.dropdown-menu.show'); 9001 var parent = dropdown.parentElement; 9002 9003 if (dropdown && (parent.classList.contains('dropdown-action') || parent.nodeName === 'BODY')) { 9004 var _dropdown$getBounding = dropdown.getBoundingClientRect(), 9005 x = _dropdown$getBounding.x, 9006 y = _dropdown$getBounding.y; 9007 9008 dropdown.style.left = x + 'px'; 9009 dropdown.style.top = y + 'px'; 9010 dropdown.style.transform = ''; 9011 document.body.appendChild(dropdown); 9012 } 9013 }); 9014 /** 9015 * OPTIONS 9016 * 9017 * Required 9018 * service {string|object}: Either the service name, or an object with the keys as the service to call, and the value as the service configuration object. 9019 * 9020 * Optional 9021 * data {object|node|string}: The data to send to the service. If the object passed is the ID of a form or a form element, the form fields will be serialized and used as the data. 9022 * successCallback {function}: A function to execute when the server returns a response. It receives a JSON object as it's first parameter. 9023 * exceptionCallback {function}: A function to execute when the response from the server contains a service exception. It receives a the exception message as it's first parameter. 9024 */ 9025 9026 var Service = function Service() { 9027 var instance = this; 9028 var args = Service.parseInvokeArgs(Array.prototype.slice.call(arguments, 0)); 9029 return Service.invoke.apply(Service, args); 9030 }; 9031 9032 Service.URL_INVOKE = themeDisplay.getPathContext() + '/api/jsonws/invoke'; 9033 9034 Service.bind = function () { 9035 var args = Array.prototype.slice.call(arguments, 0); 9036 return function () { 9037 var newArgs = Array.prototype.slice.call(arguments, 0); 9038 return Service.apply(Service, args.concat(newArgs)); 9039 }; 9040 }; 9041 9042 Service.parseInvokeArgs = function (args) { 9043 var instance = this; 9044 var payload = args[0]; 9045 var ioConfig = instance.parseIOConfig(args); 9046 9047 if (typeof payload === 'string') { 9048 payload = instance.parseStringPayload(args); 9049 instance.parseIOFormConfig(ioConfig, args); 9050 var lastArg = args[args.length - 1]; 9051 9052 if (_typeof(lastArg) === 'object' && lastArg.method) { 9053 ioConfig.method = lastArg.method; 9054 } 9055 } 9056 9057 return [payload, ioConfig]; 9058 }; 9059 9060 Service.parseIOConfig = function (args) { 9061 var instance = this; 9062 var payload = args[0]; 9063 var ioConfig = payload.io || {}; 9064 delete payload.io; 9065 9066 if (!ioConfig.success) { 9067 var callbacks = args.filter(isFunction); 9068 var callbackException = callbacks[1]; 9069 var callbackSuccess = callbacks[0]; 9070 9071 if (!callbackException) { 9072 callbackException = callbackSuccess; 9073 } 9074 9075 ioConfig.complete = function (xhr) { 9076 var response = xhr.responseJSON; 9077 9078 if (response !== null && !response.hasOwnProperty('exception')) { 9079 if (callbackSuccess) { 9080 callbackSuccess.call(this, response); 9081 } 9082 } else if (callbackException) { 9083 var exception = response ? response.exception : 'The server returned an empty response'; 9084 callbackException.call(this, exception, response); 9085 } 9086 }; 9087 } 9088 9089 if (!ioConfig.hasOwnProperty('cache') && REGEX_METHOD_GET.test(ioConfig.type)) { 9090 ioConfig.cache = false;
9091 } 9092 9093 if (Liferay.PropsValues.NTLM_AUTH_ENABLED && Liferay.Browser.isIe()) { 9094 ioConfig.type = 'GET'; 9095 } 9096 9097 return ioConfig; 9098 }; 9099 9100 Service.parseIOFormConfig = function (ioConfig, args) { 9101 var instance = this; 9102 var form = args[1]; 9103 9104 if (isNode(form)) { 9105 ioConfig.form = form; 9106 9107 if (ioConfig.form.enctype == STR_MULTIPART) { 9108 ioConfig.contentType = false; 9109 ioConfig.processData = false; 9110 } 9111 } 9112 }; 9113 9114 Service.parseStringPayload = function (args) { 9115 var params = {}; 9116 var payload = {}; 9117 var config = args[1]; 9118 9119 if (!isFunction(config) && !isNode(config)) { 9120 params = config; 9121 } 9122 9123 payload[args[0]] = params; 9124 return payload; 9125 }; 9126 9127 Service.invoke = function (payload, ioConfig) { 9128 var instance = this; 9129 var cmd = JSON.stringify(payload); 9130 var p_auth = Liferay.authToken; 9131 ioConfig = Object.assign({ 9132 data: { 9133 cmd: cmd, 9134 p_auth: p_auth 9135 }, 9136 dataType: 'JSON' 9137 }, ioConfig); 9138 9139 if (ioConfig.form) { 9140 if (ioConfig.form.enctype == STR_MULTIPART && isFunction(window.FormData)) { 9141 ioConfig.data = new FormData(ioConfig.form); 9142 ioConfig.data.append('cmd', cmd); 9143 ioConfig.data.append('p_auth', p_auth); 9144 } else { 9145 $(ioConfig.form).serializeArray().forEach(function (item) { 9146 ioConfig.data[item.name] = item.value; 9147 }); 9148 } 9149 9150 delete ioConfig.form; 9151 } 9152 9153 return $.ajax(instance.URL_INVOKE, ioConfig); 9154 }; 9155 9156 ['get', 'delete', 'post', 'put', 'update'].forEach(function (item) { 9157 var methodName = item; 9158 9159 if (item === 'delete') { 9160 methodName = 'del'; 9161 } 9162 9163 Service[methodName] = function () { 9164 var args = Array.prototype.slice.call(arguments, 0); 9165 var method = { 9166 method: item 9167 }; 9168 args.push(method); 9169 return Service.apply(Service, args); 9170 }; 9171 }); 9172 Liferay.Service = Service; 9173 var componentDestroyConfigs = {}; 9174 var componentPromiseWrappers = {}; 9175 var components = {}; 9176 var componentsFn = {}; 9177 9178 var _createPromiseWrapper = function _createPromiseWrapper(value) { 9179 var promiseWrapper; 9180 9181 if (value) { 9182 promiseWrapper = { 9183 promise: Promise.resolve(value), 9184 resolve: function resolve() {} 9185 }; 9186 } else { 9187 var promiseResolve; 9188 var promise = new Promise(function (resolve) { 9189 promiseResolve = resolve; 9190 }); 9191 promiseWrapper = { 9192 promise: promise, 9193 resolve: promiseResolve 9194 }; 9195 } 9196 9197 return promiseWrapper; 9198 }; 9199 9200 Liferay.component = function (id, value, destroyConfig) { 9201 var retVal; 9202 9203 if (arguments.length === 1) { 9204 var component = components[id]; 9205 9206 if (component && isFunction(component)) { 9207 componentsFn[id] = component; 9208 component = component(); 9209 components[id] = component; 9210 } 9211 9212 retVal = component; 9213 } else { 9214 if (components[id] && value !== null) { 9215 delete componentDestroyConfigs[id]; 9216 delete componentPromiseWrappers[id]; 9217 console.warn('Component with id "' + id + '" is being registered twice. This can lead to unexpected behaviour in the "Liferay.component" and "Liferay.componentReady" APIs, as well as in the "*:registered" events.'); 9218 } 9219 9220 retVal = components[id] = value; 9221 9222 if (value === null) { 9223 delete componentDestroyConfigs[id]; 9224 delete componentPromiseWrappers[id]; 9225 } else { 9226 componentDestroyConfigs[id] = destroyConfig; 9227 Liferay.fire(id + ':registered'); 9228 var componentPromiseWrapper = componentPromiseWrappers[id]; 9229 9230 if (componentPromiseWrapper) { 9231 componentPromiseWrapper.resolve(value); 9232 } else { 9233 componentPromiseWrappers[id] = _createPromiseWrapper(value); 9234 } 9235 } 9236 } 9237 9238 return retVal; 9239 }; 9240 /** 9241 * Retrieves a list of component instances after they've been registered. 9242 * 9243 * @param {...string} componentId The ids of the components to be received 9244 * @return {Promise} A promise to be resolved with all the requested component 9245 * instances after they've been successfully registered 9246 * @review 9247 */ 9248 9249 9250 Liferay.componentReady = function () { 9251 var component; 9252 var componentPromise; 9253 9254 if (arguments.length === 1) { 9255 component = arguments[0]; 9256 } else { 9257 component = []; 9258 9259 for (var i = 0; i < arguments.length; i++) { 9260 component[i] = arguments[i]; 9261 } 9262 } 9263 9264 if (Array.isArray(component)) { 9265 componentPromise = Promise.all(component.map(function (id) { 9266 return Liferay.componentReady(id); 9267 })); 9268 } else { 9269 var componentPromiseWrapper = componentPromiseWrappers[component]; 9270 9271 if (!componentPromiseWrapper) { 9272 componentPromiseWrappers[component] = componentPromiseWrapper = _createPromiseWrapper(); 9273 } 9274 9275 componentPromise = componentPromiseWrapper.promise; 9276 } 9277 9278 return componentPromise; 9279 }; 9280 /** 9281 * Destroys the component registered by the provided component id. Invokes the 9282 * component's own destroy lifecycle methods (destroy or dispose) and deletes 9283 * the internal references to the component in the component registry. 9284 * 9285 * @param {string} componentId The id of the component to destroy 9286 * @review 9287 */ 9288 9289 9290 Liferay.destroyComponent = function (componentId) { 9291 var component = components[componentId]; 9292 9293 if (component) { 9294 var destroyFn = component.destroy || component.dispose; 9295 9296 if (destroyFn) { 9297 destroyFn.call(component); 9298 } 9299 9300 delete componentDestroyConfigs[componentId]; 9301 delete componentPromiseWrappers[componentId]; 9302 delete componentsFn[componentId]; 9303 delete components[componentId]; 9304 } 9305 }; 9306 /** 9307 * Destroys registered components matching the provided filter function. If 9308 * no filter function is provided, it will destroy all registered components. 9309 * 9310 * @param {Function} filterFn A method that receives a component destroy options 9311 * and the component itself and returns true if the component should be destroyed 9312 * @review 9313 */ 9314 9315 9316 Liferay.destroyComponents = function (filterFn) { 9317 var componentIds = Object.keys(components); 9318 9319 if (filterFn) { 9320 componentIds = componentIds.filter(function (componentId) { 9321 return filterFn(components[componentId], componentDestroyConfigs[componentId] || {}); 9322 }); 9323 } 9324 9325 componentIds.forEach(Liferay.destroyComponent); 9326 }; 9327 /** 9328 * Clears the component promises map to make sure pending promises won't get 9329 * accidentally resolved at a later stage if a component with the same id appears 9330 * causing stale code to run. 9331 */ 9332 9333 9334 Liferay.destroyUnfulfilledPromises = function () { 9335 componentPromiseWrappers = {}; 9336 }; 9337 9338 Liferay._components = components; 9339 Liferay._componentsFn = components; 9340 Liferay.Template = { 9341 PORTLET: '<div class="portlet"><div class="portlet-topper"><div class="portlet-title"></div></div><div class="portlet-content"></div><div class="forbidden-action"></div></div>' 9342 }; 9343})(AUI.$, Liferay); 9344 9345(function (A, Liferay) { 9346 A.mix(A.namespace('config.io'), { 9347 method: 'POST', 9348 uriFormatter: function uriFormatter(value) { 9349 return Liferay.Util.getURLWithSessionId(value); 9350 } 9351 }, true); 9352})(AUI(), Liferay); 9353//# sourceMappingURL=liferay.js.map 9354;(function(A, $, Liferay) { 9355 A.use('aui-base-lang'); 9356 9357 var AArray = A.Array; 9358 9359 var Lang = A.Lang; 9360 9361 var EVENT_CLICK = 'click'; 9362 9363 var MAP_TOGGLE_STATE = { 9364 false: { 9365 cssClass: 'controls-hidden', 9366 iconCssClass: 'hidden', 9367 state: 'hidden' 9368 }, 9369 true: { 9370 cssClass: 'controls-visible', 9371 iconCssClass: 'view', 9372 state: 'visible' 9373 } 9374 }; 9375 9376 var REGEX_PORTLET_ID = /^(?:p_p_id)?_(.*)_.*$/; 9377 9378 var REGEX_SUB = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g; 9379 9380 var SRC_HIDE_LINK = { 9381 src: 'hideLink' 9382 }; 9383 9384 var STR_CHECKED = 'checked'; 9385 9386 var STR_RIGHT_SQUARE_BRACKET = ']'; 9387 9388 var TPL_LEXICON_ICON = '<svg class="lexicon-icon lexicon-icon-{0} {1}" focusable="false" role="image">' + 9389 '<use data-href="' + themeDisplay.getPathThemeImages() + '/lexicon/icons.svg#{0}" />' + 9390 '<title>{0}</title>' + 9391 '</svg>'; 9392 9393 var Window = { 9394 getById: function(id) { 9395 var instance = this; 9396 9397 return instance._map[id]; 9398 }, 9399 9400 _map: {} 9401 }; 9402 9403 var Util = { 9404 submitCountdown: 0, 9405 9406 addInputCancel: function() { 9407 A.use( 9408 'aui-button-search-cancel', 9409 function(A) { 9410 new A.ButtonSearchCancel( 9411 { 9412 trigger: 'input[type=password], input[type=search], input.clearable, input.search-query' 9413 } 9414 ); 9415 } 9416 ); 9417 9418 Util.addInputCancel = function() { 9419 }; 9420 }, 9421 9422 addParams: function(params, url) { 9423 if (typeof params === 'object') { 9424 params = $.param(params, true); 9425 } 9426 else { 9427 params = String(params).trim(); 9428 } 9429 9430 var loc = url || location.href; 9431 9432 var finalUrl = loc; 9433 9434 if (params) { 9435 var anchorHash; 9436 9437 if (loc.indexOf('#') > -1) { 9438 var locationPieces = loc.split('#'); 9439 9440 loc = locationPieces[0]; 9441 anchorHash = locationPieces[1]; 9442 } 9443 9444 if (loc.indexOf('?') == -1) { 9445 params = '?' + params; 9446 } 9447 else { 9448 params = '&' + params; 9449 } 9450 9451 if (loc.indexOf(params) == -1) { 9452 finalUrl = loc + params; 9453 9454 if (anchorHash) { 9455 finalUrl += '#' + anchorHash; 9456 } 9457 if (!url) { 9458 location.href = finalUrl; 9459 } 9460 9461 } 9462 } 9463 9464 return finalUrl; 9465 }, 9466 9467 checkAll: function(form, name, allBox, selectClassName) { 9468 if (form) { 9469 form = Util.getDOM(form); 9470 allBox = Util.getDOM(allBox); 9471 9472 var selector; 9473 9474 if (Array.isArray(name)) { 9475 selector = 'input[name=' + name.join('], input[name=') + STR_RIGHT_SQUARE_BRACKET; 9476 } 9477 else { 9478 selector = 'input[name=' + name + STR_RIGHT_SQUARE_BRACKET; 9479 } 9480 9481 form = $(form); 9482 9483 var allBoxChecked = $(allBox).prop(STR_CHECKED); 9484 9485 form.find(selector).each( 9486 function(index, item) { 9487 item = $(item); 9488 9489 if (!item.prop('disabled')) { 9490 item.prop(STR_CHECKED, allBoxChecked); 9491 } 9492 } 9493 ); 9494 9495 if (selectClassName) { 9496 form.find(selectClassName).toggleClass('info', allBoxChecked); 9497 } 9498 } 9499 }, 9500 9501 checkAllBox: function(form, name, allBox) { 9502 var totalOn = 0; 9503 9504 if (form) { 9505 form = Util.getDOM(form); 9506 allBox = Util.getDOM(allBox); 9507 9508 form = $(form); 9509 9510 var allBoxNodes = $(allBox); 9511 9512 if (!allBoxNodes.length) { 9513 allBoxNodes = form.find('input[name="' + allBox + '"]'); 9514 } 9515 9516 var totalBoxes = 0; 9517 9518 var inputs = form.find('input[type=checkbox]'); 9519 9520 if (!Array.isArray(name)) { 9521 name = [name]; 9522 } 9523 9524 inputs.each( 9525 function(index, item) { 9526 item = $(item); 9527 9528 if (!item.is(allBoxNodes) && name.indexOf(item.attr('name')) > -1) { 9529 totalBoxes++; 9530 9531 if (item.prop(STR_CHECKED)) { 9532 totalOn++; 9533 } 9534 } 9535 } 9536 ); 9537 9538 allBoxNodes.prop(STR_CHECKED, totalBoxes == totalOn); 9539 } 9540 9541 return totalOn; 9542 }, 9543 9544 checkTab: function(box) { 9545 if (document.all && window.event.keyCode == 9) { 9546 box.selection = document.selection.createRange(); 9547 9548 setTimeout( 9549 function() { 9550 Util.processTab(box.id); 9551 }, 9552 0 9553 ); 9554 } 9555 }, 9556 9557 disableElements: function(el) { 9558 var currentElement = $(el)[0]; 9559 9560 if (currentElement) { 9561 var children = currentElement.getElementsByTagName('*'); 9562 9563 var emptyFnFalse = function() { 9564 return false;
9565 }; 9566 9567 for (var i = children.length - 1; i >= 0; i--) { 9568 var item = children[i]; 9569 9570 item.style.cursor = 'default'; 9571 9572 item.onclick = emptyFnFalse; 9573 item.onmouseover = emptyFnFalse; 9574 item.onmouseout = emptyFnFalse; 9575 item.onmouseenter = emptyFnFalse; 9576 item.onmouseleave = emptyFnFalse; 9577 9578 item.action = ''; 9579 item.disabled = true; 9580 item.href = 'javascript:;'; 9581 item.onsubmit = emptyFnFalse; 9582 9583 $(item).off(); 9584 } 9585 } 9586 }, 9587 9588 disableEsc: function() { 9589 if (document.all && window.event.keyCode == 27) { 9590 window.event.returnValue = false; 9591 } 9592 }, 9593 9594 disableFormButtons: function(inputs, form) { 9595 inputs.attr('disabled', true); 9596 inputs.setStyle('opacity', 0.5); 9597 9598 if (A.UA.gecko) { 9599 A.getWin().on( 9600 'unload', 9601 function(event) { 9602 inputs.attr('disabled', false); 9603 } 9604 ); 9605 } 9606 else if (A.UA.safari) { 9607 A.use( 9608 'node-event-html5', 9609 function(A) { 9610 A.getWin().on( 9611 'pagehide', 9612 function(event) { 9613 Util.enableFormButtons(inputs, form); 9614 } 9615 ); 9616 } 9617 ); 9618 } 9619 }, 9620 9621 disableToggleBoxes: function(checkBoxId, toggleBoxId, checkDisabled) { 9622 var checkBox = $('#' + checkBoxId); 9623 var toggleBox = $('#' + toggleBoxId); 9624 9625 toggleBox.prop('disabled', checkDisabled && checkBox.prop(STR_CHECKED)); 9626 9627 checkBox.on( 9628 EVENT_CLICK, 9629 function() { 9630 toggleBox.prop('disabled', !toggleBox.prop('disabled')); 9631 } 9632 ); 9633 }, 9634 9635 enableFormButtons: function(inputs) { 9636 Util._submitLocked = null; 9637 9638 Util.toggleDisabled(inputs, false); 9639 }, 9640 9641 escapeCDATA: function(str) { 9642 return str.replace( 9643 /<!\[CDATA\[|\]\]>/gi, 9644 function(match) { 9645 var str = ''; 9646 9647 if (match == ']]>') { 9648 str = ']]>'; 9649 } 9650 else if (match == '<![CDATA[') { 9651 str = '<![CDATA['; 9652 } 9653 9654 return str; 9655 } 9656 ); 9657 }, 9658 9659 focusFormField: function(el) { 9660 var doc = $(document); 9661 9662 var interacting = false; 9663 9664 el = Util.getDOM(el); 9665 9666 el = $(el); 9667 9668 doc.on( 9669 'click.focusFormField', 9670 function(event) { 9671 interacting = true; 9672 9673 doc.off('click.focusFormField'); 9674 } 9675 ); 9676 9677 if (!interacting && Util.inBrowserView(el)) { 9678 var form = el.closest('form'); 9679 9680 var focusable = !el.is(':disabled') && !el.is(':hidden') && !el.parents(':disabled').length; 9681 9682 if (!form.length || focusable) { 9683 el.focus(); 9684 } 9685 else { 9686 var portletName = form.data('fm-namespace'); 9687 9688 var formReadyEventName = portletName + 'formReady'; 9689 9690 var formReadyHandler = function(event) { 9691 var elFormName = form.attr('name'); 9692 var formName = event.formName; 9693 9694 if (elFormName === formName) { 9695 el.focus(); 9696 9697 Liferay.detach(formReadyEventName, formReadyHandler); 9698 } 9699 }; 9700 9701 Liferay.on(formReadyEventName, formReadyHandler); 9702 } 9703 } 9704 }, 9705 9706 forcePost: function(link) { 9707 link = Util.getDOM(link); 9708 9709 link = $(link); 9710 9711 if (link.length) { 9712 var url = link.attr('href'); 9713 9714 // LPS-127302 9715 9716 if (url === 'javascript:;') { 9717 return; 9718 } 9719 9720 var newWindow = link.attr('target') == '_blank'; 9721 9722 var hrefFm = $(document.hrefFm); 9723 9724 if (newWindow) { 9725 hrefFm.attr('target', '_blank'); 9726 } 9727 9728 submitForm(hrefFm, url, !newWindow); 9729 9730 Util._submitLocked = null; 9731 } 9732 }, 9733 9734 getAttributes: function(el, attributeGetter) { 9735 var instance = this; 9736 9737 var result = null; 9738 9739 if (el) { 9740 el = Util.getDOM(el); 9741 9742 if (el.jquery) { 9743 el = el[0]; 9744 } 9745 9746 result = {}; 9747 9748 var getterFn = this.isFunction(attributeGetter); 9749 var getterString = typeof attributeGetter === 'string'; 9750 9751 var attrs = el.attributes; 9752 var length = attrs.length; 9753 9754 while (length--) { 9755 var attr = attrs[length]; 9756 var name = attr.nodeName.toLowerCase(); 9757 var value = attr.nodeValue; 9758 9759 if (getterString) { 9760 if (name.indexOf(attributeGetter) === 0) { 9761 name = name.substr(attributeGetter.length); 9762 } 9763 else { 9764 continue; 9765 } 9766 } 9767 else if (getterFn) { 9768 value = attributeGetter(value, name, attrs); 9769 9770 if (value === false) { 9771 continue; 9772 } 9773 } 9774 9775 result[name] = value; 9776 } 9777 } 9778 9779 return result; 9780 }, 9781 9782 getColumnId: function(str) { 9783 var columnId = str.replace(/layout-column_/, ''); 9784 9785 return columnId; 9786 }, 9787 9788 getDOM: function(el) { 9789 if (el._node || el._nodes) { 9790 el = el.getDOM(); 9791 } 9792 9793 return el; 9794 }, 9795 9796 getGeolocation: function(success, fallback, options) { 9797 if (success && navigator.geolocation) { 9798 navigator.geolocation.getCurrentPosition( 9799 function(position) { 9800 success( 9801 position.coords.latitude, 9802 position.coords.longitude, 9803 position 9804 ); 9805 }, 9806 fallback, 9807 options 9808 ); 9809 } 9810 else if (fallback) { 9811 fallback(); 9812 } 9813 }, 9814 9815 getLexiconIcon: function(icon, cssClass) { 9816 var instance = this; 9817 9818 return $(instance.getLexiconIconTpl(icon, cssClass))[0]; 9819 }, 9820 9821 getLexiconIconTpl: function(icon, cssClass) { 9822 var instance = this; 9823 9824 return Liferay.Util.sub(TPL_LEXICON_ICON, icon, cssClass || ''); 9825 }, 9826 9827 getOpener: function() { 9828 var openingWindow = Window._opener; 9829 9830 if (!openingWindow) { 9831 var topUtil = Liferay.Util.getTop().Liferay.Util; 9832 9833 var windowName = Liferay.Util.getWindowName(); 9834 9835 var dialog = topUtil.Window.getById(windowName); 9836 9837 if (dialog) { 9838 openingWindow = dialog._opener; 9839 9840 Window._opener = openingWindow; 9841 } 9842 } 9843 9844 return openingWindow || window.opener || window.parent; 9845 }, 9846 9847 getPortletId: function(portletId) { 9848 return String(portletId).replace(REGEX_PORTLET_ID, '$1'); 9849 }, 9850 9851 getPortletNamespace: function(portletId) { 9852 return '_' + portletId + '_'; 9853 }, 9854 9855 getTop: function() { 9856 var topWindow = Util._topWindow; 9857 9858 if (!topWindow) { 9859 var parentWindow = window.parent; 9860 9861 var parentThemeDisplay; 9862 9863 while (parentWindow != window) { 9864 try { 9865 if (typeof parentWindow.location.href == 'undefined') { 9866 break; 9867 } 9868 9869 parentThemeDisplay = parentWindow.themeDisplay; 9870 } 9871 catch (e) { 9872 break; 9873 } 9874 9875 if (!parentThemeDisplay || window.name === 'simulationDeviceIframe') { 9876 break; 9877 } 9878 else if (!parentThemeDisplay.isStatePopUp() || parentWindow == parentWindow.parent) { 9879 topWindow = parentWindow; 9880 9881 break; 9882 } 9883 9884 parentWindow = parentWindow.parent; 9885 } 9886 9887 if (!topWindow) { 9888 topWindow = window; 9889 } 9890 9891 Util._topWindow = topWindow; 9892 } 9893 9894 return topWindow; 9895 }, 9896 9897 getURLWithSessionId: function(url) { 9898 if (!themeDisplay.isAddSessionIdToURL()) { 9899 return url; 9900 } 9901 9902 // LEP-4787 9903 9904 var x = url.indexOf(';'); 9905 9906 if (x > -1) { 9907 return url; 9908 } 9909 9910 var sessionId = ';jsessionid=' + themeDisplay.getSessionId(); 9911 9912 x = url.indexOf('?'); 9913 9914 if (x > -1) { 9915 return url.substring(0, x) + sessionId + url.substring(x); 9916 } 9917 9918 // In IE6, http://www.abc.com;jsessionid=XYZ does not work, but 9919 // http://www.abc.com/;jsessionid=XYZ does work. 9920 9921 x = url.indexOf('//'); 9922 9923 if (x > -1) { 9924 var y = url.lastIndexOf('/'); 9925 9926 if (x + 1 == y) { 9927 return url + '/' + sessionId; 9928 } 9929 } 9930 9931 return url + sessionId; 9932 }, 9933 9934 getWindow: function(id) { 9935 if (!id) { 9936 id = Util.getWindowName(); 9937 } 9938 9939 return Util.getTop().Liferay.Util.Window.getById(id); 9940 }, 9941 9942 getWindowName: function() { 9943 return window.name || Window._name || ''; 9944 }, 9945 9946 getWindowWidth: function() { 9947 return window.innerWidth > 0 ? window.innerWidth : screen.width; 9948 }, 9949 9950 inBrowserView: function(node, win, nodeRegion) { 9951 var viewable = false;
9952 9953 node = $(node); 9954 9955 if (node.length) { 9956 if (!nodeRegion) { 9957 nodeRegion = node.offset(); 9958 9959 nodeRegion.bottom = nodeRegion.top + node.outerHeight(); 9960 nodeRegion.right = nodeRegion.left + node.outerWidth(); 9961 } 9962 9963 if (!win) { 9964 win = window; 9965 } 9966 9967 win = $(win); 9968 9969 var winRegion = {}; 9970 9971 winRegion.left = win.scrollLeft(); 9972 winRegion.right = winRegion.left + win.width(); 9973 9974 winRegion.top = win.scrollTop(); 9975 winRegion.bottom = winRegion.top + win.height(); 9976 9977 viewable = nodeRegion.bottom <= winRegion.bottom && 9978 nodeRegion.left >= winRegion.left && 9979 nodeRegion.right <= winRegion.right && 9980 nodeRegion.top >= winRegion.top; 9981 9982 if (viewable) { 9983 var frameEl = $(win.prop('frameElement')); 9984 9985 if (frameEl.length) { 9986 var frameOffset = frameEl.offset(); 9987 9988 var xOffset = frameOffset.left - winRegion.left; 9989 9990 nodeRegion.left += xOffset; 9991 nodeRegion.right += xOffset; 9992 9993 var yOffset = frameOffset.top - winRegion.top; 9994 9995 nodeRegion.top += yOffset; 9996 nodeRegion.bottom += yOffset; 9997 9998 viewable = Util.inBrowserView(node, win.prop('parent'), nodeRegion); 9999 } 10000 } 10001 } 10002 10003 return viewable; 10004 }, 10005 10006 isFunction: function(val) { 10007 return typeof val === 'function'; 10008 }, 10009 10010 isPhone: function() { 10011 var instance = this; 10012 10013 return instance.getWindowWidth() < Liferay.BREAKPOINTS.PHONE; 10014 }, 10015 10016 isTablet: function() { 10017 var instance = this; 10018 10019 return instance.getWindowWidth() < Liferay.BREAKPOINTS.TABLET; 10020 }, 10021 10022 listCheckboxesExcept: function(form, except, name, checked) { 10023 form = Util.getDOM(form); 10024 10025 var selector = 'input[type=checkbox]'; 10026 10027 if (name) { 10028 selector += '[name=' + name + ']'; 10029 } 10030 10031 return $(form).find(selector).toArray().reduce( 10032 function(prev, item, index) { 10033 item = $(item); 10034 10035 var val = item.val(); 10036 10037 if (val && item.attr('name') != except && item.prop('checked') == checked && !item.prop('disabled')) { 10038 prev.push(val); 10039 } 10040 10041 return prev; 10042 }, 10043 [] 10044 ).join(); 10045 }, 10046 10047 listCheckedExcept: function(form, except, name) { 10048 return Util.listCheckboxesExcept(form, except, name, true); 10049 }, 10050 10051 listSelect: function(select, delimeter) { 10052 select = Util.getDOM(select); 10053 10054 return $(select).find('option').toArray().reduce( 10055 function(prev, item, index) { 10056 var val = $(item).val(); 10057 10058 if (val) { 10059 prev.push(val); 10060 } 10061 10062 return prev; 10063 }, 10064 [] 10065 ).join(delimeter || ','); 10066 }, 10067 10068 listUncheckedExcept: function(form, except, name) { 10069 return Util.listCheckboxesExcept(form, except, name, false); 10070 }, 10071 10072 normalizeFriendlyURL: function(text) { 10073 var newText = text.replace(/[^a-zA-Z0-9_-]/g, '-'); 10074 10075 if (newText[0] === '-') { 10076 newText = newText.replace(/^-+/, ''); 10077 } 10078 10079 newText = newText.replace(/--+/g, '-'); 10080 10081 return newText.toLowerCase(); 10082 }, 10083 10084 openInDialog: function(event, config) { 10085 event.preventDefault(); 10086 10087 var currentTarget = Util.getDOM(event.currentTarget); 10088 10089 currentTarget = $(currentTarget); 10090 10091 config = A.mix(A.merge({}, currentTarget.data()), config); 10092 10093 if (!config.uri) { 10094 config.uri = currentTarget.data('href') || currentTarget.attr('href'); 10095 } 10096 10097 if (!config.title) { 10098 config.title = currentTarget.attr('title'); 10099 } 10100 10101 Liferay.Util.openWindow(config); 10102 }, 10103 10104 openWindow: function(config, callback) { 10105 config.openingWindow = window; 10106 10107 var top = Util.getTop(); 10108 10109 var topUtil = top.Liferay.Util; 10110 10111 topUtil._openWindowProvider(config, callback); 10112 }, 10113 10114 processTab: function(id) { 10115 document.all[id].selection.text = String.fromCharCode(9); 10116 document.all[id].focus(); 10117 }, 10118 10119 randomInt: function() { 10120 return Math.ceil(Math.random() * (new Date()).getTime()); 10121 }, 10122 10123 removeEntitySelection: function(entityIdString, entityNameString, removeEntityButton, namespace) { 10124 $('#' + namespace + entityIdString).val(0); 10125 10126 $('#' + namespace + entityNameString).val(''); 10127 10128 Liferay.Util.toggleDisabled(removeEntityButton, true); 10129 10130 Liferay.fire('entitySelectionRemoved'); 10131 }, 10132 10133 reorder: function(box, down) { 10134 box = Util.getDOM(box); 10135 10136 box = $(box); 10137 10138 if (box.prop('selectedIndex') == -1) { 10139 box.prop('selectedIndex', 0); 10140 } 10141 else { 10142 var selectedItems = box.find('option:selected'); 10143 10144 if (down) {
10145 selectedItems.get().reverse().forEach( 10146 function(item, index) { 10147 item = $(item); 10148 10149 var itemIndex = item.prop('index'); 10150 10151 var lastIndex = box.find('option').length - 1; 10152 10153 if (itemIndex === lastIndex) { 10154 box.prepend(item); 10155 } 10156 else { 10157 item.insertAfter(item.next()); 10158 } 10159 } 10160 ); 10161 } 10162 else { 10163 selectedItems.get().forEach( 10164 function(item, index) { 10165 item = $(item); 10166 10167 var itemIndex = item.prop('index'); 10168 10169 if (itemIndex === 0) { 10170 box.append(item); 10171 } 10172 else { 10173 item.insertBefore(item.prev()); 10174 } 10175 } 10176 ); 10177 } 10178 } 10179 }, 10180 10181 rowCheckerCheckAllBox: function(ancestorTable, ancestorRow, checkboxesIds, checkboxAllIds, cssClass) { 10182 Util.checkAllBox(ancestorTable, checkboxesIds, checkboxAllIds); 10183 10184 if (ancestorRow) { 10185 ancestorRow.toggleClass(cssClass); 10186 } 10187 }, 10188 10189 savePortletTitle: function(params) { 10190 params = Object.assign( 10191 { 10192 doAsUserId: 0, 10193 plid: 0, 10194 portletId: 0, 10195 title: '', 10196 url: themeDisplay.getPathMain() + '/portal/update_portlet_title' 10197 }, 10198 params 10199 ); 10200 10201 $.ajax( 10202 params.url, 10203 { 10204 data: { 10205 doAsUserId: params.doAsUserId, 10206 p_auth: Liferay.authToken, 10207 p_l_id: params.plid, 10208 portletId: params.portletId, 10209 title: params.title 10210 } 10211 } 10212 ); 10213 }, 10214 10215 selectEntityHandler: function(container, selectEventName, disableButton) { 10216 container = $(container); 10217 10218 var openingLiferay = Util.getOpener().Liferay; 10219 10220 var selectorButtons = container.find('.selector-button'); 10221 10222 container.on( 10223 'click', 10224 '.selector-button', 10225 function(event) { 10226 var target = $(event.target); 10227 10228 if (!target.attr('data-prevent-selection')) { 10229 var currentTarget = $(event.currentTarget); 10230 10231 var confirmSelection = currentTarget.attr('data-confirm-selection') === 'true'; 10232 var confirmSelectionMessage = currentTarget.attr('data-confirm-selection-message'); 10233 10234 if (!confirmSelection || confirm(confirmSelectionMessage)) { 10235 if (disableButton !== false) { 10236 selectorButtons.prop('disabled', false); 10237 10238 currentTarget.prop('disabled', true); 10239 } 10240 10241 var result = Util.getAttributes(currentTarget, 'data-'); 10242 10243 openingLiferay.fire(selectEventName, result); 10244 10245 Util.getWindow().hide(); 10246 } 10247 } 10248 } 10249 ); 10250 10251 openingLiferay.on( 10252 'entitySelectionRemoved', 10253 function(event) { 10254 selectorButtons.prop('disabled', false); 10255 } 10256 ); 10257 }, 10258 10259 selectFolder: function(folderData, namespace) { 10260 $('#' + namespace + folderData.idString).val(folderData.idValue); 10261 10262 var name = Liferay.Util.unescape(folderData.nameValue); 10263 10264 $('#' + namespace + folderData.nameString).val(name); 10265 10266 var button = $('#' + namespace + 'removeFolderButton'); 10267 10268 Liferay.Util.toggleDisabled(button, false); 10269 }, 10270 10271 setCursorPosition: function(el, position) { 10272 var instance = this; 10273 10274 instance.setSelectionRange(el, position, position); 10275 }, 10276 10277 setSelectionRange: function(el, selectionStart, selectionEnd) { 10278 var instance = this; 10279 10280 el = Util.getDOM(el); 10281 10282 if (el.jquery) { 10283 el = el[0]; 10284 } 10285 10286 if (el.setSelectionRange) { 10287 el.focus(); 10288 10289 el.setSelectionRange(selectionStart, selectionEnd); 10290 } 10291 else if (el.createTextRange) { 10292 var textRange = el.createTextRange(); 10293 10294 textRange.collapse(true); 10295 10296 textRange.moveEnd('character', selectionEnd); 10297 textRange.moveEnd('character', selectionStart); 10298 10299 textRange.select(); 10300 } 10301 }, 10302 10303 showCapsLock: function(event, span) { 10304 var keyCode = event.keyCode ? event.keyCode : event.which; 10305 10306 var shiftKeyCode = keyCode === 16; 10307 10308 var shiftKey = event.shiftKey ? event.shiftKey : shiftKeyCode; 10309 10310 var display = 'none'; 10311 10312 if (keyCode >= 65 && keyCode <= 90 && !shiftKey || keyCode >= 97 && keyCode <= 122 && shiftKey) { 10313 display = ''; 10314 } 10315 10316 $('#' + span).css('display', display); 10317 }, 10318 10319 sortByAscending: function(a, b) { 10320 a = a[1].toLowerCase(); 10321 b = b[1].toLowerCase(); 10322 10323 if (a > b) { 10324 return 1; 10325 } 10326 10327 if (a < b) { 10328 return -1; 10329 } 10330 10331 return 0; 10332 }, 10333 10334 sub: function(string, data) { 10335 if (arguments.length > 2 || (typeof data !== 'object' && typeof data !== 'function')) { 10336 data = Array.prototype.slice.call(arguments, 1); 10337 } 10338 10339 return string.replace ? string.replace( 10340 REGEX_SUB, 10341 function(match, key) { 10342 return data[key] === undefined ? match : data[key]; 10343 } 10344 ) : string; 10345 }, 10346 10347 submitForm: function(form) { 10348 form.submit(); 10349 }, 10350 10351 toggleBoxes: function(checkBoxId, toggleBoxId, displayWhenUnchecked, toggleChildCheckboxes) { 10352 var checkBox = $('#' + checkBoxId); 10353 var toggleBox = $('#' + toggleBoxId); 10354 10355 var checked = checkBox.prop(STR_CHECKED); 10356 10357 if (displayWhenUnchecked) { 10358 checked = !checked; 10359 } 10360 10361 toggleBox.toggleClass('hide', !checked); 10362 10363 checkBox.on( 10364 EVENT_CLICK, 10365 function() { 10366 toggleBox.toggleClass('hide'); 10367 10368 if (toggleChildCheckboxes) { 10369 var childCheckboxes = toggleBox.find('input[type=checkbox]'); 10370 10371 childCheckboxes.prop(STR_CHECKED, checkBox.prop(STR_CHECKED)); 10372 } 10373 } 10374 ); 10375 }, 10376 10377 toggleDisabled: function(button, state) { 10378 button = Util.getDOM(button); 10379 10380 button = $(button); 10381 10382 button.each( 10383 function(index, item) { 10384 item = $(item); 10385 10386 item.prop('disabled', state); 10387 10388 item.toggleClass('disabled', state); 10389 } 10390 ); 10391 }, 10392 10393 toggleRadio: function(radioId, showBoxIds, hideBoxIds) { 10394 var radioButton = $('#' + radioId); 10395 10396 var showBoxes; 10397 10398 if (showBoxIds) { 10399 if (Array.isArray(showBoxIds)) { 10400 showBoxIds = showBoxIds.join(',#'); 10401 } 10402 10403 showBoxes = $('#' + showBoxIds); 10404 10405 showBoxes.toggleClass('hide', !radioButton.prop(STR_CHECKED)); 10406 } 10407 10408 radioButton.on( 10409 'change', 10410 function() { 10411 if (showBoxes) { 10412 showBoxes.removeClass('hide'); 10413 } 10414 10415 if (hideBoxIds) { 10416 if (Array.isArray(hideBoxIds)) { 10417 hideBoxIds = hideBoxIds.join(',#'); 10418 } 10419 10420 $('#' + hideBoxIds).addClass('hide'); 10421 } 10422 } 10423 ); 10424 }, 10425 10426 toggleSearchContainerButton: function(buttonId, searchContainerId, form, ignoreFieldName) { 10427 $(searchContainerId).on( 10428 EVENT_CLICK, 10429 'input[type=checkbox]', 10430 function() { 10431 Util.toggleDisabled(buttonId, !Util.listCheckedExcept(form, ignoreFieldName)); 10432 } 10433 ); 10434 }, 10435 10436 toggleSelectBox: function(selectBoxId, value, toggleBoxId) { 10437 var selectBox = $('#' + selectBoxId); 10438 var toggleBox = $('#' + toggleBoxId); 10439 10440 var dynamicValue = this.isFunction(value); 10441 10442 var toggle = function() { 10443 var currentValue = selectBox.val(); 10444 10445 var visible = value == currentValue; 10446 10447 if (dynamicValue) { 10448 visible = value(currentValue, value); 10449 } 10450 10451 toggleBox.toggleClass('hide', !visible); 10452 }; 10453 10454 toggle(); 10455 10456 selectBox.on('change', toggle); 10457 }, 10458 10459 toNumber: function(value) { 10460 return parseInt(value, 10) || 0; 10461 }, 10462 10463 _defaultPreviewArticleFn: function(event) { 10464 var instance = this; 10465 10466 event.preventDefault(); 10467 10468 Util.defaultPreviewArticleFn(event); 10469 }, 10470 10471 _defaultSubmitFormFn: function(event) { 10472 var form = event.form; 10473 10474 var hasErrors = false;
10475 10476 if (event.validate) { 10477 var liferayForm = Liferay.Form.get(form.attr('id')); 10478 10479 if (liferayForm) { 10480 var validator = liferayForm.formValidator; 10481 10482 if (A.instanceOf(validator, A.FormValidator)) { 10483 validator.validate(); 10484 10485 hasErrors = validator.hasErrors(); 10486 10487 if (hasErrors) { 10488 validator.focusInvalidField(); 10489 } 10490 } 10491 } 10492 } 10493 10494 if (!hasErrors) { 10495 var action = event.action || form.getAttribute('action'); 10496 10497 var singleSubmit = event.singleSubmit; 10498 10499 var inputs = form.all('button[type=submit], input[type=button], input[type=image], input[type=reset], input[type=submit]'); 10500 10501 Util.disableFormButtons(inputs, form); 10502 10503 if (singleSubmit === false) { 10504 Util._submitLocked = A.later( 10505 1000, 10506 Util, 10507 Util.enableFormButtons, 10508 [inputs, form] 10509 ); 10510 } 10511 else { 10512 Util._submitLocked = true; 10513 } 10514 10515 var actionURL = new A.Url(action); 10516 10517 var authToken = actionURL.getParameter('p_auth') || ''; 10518 10519 form.append('<input name="p_auth" type="hidden" value="' + authToken + '" />'); 10520 10521 if (authToken) { 10522 actionURL.removeParameter('p_auth'); 10523 10524 action = actionURL.toString(); 10525 } 10526 10527 form.attr('action', action); 10528 10529 Util.submitForm(form); 10530 10531 form.attr('target', ''); 10532 10533 Util._submitLocked = null; 10534 } 10535 }, 10536 10537 _getEditableInstance: function(title) { 10538 var editable = Util._EDITABLE; 10539 10540 if (!editable) { 10541 editable = new A.Editable( 10542 { 10543 after: { 10544 contentTextChange: function(event) { 10545 var instance = this; 10546 10547 if (!event.initial) { 10548 var title = instance.get('node'); 10549 10550 var portletTitleEditOptions = title.getData('portletTitleEditOptions'); 10551 10552 Util.savePortletTitle( 10553 { 10554 doAsUserId: portletTitleEditOptions.doAsUserId, 10555 plid: portletTitleEditOptions.plid, 10556 portletId: portletTitleEditOptions.portletId, 10557 title: event.newVal 10558 } 10559 ); 10560 } 10561 }, 10562 startEditing: function(event) { 10563 var instance = this; 10564 10565 var Layout = Liferay.Layout; 10566 10567 if (Layout) { 10568 instance._dragListener = Layout.getLayoutHandler().on( 10569 'drag:start', 10570 function(event) { 10571 instance.fire('save'); 10572 } 10573 ); 10574 } 10575 }, 10576 stopEditing: function(event) { 10577 var instance = this; 10578 10579 if (instance._dragListener) { 10580 instance._dragListener.detach(); 10581 } 10582 } 10583 }, 10584 cssClass: 'lfr-portlet-title-editable', 10585 node: title 10586 } 10587 ); 10588 10589 Util._EDITABLE = editable; 10590 } 10591 10592 return editable; 10593 } 10594 }; 10595 10596 Liferay.provide( 10597 Util, 10598 'afterIframeLoaded', 10599 function(event) { 10600 var nodeInstances = A.Node._instances; 10601 10602 var docEl = event.doc; 10603 10604 var docUID = docEl._yuid; 10605 10606 if (docUID in nodeInstances) { 10607 delete nodeInstances[docUID]; 10608 } 10609 10610 var iframeDocument = A.one(docEl); 10611 10612 var iframeBody = iframeDocument.one('body'); 10613 10614 var dialog = event.dialog; 10615 10616 var lfrFormContent = iframeBody.one('.lfr-form-content'); 10617 10618 iframeBody.addClass('dialog-iframe-popup'); 10619 10620 if (lfrFormContent && iframeBody.one('.button-holder.dialog-footer')) { 10621 iframeBody.addClass('dialog-with-footer'); 10622 10623 var stagingAlert = iframeBody.one('.portlet-body > .lfr-portlet-message-staging-alert'); 10624 10625 if (stagingAlert) { 10626 stagingAlert.remove(); 10627 10628 lfrFormContent.prepend(stagingAlert); 10629 } 10630 } 10631 10632 iframeBody.addClass(dialog.iframeConfig.bodyCssClass); 10633 10634 event.win.focus(); 10635 10636 var detachEventHandles = function() { 10637 AArray.invoke(eventHandles, 'detach'); 10638 10639 iframeDocument.purge(true); 10640 }; 10641 10642 var eventHandles = [ 10643 iframeBody.delegate('submit', detachEventHandles, 'form'), 10644 10645 iframeBody.delegate( 10646 EVENT_CLICK, 10647 function(event) { 10648 dialog.set( 10649 'visible', 10650 false, 10651 event.currentTarget.hasClass('lfr-hide-dialog') ? SRC_HIDE_LINK : null 10652 ); 10653 10654 detachEventHandles(); 10655 }, 10656 '.btn-cancel,.lfr-hide-dialog' 10657 ) 10658 ]; 10659 }, 10660 ['aui-base'] 10661 ); 10662 10663 Liferay.provide( 10664 Util, 10665 'openDDMPortlet', 10666 function(config, callback) { 10667 var instance = this; 10668 10669 var defaultValues = { 10670 eventName: 'selectStructure' 10671 }; 10672 10673 config = A.merge(defaultValues, config); 10674 10675 var ddmURL; 10676 10677 if (config.basePortletURL) { 10678 ddmURL = Liferay.PortletURL.createURL(config.basePortletURL); 10679 } 10680 else { 10681 ddmURL = Liferay.PortletURL.createRenderURL(); 10682 } 10683 10684 ddmURL.setEscapeXML(false); 10685 10686 ddmURL.setDoAsGroupId(config.doAsGroupId || themeDisplay.getScopeGroupId()); 10687 10688 ddmURL.setParameter('classNameId', config.classNameId); 10689 ddmURL.setParameter('classPK', config.classPK); 10690 ddmURL.setParameter('resourceClassNameId', config.resourceClassNameId); 10691 ddmURL.setParameter('eventName', config.eventName); 10692 ddmURL.setParameter('groupId', config.groupId); 10693 ddmURL.setParameter('mode', config.mode); 10694 10695 if (config.mvcPath) { 10696 ddmURL.setParameter('mvcPath', config.mvcPath); 10697 } 10698 else { 10699 ddmURL.setParameter('mvcPath', '/view.jsp'); 10700 } 10701 10702 if ('navigationStartsOn' in config) { 10703 ddmURL.setParameter('navigationStartsOn', config.navigationStartsOn); 10704 } 10705 10706 ddmURL.setParameter('portletResourceNamespace', config.portletResourceNamespace); 10707 10708 if ('redirect' in config) { 10709 ddmURL.setParameter('redirect', config.redirect); 10710 } 10711 10712 if ('refererPortletName' in config) { 10713 ddmURL.setParameter('refererPortletName', config.refererPortletName); 10714 } 10715 10716 if ('refererWebDAVToken' in config) { 10717 ddmURL.setParameter('refererWebDAVToken', config.refererWebDAVToken); 10718 } 10719 10720 ddmURL.setParameter('scopeTitle', config.title); 10721 10722 if ('searchRestriction' in config) { 10723 ddmURL.setParameter('searchRestriction', config.searchRestriction); 10724 ddmURL.setParameter('searchRestrictionClassNameId', config.searchRestrictionClassNameId); 10725 ddmURL.setParameter('searchRestrictionClassPK', config.searchRestrictionClassPK); 10726 } 10727 10728 if ('showAncestorScopes' in config) { 10729 ddmURL.setParameter('showAncestorScopes', config.showAncestorScopes); 10730 } 10731 10732 if ('showBackURL' in config) { 10733 ddmURL.setParameter('showBackURL', config.showBackURL); 10734 } 10735 10736 if ('showCacheableInput' in config) { 10737 ddmURL.setParameter('showCacheableInput', config.showCacheableInput); 10738 } 10739 10740 if ('showHeader' in config) { 10741 ddmURL.setParameter('showHeader', config.showHeader); 10742 } 10743 10744 if ('showManageTemplates' in config) { 10745 ddmURL.setParameter('showManageTemplates', config.showManageTemplates); 10746 } 10747 10748 ddmURL.setParameter('structureAvailableFields', config.structureAvailableFields); 10749 ddmURL.setParameter('templateId', config.templateId); 10750 10751 ddmURL.setPortletId(Liferay.PortletKeys.DYNAMIC_DATA_MAPPING); 10752 ddmURL.setWindowState('pop_up'); 10753 10754 config.uri = ddmURL.toString(); 10755 10756 var dialogConfig = config.dialog; 10757 10758 if (!dialogConfig) { 10759 dialogConfig = {}; 10760 10761 config.dialog = dialogConfig; 10762 } 10763 10764 var eventHandles = []; 10765 10766 if (callback) { 10767 eventHandles.push(Liferay.once(config.eventName, callback)); 10768 } 10769 10770 var detachSelectionOnHideFn = function(event) { 10771 Liferay.fire(config.eventName); 10772 10773 if (!event.newVal) { 10774 (new A.EventHandle(eventHandles)).detach(); 10775 } 10776 }; 10777 10778 Util.openWindow( 10779 config, 10780 function(dialogWindow) { 10781 eventHandles.push(dialogWindow.after(['destroy', 'visibleChange'], detachSelectionOnHideFn)); 10782 } 10783 ); 10784 }, 10785 ['liferay-portlet-url'] 10786 ); 10787 10788 Liferay.provide( 10789 Util, 10790 'openDocument', 10791 function(webDavUrl, onSuccess, onError) { 10792 if (A.UA.ie) { 10793 try { 10794 var executor = new A.config.win.ActiveXObject('SharePoint.OpenDocuments'); 10795 10796 executor.EditDocument(webDavUrl); 10797 10798 if (Lang.isFunction(onSuccess)) { 10799 onSuccess(); 10800 } 10801 10802 } 10803 catch (e) { 10804 if (Lang.isFunction(onError)) { 10805 onError(e); 10806 } 10807 } 10808 } 10809 }, 10810 ['aui-base'] 10811 ); 10812 10813 Liferay.provide( 10814 Util, 10815 'portletTitleEdit', 10816 function(options) { 10817 var obj = options.obj; 10818 10819 if (obj) { 10820 var title = obj.one('.portlet-title-text'); 10821 10822 if (title && !title.hasClass('not-editable')) { 10823 title.addClass('portlet-title-editable'); 10824 10825 title.on( 10826 EVENT_CLICK, 10827 function(event) { 10828 var editable = Util._getEditableInstance(title); 10829 10830 var rendered = editable.get('rendered'); 10831 10832 if (rendered) { 10833 editable.fire('stopEditing'); 10834 } 10835 10836 editable.set('node', event.currentTarget); 10837 10838 if (rendered) { 10839 editable.syncUI(); 10840 } 10841 10842 editable._startEditing(event); 10843 } 10844 ); 10845 10846 title.setData('portletTitleEditOptions', options); 10847 } 10848 } 10849 }, 10850 ['aui-editable-deprecated'] 10851 ); 10852 10853 Liferay.provide( 10854 Util, 10855 'editEntity', 10856 function(config, callback) { 10857 var dialog = Util.getWindow(config.id); 10858 10859 var eventName = config.eventName || config.id; 10860 10861 var eventHandles = [Liferay.on(eventName, callback)]; 10862 10863 var detachSelectionOnHideFn = function(event) { 10864 if (!event.newVal) { 10865 (new A.EventHandle(eventHandles)).detach(); 10866 } 10867 }; 10868 10869 if (dialog) { 10870 eventHandles.push(dialog.after(['destroy', 'visibleChange'], detachSelectionOnHideFn)); 10871 10872 dialog.show(); 10873 } 10874 else { 10875 var destroyDialog = function(event) { 10876 var dialogId = config.id; 10877 10878 var dialogWindow = Util.getWindow(dialogId); 10879 10880 if (dialogWindow && Util.getPortletId(dialogId) === event.portletId) { 10881 dialogWindow.destroy(); 10882 10883 Liferay.detach('destroyPortlet', destroyDialog); 10884 } 10885 }; 10886 10887 var editURL = new Liferay.PortletURL.createURL( 10888 config.uri, 10889 A.merge( 10890 { 10891 eventName: eventName 10892 },
10893 config.urlParams 10894 ) 10895 ); 10896 10897 config.uri = editURL.toString(); 10898 10899 config.dialogIframe = A.merge( 10900 { 10901 bodyCssClass: 'dialog-with-footer' 10902 }, 10903 config.dialogIframe || {} 10904 ); 10905 10906 Util.openWindow( 10907 config, 10908 function(dialogWindow) { 10909 eventHandles.push( 10910 dialogWindow.after(['destroy', 'visibleChange'], detachSelectionOnHideFn) 10911 ); 10912 10913 Liferay.on('destroyPortlet', destroyDialog); 10914 } 10915 ); 10916 } 10917 }, 10918 ['aui-base', 'liferay-portlet-url', 'liferay-util-window'] 10919 ); 10920 10921 Liferay.provide( 10922 Util, 10923 'selectEntity', 10924 function(config, callback) { 10925 var dialog = Util.getWindow(config.id); 10926 10927 var eventName = config.eventName || config.id; 10928 10929 var eventHandles = [Liferay.on(eventName, callback)]; 10930 10931 var selectedData = config.selectedData; 10932 10933 if (selectedData) { 10934 config.dialog.destroyOnHide = true; 10935 } 10936 10937 var detachSelectionOnHideFn = function(event) { 10938 if (!event.newVal) { 10939 (new A.EventHandle(eventHandles)).detach(); 10940 } 10941 }; 10942 10943 var disableSelectedAssets = function(event) { 10944 if (selectedData && selectedData.length) { 10945 var currentWindow = event.currentTarget.node.get('contentWindow.document'); 10946 10947 var selectorButtons = currentWindow.all('.lfr-search-container-wrapper .selector-button'); 10948 10949 A.some( 10950 selectorButtons, 10951 function(item, index) { 10952 var assetEntryId = item.attr('data-entityid') || item.attr('data-entityname'); 10953 10954 var assetEntryIndex = selectedData.indexOf(assetEntryId); 10955 10956 if (assetEntryIndex > -1) { 10957 item.attr('data-prevent-selection', true); 10958 item.attr('disabled', true); 10959 10960 selectedData.splice(assetEntryIndex, 1); 10961 } 10962 10963 return !selectedData.length; 10964 } 10965 ); 10966 } 10967 }; 10968 10969 if (dialog) { 10970 eventHandles.push(dialog.after(['destroy', 'visibleChange'], detachSelectionOnHideFn)); 10971 10972 dialog.show(); 10973 } 10974 else { 10975 var destroyDialog = function(event) { 10976 var dialogId = config.id; 10977 10978 var dialogWindow = Util.getWindow(dialogId); 10979 10980 if (dialogWindow && Util.getPortletId(dialogId) === event.portletId) { 10981 dialogWindow.destroy(); 10982 10983 Liferay.detach('destroyPortlet', destroyDialog); 10984 } 10985 }; 10986 10987 Util.openWindow( 10988 config, 10989 function(dialogWindow) { 10990 eventHandles.push( 10991 dialogWindow.after(['destroy', 'visibleChange'], detachSelectionOnHideFn), 10992 dialogWindow.iframe.after(['load'], disableSelectedAssets) 10993 ); 10994 10995 Liferay.on('destroyPortlet', destroyDialog); 10996 } 10997 ); 10998 } 10999 }, 11000 ['aui-base', 'liferay-util-window'] 11001 ); 11002 11003 Liferay.provide( 11004 Util, 11005 'toggleControls', 11006 function(node) { 11007 var docBody = A.getBody(); 11008 11009 node = node || docBody; 11010 11011 var trigger = node.one('.toggle-controls'); 11012 11013 if (trigger) { 11014 var controlsVisible = Liferay._editControlsState === 'visible'; 11015 11016 var currentState = MAP_TOGGLE_STATE[controlsVisible]; 11017 11018 var icon = trigger.one('.lexicon-icon'); 11019 11020 if (icon) { 11021 currentState.icon = icon; 11022 } 11023 11024 docBody.addClass(currentState.cssClass); 11025 11026 Liferay.fire( 11027 'toggleControls', 11028 { 11029 enabled: controlsVisible 11030 } 11031 ); 11032 11033 trigger.on( 11034 'tap', 11035 function(event) { 11036 controlsVisible = !controlsVisible; 11037 11038 var prevState = currentState; 11039 11040 currentState = MAP_TOGGLE_STATE[controlsVisible]; 11041 11042 docBody.toggleClass(prevState.cssClass); 11043 docBody.toggleClass(currentState.cssClass); 11044 11045 var editControlsIconClass = currentState.iconCssClass; 11046 var editControlsState = currentState.state; 11047 11048 if (icon) { 11049 var newIcon = currentState.icon; 11050 11051 if (!newIcon) { 11052 newIcon = Util.getLexiconIcon(editControlsIconClass); 11053 11054 newIcon = A.one(newIcon); 11055 11056 currentState.icon = newIcon; 11057 } 11058 11059 icon.replace(newIcon); 11060 11061 icon = newIcon; 11062 } 11063 11064 Liferay._editControlsState = editControlsState; 11065 11066 Liferay.Store('com.liferay.frontend.js.web_toggleControls', editControlsState); 11067 11068 Liferay.fire( 11069 'toggleControls', 11070 { 11071 enabled: controlsVisible, 11072 src: 'ui' 11073 } 11074 ); 11075 } 11076 ); 11077 } 11078 }, 11079 ['event-tap', 'liferay-store'] 11080 ); 11081 11082 Liferay.provide( 11083 window, 11084 'submitForm', 11085 function(form, action, singleSubmit, validate) { 11086 if (!Util._submitLocked) { 11087 if (form.jquery) { 11088 form = form[0]; 11089 } 11090 11091 Liferay.fire( 11092 'submitForm', 11093 { 11094 action: action, 11095 form: A.one(form), 11096 singleSubmit: singleSubmit, 11097 validate: validate !== false 11098 } 11099 ); 11100 } 11101 }, 11102 ['aui-base', 'aui-form-validator', 'aui-url', 'liferay-form'] 11103 ); 11104 11105 Liferay.publish( 11106 'submitForm', 11107 { 11108 defaultFn: Util._defaultSubmitFormFn 11109 } 11110 ); 11111 11112 Liferay.provide( 11113 Util, 11114 'defaultPreviewArticleFn', 11115 function(event) { 11116 var instance = this; 11117 11118 var urlPreview = instance._urlPreview; 11119 11120 if (!urlPreview) { 11121 urlPreview = new Liferay.UrlPreview( 11122 { 11123 title: Util.escapeHTML(event.title), 11124 url: event.uri 11125 } 11126 ); 11127 11128 instance._urlPreview = urlPreview; 11129 } 11130 else { 11131 urlPreview.set('title', Util.escapeHTML(event.title)); 11132 urlPreview.set('url', event.uri); 11133 } 11134 11135 urlPreview.open(); 11136 }, 11137 ['liferay-url-preview'] 11138 ); 11139 11140 Liferay.publish( 11141 'previewArticle', 11142 { 11143 defaultFn: Util._defaultPreviewArticleFn 11144 } 11145 ); 11146 11147 Liferay.provide( 11148 Util, 11149 '_openWindowProvider', 11150 function(config, callback) { 11151 var dialog = Window.getWindow(config); 11152 11153 if (Lang.isFunction(callback)) { 11154 callback(dialog); 11155 } 11156 }, 11157 ['liferay-util-window'] 11158 ); 11159 11160 Liferay.after( 11161 'closeWindow', 11162 function(event) {
11163 var id = event.id; 11164 11165 var dialog = Liferay.Util.getTop().Liferay.Util.Window.getById(id); 11166 11167 if (dialog && dialog.iframe) { 11168 var dialogWindow = dialog.iframe.node.get('contentWindow').getDOM(); 11169 11170 var openingWindow = dialogWindow.Liferay.Util.getOpener(); 11171 var redirect = event.redirect; 11172 11173 if (redirect) { 11174 openingWindow.Liferay.Util.navigate(redirect); 11175 } 11176 else { 11177 var refresh = event.refresh; 11178 11179 if (refresh && openingWindow) { 11180 var data; 11181 11182 if (!event.portletAjaxable) { 11183 data = { 11184 portletAjaxable: false 11185 }; 11186 } 11187 11188 openingWindow.Liferay.Portlet.refresh('#p_p_id_' + refresh + '_', data); 11189 } 11190 } 11191 11192 dialog.hide(); 11193 } 11194 } 11195 ); 11196 11197 Util.Window = Window; 11198 11199 Liferay.Util = Util; 11200 11201 Liferay.BREAKPOINTS = { 11202 PHONE: 768, 11203 TABLET: 980 11204 }; 11205 11206 Liferay.STATUS_CODE = { 11207 BAD_REQUEST: 400, 11208 INTERNAL_SERVER_ERROR: 500, 11209 OK: 200, 11210 SC_DUPLICATE_FILE_EXCEPTION: 490, 11211 SC_FILE_ANTIVIRUS_EXCEPTION: 494, 11212 SC_FILE_EXTENSION_EXCEPTION: 491, 11213 SC_FILE_NAME_EXCEPTION: 492, 11214 SC_FILE_SIZE_EXCEPTION: 493, 11215 SC_UPLOAD_REQUEST_SIZE_EXCEPTION: 495 11216 }; 11217 11218 // 0-200: Theme Developer 11219 // 200-400: Portlet Developer 11220 // 400+: Liferay 11221 11222 Liferay.zIndex = { 11223 ALERT: 430, 11224 DOCK: 10, 11225 DOCK_PARENT: 20, 11226 DRAG_ITEM: 460, 11227 DROP_AREA: 440, 11228 DROP_POSITION: 450, 11229 MENU: 5000, 11230 OVERLAY: 1000, 11231 POPOVER: 1600, 11232 TOOLTIP: 10000, 11233 WINDOW: 1200 11234 }; 11235})(AUI(), AUI.$, Liferay); 11236!function(t,e){for(var n in e)t[n]=e[n]}(window,function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/o/frontend-js-web/liferay/",n(n.s=8)}([function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.string=e.object=e.Disposable=e.async=e.array=void 0;var r=n(12);Object.keys(r).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var o=s(r),a=s(n(13)),i=s(n(14)),u=s(n(17)),c=s(n(18)),l=s(n(19));function s(t){return t&&t.__esModule?t:{default:t}}e.array=a.default,e.async=i.default,e.Disposable=u.default,e.object=c.default,e.string=l.default,e.default=o.default},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.abstractMethod=function(){throw Error("Unimplemented abstract method")},e.disableCompatibilityMode=function(){r=void 0},e.enableCompatibilityMode=i,e.getCompatibilityModeData=function(){void 0===r&&"undefined"!=typeof window&&window.__METAL_COMPATIBILITY__&&i(window.__METAL_COMPATIBILITY__);return r},e.getFunctionName=function(t){if(!t.name){var e=t.toString();t.name=e.substring(9,e.indexOf("("))}return t.name},e.getStaticProperty=function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u;var o=n+"_MERGED";if(!e.hasOwnProperty(o)){var a=e.hasOwnProperty(n)?e[n]:null;e.__proto__&&!e.__proto__.isPrototypeOf(Function)&&(a=r(a,t(e.__proto__,n,r))),e[o]=a}return e[o]},e.getUid=function(t,e){if(t){var n=t[a];return e&&!t.hasOwnProperty(a)&&(n=null),n||(t[a]=o++)}return o++},e.identityFunction=function(t){return t},e.isBoolean=function(t){return"boolean"==typeof t},e.isDef=c,e.isDefAndNotNull=function(t){return c(t)&&!l(t)},e.isDocument=function(t){return t&&"object"===(void 0===t?"undefined":n(t))&&9===t.nodeType},e.isDocumentFragment=function(t){return t&&"object"===(void 0===t?"undefined":n(t))&&11===t.nodeType},e.isElement=function(t){return t&&"object"===(void 0===t?"undefined":n(t))&&1===t.nodeType},e.isFunction=function(t){return"function"==typeof t},e.isNull=l,e.isNumber=function(t){return"number"==typeof t},e.isWindow=function(t){return null!==t&&t===t.window},e.isObject=function(t){var e=void 0===t?"undefined":n(t);return"object"===e&&null!==t||"function"===e},e.isPromise=function(t){return t&&"object"===(void 0===t?"undefined":n(t))&&"function"==typeof t.then},e.isString=function(t){return"string"==typeof t||t instanceof String},e.isServerSide=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{checkEnv:!0},n=void 0!==t&&!t.browser;n&&e.checkEnv&&(n=void 0!==t.env&&!0);return n},e.nullFunction=function(){};var r=void 0,o=1,a=e.UID_PROPERTY="core_"+(1e9*Math.random()>>>0);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r=t}function u(t,e){return t||e}function c(t){return void 0!==t}function l(t){return null===t}}).call(this,n(3))},function(t,e){var n,r,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(t){n=a}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(t){r=i}}();var c,l=[],s=!1,f=-1;
11236function p(){s&&c&&(s=!1,c.length?l=c.concat(l):f=-1,l.length&&d())}function d(){if(!s){var t=u(p);s=!0;for(var e=l.length;e;){for(c=l,l=[];++f<e;)c&&c[f].run();f=-1,e=l.length}c=null,s=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new h(t,e)),1!==l.length||s||u(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.PortletConstants=void 0;var n={EDIT:"edit",HELP:"help",VIEW:"view",MAXIMIZED:"maximized",MINIMIZED:"minimized",NORMAL:"normal",FULL:"cacheLevelFull",PAGE:"cacheLevelPage",PORTLET:"cacheLevelPortlet"};e.PortletConstants=n;var r=n;e.default=r},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.validateState=e.validatePortletId=e.validateParameters=e.validateForm=e.validateArguments=e.getUrl=e.getUpdatedPublicRenderParameters=e.generatePortletModeAndWindowStateString=e.generateActionUrl=e.encodeFormAsString=e.decodeUpdateString=void 0;var r=n(1);function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}e.decodeUpdateString=function(t,e){var n=t&&t.portlets?t.portlets:{};try{var r=JSON.parse(e);if(r.portlets)for(var o=Object.keys(n),a=0,i=o;a<i.length;a++){var u=i[a],c=r.portlets[u].state,l=n[u].state;if(!c||!l)throw new Error("Invalid update string.\nold state=".concat(l,"\nnew state=").concat(c));d(t,c,u)&&(n[u]=r.portlets[u])}}catch(t){}return n};var i=function(t,e){for(var n=[],r=function(r){var o=e.elements[r],i=o.name,u=o.nodeName.toUpperCase(),c="INPUT"===u?o.type.toUpperCase():"",l=o.value;if(i&&!o.disabled&&"FILE"!==c)if("SELECT"===u&&o.multiple)a(o.options).forEach(function(e){if(e.checked){var r=e.value,o=encodeURIComponent(t+i)+"="+encodeURIComponent(r);n.push(o)}});else if("CHECKBOX"!==c&&"RADIO"!==c||o.checked){var s=encodeURIComponent(t+i)+"="+encodeURIComponent(l);n.push(s)}},o=0;o<e.elements.length;o++)r(o);return n.join("&")};e.encodeFormAsString=i;var u=function(t,e){var n="";if(Array.isArray(e))if(0===e.length)n+="&"+encodeURIComponent(t)+"=";else{var r=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var c=i.value;n+="&"+encodeURIComponent(t),n+=null===c?"=":"="+encodeURIComponent(c)}}catch(t){o=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}}return n};e.generateActionUrl=function(t,e,n){var r={credentials:"same-origin",method:"POST",url:e};if(n)if("multipart/form-data"===n.enctype){var o=new FormData(n);r.body=o}else{var a=i(t,n);"GET"===(n.method?n.method.toUpperCase():"GET")?(e.indexOf("?")>=0?e+="&".concat(a):e+="?".concat(a),r.url=e):(r.body=a,r.headers={"Content-Type":"application/x-www-form-urlencoded"})}return r};var c=function(t,e,n,r,o){var a="";if(t.portlets&&t.portlets[e]){var i=t.portlets[e];if(i&&i.state&&i.state.parameters){var c=i.state.parameters[n];void 0!==c&&(a+=u("p_r_p_"===r?o:"priv_r_p_"===r?e+"priv_r_p_"+n:e+n,c))}}return a},l=function(t,e){var n="";if(t.portlets){var r=t.portlets[e];if(r.state){var o=r.state;n+="&p_p_mode="+encodeURIComponent(o.portletMode),n+="&p_p_state="+encodeURIComponent(o.windowState)}}return n};e.generatePortletModeAndWindowStateString=l;e.getUpdatedPublicRenderParameters=function(t,e,n){var r={};if(t&&t.portlets){var o=t.portlets[e];if(o&&o.pubParms)for(var a=o.pubParms,i=0,u=Object.keys(a);i<u.length;i++){var c=u[i];if(!f(t,e,n,c))r[a[c]]=n.parameters[c]}}return r};e.getUrl=function(t,e,n,r,o,a){var i="cacheLevelPage",s="",f="";if(t&&t.portlets){"RENDER"===e&&void 0===n&&(n=null);var d=t.portlets[n];if(d&&("RESOURCE"===e?(f=decodeURIComponent(d.encodedResourceURL),o&&(i=o),f+="&p_p_cacheability="+encodeURIComponent(i),a&&(f+="&p_p_resource_id="+encodeURIComponent(a))):"RENDER"===e&&null!==n?f=decodeURIComponent(d.encodedRenderURL):"RENDER"===e?f=decodeURIComponent(t.encodedCurrentURL):"ACTION"===e?(f=decodeURIComponent(d.encodedActionURL),f+="&p_p_hub="+encodeURIComponent("0")):"PARTIAL_ACTION"===e&&(f=decodeURIComponent(d.encodedActionURL),f+="&p_p_hub="+encodeURIComponent("1")),"RESOURCE"!==e||"cacheLevelFull"!==i)){if(n&&(f+=l(t,n)),n&&(s="",d.state&&d.state.parameters)){for(var h=d.state.parameters,v=0,y=Object.keys(h);v<y.length;v++){var _=y[v];p(t,n,_)||(s+=c(t,n,_,"priv_r_p_"))}f+=s}if(t.prpMap){s="";for(var m={},b=0,g=Object.keys(t.prpMap);b<g.length;b++)for(var w=g[b],E=0,j=Object.keys(t.prpMap[w]);E<j.length;E++){var O=j[E],S=t.prpMap[w][O].split("|");m.hasOwnProperty(w)||(m[w]=c(t,S[0],S[1],"p_r_p_",w),s+=m[w])}f+=s}}}if(r){s="";for(var T=0,I=Object.keys(r);T<I.length;T++){var P=I[T];s+=u(n+P,r[P])}f+=s}return Promise.resolve(f)};var s=function(t,e){var n=!1;void 0===t&&void 0===e&&(n=!0),void 0!==t&&void 0!==e||(n=!1),t.length!==e.length&&(n=!1);for(var r=t.length-1;r>=0;r--)t[r]!==e[r]&&(n=!1);return n},f=function(t,e,n,r){var o=!1;if(t&&t.portlets){var a=t.portlets[e];if(n.parameters[r]&&a.state.parameters[r]){var i=n.parameters[r],u=a.state.parameters[r];o=s(i,u)}}return o},p=function(t,e,n){var r=!1;if(t&&t.portlets){var o=t.portlets[e];if(o&&o.pubParms)r=Object.keys(o.pubParms).includes(n)}return r},d=function(t,e,n){var r=!1;if(t&&t.portlets&&t.portlets[n]){var o=t.portlets[n].state;if(!e.portletMode||!e.windowState||!e.parameters)throw new Error("Error decoding state: ".concat(e));if(e.porletMode!==o.portletMode||e.windowState!==o.windowState)r=!0;else{for(var a=0,i=Object.keys(e.parameters);a<i.length;a++){var u=i[a],c=e.parameters[u],l=o.parameters[u];s(c,l)||(r=!0)}for(var f=0,p=Object.keys(o.parameters);f<p.length;f++){var d=p[f];e.parameters[d]||(r=!0)}}}return r};e.validateArguments=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(t.length<e)throw new TypeError("Too few arguments provided: Number of arguments: ".concat(t.length));if(t.length>n)throw new TypeError("Too many arguments provided: ".concat([].join.call(t,", ")));if(Array.isArray(r))for(var a=Math.min(t.length,r.length)-1;a>=0;a--){if(o(t[a])!==r[a])throw new TypeError("Parameter ".concat(a," is of type ").concat(o(t[a])," rather than the expected type ").concat(r[a]));if(null===t[a]||void 0===t[a])throw new TypeError("Argument is ".concat(o(t[a])))}};e.validateForm=function(t){if(!(t instanceof HTMLFormElement))throw new TypeError("Element must be an HTMLFormElement");var e=t.method?t.method.toUpperCase():void 0;if(e&&"GET"!==e&&"POST"!==e)throw new TypeError("Invalid form method ".concat(e,". Allowed methods are GET & POST"));var n=t.enctype;if(n&&"application/x-www-form-urlencoded"!==n&&"multipart/form-data"!==n)throw new TypeError("Invalid form enctype ".concat(n,". Allowed: 'application/x-www-form-urlencoded' & 'multipart/form-data'"));if(n&&"multipart/form-data"===n&&"POST"!==e)throw new TypeError("Invalid method with multipart/form-data. Must be POST");if(!n||"application/x-www-form-urlencoded"===n)for(var r=t.elements.length,o=0;o<r;o++)if("INPUT"===t.elements[o].nodeName.toUpperCase()&&"FILE"===t.elements[o].type.toUpperCase())throw new TypeError("Mu
11236st use enctype = 'multipart/form-data' with input type FILE.")};var h=function(t){if(!(0,r.isDefAndNotNull)(t))throw new TypeError("The parameter object is: ".concat(o(t)));for(var e=0,n=Object.keys(t);e<n.length;e++){var a=n[e];if(!Array.isArray(t[a]))throw new TypeError("".concat(a," parameter is not an array"));if(!t[a].length)throw new TypeError("".concat(a," parameter is an empty array"))}};e.validateParameters=h;e.validatePortletId=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.portlets&&Object.keys(t.portlets).includes(e)};e.validateState=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h(t.parameters);var n=t.portletMode;if(!(0,r.isString)(n))throw new TypeError("Invalid parameters. portletMode is ".concat(o(n)));var a=e.allowedPM;if(!a.includes(n.toLowerCase()))throw new TypeError("Invalid portletMode=".concat(n," is not in ").concat(a));var i=t.windowState;if(!(0,r.isString)(i))throw new TypeError("Invalid parameters. windowState is ".concat(o(i)));var u=e.allowedWS;if(!u.includes(i.toLowerCase()))throw new TypeError("Invalid windowState=".concat(i," is not in ").concat(u))}},function(t,e,n){(function(e){var n="Expected a function",r="__lodash_hash_undefined__",o="[object Function]",a="[object GeneratorFunction]",i=/^\[object .+?Constructor\]$/,u="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,l=u||c||Function("return this")();var s,f=Array.prototype,p=Function.prototype,d=Object.prototype,h=l["__core-js_shared__"],v=(s=/[^.]+$/.exec(h&&h.keys&&h.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"",y=p.toString,_=d.hasOwnProperty,m=d.toString,b=RegExp("^"+y.call(_).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),g=f.splice,w=k(l,"Map"),E=k(Object,"create");function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function O(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function S(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function T(t,e){for(var n,r,o=t.length;o--;)if((n=t[o][0])===(r=e)||n!=n&&r!=r)return o;return-1}function I(t){return!(!C(t)||(e=t,v&&v in e))&&(function(t){var e=C(t)?m.call(t):"";return e==o||e==a}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?b:i).test(function(t){if(null!=t){try{return y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function P(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function k(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return I(n)?n:void 0}function A(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(n);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return r.cache=a.set(o,i),i};return r.cache=new(A.Cache||S),r}function C(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}j.prototype.clear=function(){this.__data__=E?E(null):{}},j.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},j.prototype.get=function(t){var e=this.__data__;if(E){var n=e[t];return n===r?void 0:n}return _.call(e,t)?e[t]:void 0},j.prototype.has=function(t){var e=this.__data__;return E?void 0!==e[t]:_.call(e,t)},j.prototype.set=function(t,e){return this.__data__[t]=E&&void 0===e?r:e,this},O.prototype.clear=function(){this.__data__=[]},O.prototype.delete=function(t){var e=this.__data__,n=T(e,t);return!(n<0)&&(n==e.length-1?e.pop():g.call(e,n,1),!0)},O.prototype.get=function(t){var e=this.__data__,n=T(e,t);return n<0?void 0:e[n][1]},O.prototype.has=function(t){return T(this.__data__,t)>-1},O.prototype.set=function(t,e){var n=this.__data__,r=T(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},S.prototype.clear=function(){this.__data__={hash:new j,map:new(w||O),string:new j}},S.prototype.delete=function(t){return P(this,t).delete(t)},S.prototype.get=function(t){return P(this,t).get(t)},S.prototype.has=function(t){return P(this,t).has(t)},S.prototype.set=function(t,e){return P(this,t).set(t,e),this}
11236,A.Cache=S,t.exports=A}).call(this,n(0))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"portlet",{enumerable:!0,get:function(){return c.default}});var r=h(n(9)),o=h(n(10)),a=h(n(11)),i=h(n(20)),u=h(n(21)),c=h(n(22)),l=h(n(30)),s=h(n(31)),f=h(n(32)),p=h(n(33)),d=h(n(34));function h(t){return t&&t.__esModule?t:{default:t}}Liferay.Util.escape=r.default,Liferay.Util.fetch=o.default,Liferay.Util.formatXML=a.default,Liferay.Util.groupBy=i.default,Liferay.Util.isEqual=u.default,Liferay.Util.navigate=l.default,Liferay.Util.ns=s.default,Liferay.Util.objectToFormData=f.default,Liferay.Util.toCharCode=p.default,Liferay.Util.openToast=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];Liferay.Loader.require("frontend-js-web/liferay/toast/commands/OpenToast.es",function(t){t.openToast.apply(t,e)})},Liferay.Util.unescape=d.default},function(t,e,n){(function(e){var n=1/0,r="[object Symbol]",o=/[&<>"'`]/g,a=RegExp(o.source),i="object"==typeof e&&e&&e.Object===Object&&e,u="object"==typeof self&&self&&self.Object===Object&&self,c=i||u||Function("return this")();var l,s=(l={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},function(t){return null==l?void 0:l[t]}),f=Object.prototype.toString,p=c.Symbol,d=p?p.prototype:void 0,h=d?d.toString:void 0;function v(t){if("string"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&f.call(t)==r}(t))return h?h.call(t):"";var e=t+"";return"0"==e&&1/t==-n?"-0":e}t.exports=function(t){var e;return(t=null==(e=t)?"":v(e))&&a.test(t)?t.replace(o,s):t}}).call(this,n(0))},function(t,e){function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fetch(t,function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?n(o,!0).forEach(function(e){r(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(o).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}({},o,{},e))};var o={credentials:"include"}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(n,!0).forEach(function(e){a(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},T,{},e),P=n.newLine,k=n.tagIndent;if(!(0,r.isString)(t))throw new TypeError("Parameter content must be a string");var A=[];t=(t=(t=(t=(t=(t=t.trim()).replace(i,function(t){return A.push(t),O})).replace(w,"><")).replace(b,j+"<")).replace(_,j+"$1$2")).replace(S,function(){return A.shift()});var C=0,R=!1,L=t.split(j),M=0,D="";return L.forEach(function(t,e){i.test(t)?D+=I(M,P,k)+t:c.test(t)?(D+=I(M,P,k)+t,C++,R=!0,(u.test(t)||s.test(t))&&(R=0!==--C)):u.test(t)?(D+=t,R=0!==--C):f.exec(L[e-1])&&p.exec(t)&&d.exec(L[e-1])==h.exec(t)[0].replace("/",E)?(D+=t,!R&&--M):!v.test(t)||m.test(t)||g.test(t)?v.test(t)&&m.test(t)?D+=R?t:I(M,P,k)+t:m.test(t)?D+=R?t:I(--M,P,k)+t:g.test(t)?D+=R?t:I(M,P,k)+t:l.test(t)?D+=I(M,P,k)+t:D+=y?I(M,P,k)+t:t:D+=R?t:I(M++,P,k)+t,new RegExp("^"+P).test(D)&&(D=D.slice(P.length))}),D};var r=n(1);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var i=/<!\[CDATA\[[\0-\uFFFF]*?\]\]>/g,u=/-->|\]>/,c=/<!/,l=/<\?/,s=/!DOCTYPE/,f=/^<\w/,p=/^<\/\w/,d=/^<[\w:\-\.\,]+/,h=/^<\/[\w:\-\.\,]+/,v=/<\w/,y=/xmlns(?:\:|\=)/g,_=/\s*(xmlns)(\:|\=)/g,m=/<\//,b=/</g,g=/\/>/,w=/>\s+</g,E="",j="~::~",O="<"+j+"CDATA"+j+">",S=new RegExp(O,"g"),T={newLine:"\r\n",tagIndent:"\t"};function I(t,e,n){return e+new Array(t+1).join(n)}},function(t,e,n){"use strict";
11236Object.defineProperty(e,"__esModule",{value:!0}),e.core=void 0;var r=n(2);Object.keys(r).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(r);e.default=o,e.core=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return r(t,null,[{key:"equal",value:function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}},{key:"firstDefinedValue",value:function(t){for(var e=0;e<t.length;e++)if(void 0!==t[e])return t[e]}},{key:"flatten",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0;r<e.length;r++)Array.isArray(e[r])?t.flatten(e[r],n):n.push(e[r]);return n}},{key:"remove",value:function(e,n){var r,o=e.indexOf(n);return(r=o>=0)&&t.removeAt(e,o),r}},{key:"removeAt",value:function(t,e){return 1===Array.prototype.splice.call(t,e,1).length}},{key:"slice",value:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=[],o=e;o<n;o++)r.push(t[o]);return r}}]),t}();e.default=o},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o={throwException:function(t){o.nextTick(function(){throw t})},run:function(t,e){o.run.workQueueScheduled_||(o.nextTick(o.run.processWorkQueue),o.run.workQueueScheduled_=!0),o.run.workQueue_.push(new o.run.WorkItem_(t,e))}};o.run.workQueueScheduled_=!1,o.run.workQueue_=[],o.run.processWorkQueue=function(){for(;o.run.workQueue_.length;){var t=o.run.workQueue_;o.run.workQueue_=[];for(var e=0;e<t.length;e++){var n=t[e];try{n.fn.call(n.scope)}catch(t){o.throwException(t)}}}o.run.workQueueScheduled_=!1},o.run.WorkItem_=function(t,e){this.fn=t,this.scope=e},o.nextTick=function(e,n){var a=e;n&&(a=e.bind(n)),a=o.nextTick.wrapCallback_(a),o.nextTick.setImmediate_||("function"==typeof t&&(0,r.isServerSide)({checkEnv:!1})?o.nextTick.setImmediate_=t:o.nextTick.setImmediate_=o.nextTick.getSetImmediateEmulator_()),o.nextTick.setImmediate_(a)},o.nextTick.setImmediate_=null,o.nextTick.getSetImmediateEmulator_=function(){var t=void 0;if("function"==typeof MessageChannel&&(t=MessageChannel),void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&(t=function(){var t=document.createElement("iframe");t.style.display="none",t.src="",t.title="",document.documentElement.appendChild(t);var e=t.contentWindow,n=e.document;n.open(),n.write(""),n.close();var r="callImmediate"+Math.random(),o=e.location.protocol+"//"+e.location.host,a=function(t){t.origin!==o&&t.data!==r||this.port1.onmessage()}.bind(this);e.addEventListener("message",a,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(r,o)}}}),void 0!==t){var e=new t,n={},r=n;return e.port1.onmessage=function(){var t=(n=n.next).cb;n.cb=null,t()},function(t){r.next={cb:t},r=r.next,e.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("script")?function(t){var e=document.createElement("script");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){setTimeout(t,0)}},o.nextTick.wrapCallback_=function(t){return t},e.default=o}).call(this,n(15).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function a(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new a(o.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new a(o.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(16),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,o,a,i,u,c=1,l={},s=!1,f=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){h(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((a=new MessageChannel).port1.onmessage=function(t){h(t.data)},r=function(t){a.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(t){var e=f.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):r=function(t){setTimeout(h,0,t)}:(i="setImmediate$"+Math.random()+"$",u=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(i)&&h(+e.data.slice(i.length))},t.addEventListener?t.addEventListener("message",u,!1):t.attachEvent("onmessage",u),r=function(e){t.postMessage(i+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var o={callback:t,args:e};return l[c]=o,r(c),c++},p.clearImmediate=d}function d(t){delete l[t]}function h(t){if(s)setTimeout(h,0,t);else{var e=l[t];if(e){s=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{d(t),s=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(0),n(3))},function(t,e,n){"use strict";
11236Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.disposed_=!1}return r(t,[{key:"dispose",value:function(){this.disposed_||(this.disposeInternal(),this.disposed_=!0)}},{key:"disposeInternal",value:function(){}},{key:"isDisposed",value:function(){return this.disposed_}}]),t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return r(t,null,[{key:"mixin",value:function(t){for(var e=void 0,n=void 0,r=arguments.length,o=Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];for(var i=0;i<o.length;i++)for(e in n=o[i])t[e]=n[e];return t}},{key:"getObjectByName",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window,n=t.split(".");return n.reduce(function(t,e){return t[e]},e)}},{key:"map",value:function(t,e){for(var n={},r=Object.keys(t),o=0;o<r.length;o++)n[r[o]]=e(r[o],t[r[o]]);return n}},{key:"shallowEqual",value:function(t,e){if(t===e)return!0;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0;o<n.length;o++)if(t[n[o]]!==e[n[o]])return!1;return!0}}]),t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return r(t,null,[{key:"caseInsensitiveCompare",value:function(t,e){var n=String(t).toLowerCase(),r=String(e).toLowerCase();return n<r?-1:n===r?0:1}},{key:"collapseBreakingSpaces",value:function(t){return t.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")}},{key:"escapeRegex",value:function(t){return String(t).replace(/([-()[\]{}+?*.$^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")}},{key:"getRandomString",value:function(){var t=2147483648;return Math.floor(Math.random()*t).toString(36)+Math.abs(Math.floor(Math.random()*t)^Date.now()).toString(36)}},{key:"hashCode",value:function(t){for(var e=0,n=0,r=t.length;n<r;n++)e=31*e+t.charCodeAt(n),e%=4294967296;return e}},{key:"replaceInterval",value:function(t,e,n,r){return t.substring(0,e)+r+t.substring(n)}}]),t}();e.default=o},function(t,e,n){(function(t,n){var r=200,o="Expected a function",a="__lodash_hash_undefined__",i=1,u=2,c=1/0,l=9007199254740991,s="[object Arguments]",f="[object Array]",p="[object Boolean]",d="[object Date]",h="[object Error]",v="[object Function]",y="[object GeneratorFunction]",_="[object Map]",m="[object Number]",b="[object Object]",g="[object RegExp]",w="[object Set]",E="[object String]",j="[object Symbol]",O="[object ArrayBuffer]",S="[object DataView]",T=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,I=/^\w*$/,P=/^\./,k=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,A=/\\(\\)?/g,C=/^\[object .+?Constructor\]$/,R=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L[s]=L[f]=L[O]=L[p]=L[S]=L[d]=L[h]=L[v]=L[_]=L[m]=L[b]=L[g]=L[w]=L[E]=L["[object WeakMap]"]=!1;var M="object"==typeof t&&t&&t.Object===Object&&t,D="object"==typeof self&&self&&self.Object===Object&&self,U=M||D||Function("return this")(),x=e&&!e.nodeType&&e,N=x&&"object"==typeof n&&n&&!n.nodeType&&n,F=N&&N.exports===x&&M.process,z=function(){try{return F&&F.binding("util")}catch(t){}}(),$=z&&z.isTypedArray;function W(t,e,n,r){for(var o=-1,a=t?t.length:0;++o<a;){var i=t[o];e(r,i,n(i),t)}return r}function B(t,e){for(var n=-1,r=t?t.length:0;++n<r;)if(e(t[n],n,t))return!0;return!1}function H(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function J(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function G(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var V,Y,Q,q=Array.prototype,K=Function.prototype,X=Object.prototype,Z=U["__core-js_shared__"],tt=(V=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(sr
11236c)_1."+V:"",et=K.toString,nt=X.hasOwnProperty,rt=X.toString,ot=RegExp("^"+et.call(nt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),at=U.Symbol,it=U.Uint8Array,ut=X.propertyIsEnumerable,ct=q.splice,lt=(Y=Object.keys,Q=Object,function(t){return Y(Q(t))}),st=Jt(U,"DataView"),ft=Jt(U,"Map"),pt=Jt(U,"Promise"),dt=Jt(U,"Set"),ht=Jt(U,"WeakMap"),vt=Jt(Object,"create"),yt=Zt(st),_t=Zt(ft),mt=Zt(pt),bt=Zt(dt),gt=Zt(ht),wt=at?at.prototype:void 0,Et=wt?wt.valueOf:void 0,jt=wt?wt.toString:void 0;function Ot(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function St(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function It(t){var e=-1,n=t?t.length:0;for(this.__data__=new Tt;++e<n;)this.add(t[e])}function Pt(t){this.__data__=new St(t)}function kt(t,e){var n=ie(t)||ae(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,o=!!r;for(var a in t)!e&&!nt.call(t,a)||o&&("length"==a||Vt(a,r))||n.push(a);return n}function At(t,e){for(var n=t.length;n--;)if(oe(t[n][0],e))return n;return-1}function Ct(t,e,n,r){return Mt(t,function(t,o,a){e(r,t,n(t),a)}),r}Ot.prototype.clear=function(){this.__data__=vt?vt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(vt){var n=e[t];return n===a?void 0:n}return nt.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:nt.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?a:e,this},St.prototype.clear=function(){this.__data__=[]},St.prototype.delete=function(t){var e=this.__data__,n=At(e,t);return!(n<0)&&(n==e.length-1?e.pop():ct.call(e,n,1),!0)},St.prototype.get=function(t){var e=this.__data__,n=At(e,t);return n<0?void 0:e[n][1]},St.prototype.has=function(t){return At(this.__data__,t)>-1},St.prototype.set=function(t,e){var n=this.__data__,r=At(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(ft||St),string:new Ot}},Tt.prototype.delete=function(t){return Ht(this,t).delete(t)},Tt.prototype.get=function(t){return Ht(this,t).get(t)},Tt.prototype.has=function(t){return Ht(this,t).has(t)},Tt.prototype.set=function(t,e){return Ht(this,t).set(t,e),this},It.prototype.add=It.prototype.push=function(t){return this.__data__.set(t,a),this},It.prototype.has=function(t){return this.__data__.has(t)},Pt.prototype.clear=function(){this.__data__=new St},Pt.prototype.delete=function(t){return this.__data__.delete(t)},Pt.prototype.get=function(t){return this.__data__.get(t)},Pt.prototype.has=function(t){return this.__data__.has(t)},Pt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof St){var o=n.__data__;if(!ft||o.length<r-1)return o.push([t,e]),this;n=this.__data__=new Tt(o)}return n.set(t,e),this};var Rt,Lt,Mt=(Rt=function(t,e){return t&&Dt(t,e,he)},function(t,e){if(null==t)return t;if(!ue(t))return Rt(t,e);for(var n=t.length,r=Lt?n:-1,o=Object(t);(Lt?r--:++r<n)&&!1!==e(o[r],r,o););return t}),Dt=function(t){return function(e,n,r){for(var o=-1,a=Object(e),i=r(e),u=i.length;u--;){var c=i[t?u:++o];if(!1===n(a[c],c,a))break}return e}}();function Ut(t,e){for(var n=0,r=(e=Yt(e,t)?[e]:Wt(e)).length;null!=t&&n<r;)t=t[Xt(e[n++])];return n&&n==r?t:void 0}function xt(t,e){return null!=t&&e in Object(t)}function Nt(t,e,n,r,o){return t===e||(null==t||null==e||!se(t)&&!fe(e)?t!=t&&e!=e:function(t,e,n,r,o,a){var c=ie(t),l=ie(e),v=f,y=f;c||(v=(v=Gt(t))==s?b:v);l||(y=(y=Gt(e))==s?b:y);var T=v==b&&!H(t),I=y==b&&!H(e),P=v==y;if(P&&!T)return a||(a=new Pt),c||de(t)?Bt(t,e,n,r,o,a):function(t,e,n,r,o,a,c){switch(n){case S:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case O:return!(t.byteLength!=e.byteLength||!r(new it(t),new it(e)));case p:case d:case m:return oe(+t,+e);case h:return t.name==e.name&&t.message==e.message;case g:case E:return t==e+"";case _:var l=J;case w:var s=a&u;if(l||(l=G),t.size!=e.size&&!s)return!1;var f=c.get(t);if(f)return f==e;a|=i,c.set(t,e);var v=Bt(l(t),l(e),r,o,a,c);return c.delete(t),v;case j:if(Et)return Et.call(t)==Et.call(e)}return!1}(t,e,v,n,r,o,a);if(!(o&u)){var k=T&&nt.call(t,"__wrapped__"),A=I&&nt.call(e,"__wrapped__");
11236if(k||A){var C=k?t.value():t,R=A?e.value():e;return a||(a=new Pt),n(C,R,r,o,a)}}if(!P)return!1;return a||(a=new Pt),function(t,e,n,r,o,a){var i=o&u,c=he(t),l=c.length,s=he(e).length;if(l!=s&&!i)return!1;var f=l;for(;f--;){var p=c[f];if(!(i?p in e:nt.call(e,p)))return!1}var d=a.get(t);if(d&&a.get(e))return d==e;var h=!0;a.set(t,e),a.set(e,t);var v=i;for(;++f<l;){p=c[f];var y=t[p],_=e[p];if(r)var m=i?r(_,y,p,e,t,a):r(y,_,p,t,e,a);if(!(void 0===m?y===_||n(y,_,r,o,a):m)){h=!1;break}v||(v="constructor"==p)}if(h&&!v){var b=t.constructor,g=e.constructor;b!=g&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g)&&(h=!1)}return a.delete(t),a.delete(e),h}(t,e,n,r,o,a)}(t,e,Nt,n,r,o))}function Ft(t){return!(!se(t)||function(t){return!!tt&&tt in t}(t))&&(ce(t)||H(t)?ot:C).test(Zt(t))}function zt(t){return"function"==typeof t?t:null==t?ve:"object"==typeof t?ie(t)?function(t,e){if(Yt(t)&&Qt(e))return qt(Xt(t),e);return function(n){var r=function(t,e,n){var r=null==t?void 0:Ut(t,e);return void 0===r?n:r}(n,t);return void 0===r&&r===e?function(t,e){return null!=t&&function(t,e,n){e=Yt(e,t)?[e]:Wt(e);var r,o=-1,a=e.length;for(;++o<a;){var i=Xt(e[o]);if(!(r=null!=t&&n(t,i)))break;t=t[i]}if(r)return r;return!!(a=t?t.length:0)&&le(a)&&Vt(i,a)&&(ie(t)||ae(t))}(t,e,xt)}(n,t):Nt(e,r,void 0,i|u)}}(t[0],t[1]):function(t){var e=function(t){var e=he(t),n=e.length;for(;n--;){var r=e[n],o=t[r];e[n]=[r,o,Qt(o)]}return e}(t);if(1==e.length&&e[0][2])return qt(e[0][0],e[0][1]);return function(n){return n===t||function(t,e,n,r){var o=n.length,a=o,c=!r;if(null==t)return!a;for(t=Object(t);o--;){var l=n[o];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++o<a;){var s=(l=n[o])[0],f=t[s],p=l[1];if(c&&l[2]){if(void 0===f&&!(s in t))return!1}else{var d=new Pt;if(r)var h=r(f,p,s,t,e,d);if(!(void 0===h?Nt(p,f,r,i|u,d):h))return!1}}return!0}(n,t,e)}}(t):Yt(e=t)?(n=Xt(e),function(t){return null==t?void 0:t[n]}):function(t){return function(e){return Ut(e,t)}}(e);var e,n}function $t(t){if(n=(e=t)&&e.constructor,r="function"==typeof n&&n.prototype||X,e!==r)return lt(t);var e,n,r,o=[];for(var a in Object(t))nt.call(t,a)&&"constructor"!=a&&o.push(a);return o}function Wt(t){return ie(t)?t:Kt(t)}function Bt(t,e,n,r,o,a){var c=o&u,l=t.length,s=e.length;if(l!=s&&!(c&&s>l))return!1;var f=a.get(t);if(f&&a.get(e))return f==e;var p=-1,d=!0,h=o&i?new It:void 0;for(a.set(t,e),a.set(e,t);++p<l;){var v=t[p],y=e[p];if(r)var _=c?r(y,v,p,e,t,a):r(v,y,p,t,e,a);if(void 0!==_){if(_)continue;d=!1;break}if(h){if(!B(e,function(t,e){if(!h.has(e)&&(v===t||n(v,t,r,o,a)))return h.add(e)})){d=!1;break}}else if(v!==y&&!n(v,y,r,o,a)){d=!1;break}}return a.delete(t),a.delete(e),d}function Ht(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Jt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Ft(n)?n:void 0}var Gt=function(t){return rt.call(t)};function Vt(t,e){return!!(e=null==e?l:e)&&("number"==typeof t||R.test(t))&&t>-1&&t%1==0&&t<e}function Yt(t,e){if(ie(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!pe(t))||(I.test(t)||!T.test(t)||null!=e&&t in Object(e))}function Qt(t){return t==t&&!se(t)}function qt(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}(st&&Gt(new st(new ArrayBuffer(1)))!=S||ft&&Gt(new ft)!=_||pt&&"[object Promise]"!=Gt(pt.resolve())||dt&&Gt(new dt)!=w||ht&&"[object WeakMap]"!=Gt(new ht))&&(Gt=function(t){var e=rt.call(t),n=e==b?t.constructor:void 0,r=n?Zt(n):void 0;if(r)switch(r){case yt:return S;case _t:return _;case mt:return"[object Promise]";case bt:return w;case gt:return"[object WeakMap]"}return e});var Kt=re(function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(pe(t))return jt?jt.call(t):"";var e=t+"";return"0"==e&&1/t==-c?"-0":e}(e);var n=[];return P.test(t)&&n.push(""),t.replace(k,function(t,e,r,o){n.push(r?o.replace(A,"$1"):e||t)}),n});function Xt(t){if("string"==typeof t||pe(t))return t;var e=t+"";return"0"==e&&1/t==-c?"-0":e}function Zt(t){if(null!=t){try{return et.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var te,ee,ne=(te=function(t,e,n){nt.call(t,n)?t[n].push(e):t[n]=[e]},function(t,e){var n=ie(t)?W:Ct,r=ee?ee():{};return n(t,te,zt(e),r)});function re(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(o);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=t.apply(this,r);return n.cache=a.set(o,i),i};return n.cache=new(re.Cache||Tt),n}function oe(t,e){return t===e||t!=t&&e!=e}function ae(t){return function(t){return fe(t)&&ue(t)}(t)&&nt.call(t,"callee")&&(!ut.call(t,"callee")||rt.call(t)==s)}re.Cache=Tt;var ie=Array.isArray;function ue(t){return null!=t&&le(t.length)&&!ce(t)}function ce(t){var e=se(t)?rt.call(t):"";return e==v||e==y}function le(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function se(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function fe(t){return!!t&&"object"==typeof t}function pe(t){return"symbol"==typeof t||fe(t)&&rt.call(t)==j}var de=$?function(t){return function(e){return t(e)}}($):function(t){return fe(t)&&le(t.length)&&!!L[rt.call(t)]};function he(t){return ue(t)?kt(t):$t(t)}function ve(t){return t}n.exports=ne}).call(this,n(0),n(4)(t))},function(t,e,n){(function(t,n){var r=200,o="__lodash_hash_undefined__",a=1,i=2,u=9007199254740991,c="[object Arguments]",l="[object Array]",s="[object AsyncFunction]",f="[object Boolean]",p="[object Date]",d="[object Error]",h="[object Function]",v="[object GeneratorFunction]",y="[object Map]",_="[object Number]",m="[object Null]",b
vendor: 4,028 bytes, line 11236
11236="[object Object]",g="[object Proxy]",w="[object RegExp]",E="[object Set]",j="[object String]",O="[object Symbol]",S="[object Undefined]",T="[object ArrayBuffer]",I="[object DataView]",P=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,A={};A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A[c]=A[l]=A[T]=A[f]=A[I]=A[p]=A[d]=A[h]=A[y]=A[_]=A[b]=A[w]=A[E]=A[j]=A["[object WeakMap]"]=!1;var C="object"==typeof t&&t&&t.Object===Object&&t,R="object"==typeof self&&self&&self.Object===Object&&self,L=C||R||Function("return this")(),M=e&&!e.nodeType&&e,D=M&&"object"==typeof n&&n&&!n.nodeType&&n,U=D&&D.exports===M,x=U&&C.process,N=function(){try{return x&&x.binding&&x.binding("util")}catch(t){}}(),F=N&&N.isTypedArray;function z(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function $(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function W(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var B,H,J,G=Array.prototype,V=Function.prototype,Y=Object.prototype,Q=L["__core-js_shared__"],q=V.toString,K=Y.hasOwnProperty,X=(B=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"",Z=Y.toString,tt=RegExp("^"+q.call(K).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),et=U?L.Buffer:void 0,nt=L.Symbol,rt=L.Uint8Array,ot=Y.propertyIsEnumerable,at=G.splice,it=nt?nt.toStringTag:void 0,ut=Object.getOwnPropertySymbols,ct=et?et.isBuffer:void 0,lt=(H=Object.keys,J=Object,function(t){return H(J(t))}),st=Nt(L,"DataView"),ft=Nt(L,"Map"),pt=Nt(L,"Promise"),dt=Nt(L,"Set"),ht=Nt(L,"WeakMap"),vt=Nt(Object,"create"),yt=Wt(st),_t=Wt(ft),mt=Wt(pt),bt=Wt(dt),gt=Wt(ht),wt=nt?nt.prototype:void 0,Et=wt?wt.valueOf:void 0;function jt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ot(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function St(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new St;++e<n;)this.add(t[e])}function It(t){var e=this.__data__=new Ot(t);this.size=e.size}function Pt(t,e){var n=Jt(t),r=!n&&Ht(t),o=!n&&!r&&Gt(t),a=!n&&!r&&!o&&Kt(t),i=n||r||o||a,u=i?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=u.length;for(var l in t)!e&&!K.call(t,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||$t(l,c))||u.push(l);return u}function kt(t,e){for(var n=t.length;n--;)if(Bt(t[n][0],e))return n;return-1}function At(t){return null==t?void 0===t?S:m:it&&it in Object(t)?function(t){var e=K.call(t,it),n=t[it];try{t[it]=void 0;var r=!0}catch(t){}var o=Z.call(t);r&&(e?t[it]=n:delete t[it]);return o}(t):function(t){return Z.call(t)}(t)}function Ct(t){return qt(t)&&At(t)==c}function Rt(t,e,n,r,o){return t===e||(null==t||null==e||!qt(t)&&!qt(e)?t!=t&&e!=e:function(t,e,n,r,o,u){var s=Jt(t),h=Jt(e),v=s?l:zt(t),m=h?l:zt(e),g=(v=v==c?b:v)==b,S=(m=m==c?b:m)==b,P=v==m;if(P&&Gt(t)){if(!Gt(e))return!1;s=!0,g=!1}if(P&&!g)return u||(u=new It),s||Kt(t)?Dt(t,e,n,r,o,u):function(t,e,n,r,o,u,c){switch(n){case I:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case T:return!(t.byteLength!=e.byteLength||!u(new rt(t),new rt(e)));case f:case p:case _:return Bt(+t,+e);case d:return t.name==e.name&&t.message==e.message;case w:case j:return t==e+"";case y:var l=$;case E:var s=r&a;if(l||(l=W),t.size!=e.size&&!s)return!1;var h=c.get(t);if(h)return h==e;r|=i,c.set(t,e);var v=Dt(l(t),l(e),r,o,u,c);return c.delete(t),v;case O:if(Et)return Et.call(t)==Et.call(e)}return!1}(t,e,v,n,r,o,u);if(!(n&a)){var k=g&&K.call(t,"__wrapped__"),A=S&&K.call(e,"__wrapped__");
11236if(k||A){var C=k?t.value():t,R=A?e.value():e;return u||(u=new It),o(C,R,n,r,u)}}if(!P)return!1;return u||(u=new It),function(t,e,n,r,o,i){var u=n&a,c=Ut(t),l=c.length,s=Ut(e).length;if(l!=s&&!u)return!1;var f=l;for(;f--;){var p=c[f];if(!(u?p in e:K.call(e,p)))return!1}var d=i.get(t);if(d&&i.get(e))return d==e;var h=!0;i.set(t,e),i.set(e,t);var v=u;for(;++f<l;){p=c[f];var y=t[p],_=e[p];if(r)var m=u?r(_,y,p,e,t,i):r(y,_,p,t,e,i);if(!(void 0===m?y===_||o(y,_,n,r,i):m)){h=!1;break}v||(v="constructor"==p)}if(h&&!v){var b=t.constructor,g=e.constructor;b!=g&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g)&&(h=!1)}return i.delete(t),i.delete(e),h}(t,e,n,r,o,u)}(t,e,n,r,Rt,o))}function Lt(t){return!(!Qt(t)||function(t){return!!X&&X in t}(t))&&(Vt(t)?tt:P).test(Wt(t))}function Mt(t){if(n=(e=t)&&e.constructor,r="function"==typeof n&&n.prototype||Y,e!==r)return lt(t);var e,n,r,o=[];for(var a in Object(t))K.call(t,a)&&"constructor"!=a&&o.push(a);return o}function Dt(t,e,n,r,o,u){var c=n&a,l=t.length,s=e.length;if(l!=s&&!(c&&s>l))return!1;var f=u.get(t);if(f&&u.get(e))return f==e;var p=-1,d=!0,h=n&i?new Tt:void 0;for(u.set(t,e),u.set(e,t);++p<l;){var v=t[p],y=e[p];if(r)var _=c?r(y,v,p,e,t,u):r(v,y,p,t,e,u);if(void 0!==_){if(_)continue;d=!1;break}if(h){if(!z(e,function(t,e){if(a=e,!h.has(a)&&(v===t||o(v,t,n,r,u)))return h.push(e);var a})){d=!1;break}}else if(v!==y&&!o(v,y,n,r,u)){d=!1;break}}return u.delete(t),u.delete(e),d}function Ut(t){return function(t,e,n){var r=e(t);return Jt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,Xt,Ft)}function xt(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Nt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Lt(n)?n:void 0}jt.prototype.clear=function(){this.__data__=vt?vt(null):{},this.size=0},jt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},jt.prototype.get=function(t){var e=this.__data__;if(vt){var n=e[t];return n===o?void 0:n}return K.call(e,t)?e[t]:void 0},jt.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:K.call(e,t)},jt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=vt&&void 0===e?o:e,this},Ot.prototype.clear=function(){this.__data__=[],this.size=0},Ot.prototype.delete=function(t){var e=this.__data__,n=kt(e,t);return!(n<0)&&(n==e.length-1?e.pop():at.call(e,n,1),--this.size,!0)},Ot.prototype.get=function(t){var e=this.__data__,n=kt(e,t);return n<0?void 0:e[n][1]},Ot.prototype.has=function(t){return kt(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var n=this.__data__,r=kt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},St.prototype.clear=function(){this.size=0,this.__data__={hash:new jt,map:new(ft||Ot),string:new jt}},St.prototype.delete=function(t){var e=xt(this,t).delete(t);return this.size-=e?1:0,e},St.prototype.get=function(t){return xt(this,t).get(t)},St.prototype.has=function(t){return xt(this,t).has(t)},St.prototype.set=function(t,e){var n=xt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Tt.prototype.add=Tt.prototype.push=function(t){return this.__data__.set(t,o),this},Tt.prototype.has=function(t){return this.__data__.has(t)},It.prototype.clear=function(){this.__data__=new Ot,this.size=0},It.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},It.prototype.get=function(t){return this.__data__.get(t)},It.prototype.has=function(t){return this.__data__.has(t)},It.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ot){var o=n.__data__;if(!ft||o.length<r-1)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new St(o)}return n.set(t,e),this.size=n.size,this};var Ft=ut?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,a=[];++n<r;){var i=t[n];e(i,n,t)&&(a[o++]=i)}return a}(ut(t),function(e){return ot.call(t,e)}))}:function(){return[]},zt=At;function $t(t,e){return!!(e=null==e?u:e)&&("number"==typeof t||k.test(t))&&t>-1&&t%1==0&&t<e}function Wt(t){if(null!=t){try{return q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Bt(t,e){return t===e||t!=t&&e!=e}(st&&zt(new st(new ArrayBuffer(1)))!=I||ft&&zt(new ft)!=y||pt&&"[object Promise]"!=zt(pt.resolve())||dt&&zt(new dt)!=E||ht&&"[object WeakMap]"!=zt(new ht))&&(zt=function(t){var e=At(t),n=e==b?t.constructor:void 0,r=n?Wt(n):"";if(r)switch(r){case yt:return I;case _t:return y;case mt:return"[object Promise]";case bt:return E;case gt:return"[object WeakMap]"}return e});var Ht=Ct(function(){return arguments}())?Ct:function(t){return qt(t)&&K.call(t,"callee")&&!ot.call(t,"callee")},Jt=Array.isArray;var Gt=ct||function(){return!1};function Vt(t){if(!Qt(t))return!1;var e=At(t);return e==h||e==v||e==s||e==g}function Yt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=u}function Qt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function qt(t){return null!=t&&"object"==typeof t}var Kt=F?function(t){return function(e){return t(e)}}(F):function(t){return qt(t)&&Yt(t.length)&&!!A[At(t)]};function Xt(t){return null!=(e=t)&&Yt(e.length)&&!Vt(e)?Pt(t):Mt(t);var e}n.exports=function(t,e){return Rt(t,e)}}).call(this,n(0),n(4)(t))},function(t,e,n){var r;
11236Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o={register:((r=n(23))&&r.__esModule?r:{default:r}).default};e.default=o},function(t,e,n){(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.register=void 0;var r=i(n(24)),o=i(n(25)),a=n(6);function i(t){return t&&t.__esModule?t:{default:t}}var u=function(e){(0,a.validateArguments)(arguments,1,1,["string"]);var n=t.portlet.data.pageRenderState;return new r.default(function(t,r){(0,a.validatePortletId)(n,e)?t(new o.default(e)):r(new Error("Invalid portlet ID"))})};e.register=u;var c=u;e.default=c}).call(this,n(0))},function(t,e,n){"use strict"; 11237/*! 11238 * Promises polyfill from Google's Closure Library. 11239 * 11240 * Copyright 2013 The Closure Library Authors. All Rights Reserved. 11241 * 11242 * NOTE(eduardo): Promise support is not ready on all supported browsers, 11243 * therefore metal-promise is temporarily using Google's promises as polyfill. 11244 * It supports cancellable promises and has clean and fast implementation. 11245 */Object.defineProperty(e,"__esModule",{value:!0}),e.CancellablePromise=void 0;var r=n(1);var o=function(){};o.prototype.then=function(){},o.IMPLEMENTED_BY_PROP="$goog_Thenable",o.addImplementation=function(t){t.prototype.then=t.prototype.then,t.prototype.$goog_Thenable=!0},o.isImplementedBy=function(t){if(!t)return!1;try{return!!t.$goog_Thenable}catch(t){return!1}};var a=function(t){var e=Array.prototype.slice.call(arguments,1);return function(){var n=e.slice();return n.push.apply(n,arguments),t.apply(this,n)}},i=function t(e,n){this.state_=t.State_.PENDING,this.result_=void 0,this.parent_=null,this.callbackEntries_=null,this.executing_=!1,t.UNHANDLED_REJECTION_DELAY>0?this.unhandledRejectionId_=0:0===t.UNHANDLED_REJECTION_DELAY&&(this.hadUnhandledRejection_=!1);try{var r=this;e.call(n,function(e){r.resolve_(t.State_.FULFILLED,e)},function(e){r.resolve_(t.State_.REJECTED,e)})}catch(e){this.resolve_(t.State_.REJECTED,e)}};i.UNHANDLED_REJECTION_DELAY=0,i.State_={PENDING:0,BLOCKED:1,FULFILLED:2,REJECTED:3},i.CallbackEntry_=null,i.resolve=function(t){return new i(function(e){e(t)})}
11245,i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(t){return new i(function(e,n){t.length||e(void 0);for(var r,o=0;r=t[o];o++)r.then(e,n)})},i.all=function(t){return new i(function(e,n){var r=t.length,o=[];if(r)for(var i,u=function(t,n){r--,o[t]=n,0===r&&e(o)},c=function(t){n(t)},l=0;i=t[l];l++)i.then(a(u,l),c);else e(o)})},i.firstFulfilled=function(t){return new i(function(e,n){var r=t.length,o=[];if(r)for(var i,u=function(t){e(t)},c=function(t,e){r--,o[t]=e,0===r&&n(o)},l=0;i=t[l];l++)i.then(u,a(c,l));else e(void 0)})},i.prototype.then=function(t,e,n){return this.addChildPromise_((0,r.isFunction)(t)?t:null,(0,r.isFunction)(e)?e:null,n)},o.addImplementation(i),i.prototype.thenAlways=function(t,e){var n=function(){try{t.call(e)}catch(t){i.handleRejection_.call(null,t)}};return this.addCallbackEntry_({child:null,onRejected:n,onFulfilled:n}),this},i.prototype.thenCatch=function(t,e){return this.addChildPromise_(null,t,e)},i.prototype.catch=i.prototype.thenCatch,i.prototype.cancel=function(t){this.state_===i.State_.PENDING&&r.async.run(function(){var e=new i.CancellationError(t);e.IS_CANCELLATION_ERROR=!0,this.cancelInternal_(e)},this)},i.prototype.cancelInternal_=function(t){this.state_===i.State_.PENDING&&(this.parent_?this.parent_.cancelChild_(this,t):this.resolve_(i.State_.REJECTED,t))},i.prototype.cancelChild_=function(t,e){if(this.callbackEntries_){for(var n,r=0,o=-1,a=0;n=this.callbackEntries_[a];a++){var u=n.child;if(u&&(r++,u===t&&(o=a),o>=0&&r>1))break}if(o>=0)if(this.state_===i.State_.PENDING&&1===r)this.cancelInternal_(e);else{var c=this.callbackEntries_.splice(o,1)[0];this.executeCallback_(c,i.State_.REJECTED,e)}}},i.prototype.addCallbackEntry_=function(t){this.callbackEntries_&&this.callbackEntries_.length||this.state_!==i.State_.FULFILLED&&this.state_!==i.State_.REJECTED||this.scheduleCallbacks_(),this.callbackEntries_||(this.callbackEntries_=[]),this.callbackEntries_.push(t)},i.prototype.addChildPromise_=function(t,e,n){var o={child:null,onFulfilled:null,onRejected:null};return o.child=new i(function(a,i){o.onFulfilled=t?function(e){try{var r=t.call(n,e);a(r)}catch(t){i(t)}}:a,o.onRejected=e?function(t){try{var o=e.call(n,t);!(0,r.isDef)(o)&&t.IS_CANCELLATION_ERROR?i(t):a(o)}catch(t){i(t)}}:i}),o.child.parent_=this,this.addCallbackEntry_(o),o.child},i.prototype.unblockAndFulfill_=function(t){if(this.state_!==i.State_.BLOCKED)throw new Error("CancellablePromise is not blocked.");this.state_=i.State_.PENDING,this.resolve_(i.State_.FULFILLED,t)},i.prototype.unblockAndReject_=function(t){if(this.state_!==i.State_.BLOCKED)throw new Error("CancellablePromise is not blocked.");this.state_=i.State_.PENDING,this.resolve_(i.State_.REJECTED,t)},i.prototype.resolve_=function(t,e){if(this.state_===i.State_.PENDING){if(this===e)t=i.State_.REJECTED,e=new TypeError("CancellablePromise cannot resolve to itself");else{if(o.isImplementedBy(e))return e=e,this.state_=i.State_.BLOCKED,void e.then(this.unblockAndFulfill_,this.unblockAndReject_,this);if((0,r.isObject)(e))try{var n=e.then;if((0,r.isFunction)(n))return void this.tryThen_(e,n)}catch(n){t=i.State_.REJECTED,e=n}}this.result_=e,this.state_=t,this.scheduleCallbacks_(),t!==i.State_.REJECTED||e.IS_CANCELLATION_ERROR||i.addUnhandledRejection_(this,e)}},i.prototype.tryThen_=function(t,e){this.state_=i.State_.BLOCKED;var n=this,r=!1,o=function(t){r||(r=!0,n.unblockAndReject_(t))};try{e.call(t,function(t){r||(r=!0,n.unblockAndFulfill_(t))},o)}catch(t){o(t)}},i.prototype.scheduleCallbacks_=function(){this.executing_||(this.executing_=!0,r.async.run(this.executeCallbacks_,this))},i.prototype.executeCallbacks_=function(){for(;this.callbackEntries_&&this.callbackEntries_.length;){var t=this.callbackEntries_;this.callbackEntries_=[];for(var e=0;e<t.length;e++)this.executeCallback_(t[e],this.state_,this.result_)}this.executing_=!1},i.prototype.executeCallback_=function(t,e,n){e===i.State_.FULFILLED?t.onFulfilled(n):(this.removeUnhandledRejection_(),t.onRejected(n))},i.prototype.removeUnhandledRejection_=function(){var t;if(i.UNHANDLED_REJECTION_DELAY>0)for(t=this;t&&t.unhandledRejectionId_;t=t.parent_)clearTimeout(t.unhandledRejectionId_),t.unhandledRejectionId_=0;else if(0===i.UNHANDLED_REJECTION_DELAY)for(t=this;t&&t.hadUnhandledRejection_;t=t.parent_)t.hadUnhandledRejection_=!1},i.addUnhandledRejection_=function(t,e){i.UNHANDLED_REJECTION_DELAY>0?t.unhandledRejectionId_=setTimeout(function(){i.handleRejection_.call(null,e)},i.UNHANDLED_REJECTION_DELAY):0===i.UNHANDLED_REJECTION_DELAY&&(t.hadUnhandledRejection_=!0,r.async.run(function(){t.hadUnhandledRejection_&&i.handleRejection_.call(null,e)}))},i.handleRejection_=r.async.throwException,i.setUnhandledRejectionHandler=function(t){i.handleRejection_=t},(i.CancellationError=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return n&&(r.message=n),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(Error)).prototype.name="cancel",e.CancellablePromise=i,e.default=i}
11245,function(t,e,n){(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.PortletInit=void 0;var r=n(1),o=c(n(26)),a=c(n(5)),i=n(6),u=c(n(29));function c(t){return t&&t.__esModule?t:{default:t}}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var p,d=window.history&&window.history.pushState,h=!1,v={},y=[],_=function(){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this._portletId=n,this.constants=Object.assign({},a.default),p||(p=t.portlet.data.pageRenderState,this._updateHistory(!0)),this.portletModes=p.portlets[this._portletId].allowedPM.slice(0),this.windowStates=p.portlets[this._portletId].allowedWS.slice(0)}var n,c,_;return n=e,(c=[{key:"_executeAction",value:function(t,e){var n=this;return new Promise(function(r,o){(0,i.getUrl)(p,"ACTION",n._portletId,t).then(function(t){var a=(0,i.generateActionUrl)(n._portletId,t,e);fetch(a.url,a).then(function(t){return t.text()}).then(function(t){var e=n._updatePageStateFromString(t,n._portletId);r(e)}).catch(function(t){o(t)})})})}},{key:"_hasListener",value:function(t){return Object.keys(v).map(function(t){return v[t].id}).includes(t)}},{key:"_reportError",value:function(t,e){Object.keys(v).map(function(n){var r=v[n];return r.id===t&&"portlet.onError"===r.type&&setTimeout(function(){r.handler("portlet.onError",e)}),!1})}},{key:"_setPageState",value:function(t,e){var n=this;if(!(0,r.isString)(e))throw new TypeError("Invalid update string: ".concat(e));this._updatePageState(e,t).then(function(t){n._updatePortletStates(t)},function(e){h=!1,n._reportError(t,e)})}},{key:"_setState",value:function(t){for(var e=(0,i.getUpdatedPublicRenderParameters)(p,this._portletId,t),n=[],r=0,o=Object.keys(e);r<o.length;r++)for(var a=o[r],u=e[a],c=p.prpMap[a],l=0,f=Object.keys(c);l<f.length;l++){var d=f[l];if(d!==this._portletId){var h=c[d].split("|"),v=h[0],y=h[1];void 0===u?delete p.portlets[v].state.parameters[y]:p.portlets[v].state.parameters[y]=s(u),n.push(v)}}var _=this._portletId;p.portlets[_].state=t,n.push(_);for(var m=0,b=n;m<b.length;m++){var g=b[m];p.portlets[g].renderData.content=null}return this._updateHistory(),Promise.resolve(n)}},{key:"_setupAction",value:function(t,e){var n=this;if(this.isInProgress())throw{message:"Operation is already in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: ".concat(this._portletId),name:"NotInitializedException"};return h=!0,this._executeAction(t,e).then(function(t){return n._updatePortletStates(t).then(function(t){return h=!1,t})},function(t){h=!1,n._reportError(n._portletId,t)})}},{key:"_updateHistory",value:function(t){d&&(0,i.getUrl)(p,"RENDER",null,{}).then(function(e){var n=JSON.stringify(p);if(t)history.replaceState(n,"");else try{history.pushState(n,"",e)}catch(t){}})}},{key:"_updatePageState",value:function(t){var e=this;return new Promise(function(n,r){try{n(e._updatePageStateFromString(t,e._portletId))}catch(t){r(new Error("Partial Action decode status: ".concat(t.message)))}})}},{key:"_updatePageStateFromString",value:function(t,e){for(var n=(0,i.decodeUpdateString)(p,t),r=[],o=!1,a=0,u=Object.keys(n);a<u.length;a++){var c=u[a],l=n[c];p.portlets[c]=l,r.push(c),o=!0}return o&&e&&this._updateHistory(),r}},{key:"_updatePortletStates",value:function(t){var e=this;return new Promise(function(n,r){if(0===t.length)h=!1;else{var o=!0,a=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var l=u.value;e._updateStateForPortlet(l)}}catch(t){a=!0,i=t}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}}n(t)})}},{key:"_updateState",value:function(t){var e=this;
11245if(h)throw{message:"Operation in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: ".concat(this._portletId),name:"NotInitializedException"};h=!0,this._setState(t).then(function(t){e._updatePortletStates(t)}).catch(function(t){h=!1,e._reportError(e._portletId,t)})}},{key:"_updateStateForPortlet",value:function(t){for(var e=y.map(function(t){return t.handle}),n=0,r=Object.keys(v);n<r.length;n++){var o=r[n],a=v[o];"portlet.onStateChange"===a.type&&(a.id!==t||e.includes(o)||y.push(a))}y.length>0&&setTimeout(function(){for(h=!0;y.length>0;){var t=y.shift(),e=t.handler,n=t.id;if(p.portlets[n]){var r=p.portlets[n].renderData,o=new u.default(p.portlets[n].state);r&&r.content?e("portlet.onStateChange",o,r):e("portlet.onStateChange",o)}}h=!1})}},{key:"action",value:function(){for(var t=null,e=0,n=null,o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];for(var c=0,l=a;c<l.length;c++){var s=l[c];if(s instanceof HTMLFormElement){if(null!==n)throw new TypeError("Too many [object HTMLFormElement] arguments: ".concat(s,", ").concat(n));n=s}else if((0,r.isObject)(s)){if((0,i.validateParameters)(s),null!==t)throw new TypeError("Too many parameters arguments");t=s}else if(void 0!==s){var f=Object.prototype.toString.call(s);throw new TypeError("Invalid argument type. Argument ".concat(e+1," is of type ").concat(f))}e++}return n&&(0,i.validateForm)(n),this._setupAction(t,n).then(function(t){Promise.resolve(t)}).catch(function(t){Promise.reject(t)})}},{key:"addEventListener",value:function(t,e){if(arguments.length>2)throw new TypeError("Too many arguments passed to addEventListener");if(!(0,r.isString)(t)||!(0,r.isFunction)(e))throw new TypeError("Invalid arguments passed to addEventListener");var n=this._portletId;if(t.startsWith("portlet.")&&"portlet.onStateChange"!==t&&"portlet.onError"!==t)throw new TypeError("The system event type is invalid: ".concat(t));var a=(0,o.default)(),i={handle:a,handler:e,id:n,type:t};return v[a]=i,"portlet.onStateChange"===t&&this._updateStateForPortlet(this._portletId),a}},{key:"createResourceUrl",value:function(t,e,n){if(arguments.length>3)throw new TypeError("Too many arguments. 3 arguments are allowed.");if(t){if(!(0,r.isObject)(t))throw new TypeError("Invalid argument type. Resource parameters must be a parameters object.");(0,i.validateParameters)(t)}var o=null;if(e){if(!(0,r.isString)(e))throw new TypeError("Invalid argument type. Cacheability argument must be a string.");if("cacheLevelPage"!==e&&"cacheLevelPortlet"!==e&&"cacheLevelFull"!==e)throw new TypeError("Invalid cacheability argument: ".concat(e));o=e}if(o||(o="cacheLevelPage"),n&&!(0,r.isString)(n))throw new TypeError("Invalid argument type. Resource ID argument must be a string.");return(0,i.getUrl)(p,"RESOURCE",this._portletId,t,o,n)}},{key:"dispatchClientEvent",value:function(t,e){if((0,i.validateArguments)(arguments,2,2,["string"]),t.match(new RegExp("^portlet[.].*")))throw new TypeError("The event type is invalid: "+t);return Object.keys(v).reduce(function(n,r){var o=v[r];return t.match(o.type)&&(o.handler(t,e),n++),n},0)}},{key:"isInProgress",value:function(){return h}},{key:"newParameters",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={};return Object.keys(t).forEach(function(n){Array.isArray(t[n])&&(e[n]=s(t[n]))}),e}},{key:"newState",value:function(t){return new u.default(t)}},{key:"removeEventListener",value:function(t){if(arguments.length>1)throw new TypeError("Too many arguments passed to removeEventListener");if(!(0,r.isDefAndNotNull)(t))throw new TypeError("The event handle provided is ".concat(l(t)));var e=!1;if((0,r.isObject)(v[t])&&v[t].id===this._portletId){delete v[t];for(var n=y.length,o=0;o<n;o++){var a=y[o];a&&a.handle===t&&y.splice(o,1)}e=!0}if(!e)throw new TypeError("The event listener handle doesn't match any listeners.")}},{key:"setRenderState",value:function(t){if((0,i.validateArguments)(arguments,1,1,["object"]),p.portlets&&p.portlets[this._portletId]){var e=p.portlets[this._portletId];(0,i.validateState)(t,e),this._updateState(t)}}},{key:"startPartialAction",value:function(t){var e=this,n=null;if(arguments.length>1)throw new TypeError("Too many arguments. 1 arguments are allowed");if(void 0!==t){if(!(0,r.isObject)(t))throw new TypeError("Invalid argument type. Argument is of type ".concat(l(t)));(0,i.validateParameters)(t),n=t}
11245if(!0===h)throw{message:"Operation in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: ".concat(this._portletId),name:"NotInitializedException"};h=!0;var o={setPageState:function(t){e._setPageState(e._portletId,t)},url:""};return(0,i.getUrl)(p,"PARTIAL_ACTION",this._portletId,n).then(function(t){return o.url=t,o})}}])&&f(n.prototype,c),_&&f(n,_),e}();e.PortletInit=_;var m=_;e.default=m}).call(this,n(0))},function(t,e,n){var r,o,a=n(27),i=n(28),u=0,c=0;t.exports=function(t,e,n){var l=e&&n||0,s=e||[],f=(t=t||{}).node||r,p=void 0!==t.clockseq?t.clockseq:o;if(null==f||null==p){var d=a();null==f&&(f=r=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=o=16383&(d[6]<<8|d[7]))}var h=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:c+1,y=h-u+(v-c)/1e4;if(y<0&&void 0===t.clockseq&&(p=p+1&16383),(y<0||h>u)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");u=h,c=v,o=p;var _=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;s[l++]=_>>>24&255,s[l++]=_>>>16&255,s[l++]=_>>>8&255,s[l++]=255&_;var m=h/4294967296*1e4&268435455;s[l++]=m>>>8&255,s[l++]=255&m,s[l++]=m>>>24&15|16,s[l++]=m>>>16&255,s[l++]=p>>>8|128,s[l++]=255&p;for(var b=0;b<6;++b)s[l+b]=f[b];return e||i(s)}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return[o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]]].join("")}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.RenderState=void 0;var r,o=n(1),a=(r=n(5))&&r.__esModule?r:{default:r};function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(0,o.isObject)(e)?this.from(e):(this.parameters={},this.portletMode=a.default.VIEW,this.windowState=a.default.NORMAL)}var e,n,r;return e=t,(n=[{key:"clone",value:function(){return new t(this)}},{key:"from",value:function(t){for(var e in this.parameters={},t.parameters)t.parameters.hasOwnProperty(e)&&Array.isArray(t.parameters[e])&&(this.parameters[e]=t.parameters[e].slice(0));this.setPortletMode(t.portletMode),this.setWindowState(t.windowState)}},{key:"getPortletMode",value:function(){return this.portletMode}},{key:"getValue",value:function(t,e){if(!(0,o.isString)(t))throw new TypeError("Parameter name must be a string");var n=this.parameters[t];return Array.isArray(n)&&(n=n[0]),void 0===n&&void 0!==e&&(n=e),n}},{key:"getValues",value:function(t,e){if(!(0,o.isString)(t))throw new TypeError("Parameter name must be a string");var n=this.parameters[t];return n||e}},{key:"getWindowState",value:function(){return this.windowState}},{key:"remove",value:function(t){if(!(0,o.isString)(t))throw new TypeError("Parameter name must be a string");void 0!==this.parameters[t]&&delete this.parameters[t]}},{key:"setPortletMode",value:function(t){if(!(0,o.isString)(t))throw new TypeError("Portlet Mode must be a string");t!==a.default.EDIT&&t!==a.default.HELP&&t!==a.default.VIEW||(this.portletMode=t)}},{key:"setValue",value:function(t,e){if(!(0,o.isString)(t))throw new TypeError("Parameter name must be a string");if(!(0,o.isString)(e)&&null!==e&&!Array.isArray(e))throw new TypeError("Parameter value must be a string, an array or null");Array.isArray(e)||(e=[e]),this.parameters[t]=e}},{key:"setValues",value:function(t,e){this.setValue(t,e)}},{key:"setWindowState",value:function(t){if(!(0,o.isString)(t))throw new TypeError("Window State must be a string");t!==a.default.MAXIMIZED&&t!==a.default.MINIMIZED&&t!==a.default.NORMAL||(this.windowState=t)}}])&&i(e.prototype,n),r&&i(e,r),t}();e.RenderState=u;var c=u;e.default=c}
11245,function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){Liferay.SPA?(Liferay.SPA.app.navigate(t),e&&Object.keys(e).forEach(function(t){Liferay.once(t,e[t])})):window.location.href=t}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){var n;if("object"!==a(e))n=u(t,e);else{n={},Object.keys(e).forEach(function(r){var o=r;r=u(t,r),n[r]=e[o]})}return n};var r,o=(r=n(7))&&r.__esModule?r:{default:r};function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,u=(i=function(t,e){return void 0!==e&&0!==e.lastIndexOf(t,0)&&(e="".concat(t).concat(e)),e},(0,o.default)(i,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length>1?Array.prototype.join.call(e,"_"):String(e[0])}))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new FormData;var o=arguments.length>2?arguments[2]:void 0;Object.entries(e).forEach(function(e){var a,i,u=(i=2,function(t){if(Array.isArray(t))return t}(a=e)||function(t,e){var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n}(a,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()),c=u[0],l=u[1],s=o?"".concat(o,"[").concat(c,"]"):c;Array.isArray(l)?l.forEach(function(e){t(function(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n;return t}({},s,e),n)}):!(0,r.isObject)(l)||l instanceof File?n.append(s,l):t(l,n,s)});return n};var r=n(1)},function(t,e,n){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=(0,((r=n(7))&&r.__esModule?r:{default:r}).default)(function(t){return t.split("").map(function(t){return t.charCodeAt()}).join("")});e.default=o},function(t,e,n){(function(e){var n=1/0,r="[object Symbol]",o=/&(?:amp|lt|gt|quot|#39|#96);/g,a=RegExp(o.source),i="object"==typeof e&&e&&e.Object===Object&&e,u="object"==typeof self&&self&&self.Object===Object&&self,c=i||u||Function("return this")();var l,s=(l={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},function(t){return null==l?void 0:l[t]}),f=Object.prototype.toString,p=c.Symbol,d=p?p.prototype:void 0,h=d?d.toString:void 0;function v(t){if("string"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&f.call(t)==r}(t))return h?h.call(t):"";var e=t+"";return"0"==e&&1/t==-n?"-0":e}t.exports=function(t){var e;return(t=null==(e=t)?"":v(e))&&a.test(t)?t.replace(o,s):t}}).call(this,n(0))}])); 11246//# sourceMappingURL=global.bundle.js.map 11247; 11248 11249(function (A, Liferay) { 11250 var Tabs = Liferay.namespace('Portal.Tabs'); 11251 var ToolTip = Liferay.namespace('Portal.ToolTip'); 11252 var BODY_CONTENT = 'bodyContent'; 11253 var TRIGGER = 'trigger'; 11254 11255 Liferay.Portal.Tabs._show = function (event) { 11256 var names = event.names; 11257 var namespace = event.namespace; 11258 var selectedIndex = event.selectedIndex; 11259 var tabItem = event.tabItem; 11260 var tabSection = event.tabSection; 11261 11262 if (tabItem) { 11263 tabItem.radioClass('active'); 11264 } 11265 11266 if (tabSection) { 11267 tabSection.show(); 11268 } 11269 11270 var tabTitle = A.one('#' + event.namespace + 'dropdownTitle'); 11271 11272 if (tabTitle) { 11273 tabTitle.html(tabItem.one('a').text()); 11274 } 11275 11276 names.splice(selectedIndex, 1); 11277 var el; 11278 11279 for (var i = 0; i < names.length; i++) { 11280 el = A.one('#' + namespace + Liferay.Util.toCharCode(names[i]) + 'TabsSection'); 11281 11282 if (el) { 11283 el.hide(); 11284 } 11285 } 11286 }; 11287 11288 Liferay.provide(Tabs, 'show', function (namespace, names, id, callback) { 11289 var namespacedId = namespace + Liferay.Util.toCharCode(id);
11290 var tab = A.one('#' + namespacedId + 'TabsId'); 11291 var tabSection = A.one('#' + namespacedId + 'TabsSection'); 11292 var details = { 11293 id: id, 11294 names: names, 11295 namespace: namespace, 11296 selectedIndex: names.indexOf(id), 11297 tabItem: tab, 11298 tabSection: tabSection 11299 }; 11300 11301 if (callback && A.Lang.isFunction(callback)) { 11302 callback.call(this, namespace, names, id, details); 11303 } 11304 11305 Liferay.fire('showTab', details); 11306 }, ['aui-base']); 11307 Liferay.publish('showTab', { 11308 defaultFn: Liferay.Portal.Tabs._show 11309 }); 11310 11311 ToolTip._getText = function (id) { 11312 var node = A.one('#' + id); 11313 var text = ''; 11314 11315 if (node) { 11316 var toolTipTextNode = node.next('.taglib-text'); 11317 11318 if (toolTipTextNode) { 11319 text = toolTipTextNode.html(); 11320 } 11321 } 11322 11323 return text; 11324 }; 11325 11326 ToolTip.hide = function () { 11327 var instance = this; 11328 var cached = instance._cached; 11329 11330 if (cached) { 11331 cached.hide(); 11332 } 11333 }; 11334 11335 Liferay.provide(ToolTip, 'show', function (obj, text, tooltipConfig) { 11336 var instance = this; 11337 var cached = instance._cached; 11338 var hideTooltipTask = instance._hideTooltipTask; 11339 11340 if (!cached) { 11341 var config = A.merge({ 11342 cssClass: 'tooltip-help', 11343 html: true, 11344 opacity: 1, 11345 stickDuration: 100, 11346 visible: false, 11347 zIndex: Liferay.zIndex.TOOLTIP 11348 }, tooltipConfig); 11349 cached = new A.Tooltip(config).render(); 11350 cached.after('visibleChange', A.bind('_syncUIPosAlign', cached)); 11351 hideTooltipTask = A.debounce('_onBoundingBoxMouseleave', cached.get('stickDuration'), cached); 11352 instance._hideTooltipTask = hideTooltipTask; 11353 instance._cached = cached; 11354 } else { 11355 cached.setAttrs(tooltipConfig); 11356 } 11357 11358 hideTooltipTask.cancel(); 11359 11360 if (obj.jquery) { 11361 obj = obj[0]; 11362 } 11363 11364 obj = A.one(obj); 11365 11366 if (text == null) { 11367 text = instance._getText(obj.guid()); 11368 } 11369 11370 cached.set(BODY_CONTENT, text); 11371 cached.set(TRIGGER, obj); 11372 var boundingBox = cached.get('boundingBox'); 11373 boundingBox.detach('hover'); 11374 obj.detach('hover'); 11375 obj.on('hover', A.bind('_onBoundingBoxMouseenter', cached), hideTooltipTask); 11376 boundingBox.on('hover', function (event) { 11377 hideTooltipTask.cancel(); 11378 obj.once('mouseenter', hideTooltipTask.cancel); 11379 }, hideTooltipTask); 11380 cached.show(); 11381 }, ['aui-tooltip-base']); 11382})(AUI(), Liferay); 11383//# sourceMappingURL=portal.js.map 11384; 11385 11386(function (A, Liferay) { 11387 var Lang = A.Lang; 11388 var Util = Liferay.Util; 11389 var STR_HEAD = 'head'; 11390 var TPL_NOT_AJAXABLE = '<div class="alert alert-info">{0}</div>'; 11391 var Portlet = { 11392 list: [], 11393 readyCounter: 0, 11394 destroyComponents: function destroyComponents(portletId) { 11395 Liferay.destroyComponents(function (component, destroyConfig) { 11396 return portletId === destroyConfig.portletId; 11397 }); 11398 }, 11399 isStatic: function isStatic(portletId) { 11400 var instance = this; 11401 var id = Util.getPortletId(portletId.id || portletId); 11402 return id in instance._staticPortlets; 11403 }, 11404 refreshLayout: function refreshLayout(portletBoundary) {}, 11405 register: function register(portletId) { 11406 var instance = this; 11407 11408 if (instance.list.indexOf(portletId) < 0) { 11409 instance.list.push(portletId); 11410 } 11411 }, 11412 _defCloseFn: function _defCloseFn(event) { 11413 var instance = this; 11414 event.portlet.remove(true); 11415 11416 if (!event.nestedPortlet) { 11417 A.io.request(themeDisplay.getPathMain() + '/portal/update_layout', { 11418 after: { 11419 success: function success() { 11420 Liferay.fire('updatedLayout'); 11421 } 11422 }, 11423 data: { 11424 cmd: 'delete', 11425 doAsUserId: event.doAsUserId, 11426 p_auth: Liferay.authToken, 11427 p_l_id: event.plid, 11428 p_p_id: event.portletId, 11429 p_v_l_s_g_id: themeDisplay.getSiteGroupId() 11430 } 11431 }); 11432 } 11433 }, 11434 _loadMarkupHeadElements: function _loadMarkupHeadElements(response, loadHTML) { 11435 var markupHeadElements = response.markupHeadElements; 11436 11437 if (markupHeadElements && markupHeadElements.length) { 11438 var head = A.one(STR_HEAD); 11439 head.append(markupHeadElements); 11440 var container = A.Node.create('<div />'); 11441 container.plug(A.Plugin.ParseContent); 11442 container.setContent(markupHeadElements); 11443 } 11444 }, 11445 _loadPortletFiles: function _loadPortletFiles(response, loadHTML) { 11446 var footerCssPaths = response.footerCssPaths || []; 11447 var headerCssPaths = response.headerCssPaths || []; 11448 var javascriptPaths = response.headerJavaScriptPaths || []; 11449 javascriptPaths = javascriptPaths.concat(response.footerJavaScriptPaths || []); 11450 var body = A.getBody(); 11451 var head = A.one(STR_HEAD); 11452 11453 if (headerCssPaths.length) { 11454 A.Get.css(headerCssPaths, { 11455 insertBefore: head.get('firstChild').getDOM() 11456 }); 11457 } 11458 11459 var lastChild = body.get('lastChild').getDOM(); 11460 11461 if (footerCssPaths.length) { 11462 A.Get.css(footerCssPaths, {
11463 insertBefore: lastChild 11464 }); 11465 } 11466 11467 var responseHTML = response.portletHTML; 11468 11469 if (javascriptPaths.length) { 11470 A.Get.script(javascriptPaths, { 11471 onEnd: function onEnd(obj) { 11472 loadHTML(responseHTML); 11473 } 11474 }); 11475 } else { 11476 loadHTML(responseHTML); 11477 } 11478 }, 11479 _mergeOptions: function _mergeOptions(portlet, options) { 11480 options = options || {}; 11481 options.doAsUserId = options.doAsUserId || themeDisplay.getDoAsUserIdEncoded(); 11482 options.plid = options.plid || themeDisplay.getPlid(); 11483 options.portlet = portlet; 11484 options.portletId = portlet.portletId; 11485 return options; 11486 }, 11487 _staticPortlets: {} 11488 }; 11489 Liferay.provide(Portlet, 'add', function (options) { 11490 var instance = this; 11491 Liferay.fire('initLayout'); 11492 var doAsUserId = options.doAsUserId || themeDisplay.getDoAsUserIdEncoded(); 11493 var plid = options.plid || themeDisplay.getPlid(); 11494 var portletData = options.portletData; 11495 var portletId = options.portletId; 11496 var portletItemId = options.portletItemId; 11497 var placeHolder = options.placeHolder; 11498 11499 if (!placeHolder) { 11500 placeHolder = A.Node.create('<div class="loading-animation" />'); 11501 } else { 11502 placeHolder = A.one(placeHolder); 11503 } 11504 11505 var beforePortletLoaded = options.beforePortletLoaded; 11506 var onCompleteFn = options.onComplete; 11507 11508 var onComplete = function onComplete(portlet, portletId) { 11509 if (onCompleteFn) { 11510 onCompleteFn(portlet, portletId); 11511 } 11512 11513 instance.list.push(portlet.portletId); 11514 11515 if (portlet) { 11516 portlet.attr('data-qa-id', 'app-loaded'); 11517 } 11518 11519 Liferay.fire('addPortlet', { 11520 portlet: portlet 11521 }); 11522 }; 11523 11524 var container = null; 11525 11526 if (Liferay.Layout && Liferay.Layout.INITIALIZED) { 11527 container = Liferay.Layout.getActiveDropContainer(); 11528 } 11529 11530 if (!container) { 11531 return; 11532 } 11533 11534 var currentColumnId = Util.getColumnId(container.attr('id')); 11535 var portletPosition = 0; 11536 11537 if (options.placeHolder) { 11538 var column = placeHolder.get('parentNode'); 11539 11540 if (!column) { 11541 return; 11542 } 11543 11544 placeHolder.addClass('portlet-boundary'); 11545 var columnPortlets = column.all('.portlet-boundary'); 11546 var nestedPortlets = column.all('.portlet-nested-portlets'); 11547 portletPosition = columnPortlets.indexOf(placeHolder); 11548 var nestedPortletOffset = 0; 11549 nestedPortlets.some(function (nestedPortlet) { 11550 var nestedPortletIndex = columnPortlets.indexOf(nestedPortlet); 11551 11552 if (nestedPortletIndex !== -1 && nestedPortletIndex < portletPosition) { 11553 nestedPortletOffset += nestedPortlet.all('.portlet-boundary').size(); 11554 } else if (nestedPortletIndex >= portletPosition) { 11555 return true; 11556 } 11557 }); 11558 portletPosition -= nestedPortletOffset; 11559 currentColumnId = Util.getColumnId(column.attr('id')); 11560 } 11561 11562 var url = themeDisplay.getPathMain() + '/portal/update_layout'; 11563 var data = { 11564 cmd: 'add', 11565 dataType: 'JSON', 11566 doAsUserId: doAsUserId, 11567 p_auth: Liferay.authToken, 11568 p_l_id: plid, 11569 p_p_col_id: currentColumnId, 11570 p_p_col_pos: portletPosition, 11571 p_p_i_id: portletItemId, 11572 p_p_id: portletId, 11573 p_p_isolated: true, 11574 p_v_l_s_g_id: themeDisplay.getSiteGroupId(), 11575 portletData: portletData 11576 }; 11577 var firstPortlet = container.one('.portlet-boundary'); 11578 var hasStaticPortlet = firstPortlet && firstPortlet.isStatic; 11579 11580 if (!options.placeHolder && !options.plid) { 11581 if (!hasStaticPortlet) { 11582 container.prepend(placeHolder); 11583 } else { 11584 firstPortlet.placeAfter(placeHolder); 11585 } 11586 } 11587 11588 if (themeDisplay.isFreeformLayout()) { 11589 container.prepend(placeHolder); 11590 } 11591 11592 data.currentURL = Liferay.currentURL; 11593 instance.addHTML({ 11594 beforePortletLoaded: beforePortletLoaded, 11595 data: data, 11596 onComplete: onComplete, 11597 placeHolder: placeHolder, 11598 url: url 11599 }); 11600 }, ['aui-base']); 11601 Liferay.provide(Portlet, 'addHTML', function (options) { 11602 var instance = this; 11603 var portletBoundary = null; 11604 var beforePortletLoaded = options.beforePortletLoaded; 11605 var data = options.data; 11606 var dataType = 'HTML'; 11607 var onComplete = options.onComplete; 11608 var placeHolder = options.placeHolder; 11609 var url = options.url; 11610 11611 if (data && Lang.isString(data.dataType)) { 11612 dataType = data.dataType; 11613 } 11614 11615 dataType = dataType.toUpperCase(); 11616 11617 var addPortletReturn = function addPortletReturn(html) { 11618 var container = placeHolder.get('parentNode'); 11619 var portletBound = A.Node.create('<div></div>'); 11620 portletBound.plug(A.Plugin.ParseContent); 11621 portletBound.setContent(html); 11622 portletBound = portletBound.one('> *'); 11623 var portletId; 11624 11625 if (portletBound) { 11626 var id = portletBound.attr('id'); 11627 portletId = Util.getPortletId(id); 11628 portletBound.portletId = portletId; 11629 placeHolder.hide(); 11630 placeHolder.placeAfter(portletBound); 11631 placeHolder.remove(); 11632 instance.refreshLayout(portletBound); 11633 11634 if (window.location.hash) { 11635 window.location.href = encodeURI(window.location.hash); 11636 } 11637 11638 portletBoundary = portletBound; 11639 var Layout = Liferay.Layout; 11640 11641 if (Layout && Layout.INITIALIZED) { 11642 Layout.updateCurrentPortletInfo(portletBoundary); 11643 11644 if (container) { 11645 Layout.syncEmptyColumnClassUI(container); 11646 } 11647 11648 Layout.syncDraggableClassUI(); 11649 Layout.updatePortletDropZones(portletBoundary); 11650 } 11651 11652 if (onComplete) { 11653 onComplete(portletBoundary, portletId); 11654 } 11655 } else { 11656 placeHolder.remove(); 11657 } 11658 11659 return portletId; 11660 }; 11661 11662 if (beforePortletLoaded) { 11663 beforePortletLoaded(placeHolder); 11664 } 11665 11666 A.io.request(url, { 11667 after: { 11668 success: function success() { 11669 if (!data || !data.preventNotification) { 11670 Liferay.fire('updatedLayout'); 11671 } 11672 } 11673 }, 11674 data: data, 11675 dataType: dataType, 11676 on: { 11677 failure: function failure(event, id, obj) { 11678 var statusText = obj.statusText; 11679 11680 if (statusText) { 11681 var status = 'S\x27ha\x20produït\x20un\x20error\x20inesperat\x2e\x20Refresqueu\x20la\x20pàgina\x20actual\x2e'; 11682 11683 if (statusText == 'timeout') { 11684 status = 'Sol\xb7licitud\x20de\x20temps\x20mort'; 11685 } 11686 11687 placeHolder.hide(); 11688 placeHolder.placeAfter('<div class="alert alert-danger">' + status + '</div>'); 11689 } 11690 }, 11691 success: function success(event, id, obj) { 11692 var instance = this; 11693 var response = instance.get('responseData'); 11694 11695 if (dataType == 'HTML') { 11696 addPortletReturn(response); 11697 } else if (response.refresh) { 11698 addPortletReturn(response.portletHTML); 11699 } else { 11700 Portlet._loadMarkupHeadElements(response); 11701 11702 Portlet._loadPortletFiles(response, addPortletReturn); 11703 } 11704 } 11705 } 11706 }); 11707 }, ['aui-io-request', 'aui-parse-content']); 11708 Liferay.provide(Portlet, 'close', function (portlet, skipConfirm, options) { 11709 var instance = this; 11710 portlet = A.one(portlet); 11711 11712 if (portlet && (skipConfirm || confirm('Segur\x20que\x20voleu\x20suprimir\x20aquest\x20component\x3f'))) { 11713 var portletId = portlet.portletId; 11714 var portletIndex = instance.list.indexOf(portletId); 11715 11716 if (portletIndex >= 0) { 11717 instance.list.splice(portletIndex, 1); 11718 } 11719 11720 options = Portlet._mergeOptions(portlet, options); 11721 Portlet.destroyComponents(portletId); 11722 Liferay.fire('destroyPortlet', options); 11723 Liferay.fire('closePortlet', options); 11724 } else { 11725 A.config.win.focus(); 11726 } 11727 }, ['aui-io-request']); 11728 Liferay.provide(Portlet, 'destroy', function (portlet, options) { 11729 portlet = A.one(portlet); 11730 11731 if (portlet) { 11732 var portletId = portlet.portletId || Util.getPortletId(portlet.attr('id')); 11733 Portlet.destroyComponents(portletId); 11734 Liferay.fire('destroyPortlet', Portlet._mergeOptions(portlet, options)); 11735 } 11736 }, ['aui-node-base']); 11737 Liferay.provide(Portlet, 'minimize', function (portlet, el, options) { 11738 var instance = this; 11739 options = options || {}; 11740 var doAsUserId = options.doAsUserId || themeDisplay.getDoAsUserIdEncoded(); 11741 var plid = options.plid || themeDisplay.getPlid(); 11742 portlet = A.one(portlet); 11743 11744 if (portlet) { 11745 var content = portlet.one('.portlet-content-container'); 11746 11747 if (content) { 11748 var restore = content.hasClass('hide');
11749 content.toggle(); 11750 portlet.toggleClass('portlet-minimized'); 11751 var link = A.one(el); 11752 11753 if (link) { 11754 var title = restore ? 'Minimitza' : 'Restaura'; 11755 link.attr('alt', title); 11756 link.attr('title', title); 11757 var linkText = link.one('.taglib-text-icon'); 11758 11759 if (linkText) { 11760 linkText.html(title); 11761 } 11762 11763 var icon = link.one('i'); 11764 11765 if (icon) { 11766 icon.removeClass('icon-minus icon-resize-vertical'); 11767 11768 if (restore) { 11769 icon.addClass('icon-minus'); 11770 } else { 11771 icon.addClass('icon-resize-vertical'); 11772 } 11773 } 11774 } 11775 11776 A.io.request(themeDisplay.getPathMain() + '/portal/update_layout', { 11777 after: { 11778 success: function success() { 11779 if (restore) { 11780 var data = { 11781 doAsUserId: doAsUserId, 11782 p_l_id: plid, 11783 p_p_boundary: false, 11784 p_p_id: portlet.portletId, 11785 p_p_isolated: true 11786 }; 11787 portlet.plug(A.Plugin.ParseContent); 11788 portlet.load(themeDisplay.getPathMain() + '/portal/render_portlet?' + A.QueryString.stringify(data)); 11789 } 11790 } 11791 }, 11792 data: { 11793 cmd: 'minimize', 11794 doAsUserId: doAsUserId, 11795 p_auth: Liferay.authToken, 11796 p_l_id: plid, 11797 p_p_id: portlet.portletId, 11798 p_p_restore: restore, 11799 p_v_l_s_g_id: themeDisplay.getSiteGroupId() 11800 } 11801 }); 11802 } 11803 } 11804 }, ['aui-io', 'aui-parse-content', 'node-load', 'querystring-stringify']); 11805 Liferay.provide(Portlet, 'onLoad', function (options) { 11806 var instance = this; 11807 var canEditTitle = options.canEditTitle; 11808 var columnPos = options.columnPos; 11809 var isStatic = options.isStatic == 'no' ? null : options.isStatic; 11810 var namespacedId = options.namespacedId; 11811 var portletId = options.portletId; 11812 var refreshURL = options.refreshURL; 11813 var refreshURLData = options.refreshURLData; 11814 11815 if (isStatic) { 11816 instance.registerStatic(portletId); 11817 } 11818 11819 var portlet = A.one('#' + namespacedId); 11820 11821 if (portlet && !portlet.portletProcessed) { 11822 portlet.portletProcessed = true; 11823 portlet.portletId = portletId; 11824 portlet.columnPos = columnPos; 11825 portlet.isStatic = isStatic; 11826 portlet.refreshURL = refreshURL; 11827 portlet.refreshURLData = refreshURLData; // Functions to run on portlet load 11828 11829 if (canEditTitle) { 11830 // https://github.com/yui/yui3/issues/1808 11831 var events = 'focus'; 11832 11833 if (!A.UA.touch) { 11834 events = ['focus', 'mousemove']; 11835 } 11836 11837 var handle = portlet.on(events, function (event) { 11838 Util.portletTitleEdit({ 11839 doAsUserId: themeDisplay.getDoAsUserIdEncoded(), 11840 obj: portlet, 11841 plid: themeDisplay.getPlid(), 11842 portletId: portletId 11843 }); 11844 handle.detach(); 11845 }); 11846 } 11847 } 11848 11849 Liferay.fire('portletReady', { 11850 portlet: portlet, 11851 portletId: portletId 11852 }); 11853 instance.readyCounter++; 11854 11855 if (instance.readyCounter === instance.list.length) { 11856 Liferay.fire('allPortletsReady', { 11857 portletId: portletId 11858 }); 11859 } 11860 }, ['aui-base', 'aui-timer', 'event-move']); 11861 Liferay.provide(Portlet, 'refresh', function (portlet, data) { 11862 var instance = this; 11863 portlet = A.one(portlet); 11864 11865 if (portlet) { 11866 data = data || portlet.refreshURLData || {}; 11867 11868 if (!data.hasOwnProperty('portletAjaxable')) { 11869 data.portletAjaxable = true; 11870 } 11871 11872 var id = portlet.attr('portlet'); 11873 var url = portlet.refreshURL; 11874 var placeHolder = A.Node.create('<div class="loading-animation" id="p_p_id' + id + '" />'); 11875 11876 if (data.portletAjaxable && url) { 11877 portlet.placeBefore(placeHolder); 11878 portlet.remove(true); 11879 Portlet.destroyComponents(portlet.portletId); 11880 var params = {}; 11881 var urlPieces = url.split('?'); 11882 11883 if (urlPieces.length > 1) { 11884 params = A.QueryString.parse(urlPieces[1]); 11885 delete params.dataType; 11886 url = urlPieces[0]; 11887 } 11888 11889 instance.addHTML({ 11890 data: A.mix(params, data, true), 11891 onComplete: function onComplete(portlet, portletId) { 11892 portlet.refreshURL = url; 11893 11894 if (portlet) { 11895 portlet.attr('data-qa-id', 'app-refreshed'); 11896 } 11897 11898 Liferay.fire(portlet.portletId + ':portletRefreshed', { 11899 portlet: portlet, 11900 portletId: portletId 11901 }); 11902 }, 11903 placeHolder: placeHolder, 11904 url: url 11905 }); 11906 } else if (!portlet.getData('pendingRefresh')) { 11907 portlet.setData('pendingRefresh', true); 11908 var nonAjaxableContentMessage = Lang.sub(TPL_NOT_AJAXABLE, ['Aquest\x20canvi\x20només\x20es\x20mostrarà\x20després\x20de\x20refrescar\x20la\x20pàgina\x20actual\x2e']); 11909 var portletBody = portlet.one('.portlet-body'); 11910 portletBody.placeBefore(nonAjaxableContentMessage); 11911 portletBody.hide(); 11912 } 11913 } 11914 }, ['aui-base', 'querystring-parse']); 11915 Liferay.provide(Portlet, 'registerStatic', function (portletId) { 11916 var instance = this; 11917 var Node = A.Node; 11918 11919 if (Node && portletId instanceof Node) { 11920 portletId = portletId.attr('id'); 11921 } else if (portletId.id) { 11922 portletId = portletId.id; 11923 } 11924 11925 var id = Util.getPortletId(portletId); 11926 instance._staticPortlets[id] = true; 11927 }, ['aui-base']); 11928 Liferay.provide(Portlet, 'openWindow', function (options) { 11929 var instance = this; 11930 var bodyCssClass = options.bodyCssClass; 11931 var destroyOnHide = options.destroyOnHide; 11932 var namespace = options.namespace; 11933 var portlet = options.portlet; 11934 var subTitle = options.subTitle; 11935 var title = options.title; 11936 var uri = options.uri; 11937 portlet = A.one(portlet); 11938 11939 if (portlet && uri) { 11940 var portletTitle = portlet.one('.portlet-title') || portlet.one('.portlet-title-default'); 11941 var titleHtml = title; 11942 11943 if (portletTitle) { 11944 if (portlet.one('#cpPortletTitle')) { 11945 titleHtml = portletTitle.one('.portlet-title-text').outerHTML() + ' - ' + titleHtml; 11946 } else { 11947 titleHtml = portletTitle.text() + ' - ' + titleHtml; 11948 } 11949 } 11950 11951 if (subTitle) { 11952 titleHtml += '<div class="portlet-configuration-subtitle small"><span class="portlet-configuration-subtitle-text">' + subTitle + '</span></div>'; 11953 } 11954 11955 Liferay.Util.openWindow({ 11956 cache: false, 11957 dialog: { 11958 destroyOnHide: destroyOnHide 11959 }, 11960 dialogIframe: { 11961 bodyCssClass: bodyCssClass, 11962 id: namespace + 'configurationIframe', 11963 uri: uri 11964 }, 11965 id: namespace + 'configurationIframeDialog', 11966 title: titleHtml, 11967 uri: uri 11968 }, function (dialog) { 11969 dialog.once('drag:init', function () { 11970 dialog.dd.addInvalid('.portlet-configuration-subtitle-text'); 11971 }); 11972 }); 11973 } 11974 }, ['liferay-util-window']); 11975 Liferay.publish('closePortlet', { 11976 defaultFn: Portlet._defCloseFn 11977 }); 11978 Liferay.publish('allPortletsReady', {
11979 fireOnce: true 11980 }); // Backwards compatability 11981 11982 Portlet.ready = function (fn) { 11983 Liferay.on('portletReady', function (event) { 11984 fn(event.portletId, event.portlet); 11985 }); 11986 }; 11987 11988 Liferay.Portlet = Portlet; 11989})(AUI(), Liferay); 11990//# sourceMappingURL=portlet.js.map 11991Liferay.Workflow = { 11992 ACTION_PUBLISH: 1, 11993 ACTION_SAVE_DRAFT: 2, 11994 STATUS_ANY: -1, 11995 STATUS_APPROVED: 0, 11996 STATUS_DENIED: 4, 11997 STATUS_DRAFT: 2, 11998 STATUS_EXPIRED: 3, 11999 STATUS_PENDING: 1 12000}; 12001//# sourceMappingURL=workflow.js.map 12002AUI.add( 12003 'liferay-address', 12004 function(A) { 12005 Liferay.Address = { 12006 getCountries: function(callback) { 12007 Liferay.Service( 12008 '/country/get-countries', 12009 { 12010 active: true 12011 }, 12012 callback 12013 ); 12014 }, 12015 12016 getRegions: function(callback, selectKey) { 12017 Liferay.Service( 12018 '/region/get-regions', 12019 { 12020 active: true, 12021 countryId: Number(selectKey) 12022 }, 12023 callback 12024 ); 12025 } 12026 }; 12027 }, 12028 '', 12029 { 12030 requires: [] 12031 } 12032); 12033AUI.add( 12034 'liferay-form', 12035 function(A) { 12036 var AArray = A.Array; 12037 12038 var Lang = A.Lang; 12039 12040 var formConfig; 12041 12042 var DEFAULTS_FORM_VALIDATOR = A.config.FormValidator; 12043 12044 var defaultAcceptFiles = DEFAULTS_FORM_VALIDATOR.RULES.acceptFiles; 12045 12046 var TABS_SECTION_STR = 'TabsSection'; 12047 12048 var REGEX_EMAIL = /^[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:\w(?:[\w-]*\w)?\.)+(\w(?:[\w-]*\w))$/; 12049 12050 var REGEX_NUMBER = /^[+\-]?(\d+)([.|,]\d+)*([eE][+-]?\d+)?$/; 12051 12052 var REGEX_URL = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(https?\:\/\/|www.|[-;
12052:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))((.*):(\d*)\/?(.*))?)/; 12053 12054 var acceptFiles = function(val, node, ruleValue) { 12055 if (ruleValue == '*') { 12056 return true; 12057 } 12058 12059 return defaultAcceptFiles(val, node, ruleValue); 12060 }; 12061 12062 var email = function (val) { 12063 return REGEX_EMAIL.test(val); 12064 }; 12065 12066 var maxFileSize = function(val, node, ruleValue) { 12067 var nodeType = node.get('type').toLowerCase(); 12068 12069 if (nodeType === 'file') { 12070 return (ruleValue === 0 || node._node.files[0].size <= ruleValue); 12071 } 12072 12073 return true; 12074 }; 12075 12076 var number = function(val, node, ruleValue) { 12077 return REGEX_NUMBER && REGEX_NUMBER.test(val); 12078 }; 12079 12080 var url = function(val, node, ruleValue) { 12081 return REGEX_URL && REGEX_URL.test(val); 12082 }; 12083 12084 A.mix( 12085 DEFAULTS_FORM_VALIDATOR.RULES, 12086 { 12087 acceptFiles: acceptFiles, 12088 email: email, 12089 maxFileSize: maxFileSize, 12090 number: number, 12091 url: url 12092 }, 12093 true 12094 ); 12095 12096 A.mix( 12097 DEFAULTS_FORM_VALIDATOR.STRINGS, 12098 { 12099 DEFAULT: 'Solucioneu\x20el\x20problema\x20amb\x20aquest\x20camp\x2e', 12100 acceptFiles: 'Introduïu\x20un\x20valor\x20amb\x20una\x20extensió\x20vàlida\x20\x28\x7b0\x7d\x29\x2e', 12101 alpha: 'Introduïu\x20només\x20lletres\x2e', 12102 alphanum: 'Introduïu\x20només\x20caràcters\x20alfanumèrics\x2e', 12103 date: 'Introduïu\x20una\x20data\x20vàlida\x2e', 12104 digits: 'Introduïu\x20només\x20dÃÂgits\x2e', 12105 email: 'Introduïu\x20una\x20adreça\x20de\x20correu\x20electrònic\x20vàlida\x2e', 12106 equalTo: 'Introduïu\x20el\x20mateix\x20valor\x20de\x20nou\x2e', 12107 max: 'Introduïu\x20un\x20valor\x20menor\x20o\x20igual\x20a\x20\x7b0\x7d\x2e', 12108 maxFileSize: 'Introduïu\x20un\x20fitxer\x20amb\x20una\x20mida\x20no\x20més\x20gran\x20de\x20\x7b0\x7d\x2e', 12109 maxLength: 'No\x20introduïu\x20més\x20de\x20\x7b0\x7d\x20caràcters\x2e', 12110 min: 'Introduïu\x20un\x20valor\x20superior\x20o\x20igual\x20a\x20\x7b0\x7d\x2e', 12111 minLength: 'Introduïu\x20al\x20menys\x20\x7b0\x7d\x20caràcters\x2e', 12112 number: 'Introduïu\x20un\x20número\x20vàlid\x2e', 12113 range: 'Introduïu\x20un\x20valor\x20entre\x20\x7b0\x7d\x20i\x20\x7b1\x7d\x2e', 12114 rangeLength: 'Introduïu\x20un\x20valor\x20entre\x20\x7b0\x7d\x20i\x20\x7b1\x7d\x20caràcters\x2e', 12115 required: 'Aquest\x20camp\x20és\x20obligatori\x2e', 12116 url: 'Introduïu\x20una\x20URL\x20vàlida\x2e' 12117 }, 12118 true 12119 ); 12120 12121 var Form = A.Component.create( 12122 { 12123 ATTRS: { 12124 fieldRules: { 12125 setter: function(val) { 12126 var instance = this; 12127 12128 instance._processFieldRules(val); 12129 12130 return val; 12131 } 12132 }, 12133 id: {}, 12134 namespace: {}, 12135 onSubmit: { 12136 valueFn: function() { 12137 var instance = this; 12138 12139 return instance._onSubmit; 12140 } 12141 }, 12142 validateOnBlur: { 12143 validator: Lang.isBoolean, 12144 value: true 12145 } 12146 }, 12147 12148 EXTENDS: A.Base, 12149 12150 prototype: { 12151 initializer: function() { 12152 var instance = this; 12153 12154 var id = instance.get('id'); 12155 12156 var form = document[id]; 12157 var formNode = A.one(form); 12158 12159 instance.form = form; 12160 instance.formNode = formNode; 12161 12162 if (formNode) { 12163 var formValidator = new A.FormValidator( 12164 { 12165 boundingBox: formNode, 12166 validateOnBlur: instance.get('validateOnBlur') 12167 } 12168 ); 12169 12170 A.Do.before('_validatable', formValidator, 'validatable', instance); 12171 12172 instance.formValidator = formValidator; 12173 12174 instance._processFieldRules(); 12175 12176 instance._bindForm(); 12177 } 12178 }, 12179 12180 addRule: function(fieldName, validatorName, errorMessage, body, custom) { 12181 var instance = this; 12182 12183 var fieldRules = instance.get('fieldRules'); 12184 12185 var ruleIndex = instance._findRuleIndex(fieldRules, fieldName, validatorName); 12186 12187 if (ruleIndex == -1) { 12188 fieldRules.push( 12189 { 12190 body: body || '', 12191 custom: custom || false, 12192 errorMessage: errorMessage || '', 12193 fieldName: fieldName, 12194 validatorName: validatorName 12195 } 12196 ); 12197 12198 instance._processFieldRules(fieldRules); 12199 } 12200 }, 12201 12202 removeRule: function(fieldName, validatorName) { 12203 var instance = this; 12204 12205 var fieldRules = instance.get('fieldRules'); 12206 12207 var ruleIndex = instance._findRuleIndex(fieldRules, fieldName, validatorName); 12208 12209 if (ruleIndex != -1) { 12210 var rule = fieldRules[ruleIndex]; 12211 12212 instance.formValidator.resetField(rule.fieldName); 12213 12214 fieldRules.splice(ruleIndex, 1); 12215 12216 instance._processFieldRules(fieldRules); 12217 } 12218 }, 12219 12220 _afterGetFieldsByName: function(fieldName) { 12221 var instance = this; 12222 12223 var editorString = 'Editor'; 12224 12225 if (fieldName.lastIndexOf(editorString) === (fieldName.length - editorString.length)) { 12226 var formNode = instance.formNode; 12227 12228 return new A.Do.AlterReturn( 12229 'Return editor dom element', 12230 formNode.one('#' + fieldName) 12231 ); 12232 } 12233 }, 12234 12235 _bindForm: function() { 12236 var instance = this; 12237 12238 var formNode = instance.formNode; 12239 var formValidator = instance.formValidator; 12240 12241 formValidator.on('submit', A.bind('_onValidatorSubmit', instance)); 12242 formValidator.on('submitError', A.bind('_onSubmitError', instance)); 12243 12244 formNode.delegate(['blur', 'focus'], A.bind('_onFieldFocusChange', instance), 'button,input,select,textarea'); 12245 formNode.delegate(['blur', 'input'], A.bind('_onEditorBlur', instance), 'div[contenteditable="true"]'); 12246 12247 A.Do.after('_afterGetFieldsByName', formValidator, 'getFieldsByName', instance); 12248 }, 12249 12250 _defaultSubmitFn: function(event) { 12251 var instance = this; 12252 12253 if (!event.stopped) { 12254 submitForm(instance.form); 12255 } 12256 }, 12257 12258 _findRuleIndex: function(fieldRules, fieldName, validatorName) { 12259 var ruleIndex = -1; 12260 12261 AArray.some( 12262 fieldRules, 12263 function(element, index) { 12264 if (element.fieldName === fieldName && 12265 element.validatorName === validatorName) { 12266 ruleIndex = index; 12267 12268 return true; 12269 } 12270 } 12271 ); 12272 12273 return ruleIndex; 12274 }, 12275 12276 _focusInvalidFieldTab: function() { 12277 var instance = this; 12278 12279 var formNode = instance.formNode; 12280 12281 var field = formNode.one('.' + instance.formValidator.get('errorClass')); 12282 12283 if (field) { 12284 var fieldWrapper = field.ancestor('form > div'); 12285 12286 var formTabs = formNode.one('.lfr-nav'); 12287 12288 if (fieldWrapper && formTabs) { 12289 var tabs = formTabs.all('.tab'); 12290 var tabsNamespace = formTabs.getAttribute('data-tabs-namespace'); 12291 12292 var tabNames = AArray.map( 12293 tabs._nodes, 12294 function(tab) { 12295 return tab.getAttribute('data-tab-name'); 12296 } 12297 ) 12298 12299 var fieldWrapperId = fieldWrapper.getAttribute('id').slice(0, -TABS_SECTION_STR.length); 12300 12301 var fieldTabId = AArray.find( 12302 tabs._nodes, 12303 function(tab) { 12304 return tab.getAttribute('id').indexOf(fieldWrapperId) !== -1; 12305 } 12306 ) 12307 12308 Liferay.Portal.Tabs.show(tabsNamespace, tabNames, fieldTabId.getAttribute('data-tab-name')); 12309 } 12310 } 12311 }, 12312 12313 _onEditorBlur: function(event) { 12314 var instance = this; 12315 12316 var formValidator = instance.formValidator; 12317 12318 formValidator.validateField(event.target); 12319 }, 12320 12321 _onFieldFocusChange: function(event) { 12322 var instance = this; 12323 12324 var row = event.currentTarget.ancestor('.field'); 12325 12326 if (row) { 12327 row.toggleClass('field-focused', event.type === 'focus'); 12328 } 12329 }, 12330 12331 _onSubmit: function(event) { 12332 var instance = this; 12333 12334 event.preventDefault(); 12335 12336 setTimeout( 12337 function() { 12338 instance._defaultSubmitFn(event); 12339 }, 12340 0 12341 ); 12342 }, 12343 12344 _onSubmitError: function(event) { 12345 var instance = this; 12346 12347 var collapsiblePanels = instance.formNode.all('.panel-collapse'); 12348 12349 collapsiblePanels.each( 12350 function(panel) { 12351 var errorFields = panel.get('children').all('.has-error'); 12352 12353 if (errorFields.size() > 0 && !panel.hasClass('in')) { 12354 var panelNode = panel.getDOM(); 12355 12356 AUI.$(panelNode).collapse('show'); 12357 } 12358 } 12359 ); 12360 }, 12361 12362 _onValidatorSubmit: function(event) { 12363 var instance = this; 12364 12365 var onSubmit = instance.get('onSubmit'); 12366 12367 onSubmit.call(instance, event.validator.formEvent); 12368 }, 12369 12370 _processFieldRule: function(rules, strings, rule) { 12371 var instance = this; 12372 12373 var value = true; 12374 12375 var fieldName = rule.fieldName;
12376 var validatorName = rule.validatorName; 12377 12378 var field = this.formValidator.getField(fieldName); 12379 12380 if (field) { 12381 var fieldNode = field.getDOMNode(); 12382 12383 A.Do.after('_setFieldAttribute', fieldNode, 'setAttribute', instance, fieldName); 12384 12385 A.Do.after('_removeFieldAttribute', fieldNode, 'removeAttribute', instance, fieldName); 12386 } 12387 12388 if ((rule.body || rule.body === 0) && !rule.custom) { 12389 value = rule.body; 12390 } 12391 12392 var fieldRules = rules[fieldName]; 12393 12394 if (!fieldRules) { 12395 fieldRules = {}; 12396 12397 rules[fieldName] = fieldRules; 12398 } 12399 12400 fieldRules[validatorName] = value; 12401 12402 if (rule.custom) { 12403 DEFAULTS_FORM_VALIDATOR.RULES[validatorName] = rule.body; 12404 } 12405 12406 var errorMessage = rule.errorMessage; 12407 12408 if (errorMessage) { 12409 var fieldStrings = strings[fieldName]; 12410 12411 if (!fieldStrings) { 12412 fieldStrings = {}; 12413 12414 strings[fieldName] = fieldStrings; 12415 } 12416 12417 fieldStrings[validatorName] = errorMessage; 12418 } 12419 }, 12420 12421 _processFieldRules: function(fieldRules) { 12422 var instance = this; 12423 12424 if (!fieldRules) { 12425 fieldRules = instance.get('fieldRules'); 12426 } 12427 12428 var fieldStrings = {}; 12429 var rules = {}; 12430 12431 for (var rule in fieldRules) { 12432 instance._processFieldRule(rules, fieldStrings, fieldRules[rule]); 12433 } 12434 12435 var formValidator = instance.formValidator; 12436 12437 if (formValidator) { 12438 formValidator.set('fieldStrings', fieldStrings); 12439 formValidator.set('rules', rules); 12440 } 12441 }, 12442 12443 _removeFieldAttribute: function(name, fieldName) { 12444 var instance = this; 12445 12446 if (name === 'disabled') { 12447 this.formValidator.validateField(fieldName); 12448 } 12449 }, 12450 12451 _setFieldAttribute: function(name, value, fieldName) { 12452 var instance = this; 12453 12454 if (name === 'disabled') { 12455 this.formValidator.resetField(fieldName); 12456 } 12457 }, 12458 12459 _validatable: function(field) { 12460 var result; 12461 12462 if (field.test(':disabled')) { 12463 result = new A.Do.Halt(); 12464 } 12465 12466 return result; 12467 } 12468 }, 12469 12470 get: function(id) { 12471 var instance = this; 12472 12473 return instance._INSTANCES[id]; 12474 }, 12475 12476 register: function(config) { 12477 var instance = this; 12478 12479 formConfig = config; 12480 12481 var form = new Liferay.Form(config); 12482 12483 var formName = config.id || config.namespace; 12484 12485 instance._INSTANCES[formName] = form; 12486 12487 Liferay.fire( 12488 'form:registered', 12489 { 12490 form: form, 12491 formName: formName 12492 } 12493 ); 12494 12495 return form; 12496 }, 12497 12498 _INSTANCES: {} 12499 } 12500 ); 12501 12502 Liferay.Form = Form; 12503 }, 12504 '', 12505 { 12506 requires: ['aui-base', 'aui-form-validator'] 12507 } 12508); 12509AUI.add( 12510 'liferay-form-placeholders', 12511 function(A) { 12512 var ANode = A.Node; 12513 12514 var CSS_PLACEHOLDER = 'text-placeholder'; 12515 12516 var MAP_IGNORE_ATTRS = { 12517 id: 1, 12518 name: 1, 12519 type: 1 12520 }; 12521 12522 var SELECTOR_PLACEHOLDER_INPUTS = 'input[placeholder], textarea[placeholder]'; 12523 12524 var STR_BLANK = ''; 12525 12526 var STR_DATA_TYPE_PASSWORD_PLACEHOLDER = 'data-type-password-placeholder'; 12527 12528 var STR_FOCUS = 'focus'; 12529 12530 var STR_PASSWORD = 'password'; 12531 12532 var STR_PLACEHOLDER = 'placeholder'; 12533 12534 var STR_SPACE = ' '; 12535 12536 var STR_TYPE = 'type'; 12537 12538 var Placeholders = A.Component.create( 12539 { 12540 EXTENDS: A.Plugin.Base, 12541 12542 NAME: 'placeholders', 12543 12544 NS: STR_PLACEHOLDER, 12545 12546 prototype: { 12547 initializer: function(config) { 12548 var instance = this; 12549 12550 var host = instance.get('host'); 12551 12552 var formNode = host.formNode; 12553 12554 if (formNode) { 12555 var placeholderInputs = formNode.all(SELECTOR_PLACEHOLDER_INPUTS); 12556 12557 placeholderInputs.each( 12558 function(item, index) { 12559 if (!item.val()) { 12560 if (item.attr(STR_TYPE) === STR_PASSWORD) { 12561 instance._initializePasswordNode(item); 12562 } 12563 else { 12564 item.addClass(CSS_PLACEHOLDER); 12565 12566 item.val(item.attr(STR_PLACEHOLDER)); 12567 } 12568 } 12569 } 12570 ); 12571 12572 instance.host = host; 12573 12574 instance.beforeHostMethod('_onValidatorSubmit', instance._removePlaceholders, instance); 12575 instance.beforeHostMethod('_onFieldFocusChange', instance._togglePlaceholders, instance); 12576 } 12577 }, 12578 12579 _initializePasswordNode: function(field) { 12580 var placeholder = ANode.create('<input name="' + field.attr('name') + '_pass_placeholder" type="text" />'); 12581 12582 Liferay.Util.getAttributes( 12583 field, 12584 function(value, name, attrs) { 12585 var result = false;
12586 12587 if (!MAP_IGNORE_ATTRS[name]) { 12588 if (name === 'class') { 12589 value += STR_SPACE + CSS_PLACEHOLDER; 12590 } 12591 12592 placeholder.setAttribute(name, value); 12593 } 12594 12595 return result; 12596 } 12597 ); 12598 12599 placeholder.val(field.attr(STR_PLACEHOLDER)); 12600 12601 placeholder.attr(STR_DATA_TYPE_PASSWORD_PLACEHOLDER, true); 12602 12603 field.placeBefore(placeholder); 12604 12605 field.hide(); 12606 }, 12607 12608 _removePlaceholders: function() { 12609 var instance = this; 12610 12611 var formNode = instance.host.formNode; 12612 12613 var placeholderInputs = formNode.all(SELECTOR_PLACEHOLDER_INPUTS); 12614 12615 placeholderInputs.each( 12616 function(item, index) { 12617 if (item.val() == item.attr(STR_PLACEHOLDER)) { 12618 item.val(STR_BLANK); 12619 } 12620 } 12621 ); 12622 }, 12623 12624 _toggleLocalizedPlaceholders: function(event, currentTarget) { 12625 var placeholder = currentTarget.attr(STR_PLACEHOLDER); 12626 12627 if (placeholder) { 12628 var value = currentTarget.val(); 12629 12630 if (event.type === STR_FOCUS) { 12631 if (value === placeholder) { 12632 currentTarget.removeClass(CSS_PLACEHOLDER); 12633 } 12634 } 12635 else if (!value) { 12636 currentTarget.val(placeholder); 12637 12638 currentTarget.addClass(CSS_PLACEHOLDER); 12639 } 12640 } 12641 }, 12642 12643 _togglePasswordPlaceholders: function(event, currentTarget) { 12644 var placeholder = currentTarget.attr(STR_PLACEHOLDER); 12645 12646 if (placeholder) { 12647 if (event.type === STR_FOCUS) { 12648 if (currentTarget.hasAttribute(STR_DATA_TYPE_PASSWORD_PLACEHOLDER)) { 12649 currentTarget.hide(); 12650 12651 var passwordField = currentTarget.next(); 12652 12653 passwordField.show(); 12654 12655 setTimeout( 12656 function() { 12657 Liferay.Util.focusFormField(passwordField); 12658 }, 12659 0 12660 ); 12661 } 12662 } 12663 else if (currentTarget.attr(STR_TYPE) === STR_PASSWORD) { 12664 var value = currentTarget.val(); 12665 12666 if (!value) { 12667 currentTarget.hide(); 12668 12669 currentTarget.previous().show(); 12670 } 12671 } 12672 } 12673 }, 12674 12675 _togglePlaceholders: function(event) { 12676 var instance = this; 12677 12678 var currentTarget = event.currentTarget; 12679 12680 if (currentTarget.hasAttribute(STR_DATA_TYPE_PASSWORD_PLACEHOLDER) || currentTarget.attr(STR_TYPE) === STR_PASSWORD) { 12681 instance._togglePasswordPlaceholders(event, currentTarget); 12682 } 12683 else if (currentTarget.hasClass('language-value')) { 12684 instance._toggleLocalizedPlaceholders(event, currentTarget); 12685 } 12686 else { 12687 var placeholder = currentTarget.attr(STR_PLACEHOLDER); 12688 12689 if (placeholder) { 12690 var value = currentTarget.val(); 12691 12692 if (event.type === STR_FOCUS) { 12693 if (value === placeholder) { 12694 currentTarget.val(STR_BLANK); 12695 12696 currentTarget.removeClass(CSS_PLACEHOLDER); 12697 } 12698 } 12699 else if (!value) { 12700 currentTarget.val(placeholder); 12701 12702 currentTarget.addClass(CSS_PLACEHOLDER); 12703 } 12704 } 12705 } 12706 } 12707 } 12708 } 12709 ); 12710 12711 Liferay.Form.Placeholders = Placeholders; 12712 12713 A.Base.plug(Liferay.Form, Placeholders); 12714 }, 12715 '', 12716 { 12717 requires: ['liferay-form', 'plugin'] 12718 } 12719); 12720AUI.add( 12721 'liferay-icon', 12722 function(A) { 12723 var _ICON_REGISTRY = {}; 12724 12725 var Icon = { 12726 register: function(config) { 12727 var instance = this; 12728 12729 var doc = A.one(A.config.doc); 12730 12731 _ICON_REGISTRY[config.id] = config; 12732 12733 if (!instance._docClickHandler) { 12734 instance._docClickHandler = doc.delegate('click', instance._handleDocClick, '.lfr-icon-item', instance); 12735 } 12736 12737 if (!instance._docHoverHandler) { 12738 instance._docHoverHandler = doc.delegate('hover', instance._handleDocMouseOver, instance._handleDocMouseOut, '.lfr-icon-item', instance); 12739 } 12740 12741 Liferay.once( 12742 'screenLoad', 12743 function() { 12744 delete _ICON_REGISTRY[config.id]; 12745 } 12746 ); 12747 }, 12748 12749 _forcePost: function(event) { 12750 var instance = this; 12751 12752 if (!Liferay.SPA || !Liferay.SPA.app) { 12753 Liferay.Util.forcePost(event.currentTarget); 12754 12755 event.preventDefault(); 12756 } 12757 }, 12758 12759 _getConfig: function(event) { 12760 var instance = this; 12761 12762 return _ICON_REGISTRY[event.currentTarget.attr('id')]; 12763 }, 12764 12765 _handleDocClick: function(event) { 12766 var instance = this; 12767 12768 var config = instance._getConfig(event); 12769 12770 if (config) { 12771 event.preventDefault(); 12772 12773 if (config.useDialog) { 12774 instance._useDialog(event); 12775 } 12776 else { 12777 instance._forcePost(event); 12778 } 12779 } 12780 }, 12781 12782 _handleDocMouseOut: function(event) { 12783 var instance = this; 12784 12785 var config = instance._getConfig(event); 12786 12787 if (config && config.srcHover) { 12788 instance._onMouseHover(event, config.src); 12789 } 12790 }, 12791 12792 _handleDocMouseOver: function(event) { 12793 var instance = this; 12794 12795 var config = instance._getConfig(event); 12796 12797 if (config && config.srcHover) { 12798 instance._onMouseHover(event, config.srcHover); 12799 } 12800 }, 12801 12802 _onMouseHover: function(event, src) { 12803 var instance = this; 12804 12805 var img = event.currentTarget.one('img'); 12806 12807 if (img) { 12808 img.attr('src', src); 12809 } 12810 }, 12811 12812 _useDialog: function(event) { 12813 Liferay.Util.openInDialog( 12814 event, 12815 { 12816 dialog: { 12817 destroyOnHide: true 12818 }, 12819 dialogIframe: { 12820 bodyCssClass: 'dialog-with-footer' 12821 } 12822 } 12823 ); 12824 } 12825 }; 12826 12827 Liferay.Icon = Icon; 12828 }, 12829 '', 12830 { 12831 requires: ['aui-base', 'liferay-util-window'] 12832 } 12833); 12834AUI.add( 12835 'liferay-menu', 12836 function(A) { 12837 var Util = Liferay.Util; 12838 12839 var ARIA_ATTR_ROLE = 'role'; 12840 12841 var ATTR_CLASS_NAME = 'className'; 12842 12843 var AUTO = 'auto'; 12844 12845 var CSS_BTN_PRIMARY = 'btn-primary'; 12846 12847 var CSS_EXTENDED = 'lfr-extended'; 12848 12849 var CSS_OPEN = 'open'; 12850 12851 var CSS_PORTLET = '.portlet'; 12852 12853 var DEFAULT_ALIGN_POINTS = ['tl', 'bl']; 12854 12855 var EVENT_CLICK = 'click'; 12856 12857 var PARENT_NODE = 'parentNode'; 12858 12859 var STR_BOTTOM = 'b'; 12860 12861 var STR_LEFT = 'l'; 12862 12863 var STR_LTR = 'ltr'; 12864 12865 var STR_RIGHT = 'r'; 12866 12867 var STR_RTL = 'rtl'; 12868 12869 var STR_TOP = 't'; 12870 12871 var MAP_ALIGN_HORIZONTAL_OVERLAY = { 12872 left: STR_RIGHT, 12873 right: STR_LEFT 12874 }; 12875 12876 var MAP_ALIGN_HORIZONTAL_OVERLAY_RTL = { 12877 left: STR_LEFT, 12878 right: STR_RIGHT 12879 }; 12880 12881 var MAP_ALIGN_HORIZONTAL_TRIGGER = { 12882 left: STR_LEFT, 12883 right: STR_RIGHT 12884 }; 12885 12886 var MAP_ALIGN_HORIZONTAL_TRIGGER_RTL = { 12887 left: STR_RIGHT, 12888 right: STR_LEFT 12889 }; 12890 12891 var MAP_ALIGN_VERTICAL_OVERLAY = { 12892 down: STR_TOP, 12893 up: STR_BOTTOM 12894 }; 12895 12896 var MAP_ALIGN_VERTICAL_TRIGGER = { 12897 down: STR_BOTTOM, 12898 up: STR_TOP 12899 }; 12900 12901 var MAP_LIVE_SEARCH = {}; 12902 12903 var REGEX_DIRECTION = /\bdirection-(down|left|right|up)\b/; 12904 12905 var REGEX_MAX_DISPLAY_ITEMS = /max-display-items-(\d+)/; 12906 12907 var SELECTOR_ANCHOR = 'a'; 12908 12909 var SELECTOR_LIST_ITEM = 'li'; 12910 12911 var SELECTOR_SEARCH_CONTAINER = '.lfr-menu-list-search-container'; 12912 12913 var TPL_MENU = '<div class="open" />'; 12914 12915 var Menu = function() { 12916 var instance = this; 12917 12918 instance._handles = []; 12919 12920 if (!Menu._INSTANCE) { 12921 Menu._INSTANCE = instance; 12922 } 12923 }; 12924 12925 Menu.prototype = { 12926 _closeActiveMenu: function() { 12927 var instance = this; 12928 12929 var menu = instance._activeMenu; 12930 12931 if (menu) { 12932 var handles = instance._handles; 12933 12934 A.Array.invoke(handles, 'detach'); 12935 12936 handles.length = 0; 12937
12938 var overlay = instance._overlay; 12939 12940 if (overlay) { 12941 overlay.hide(); 12942 } 12943 12944 var trigger = instance._activeTrigger; 12945 12946 instance._activeMenu = null; 12947 instance._activeTrigger = null; 12948 12949 if (trigger.hasClass(CSS_EXTENDED)) { 12950 trigger.removeClass(CSS_BTN_PRIMARY); 12951 } 12952 else { 12953 trigger.get(PARENT_NODE).removeClass(CSS_OPEN); 12954 12955 var portlet = trigger.ancestor(CSS_PORTLET); 12956 12957 if (portlet) { 12958 portlet.removeClass(CSS_OPEN); 12959 } 12960 } 12961 } 12962 }, 12963 12964 _getAlignPoints: A.cached( 12965 function(cssClass) { 12966 var instance = this; 12967 12968 var alignPoints = DEFAULT_ALIGN_POINTS; 12969 12970 var defaultOverlayHorizontalAlign = STR_RIGHT; 12971 12972 var defaultTriggerHorizontalAlign = STR_LEFT; 12973 12974 var mapAlignHorizontalOverlay = MAP_ALIGN_HORIZONTAL_OVERLAY; 12975 12976 var mapAlignHorizontalTrigger = MAP_ALIGN_HORIZONTAL_TRIGGER; 12977 12978 var langDir = Liferay.Language.direction[themeDisplay.getLanguageId()] || STR_LTR; 12979 12980 if (langDir === STR_RTL) { 12981 defaultOverlayHorizontalAlign = STR_LEFT; 12982 defaultTriggerHorizontalAlign = STR_RIGHT; 12983 12984 mapAlignHorizontalOverlay = MAP_ALIGN_HORIZONTAL_OVERLAY_RTL; 12985 mapAlignHorizontalTrigger = MAP_ALIGN_HORIZONTAL_TRIGGER_RTL; 12986 } 12987 12988 if (cssClass.indexOf(AUTO) === -1) { 12989 var directionMatch = cssClass.match(REGEX_DIRECTION); 12990 12991 var direction = directionMatch && directionMatch[1] || AUTO; 12992 12993 if (direction != 'down') { 12994 var overlayHorizontal = mapAlignHorizontalOverlay[direction] || defaultOverlayHorizontalAlign; 12995 var overlayVertical = MAP_ALIGN_VERTICAL_OVERLAY[direction] || STR_TOP; 12996 12997 var triggerHorizontal = mapAlignHorizontalTrigger[direction] || defaultTriggerHorizontalAlign; 12998 var triggerVertical = MAP_ALIGN_VERTICAL_TRIGGER[direction] || STR_TOP; 12999 13000 alignPoints = [overlayVertical + overlayHorizontal, triggerVertical + triggerHorizontal]; 13001 } 13002 } 13003 13004 return alignPoints; 13005 } 13006 ), 13007 13008 _getMenu: function(trigger) { 13009 var instance = this; 13010 13011 var overlay = instance._overlay; 13012 13013 if (!overlay) { 13014 var MenuOverlay = A.Component.create( 13015 { 13016 AUGMENTS: [ 13017 A.WidgetCssClass, 13018 A.WidgetPosition, 13019 A.WidgetStdMod, 13020 A.WidgetModality, 13021 A.WidgetPositionAlign, 13022 A.WidgetPositionConstrain, 13023 A.WidgetStack 13024 ], 13025 13026 CSS_PREFIX: 'overlay', 13027 13028 EXTENDS: A.Widget, 13029 13030 NAME: 'overlay' 13031 } 13032 ); 13033 13034 overlay = new MenuOverlay( 13035 { 13036 align: { 13037 node: trigger, 13038 points: DEFAULT_ALIGN_POINTS 13039 }, 13040 constrain: true, 13041 hideClass: false, 13042 preventOverlap: true, 13043 zIndex: Liferay.zIndex.MENU 13044 } 13045 ).render(); 13046 13047 Liferay.once( 13048 'beforeScreenFlip', 13049 function() { 13050 overlay.destroy(); 13051 13052 instance._overlay = null; 13053 } 13054 ); 13055 13056 instance._overlay = overlay; 13057 } 13058 else { 13059 overlay.set('align.node', trigger); 13060 } 13061 13062 var listContainer = trigger.getData('menuListContainer'); 13063 var menu = trigger.getData('menu'); 13064 var menuHeight = trigger.getData('menuHeight'); 13065 13066 var liveSearch = menu && MAP_LIVE_SEARCH[menu.guid()]; 13067 13068 if (liveSearch) { 13069 liveSearch.reset(); 13070 } 13071 13072 var listItems; 13073 13074 if (!menu || !listContainer) { 13075 listContainer = trigger.next('ul'); 13076 13077 listItems = listContainer.all(SELECTOR_LIST_ITEM); 13078 13079 menu = A.Node.create(TPL_MENU); 13080 13081 listContainer.placeBefore(menu); 13082 13083 listItems.last().addClass('last'); 13084 13085 menu.append(listContainer); 13086 13087 trigger.setData('menuListContainer', listContainer); 13088 trigger.setData('menu', menu); 13089 13090 instance._setARIARoles(trigger, menu, listContainer); 13091 13092 if (trigger.hasClass('select')) { 13093 listContainer.delegate( 13094 'click', 13095 function(event) { 13096 var selectedListItem = event.currentTarget; 13097 13098 var selectedListItemIcon = selectedListItem.one('i'); 13099 13100 var triggerIcon = trigger.one('i'); 13101 13102 if (selectedListItemIcon && triggerIcon) { 13103 var selectedListItemIconClass = selectedListItemIcon.attr('class'); 13104 13105 triggerIcon.attr('class', selectedListItemIconClass); 13106 } 13107 13108 var selectedListItemMessage = selectedListItem.one('.lfr-icon-menu-text'); 13109 13110 var triggerMessage = trigger.one('.lfr-icon-menu-text'); 13111 13112 if (selectedListItemMessage && triggerMessage) { 13113 triggerMessage.setContent(selectedListItemMessage.text()); 13114 } 13115 }, 13116 SELECTOR_LIST_ITEM 13117 ); 13118 } 13119 } 13120 13121 overlay.setStdModContent(A.WidgetStdMod.BODY, menu); 13122 13123 if (!menuHeight) { 13124 menuHeight = instance._getMenuHeight(trigger, menu, listItems || listContainer.all
13124(SELECTOR_LIST_ITEM)); 13125 13126 trigger.setData('menuHeight', menuHeight); 13127 13128 if (menuHeight !== AUTO) { 13129 listContainer.setStyle('maxHeight', menuHeight); 13130 } 13131 } 13132 13133 instance._getFocusManager(); 13134 13135 return menu; 13136 }, 13137 13138 _getMenuHeight: function(trigger, menu, listItems) { 13139 var instance = this; 13140 13141 var cssClass = trigger.attr(ATTR_CLASS_NAME); 13142 13143 var height = AUTO; 13144 13145 if (cssClass.indexOf('lfr-menu-expanded') === -1) { 13146 var params = REGEX_MAX_DISPLAY_ITEMS.exec(cssClass); 13147 13148 var maxDisplayItems = params && parseInt(params[1], 10); 13149 13150 if (maxDisplayItems && listItems.size() > maxDisplayItems) { 13151 instance._getLiveSearch(trigger, trigger.getData('menu')); 13152 13153 height = 0; 13154 13155 var heights = listItems.slice(0, maxDisplayItems).get('offsetHeight'); 13156 13157 for (var i = heights.length - 1; i >= 0; i--) { 13158 height += heights[i]; 13159 } 13160 } 13161 } 13162 13163 return height; 13164 }, 13165 13166 _positionActiveMenu: function() { 13167 var instance = this; 13168 13169 var menu = instance._activeMenu; 13170 var trigger = instance._activeTrigger; 13171 13172 if (menu) { 13173 var cssClass = trigger.attr(ATTR_CLASS_NAME); 13174 13175 var overlay = instance._overlay; 13176 13177 var align = overlay.get('align'); 13178 13179 var listNode = menu.one('ul'); 13180 13181 var listNodeHeight = listNode.get('offsetHeight'); 13182 var listNodeWidth = listNode.get('offsetWidth'); 13183 13184 var modalMask = false; 13185 13186 align.points = instance._getAlignPoints(cssClass); 13187 13188 menu.addClass('lfr-icon-menu-open'); 13189 13190 if (Util.isPhone() || Util.isTablet()) { 13191 overlay.hide(); 13192 13193 modalMask = true; 13194 } 13195 13196 overlay.setAttrs( 13197 { 13198 align: align, 13199 centered: false, 13200 height: listNodeHeight, 13201 modal: modalMask, 13202 width: listNodeWidth 13203 } 13204 ); 13205 13206 if (!Util.isPhone() && !Util.isTablet()) { 13207 var focusManager = overlay.bodyNode.focusManager; 13208 13209 if (focusManager) { 13210 focusManager.focus(0); 13211 } 13212 } 13213 13214 overlay.show(); 13215 13216 if (cssClass.indexOf(CSS_EXTENDED) > -1) { 13217 trigger.addClass(CSS_BTN_PRIMARY); 13218 } 13219 else { 13220 trigger.get(PARENT_NODE).addClass(CSS_OPEN); 13221 13222 var portlet = trigger.ancestor(CSS_PORTLET); 13223 13224 if (portlet) { 13225 portlet.addClass(CSS_OPEN); 13226 } 13227 } 13228 } 13229 }, 13230 13231 _setARIARoles: function(trigger, menu, listContainer) { 13232 var links = menu.all(SELECTOR_ANCHOR); 13233 13234 var searchContainer = menu.one(SELECTOR_SEARCH_CONTAINER); 13235 13236 var listNode = menu.one('ul'); 13237 13238 var ariaLinksAttr = 'menuitem'; 13239 var ariaListNodeAttr = 'menu'; 13240 13241 if (searchContainer) { 13242 ariaListNodeAttr = 'listbox'; 13243 ariaListNodeAttr = 'option'; 13244 } 13245 13246 listNode.setAttribute(ARIA_ATTR_ROLE, ariaListNodeAttr); 13247 links.set(ARIA_ATTR_ROLE, ariaLinksAttr); 13248 13249 trigger.attr( 13250 { 13251 'aria-haspopup': true, 13252 role: 'button' 13253 } 13254 ); 13255 13256 listNode.setAttribute('aria-labelledby', trigger.guid()); 13257 } 13258 }; 13259 13260 Menu.handleFocus = function(id) { 13261 var node = A.one(id); 13262 13263 if (node) { 13264 node.delegate('mouseenter', A.rbind(Menu._targetLink, node, 'focus'), SELECTOR_LIST_ITEM); 13265 node.delegate('mouseleave', A.rbind(Menu._targetLink, node, 'blur'), SELECTOR_LIST_ITEM); 13266 } 13267 }; 13268 13269 var buffer = []; 13270 13271 Menu.register = function(id) { 13272 var menuNode = document.getElementById(id); 13273 13274 if (menuNode) { 13275 if (!Menu._INSTANCE) { 13276 new Menu(); 13277 } 13278 13279 buffer.push(menuNode); 13280 13281 Menu._registerTask(); 13282 } 13283 }; 13284 13285 Menu._registerTask = A.debounce( 13286 function() { 13287 if (buffer.length) { 13288 var nodes = A.all(buffer); 13289 13290 nodes.on(EVENT_CLICK, A.bind('_registerMenu', Menu)); 13291 13292 buffer.length = 0; 13293 } 13294 }, 13295 100 13296 ); 13297 13298 Menu._targetLink = function(event, action) { 13299 var anchor = event.currentTarget.one(SELECTOR_ANCHOR); 13300 13301 if (anchor) { 13302 anchor[action](); 13303 } 13304 }; 13305 13306 Liferay.provide( 13307 Menu, 13308 '_getFocusManager', 13309 function() { 13310 var menuInstance = Menu._INSTANCE; 13311 13312 var focusManager = menuInstance._focusManager; 13313 13314 if (!focusManager) { 13315 var bodyNode = menuInstance._overlay.bodyNode; 13316 13317 bodyNode.plug( 13318 A.Plugin.NodeFocusManager, 13319 { 13320 circular: true, 13321 descendants: 'li:not(.hide) a,input', 13322 focusClass: 'focus', 13323 keys: { 13324 next: 'down:40', 13325 previous: 'down:38' 13326 } 13327 } 13328 ); 13329 13330 bodyNode.on( 13331 'key', 13332 function(event) { 13333 var activeTrigger = menuInstance._activeTrigger; 13334 13335 if (activeTrigger) { 13336 menuInstance._closeActiveMenu(); 13337 13338 activeTrigger.focus(); 13339 } 13340 }, 13341 'down:27,9' 13342 ); 13343 13344 focusManager = bodyNode.focusManager; 13345 13346 bodyNode.delegate( 13347 'mouseenter', 13348 function(event) { 13349 if (focusManager.get('focused')) { 13350 focusManager.focus(event.currentTarget.one(SELECTOR_ANCHOR)); 13351 } 13352 }, 13353 SELECTOR_LIST_ITEM 13354 ); 13355 13356 focusManager.after( 13357 'activeDescendantChange', 13358 function(event) {
13359 var descendants = focusManager.get('descendants'); 13360 13361 var selectedItem = descendants.item(event.newVal); 13362 13363 if (selectedItem) { 13364 var overlayList = bodyNode.one('ul'); 13365 13366 if (overlayList) { 13367 overlayList.setAttribute('aria-activedescendant', selectedItem.guid()); 13368 } 13369 } 13370 } 13371 ); 13372 13373 menuInstance._focusManager = focusManager; 13374 } 13375 13376 focusManager.refresh(); 13377 }, 13378 ['node-focusmanager'], 13379 true 13380 ); 13381 13382 Liferay.provide( 13383 Menu, 13384 '_getLiveSearch', 13385 function(trigger, menu) { 13386 var instance = this; 13387 13388 var id = menu.guid(); 13389 13390 var liveSearch = MAP_LIVE_SEARCH[id]; 13391 13392 if (!liveSearch) { 13393 var listNode = menu.one('ul'); 13394 13395 var results = []; 13396 13397 listNode.all('li').each( 13398 function(node) { 13399 results.push( 13400 { 13401 name: node.one('.taglib-text-icon').text().trim(), 13402 node: node 13403 } 13404 ); 13405 } 13406 ); 13407 13408 liveSearch = new Liferay.MenuFilter( 13409 { 13410 content: listNode, 13411 minQueryLength: 0, 13412 queryDelay: 0, 13413 resultFilters: 'phraseMatch', 13414 resultTextLocator: 'name', 13415 source: results 13416 } 13417 ); 13418 13419 liveSearch.get('inputNode').swallowEvent('click'); 13420 13421 MAP_LIVE_SEARCH[id] = liveSearch; 13422 } 13423 }, 13424 ['liferay-menu-filter'], 13425 true 13426 ); 13427 13428 Liferay.provide( 13429 Menu, 13430 '_registerMenu', 13431 function(event) { 13432 var menuInstance = Menu._INSTANCE; 13433 13434 var handles = menuInstance._handles; 13435 13436 var trigger = event.currentTarget; 13437 13438 var activeTrigger = menuInstance._activeTrigger; 13439 13440 if (activeTrigger) { 13441 if (activeTrigger != trigger) { 13442 activeTrigger.removeClass(CSS_BTN_PRIMARY); 13443 13444 activeTrigger.get(PARENT_NODE).removeClass(CSS_OPEN); 13445 13446 var portlet = activeTrigger.ancestor(CSS_PORTLET); 13447 13448 if (portlet) { 13449 portlet.removeClass(CSS_OPEN); 13450 } 13451 } 13452 else { 13453 menuInstance._closeActiveMenu(); 13454 13455 return; 13456 } 13457 } 13458 13459 if (!trigger.hasClass('disabled')) { 13460 var menu = menuInstance._getMenu(trigger); 13461 13462 menuInstance._activeMenu = menu; 13463 menuInstance._activeTrigger = trigger; 13464 13465 if (!handles.length) { 13466 var listContainer = trigger.getData('menuListContainer'); 13467 13468 A.Event.defineOutside('touchend'); 13469 13470 handles.push( 13471 A.getWin().on('resize', A.debounce(menuInstance._positionActiveMenu, 200, menuInstance)), 13472 A.getDoc().on(EVENT_CLICK, menuInstance._closeActiveMenu, menuInstance), 13473 listContainer.on( 13474 'touchendoutside', 13475 function(event) { 13476 event.preventDefault(); 13477 13478 menuInstance._closeActiveMenu(); 13479 }, 13480 menuInstance 13481 ), 13482 Liferay.on( 13483 'dropdownShow', 13484 function(event) { 13485 if (event.src !== 'LiferayMenu') { 13486 menuInstance._closeActiveMenu(); 13487 } 13488 } 13489 ) 13490 ); 13491 13492 var DDM = A.DD && A.DD.DDM; 13493 13494 if (DDM) { 13495 handles.push(DDM.on('ddm:start', menuInstance._closeActiveMenu, menuInstance)); 13496 } 13497 } 13498 13499 menuInstance._positionActiveMenu(); 13500 13501 Liferay.fire( 13502 'dropdownShow', 13503 { 13504 src: 'LiferayMenu' 13505 } 13506 ); 13507 13508 event.halt(); 13509 } 13510 }, 13511 ['aui-widget-cssclass', 'event-outside', 'event-touch', 'widget', 'widget-modality', 'widget-position', 'widget-position-align', 'widget-position-constrain', 'widget-stack', 'widget-stdmod'] 13512 ); 13513 13514 Liferay.Menu = Menu; 13515 }, 13516 '', 13517 { 13518 requires: ['array-invoke', 'aui-debounce', 'aui-node', 'portal-available-languages'] 13519 } 13520); 13521AUI.add( 13522 'liferay-notice', 13523 function(A) { 13524 var ADOM = A.DOM; 13525 var ANode = A.Node; 13526 var Do = A.Do; 13527 var Lang = A.Lang; 13528 13529 var CSS_ALERTS = 'has-alerts'; 13530 13531 var STR_CLICK = 'click'; 13532 13533 var STR_EMPTY = ''; 13534 13535 var STR_HIDE = 'hide'; 13536 13537 var STR_PX = 'px'; 13538 13539 var STR_SHOW = 'show'; 13540 13541 /** 13542 * @deprecated 13543 * 13544 * OPTIONS 13545 * 13546 * Required 13547 * content {string}: The content of the toolbar. 13548 * 13549 * Optional 13550 * animationConfig {Object}: The Transition config, defaults to {easing: 'ease-out', duration: 2, top: '50px'}. If 'left' property is not specified, it will be automatically calculated. 13551 * closeText {string}: Use for the "close" button. Set to false to not have a close button. If set to false but in the provided markup (via content property) there is an element with class "close", a click listener on this element will be added. As result, the notice will be closed.
13552 * noticeClass {string}: A class to add to the notice toolbar. 13553 * timeout {Number}: The timeout in milliseconds, after it the notice will be automatically closed. Set it to -1, or do not add this property to disable this functionality. 13554 * toggleText {object}: The text to use for the "hide" and "show" button. Set to false to not have a hide button. 13555 * type {String}: One of 'warning' or 'notice'. If not set, default notice type will be 'notice' 13556 * useAnimation {boolean}: To animate show/hide of the notice, defaults to true. If useAnimation is set to true, but there is no timeout, 5000 will be used as timeout. 13557 * 13558 * Callbacks 13559 * onClose {function}: Called when the toolbar is closed. 13560 */ 13561 13562 var Notice = function(options) { 13563 var instance = this; 13564 13565 options = options || {}; 13566 13567 instance._closeText = options.closeText; 13568 instance._node = options.node; 13569 instance._noticeType = options.type || 'notice'; 13570 instance._noticeClass = 'alert-notice'; 13571 instance._onClose = options.onClose; 13572 instance._useCloseButton = true; 13573 13574 if (options.useAnimation) { 13575 instance._noticeClass += ' popup-alert-notice'; 13576 13577 if (!Lang.isNumber(options.timeout)) { 13578 options.timeout = 5000; 13579 } 13580 } 13581 13582 instance._animationConfig = options.animationConfig || { 13583 duration: 2, 13584 easing: 'ease-out', 13585 top: '50px' 13586 }; 13587 13588 instance._useAnimation = options.useAnimation; 13589 13590 instance._timeout = options.timeout; 13591 13592 instance._body = A.getBody(); 13593 13594 instance._useToggleButton = false; 13595 instance._hideText = STR_EMPTY; 13596 instance._showText = STR_EMPTY; 13597 13598 if (options.toggleText !== false) { 13599 instance.toggleText = A.mix( 13600 options.toggleText, 13601 { 13602 hide: null, 13603 show: null 13604 } 13605 ); 13606 13607 instance._useToggleButton = true; 13608 } 13609 13610 if (instance._noticeType == 'warning') { 13611 instance._noticeClass = 'alert-danger popup-alert-warning'; 13612 } 13613 13614 if (options.noticeClass) { 13615 instance._noticeClass += ' ' + options.noticeClass; 13616 } 13617 13618 instance._content = options.content || STR_EMPTY; 13619 13620 instance._createHTML(); 13621 13622 return instance._notice; 13623 }; 13624 13625 Notice.prototype = { 13626 close: function() { 13627 var instance = this; 13628 13629 var notice = instance._notice; 13630 13631 notice.hide(); 13632 13633 instance._body.removeClass(CSS_ALERTS); 13634 13635 if (instance._onClose) { 13636 instance._onClose(); 13637 } 13638 }, 13639 13640 setClosing: function() { 13641 var instance = this; 13642 13643 var alerts = A.all('.popup-alert-notice, .popup-alert-warning'); 13644 13645 if (alerts.size()) { 13646 instance._useCloseButton = true; 13647 13648 if (!instance._body) { 13649 instance._body = A.getBody(); 13650 } 13651 13652 instance._body.addClass(CSS_ALERTS); 13653 13654 alerts.each(instance._addCloseButton, instance); 13655 } 13656 }, 13657 13658 _addCloseButton: function(notice) { 13659 var instance = this; 13660 13661 var closeButton; 13662 13663 if (instance._closeText !== false) { 13664 instance._closeText = instance._closeText || 'Tanca'; 13665 } 13666 else { 13667 instance._useCloseButton = false; 13668 instance._closeText = STR_EMPTY; 13669 } 13670 13671 if (instance._useCloseButton) { 13672 var html = '<button class="btn btn-default submit popup-alert-close">' + 13673 instance._closeText + 13674 '</button>'; 13675 13676 closeButton = notice.append(html); 13677 } 13678 else { 13679 closeButton = notice.one('.close'); 13680 } 13681 13682 if (closeButton) { 13683 closeButton.on(STR_CLICK, instance.close, instance); 13684 } 13685 }, 13686 13687 _addToggleButton: function(notice) { 13688 var instance = this; 13689 13690 if (instance._useToggleButton) { 13691 instance._hideText = instance._toggleText.hide || 'Amaga'; 13692 instance._showText = instance._toggleText.show || 'Mostra'; 13693 13694 var toggleButton = ANode.create('<a class="toggle-button" href="javascript:;"><span>' + instance._hideText + '</span></a>'); 13695 var toggleSpan = toggleButton.one('span'); 13696 13697 var visible = 0; 13698 13699 var hideText = instance._hideText; 13700 var showText = instance._showText; 13701 13702 toggleButton.on( 13703 STR_CLICK, 13704 function(event) { 13705 var text = showText; 13706 13707 if (visible === 0) { 13708 text = hideText; 13709 13710 visible = 1; 13711 } 13712 else { 13713 visible = 0; 13714 } 13715
13716 notice.toggle(); 13717 toggleSpan.text(text); 13718 } 13719 ); 13720 13721 notice.append(toggleButton); 13722 } 13723 }, 13724 13725 _afterNoticeShow: function(event) { 13726 var instance = this; 13727 13728 instance._preventHide(); 13729 13730 var notice = instance._notice; 13731 13732 if (instance._useAnimation) { 13733 var animationConfig = instance._animationConfig; 13734 13735 var left = animationConfig.left; 13736 var top = animationConfig.top; 13737 13738 if (!left) { 13739 var noticeRegion = ADOM.region(ANode.getDOMNode(notice)); 13740 13741 left = (ADOM.winWidth() / 2) - (noticeRegion.width / 2); 13742 13743 top = -noticeRegion.height; 13744 13745 animationConfig.left = left + STR_PX; 13746 } 13747 13748 notice.setXY([left, top]); 13749 13750 notice.transition( 13751 instance._animationConfig, 13752 function() { 13753 instance._hideHandle = A.later(instance._timeout, notice, STR_HIDE); 13754 } 13755 ); 13756 } 13757 else if (instance._timeout > -1) { 13758 instance._hideHandle = A.later(instance._timeout, notice, STR_HIDE); 13759 } 13760 13761 Liferay.fire( 13762 'noticeShow', 13763 { 13764 notice: instance, 13765 useAnimation: instance._useAnimation 13766 } 13767 ); 13768 }, 13769 13770 _beforeNoticeHide: function(event) { 13771 var instance = this; 13772 13773 var returnVal; 13774 13775 if (instance._useAnimation) { 13776 var animationConfig = A.merge( 13777 instance._animationConfig, 13778 { 13779 top: -instance._notice.get('offsetHeight') + STR_PX 13780 } 13781 ); 13782 13783 instance._notice.transition( 13784 animationConfig, 13785 function() { 13786 instance._notice.toggle(false); 13787 } 13788 ); 13789 13790 returnVal = new Do.Halt(null); 13791 } 13792 13793 Liferay.fire( 13794 'noticeHide', 13795 { 13796 notice: instance, 13797 useAnimation: instance._useAnimation 13798 } 13799 ); 13800 13801 return returnVal; 13802 }, 13803 13804 _beforeNoticeShow: function(event) { 13805 var instance = this; 13806 13807 instance._notice.toggle(true); 13808 }, 13809 13810 _createHTML: function() { 13811 var instance = this; 13812 13813 var content = instance._content; 13814 var node = A.one(instance._node); 13815 13816 var notice = node || ANode.create('<div class="alert alert-warning" dynamic="true"></div>'); 13817 13818 if (content) { 13819 notice.html(content); 13820 } 13821 13822 instance._noticeClass.split(' ').forEach( 13823 function(item, index) { 13824 notice.addClass(item); 13825 } 13826 ); 13827 13828 instance._addCloseButton(notice); 13829 instance._addToggleButton(notice); 13830 13831 if (!node || (node && !node.inDoc())) { 13832 instance._body.prepend(notice); 13833 } 13834 13835 instance._body.addClass(CSS_ALERTS); 13836 13837 Do.before(instance._beforeNoticeHide, notice, STR_HIDE, instance); 13838 13839 Do.before(instance._beforeNoticeShow, notice, STR_SHOW, instance); 13840 13841 Do.after(instance._afterNoticeShow, notice, STR_SHOW, instance); 13842 13843 instance._notice = notice; 13844 }, 13845 13846 _preventHide: function() { 13847 var instance = this; 13848 13849 if (instance._hideHandle) { 13850 instance._hideHandle.cancel(); 13851 13852 instance._hideHandle = null; 13853 } 13854 } 13855 }; 13856 13857 Liferay.Notice = Notice; 13858 }, 13859 '', 13860 { 13861 requires: ['aui-base'] 13862 } 13863); 13864AUI.add( 13865 'liferay-poller', 13866 function(A) { 13867 var AObject = A.Object; 13868 13869 var _browserKey = Liferay.Util.randomInt(); 13870 var _enabled = false; 13871 var _encryptedUserId = null; 13872 var _supportsComet = false;
13873 13874 var _delayAccessCount = 0; 13875 var _delayIndex = 0; 13876 var _delays = [1, 2, 3, 4, 5, 7, 10]; 13877 13878 var _getEncryptedUserId = function() { 13879 return _encryptedUserId; 13880 }; 13881 13882 var _frozen = false; 13883 var _locked = false; 13884 13885 var _maxDelay = _delays.length - 1; 13886 13887 var _portletIdsMap = {}; 13888 13889 var _metaData = { 13890 browserKey: _browserKey, 13891 companyId: themeDisplay.getCompanyId(), 13892 portletIdsMap: _portletIdsMap, 13893 startPolling: true 13894 }; 13895 13896 var _customDelay = null; 13897 var _portlets = {}; 13898 var _requestDelay = _delays[0]; 13899 var _sendQueue = []; 13900 var _suspended = false; 13901 var _timerId = null; 13902 13903 var _url = themeDisplay.getPathContext() + '/poller'; 13904 13905 var _receiveChannel = _url + '/receive'; 13906 var _sendChannel = _url + '/send'; 13907 13908 var _closeCurlyBrace = '}'; 13909 var _openCurlyBrace = '{'; 13910 13911 var _escapedCloseCurlyBrace = '[$CLOSE_CURLY_BRACE$]'; 13912 var _escapedOpenCurlyBrace = '[$OPEN_CURLY_BRACE$]'; 13913 13914 var _cancelRequestTimer = function() { 13915 clearTimeout(_timerId); 13916 13917 _timerId = null; 13918 }; 13919 13920 var _createRequestTimer = function() { 13921 _cancelRequestTimer(); 13922 13923 if (_enabled) { 13924 if (Poller.isSupportsComet()) { 13925 _receive(); 13926 } 13927 else { 13928 _timerId = setTimeout(_receive, Poller.getDelay()); 13929 } 13930 } 13931 }; 13932 13933 var _freezeConnection = function() { 13934 _frozen = true; 13935 13936 _cancelRequestTimer(); 13937 }; 13938 13939 var _getReceiveUrl = function() { 13940 return _receiveChannel; 13941 }; 13942 13943 var _getSendUrl = function() { 13944 return _sendChannel; 13945 }; 13946 13947 var _processResponse = function(id, obj) { 13948 var response = JSON.parse(obj.responseText); 13949 var send = false; 13950 13951 if (Array.isArray(response)) { 13952 var meta = response.shift(); 13953 13954 for (var i = 0; i < response.length; i++) { 13955 var chunk = response[i].payload; 13956 13957 var chunkData = chunk.data; 13958 13959 var portletId = chunk.portletId; 13960 13961 var portlet = _portlets[portletId]; 13962 13963 if (portlet) { 13964 var currentPortletId = _portletIdsMap[portletId]; 13965 13966 if (chunkData && currentPortletId) { 13967 chunkData.initialRequest = portlet.initialRequest; 13968 } 13969 13970 portlet.listener.call(portlet.scope || Poller, chunkData, chunk.chunkId); 13971 13972 if (chunkData && chunkData.pollerHintHighConnectivity) { 13973 _requestDelay = _delays[0]; 13974 _delayIndex = 0; 13975 } 13976 13977 if (portlet.initialRequest && currentPortletId) { 13978 send = true; 13979 13980 portlet.initialRequest = false; 13981 } 13982 } 13983 } 13984 13985 if ('startPolling' in _metaData) { 13986 delete _metaData.startPolling; 13987 } 13988 13989 if (send) { 13990 _send(); 13991 } 13992 13993 if (!meta.suspendPolling) { 13994 _thawConnection(); 13995 } 13996 else { 13997 _freezeConnection(); 13998 } 13999 } 14000 }; 14001 14002 var _receive = function() { 14003 if (!_suspended && !_frozen) { 14004 _metaData.userId = _getEncryptedUserId(); 14005 _metaData.timestamp = (new Date()).getTime(); 14006 14007 AObject.each(_portlets, _updatePortletIdsMap); 14008 14009 var requestStr = JSON.stringify([_metaData]); 14010 14011 A.io( 14012 _getReceiveUrl(), 14013 { 14014 data: { 14015 pollerRequest: requestStr 14016 }, 14017 method: A.config.io.method, 14018 on: { 14019 success: _processResponse 14020 } 14021 } 14022 ); 14023 } 14024 }; 14025 14026 var _releaseLock = function() { 14027 _locked = false; 14028 }; 14029 14030 var _sendComplete = function() { 14031 _releaseLock(); 14032 _send(); 14033 }; 14034 14035 var _send = function() { 14036 if (_enabled && !_locked && _sendQueue.length && !_suspended && !_frozen) { 14037 _locked = true; 14038 14039 var data = _sendQueue.shift(); 14040 14041 _metaData.userId = _getEncryptedUserId(); 14042 _metaData.timestamp = (new Date()).getTime(); 14043 14044 AObject.each(_portlets, _updatePortletIdsMap); 14045 14046 var requestStr = JSON.stringify([_metaData].concat(data)); 14047 14048 A.io( 14049 _getSendUrl(), 14050 { 14051 data: { 14052 pollerRequest: requestStr 14053 }, 14054 method: A.config.io.method, 14055 on: { 14056 complete: _sendComplete 14057 } 14058 } 14059 ); 14060 } 14061 }; 14062 14063 var _thawConnection = function() { 14064 _frozen = false; 14065 14066 _createRequestTimer(); 14067 }; 14068 14069 var _updatePortletIdsMap = function(item, index) { 14070 _portletIdsMap[index] = item.initialRequest; 14071 }; 14072 14073 var Poller = { 14074 init: function(options) { 14075 var instance = this; 14076 14077 instance.setEncryptedUserId(options.encryptedUserId); 14078 instance.setSupportsComet(options.supportsComet); 14079 }, 14080 14081 addListener: function(key, listener, scope) { 14082 _portlets[key] = { 14083 initialRequest: true, 14084 listener: listener, 14085 scope: scope 14086 }; 14087 14088 if (!_enabled) { 14089 _enabled = true; 14090 14091 _receive(); 14092 } 14093 }, 14094 14095 cancelCustomDelay: function() { 14096 _customDelay = null; 14097 }, 14098 14099 getDelay: function() { 14100 if (_customDelay !== null) {
14101 _requestDelay = _customDelay; 14102 } 14103 else if (_delayIndex <= _maxDelay) { 14104 _requestDelay = _delays[_delayIndex]; 14105 _delayAccessCount++; 14106 14107 if (_delayAccessCount == 3) { 14108 _delayIndex++; 14109 _delayAccessCount = 0; 14110 } 14111 } 14112 14113 return _requestDelay * 1000; 14114 }, 14115 14116 getReceiveUrl: _getReceiveUrl, 14117 getSendUrl: _getSendUrl, 14118 14119 isSupportsComet: function() { 14120 return _supportsComet; 14121 }, 14122 14123 processResponse: _processResponse, 14124 14125 removeListener: function(key) { 14126 var instance = this; 14127 14128 if (key in _portlets) { 14129 delete _portlets[key]; 14130 } 14131 14132 if (AObject.keys(_portlets).length === 0) { 14133 _enabled = false; 14134 14135 _cancelRequestTimer(); 14136 } 14137 }, 14138 14139 resume: function() { 14140 _suspended = false; 14141 14142 _createRequestTimer(); 14143 }, 14144 14145 setCustomDelay: function(delay) { 14146 if (delay === null) { 14147 _customDelay = delay; 14148 } 14149 else { 14150 _customDelay = delay / 1000; 14151 } 14152 }, 14153 14154 setDelay: function(delay) { 14155 _requestDelay = delay / 1000; 14156 }, 14157 14158 setEncryptedUserId: function(encryptedUserId) { 14159 _encryptedUserId = encryptedUserId; 14160 }, 14161 14162 setSupportsComet: function(supportsComet) { 14163 _supportsComet = supportsComet; 14164 }, 14165 14166 setUrl: function(url) { 14167 _url = url; 14168 }, 14169 14170 submitRequest: function(key, data, chunkId) { 14171 if (!_frozen && key in _portlets) { 14172 for (var i in data) { 14173 if (data.hasOwnProperty(i)) { 14174 var content = data[i]; 14175 14176 if (content.replace) { 14177 content = content.replace(_openCurlyBrace, _escapedOpenCurlyBrace); 14178 content = content.replace(_closeCurlyBrace, _escapedCloseCurlyBrace); 14179 14180 data[i] = content; 14181 } 14182 } 14183 } 14184 14185 var requestData = { 14186 data: data, 14187 portletId: key 14188 }; 14189 14190 if (chunkId) { 14191 requestData.chunkId = chunkId; 14192 } 14193 14194 _sendQueue.push(requestData); 14195 14196 _send(); 14197 } 14198 }, 14199 14200 suspend: function() { 14201 _cancelRequestTimer(); 14202 14203 _suspended = true; 14204 }, 14205 14206 url: _url 14207 }; 14208 14209 A.getWin().on( 14210 'focus', 14211 function(event) { 14212 _metaData.startPolling = true; 14213 14214 _thawConnection(); 14215 } 14216 ); 14217 14218 Liferay.Poller = Poller; 14219 }, 14220 '', 14221 { 14222 requires: ['aui-base', 'io', 'json'] 14223 } 14224); 14225YUI.add('async-queue', function (Y, NAME) { 14226 14227/** 14228 * <p>AsyncQueue allows you create a chain of function callbacks executed 14229 * via setTimeout (or synchronously) that are guaranteed to run in order. 14230 * Items in the queue can be promoted or removed. Start or resume the 14231 * execution chain with run(). pause() to temporarily delay execution, or 14232 * stop() to halt and clear the queue.</p> 14233 * 14234 * @module async-queue 14235 */ 14236 14237/** 14238 * <p>A specialized queue class that supports scheduling callbacks to execute 14239 * sequentially, iteratively, even asynchronously.</p> 14240 * 14241 * <p>Callbacks can be function refs or objects with the following keys. Only 14242 * the <code>fn</code> key is required.</p> 14243 * 14244 * <ul> 14245 * <li><code>fn</code> -- The callback function</li> 14246 * <li><code>context</code> -- The execution context for the callbackFn.</li> 14247 * <li><code>args</code> -- Arguments to pass to callbackFn.</li> 14248 * <li><code>timeout</code> -- Millisecond delay before executing callbackFn. 14249 * (Applies to each iterative execution of callback)</li> 14250 * <li><code>iterations</code> -- Number of times to repeat the callback. 14251 * <li><code>until</code> -- Repeat the callback until this function returns 14252 * true. This setting trumps iterations.</li> 14253 * <li><code>autoContinue</code> -- Set to false to prevent the AsyncQueue from 14254 * executing the next callback in the Queue after 14255 * the callback completes.</li> 14256 * <li><code>id</code> -- Name that can be used to get, promote, get the 14257 * indexOf, or delete this callback.</li> 14258 * </ul> 14259 * 14260 * @class AsyncQueue 14261 * @extends EventTarget 14262 * @constructor 14263 * @param callback* {Function|Object} 0..n callbacks to seed the queue 14264 */ 14265Y.AsyncQueue = function() { 14266 this._init(); 14267 this.add.apply(this, arguments); 14268}; 14269 14270var Queue = Y.AsyncQueue, 14271 EXECUTE = 'execute', 14272 SHIFT = 'shift', 14273 PROMOTE = 'promote', 14274 REMOVE = 'remove', 14275 14276 isObject = Y.Lang.isObject, 14277 isFunction = Y.Lang.isFunction; 14278 14279/** 14280 * <p>Static default values used to populate callback configuration properties. 14281 * Preconfigured defaults include:</p> 14282 * 14283 * <ul> 14284 * <li><code>autoContinue</code>: <code>true</code></li> 14285 * <li><code>iterations</code>: 1</li> 14286 * <li><code>timeout</code>: 10 (10ms between callbacks)</li> 14287 * <li><code>until</code>: (function to run until iterations <= 0)</li> 14288 * </ul> 14289 * 14290 * @property defaults 14291 * @type {Object} 14292 * @static 14293 */ 14294Queue.defaults = Y.mix({ 14295 autoContinue : true, 14296 iterations : 1, 14297 timeout : 10, 14298 until : function () { 14299 this.iterations |= 0; 14300 return this.iterations <= 0; 14301 } 14302}, Y.config.queueDefaults || {}); 14303 14304Y.extend(Queue, Y.EventTarget, { 14305 /** 14306 * Used to indicate the queue is currently executing a callback. 14307 * 14308 * @property _running 14309 * @type {Boolean|Object} true for synchronous callback execution, the 14310 * return handle from Y.later for async callbacks. 14311 * Otherwise false. 14312 * @protected 14313 */ 14314 _running : false, 14315 14316 /** 14317 * Initializes the AsyncQueue instance properties and events. 14318 * 14319 * @method _init 14320 * @protected 14321 */ 14322 _init : function () { 14323 Y.EventTarget.call(this, { prefix: 'queue', emitFacade: true }); 14324 14325 this._q = []; 14326 14327 /** 14328 * Callback defaults for this instance. Static defaults that are not 14329 * overridden are also included. 14330 * 14331 * @property defaults 14332 * @type {Object} 14333 */ 14334 this.defaults = {}; 14335 14336 this._initEvents(); 14337 }, 14338 14339 /** 14340 * Initializes the instance events. 14341 * 14342 * @method _initEvents 14343 * @protected 14344 */ 14345 _initEvents : function () { 14346 this.publish({ 14347 'execute' : { defaultFn : this._defExecFn, emitFacade: true }, 14348 'shift' : { defaultFn : this._defShiftFn, emitFacade: true }, 14349 'add' : { defaultFn : this._defAddFn, emitFacade: true }, 14350 'promote' : { defaultFn : this._defPromoteFn, emitFacade: true }, 14351 'remove' : { defaultFn : this._defRemoveFn, emitFacade: true } 14352 }); 14353 }, 14354 14355 /** 14356 * Returns the next callback needing execution. If a callback is 14357 * configured to repeat via iterations or until, it will be returned until 14358 * the completion criteria is met. 14359 * 14360 * When the queue is empty, null is returned. 14361 * 14362 * @method next 14363 * @return {Function} the callback to execute 14364 */ 14365 next : function () { 14366 var callback; 14367 14368 while (this._q.length) { 14369 callback = this._q[0] = this._prepare(this._q[0]); 14370 if (callback && callback.until()) { 14371 this.fire(SHIFT, { callback: callback }); 14372 callback = null; 14373 } else { 14374 break; 14375 } 14376 } 14377 14378 return callback || null; 14379 }, 14380 14381 /** 14382 * Default functionality for the "shift" event. Shifts the 14383 * callback stored in the event object's <em>callback</em> property from 14384 * the queue if it is the first item. 14385 * 14386 * @method _defShiftFn 14387 * @param e {Event} The event object 14388 * @protected 14389 */ 14390 _defShiftFn : function (e) { 14391 if (this.indexOf(e.callback) === 0) { 14392 this._q.shift(); 14393 } 14394 }, 14395 14396 /** 14397 * Creates a wrapper function to execute the callback using the aggregated 14398 * configuration generated by combining the static AsyncQueue.defaults, the 14399 * instance defaults, and the specified callback settings. 14400 * 14401 * The wrapper function is decorated with the callback configuration as 14402 * properties for runtime modification. 14403 * 14404 * @method _prepare 14405 * @param callback {Object|Function} the raw callback 14406 * @return {Function} a decorated function wrapper to execute the callback 14407 * @protected 14408 */ 14409 _prepare: function (callback) { 14410 if (isFunction(callback) && callback._prepared) { 14411 return callback; 14412 } 14413 14414 var config = Y.merge( 14415 Queue.defaults, 14416 { context : this, args: [], _prepared: true }, 14417 this.defaults, 14418 (isFunction(callback) ? { fn: callback } : callback)), 14419 14420 wrapper = Y.bind(function () { 14421 if (!wrapper._running) { 14422 wrapper.iterations--; 14423 } 14424 if (isFunction(wrapper.fn)) { 14425 wrapper.fn.apply(wrapper.context || Y, 14426 Y.Array(wrapper.args)); 14427 } 14428 }, this); 14429 14430 return Y.mix(wrapper, config); 14431 }, 14432 14433 /** 14434 * Sets the queue in motion. All queued callbacks will be executed in 14435 * order unless pause() or stop() is called or if one of the callbacks is 14436 * configured with autoContinue: false. 14437 * 14438 * @method run 14439 * @return {AsyncQueue} the AsyncQueue instance 14440 * @chainable 14441 */ 14442 run : function () { 14443 var callback, 14444 cont = true; 14445 14446 if (this._executing) { 14447 this._running = true; 14448 return this; 14449 } 14450 14451 for (callback = this.next(); 14452 callback && !this.isRunning(); 14453 callback = this.next()) 14454 { 14455 cont = (callback.timeout < 0) ? 14456 this._execute(callback) : 14457 this._schedule(callback); 14458 14459 // Break to avoid an extra call to next (final-expression of the 14460 // 'for' loop), because the until function of the next callback 14461 // in the queue may return a wrong result if it depends on the 14462 // not-yet-finished work of the previous callback. 14463 if (!cont) { 14464 break; 14465 } 14466 } 14467 14468 if (!callback) { 14469 /** 14470 * Event fired when there is no remaining callback in the running queue. Also fired after stop(). 14471 * @event complete 14472 */ 14473 this.fire('complete'); 14474 } 14475 14476 return this; 14477 }, 14478 14479 /** 14480 * Handles the execution of callbacks. Returns a boolean indicating 14481 * whether it is appropriate to continue running. 14482 * 14483 * @method _execute 14484 * @param callback {Object} the callback object to execute 14485 * @return {Boolean} whether the run loop should continue 14486 * @protected 14487 */ 14488 _execute : function (callback) { 14489 14490 this._running = callback._running = true; 14491 this._executing = callback; 14492 14493 callback.iterations--; 14494 this.fire(EXECUTE, { callback: callback }); 14495 14496 var cont = this._running && callback.autoContinue; 14497 14498 this._running = callback._running = false;
14499 this._executing = false; 14500 14501 return cont; 14502 }, 14503 14504 /** 14505 * Schedules the execution of asynchronous callbacks. 14506 * 14507 * @method _schedule 14508 * @param callback {Object} the callback object to execute 14509 * @return {Boolean} whether the run loop should continue 14510 * @protected 14511 */ 14512 _schedule : function (callback) { 14513 this._running = Y.later(callback.timeout, this, function () { 14514 if (this._execute(callback)) { 14515 this.run(); 14516 } 14517 }); 14518 14519 return false; 14520 }, 14521 14522 /** 14523 * Determines if the queue is waiting for a callback to complete execution. 14524 * 14525 * @method isRunning 14526 * @return {Boolean} true if queue is waiting for a 14527 * from any initiated transactions 14528 */ 14529 isRunning : function () { 14530 return !!this._running; 14531 }, 14532 14533 /** 14534 * Default functionality for the "execute" event. Executes the 14535 * callback function 14536 * 14537 * @method _defExecFn 14538 * @param e {Event} the event object 14539 * @protected 14540 */ 14541 _defExecFn : function (e) { 14542 e.callback(); 14543 }, 14544 14545 /** 14546 * Add any number of callbacks to the end of the queue. Callbacks may be 14547 * provided as functions or objects. 14548 * 14549 * @method add 14550 * @param callback* {Function|Object} 0..n callbacks 14551 * @return {AsyncQueue} the AsyncQueue instance 14552 * @chainable 14553 */ 14554 add : function () { 14555 this.fire('add', { callbacks: Y.Array(arguments,0,true) }); 14556 14557 return this; 14558 }, 14559 14560 /** 14561 * Default functionality for the "add" event. Adds the callbacks 14562 * in the event facade to the queue. Callbacks successfully added to the 14563 * queue are present in the event's <code>added</code> property in the 14564 * after phase. 14565 * 14566 * @method _defAddFn 14567 * @param e {Event} the event object 14568 * @protected 14569 */ 14570 _defAddFn : function(e) { 14571 var _q = this._q, 14572 added = []; 14573 14574 Y.Array.each(e.callbacks, function (c) { 14575 if (isObject(c)) { 14576 _q.push(c); 14577 added.push(c); 14578 } 14579 }); 14580 14581 e.added = added; 14582 }, 14583 14584 /** 14585 * Pause the execution of the queue after the execution of the current 14586 * callback completes. If called from code outside of a queued callback, 14587 * clears the timeout for the pending callback. Paused queue can be 14588 * restarted with q.run() 14589 * 14590 * @method pause 14591 * @return {AsyncQueue} the AsyncQueue instance 14592 * @chainable 14593 */ 14594 pause: function () { 14595 if (this._running && isObject(this._running)) { 14596 this._running.cancel(); 14597 } 14598 14599 this._running = false; 14600 14601 return this; 14602 }, 14603 14604 /** 14605 * Stop and clear the queue after the current execution of the 14606 * current callback completes. 14607 * 14608 * @method stop 14609 * @return {AsyncQueue} the AsyncQueue instance 14610 * @chainable 14611 */ 14612 stop : function () { 14613 14614 this._q = []; 14615 14616 if (this._running && isObject(this._running)) { 14617 this._running.cancel(); 14618 this._running = false; 14619 } 14620 // otherwise don't systematically set this._running to false, because if 14621 // stop has been called from inside a queued callback, the _execute method 14622 // currenty running needs to call run() one more time for the 'complete' 14623 // event to be fired. 14624 14625 // if stop is called from outside a callback, we need to explicitely call 14626 // run() once again to fire the 'complete' event. 14627 if (!this._executing) { 14628 this.run(); 14629 } 14630 14631 return this; 14632 }, 14633 14634 /** 14635 * Returns the current index of a callback. Pass in either the id or 14636 * callback function from getCallback. 14637 * 14638 * @method indexOf 14639 * @param callback {String|Function} the callback or its specified id 14640 * @return {Number} index of the callback or -1 if not found 14641 */ 14642 indexOf : function (callback) { 14643 var i = 0, len = this._q.length, c; 14644 14645 for (; i < len; ++i) { 14646 c = this._q[i]; 14647 if (c === callback || c.id === callback) { 14648 return i; 14649 } 14650 } 14651 14652 return -1; 14653 }, 14654 14655 /** 14656 * Retrieve a callback by its id. Useful to modify the configuration 14657 * while the queue is running. 14658 * 14659 * @method getCallback 14660 * @param id {String} the id assigned to the callback 14661 * @return {Object} the callback object 14662 */ 14663 getCallback : function (id) { 14664 var i = this.indexOf(id); 14665 14666 return (i > -1) ? this._q[i] : null; 14667 }, 14668 14669 /** 14670 * Promotes the named callback to the top of the queue. If a callback is 14671 * currently executing or looping (via until or iterations), the promotion 14672 * is scheduled to occur after the current callback has completed. 14673 * 14674 * @method promote 14675 * @param callback {String|Object} the callback object or a callback's id 14676 * @return {AsyncQueue} the AsyncQueue instance 14677 * @chainable 14678 */ 14679 promote : function (callback) { 14680 var payload = { callback : callback },e; 14681 14682 if (this.isRunning()) { 14683 e = this.after(SHIFT, function () { 14684 this.fire(PROMOTE, payload); 14685 e.detach(); 14686 }, this); 14687 } else { 14688 this.fire(PROMOTE, payload); 14689 } 14690 14691 return this; 14692 }, 14693 14694 /** 14695 * <p>Default functionality for the "promote" event. Promotes the 14696 * named callback to the head of the queue.</p> 14697 * 14698 * <p>The event object will contain a property "callback", which 14699 * holds the id of a callback or the callback object itself.</p> 14700 * 14701 * @method _defPromoteFn 14702 * @param e {Event} the custom event 14703 * @protected 14704 */ 14705 _defPromoteFn : function (e) { 14706 var i = this.indexOf(e.callback), 14707 promoted = (i > -1) ? this._q.splice(i,1)[0] : null; 14708 14709 e.promoted = promoted; 14710 14711 if (promoted) { 14712 this._q.unshift(promoted); 14713 } 14714 }, 14715 14716 /** 14717 * Removes the callback from the queue. If the queue is active, the 14718 * removal is scheduled to occur after the current callback has completed. 14719 * 14720 * @method remove 14721 * @param callback {String|Object} the callback object or a callback's id 14722 * @return {AsyncQueue} the AsyncQueue instance 14723 * @chainable 14724 */ 14725 remove : function (callback) { 14726 var payload = { callback : callback },e; 14727 14728 // Can't return the removed callback because of the deferral until 14729 // current callback is complete 14730 if (this.isRunning()) { 14731 e = this.after(SHIFT, function () { 14732 this.fire(REMOVE, payload); 14733 e.detach(); 14734 },this); 14735 } else { 14736 this.fire(REMOVE, payload); 14737 } 14738 14739 return this; 14740 }, 14741 14742 /** 14743 * <p>Default functionality for the "remove" event. Removes the 14744 * callback from the queue.</p> 14745 * 14746 * <p>The event object will contain a property "callback", which 14747 * holds the id of a callback or the callback object itself.</p> 14748 * 14749 * @method _defRemoveFn 14750 * @param e {Event} the custom event 14751 * @protected 14752 */ 14753 _defRemoveFn : function (e) { 14754 var i = this.indexOf(e.callback); 14755 14756 e.removed = (i > -1) ? this._q.splice(i,1)[0] : null; 14757 }, 14758 14759 /** 14760 * Returns the number of callbacks in the queue. 14761 * 14762 * @method size 14763 * @return {Number} 14764 */ 14765 size : function () { 14766 // next() flushes callbacks that have met their until() criteria and 14767 // therefore shouldn't count since they wouldn't execute anyway. 14768 if (!this.isRunning()) { 14769 this.next(); 14770 } 14771 14772 return this._q.length; 14773 } 14774}); 14775 14776 14777 14778}, 'patched-v3.18.3', {"requires": ["event-custom"]}); 14779 14780YUI.add('base-build', function (Y, NAME) { 14781 14782 /** 14783 * The base-build submodule provides Base.build functionality, which
14784 * can be used to create custom classes, by aggregating extensions onto 14785 * a main class. 14786 * 14787 * @module base 14788 * @submodule base-build 14789 * @for Base 14790 */ 14791 var BaseCore = Y.BaseCore, 14792 Base = Y.Base, 14793 L = Y.Lang, 14794 14795 INITIALIZER = "initializer", 14796 DESTRUCTOR = "destructor", 14797 AGGREGATES = ["_PLUG", "_UNPLUG"], 14798 14799 build; 14800 14801 // Utility function used in `_buildCfg` to aggregate array values into a new 14802 // array from the sender constructor to the receiver constructor. 14803 function arrayAggregator(prop, r, s) { 14804 if (s[prop]) { 14805 r[prop] = (r[prop] || []).concat(s[prop]); 14806 } 14807 } 14808 14809 // Utility function used in `_buildCfg` to aggregate `_ATTR_CFG` array 14810 // values from the sender constructor into a new array on receiver's 14811 // constructor, and clear the cached hash. 14812 function attrCfgAggregator(prop, r, s) { 14813 if (s._ATTR_CFG) { 14814 // Clear cached hash. 14815 r._ATTR_CFG_HASH = null; 14816 14817 arrayAggregator.apply(null, arguments); 14818 } 14819 } 14820 14821 // Utility function used in `_buildCfg` to aggregate ATTRS configs from one 14822 // the sender constructor to the receiver constructor. 14823 function attrsAggregator(prop, r, s) { 14824 BaseCore.modifyAttrs(r, s.ATTRS); 14825 } 14826 14827 Base._build = function(name, main, extensions, px, sx, cfg) { 14828 14829 var build = Base._build, 14830 14831 builtClass = build._ctor(main, cfg), 14832 buildCfg = build._cfg(main, cfg, extensions), 14833 14834 _mixCust = build._mixCust, 14835 14836 dynamic = builtClass._yuibuild.dynamic, 14837 14838 i, l, extClass, extProto, 14839 initializer, 14840 destructor; 14841 14842 // Augment/Aggregate 14843 for (i = 0, l = extensions.length; i < l; i++) { 14844 extClass = extensions[i]; 14845 14846 extProto = extClass.prototype; 14847 14848 initializer = extProto[INITIALIZER]; 14849 destructor = extProto[DESTRUCTOR]; 14850 delete extProto[INITIALIZER]; 14851 delete extProto[DESTRUCTOR]; 14852 14853 // Prototype, old non-displacing augment 14854 Y.mix(builtClass, extClass, true, null, 1); 14855 14856 // Custom Statics 14857 _mixCust(builtClass, extClass, buildCfg); 14858 14859 if (initializer) { 14860 extProto[INITIALIZER] = initializer; 14861 } 14862 14863 if (destructor) { 14864 extProto[DESTRUCTOR] = destructor; 14865 } 14866 14867 builtClass._yuibuild.exts.push(extClass); 14868 } 14869 14870 if (px) { 14871 Y.mix(builtClass.prototype, px, true); 14872 } 14873 14874 if (sx) { 14875 Y.mix(builtClass, build._clean(sx, buildCfg), true); 14876 _mixCust(builtClass, sx, buildCfg); 14877 } 14878 14879 builtClass.prototype.hasImpl = build._impl; 14880 14881 if (dynamic) { 14882 builtClass.NAME = name; 14883 builtClass.prototype.constructor = builtClass; 14884 14885 // Carry along the reference to `modifyAttrs()` from `main`. 14886 builtClass.modifyAttrs = main.modifyAttrs; 14887 } 14888 14889 return builtClass; 14890 }; 14891 14892 build = Base._build; 14893 14894 Y.mix(build, { 14895 14896 _mixCust: function(r, s, cfg) { 14897 14898 var aggregates, 14899 custom, 14900 statics, 14901 aggr, 14902 l, 14903 i; 14904 14905 if (cfg) { 14906 aggregates = cfg.aggregates; 14907 custom = cfg.custom; 14908 statics = cfg.statics; 14909 } 14910 14911 if (statics) { 14912 Y.mix(r, s, true, statics); 14913 } 14914 14915 if (aggregates) { 14916 for (i = 0, l = aggregates.length; i < l; i++) { 14917 aggr = aggregates[i]; 14918 if (!r.hasOwnProperty(aggr) && s.hasOwnProperty(aggr)) { 14919 r[aggr] = L.isArray(s[aggr]) ? [] : {}; 14920 } 14921 Y.aggregate(r, s, true, [aggr]); 14922 } 14923 } 14924 14925 if (custom) { 14926 for (i in custom) { 14927 if (custom.hasOwnProperty(i)) { 14928 custom[i](i, r, s); 14929 } 14930 } 14931 } 14932 14933 }, 14934 14935 _tmpl: function(main) { 14936 14937 function BuiltClass() { 14938 BuiltClass.superclass.constructor.apply(this, arguments); 14939 } 14940 Y.extend(BuiltClass, main); 14941 14942 return BuiltClass; 14943 }, 14944 14945 _impl : function(extClass) { 14946 var classes = this._getClasses(), i, l, cls, exts, ll, j; 14947 for (i = 0, l = classes.length; i < l; i++) { 14948 cls = classes[i]; 14949 if (cls._yuibuild) { 14950 exts = cls._yuibuild.exts; 14951 ll = exts.length; 14952 14953 for (j = 0; j < ll; j++) { 14954 if (exts[j] === extClass) { 14955 return true; 14956 } 14957 } 14958 } 14959 } 14960 return false;
14961 }, 14962 14963 _ctor : function(main, cfg) { 14964 14965 var dynamic = (cfg && false === cfg.dynamic) ? false : true, 14966 builtClass = (dynamic) ? build._tmpl(main) : main, 14967 buildCfg = builtClass._yuibuild; 14968 14969 if (!buildCfg) { 14970 buildCfg = builtClass._yuibuild = {}; 14971 } 14972 14973 buildCfg.id = buildCfg.id || null; 14974 buildCfg.exts = buildCfg.exts || []; 14975 buildCfg.dynamic = dynamic; 14976 14977 return builtClass; 14978 }, 14979 14980 _cfg : function(main, cfg, exts) { 14981 var aggr = [], 14982 cust = {}, 14983 statics = [], 14984 buildCfg, 14985 cfgAggr = (cfg && cfg.aggregates), 14986 cfgCustBuild = (cfg && cfg.custom), 14987 cfgStatics = (cfg && cfg.statics), 14988 c = main, 14989 i, 14990 l; 14991 14992 // Prototype Chain 14993 while (c && c.prototype) { 14994 buildCfg = c._buildCfg; 14995 if (buildCfg) { 14996 if (buildCfg.aggregates) { 14997 aggr = aggr.concat(buildCfg.aggregates); 14998 } 14999 if (buildCfg.custom) { 15000 Y.mix(cust, buildCfg.custom, true); 15001 } 15002 if (buildCfg.statics) { 15003 statics = statics.concat(buildCfg.statics); 15004 } 15005 } 15006 c = c.superclass ? c.superclass.constructor : null; 15007 } 15008 15009 // Exts 15010 if (exts) { 15011 for (i = 0, l = exts.length; i < l; i++) { 15012 c = exts[i]; 15013 buildCfg = c._buildCfg; 15014 if (buildCfg) { 15015 if (buildCfg.aggregates) { 15016 aggr = aggr.concat(buildCfg.aggregates); 15017 } 15018 if (buildCfg.custom) { 15019 Y.mix(cust, buildCfg.custom, true); 15020 } 15021 if (buildCfg.statics) { 15022 statics = statics.concat(buildCfg.statics); 15023 } 15024 } 15025 } 15026 } 15027 15028 if (cfgAggr) { 15029 aggr = aggr.concat(cfgAggr); 15030 } 15031 15032 if (cfgCustBuild) { 15033 Y.mix(cust, cfg.cfgBuild, true); 15034 } 15035 15036 if (cfgStatics) { 15037 statics = statics.concat(cfgStatics); 15038 } 15039 15040 return { 15041 aggregates: aggr, 15042 custom: cust, 15043 statics: statics 15044 }; 15045 }, 15046 15047 _clean : function(sx, cfg) { 15048 var prop, i, l, sxclone = Y.merge(sx), 15049 aggregates = cfg.aggregates, 15050 custom = cfg.custom; 15051 15052 for (prop in custom) { 15053 if (sxclone.hasOwnProperty(prop)) { 15054 delete sxclone[prop]; 15055 } 15056 } 15057 15058 for (i = 0, l = aggregates.length; i < l; i++) { 15059 prop = aggregates[i]; 15060 if (sxclone.hasOwnProperty(prop)) { 15061 delete sxclone[prop]; 15062 } 15063 } 15064 15065 return sxclone; 15066 } 15067 }); 15068 15069 /** 15070 * <p> 15071 * Builds a custom constructor function (class) from the 15072 * main function, and array of extension functions (classes) 15073 * provided. The NAME field for the constructor function is 15074 * defined by the first argument passed in. 15075 * </p> 15076 * <p> 15077 * The cfg object supports the following properties 15078 * </p> 15079 * <dl> 15080 * <dt>dynamic <boolean></dt> 15081 * <dd> 15082 * <p>If true (default), a completely new class 15083 * is created which extends the main class, and acts as the 15084 * host on which the extension classes are augmented.</p> 15085 * <p>If false, the extensions classes are augmented directly to 15086 * the main class, modifying the main class' prototype.</p> 15087 * </dd> 15088 * <dt>aggregates <String[]></dt> 15089 * <dd>An array of static property names, which will get aggregated 15090 * on to the built class, in addition to the default properties build 15091 * will always aggregate as defined by the main class' static _buildCfg 15092 * property. 15093 * </dd> 15094 * </dl> 15095 * 15096 * @method build 15097 * @deprecated Use the more convenient Base.create and Base.mix methods instead 15098 * @static 15099 * @param {Function} name The name of the new class. Used to define the NAME property for the new class. 15100 * @param {Function} main The main class on which to base the built class 15101 * @param {Function[]} extensions The set of extension classes which will be 15102 * augmented/aggregated to the built class. 15103 * @param {Object} cfg Optional. Build configuration for the class (see description). 15104 * @return {Function} A custom class, created from the provided main and extension classes 15105 */ 15106 Base.build = function(name, main, extensions, cfg) { 15107 return build(name, main, extensions, null, null, cfg); 15108 }; 15109 15110 /** 15111 * Creates a new class (constructor function) which extends the base class passed in as the second argument, 15112 * and mixes in the array of extensions provided. 15113 * 15114 * Prototype properties or methods can be added to the new class, using the px argument (similar to Y.extend). 15115 * 15116 * Static properties or methods can be added to the new class, using the sx argument (similar to Y.extend). 15117 * 15118 * **NOTE FOR COMPONENT DEVELOPERS**: Both the `base` class, and `extensions` can define static a `_buildCfg` 15119 * property, which acts as class creation meta-data, and drives how special static properties from the base 15120 * class, or extensions should be copied, aggregated or (custom) mixed into the newly created class. 15121 * 15122 * The `_buildCfg` property is a hash with 3 supported properties: `statics`, `aggregates` and `custom`, e.g: 15123 * 15124 * // If the Base/Main class is the thing introducing the property: 15125 * 15126 * MyBaseClass._buildCfg = { 15127 * 15128 * // Static properties/methods to copy (Alias) to the built class. 15129 * statics: ["CopyThisMethod", "CopyThisProperty"], 15130 * 15131 * // Static props to aggregate onto the built class. 15132 * aggregates: ["AggregateThisProperty"], 15133 * 15134 * // Static properties which need custom handling (e.g. deep merge etc.) 15135 * custom: { 15136 * "CustomProperty" : function(property, Receiver, Supplier) { 15137 * ... 15138 * var triggers = Receiver.CustomProperty.triggers; 15139 * Receiver.CustomProperty.triggers = triggers.concat(Supplier.CustomProperty.triggers); 15140 * ... 15141 * } 15142 * } 15143 * }; 15144 * 15145 * MyBaseClass.CopyThisMethod = function() {...}; 15146 * MyBaseClass.CopyThisProperty = "foo"; 15147 * MyBaseClass.AggregateThisProperty = {...}; 15148 * MyBaseClass.CustomProperty = { 15149 * triggers: [...] 15150 * } 15151 * 15152 * // Or, if the Extension is the thing introducing the property: 15153 * 15154 * MyExtension._buildCfg = { 15155 * statics : ... 15156 * aggregates : ... 15157 * custom : ... 15158 * } 15159 * 15160 * This way, when users pass your base or extension class to `Y.Base.create` or `Y.Base.mix`, they don't need to 15161 * know which properties need special handling. `Y.Base` has a buildCfg which defines `ATTRS` for custom mix handling 15162 * (to protect the static config objects), and `Y.Widget` has a buildCfg which specifies `HTML_PARSER` for 15163 * straight up aggregation. 15164 * 15165 * @method create 15166 * @static 15167 * @param {String} name The name of the newly created class. Used to define the NAME property for the new class. 15168 * @param {Function} main The base class which the new class should extend. 15169 * This class needs to be Base or a class derived from base (e.g. Widget). 15170 * @param {Function[]} extensions The list of extensions which will be mixed into the built class. 15171 * @param {Object} px The set of prototype properties/methods to add to the built class. 15172 * @param {Object} sx The set of static properties/methods to add to the built class. 15173 * @return {Function} The newly created class. 15174 */ 15175 Base.create = function(name, base, extensions, px, sx) { 15176 return build(name, base, extensions, px, sx); 15177 }; 15178 15179 /** 15180 * <p>Mixes in a list of extensions to an existing class.</p> 15181 * @method mix 15182 * @static 15183 * @param {Function} main The existing class into which the extensions should be mixed. 15184 * The class needs to be Base or a class derived from Base (e.g. Widget) 15185 * @param {Function[]} extensions The set of extension classes which will mixed into the existing main class. 15186 * @return {Function} The modified main class, with extensions mixed in. 15187 */ 15188 Base.mix = function(main, extensions) { 15189 15190 if (main._CACHED_CLASS_DATA) { 15191 main._CACHED_CLASS_DATA = null; 15192 } 15193 15194 return build(null, main, extensions, null, null, {dynamic:false}); 15195 }; 15196 15197 /** 15198 * The build configuration for the Base class. 15199 * 15200 * Defines the static fields which need to be aggregated when the Base class 15201 * is used as the main class passed to the 15202 * <a href="#method_Base.build">Base.build</a> method. 15203 * 15204 * @property _buildCfg 15205 * @type Object 15206 * @static 15207 * @final 15208 * @private 15209 */ 15210 BaseCore._buildCfg = { 15211 aggregates: AGGREGATES.concat(), 15212 15213 custom: { 15214 ATTRS : attrsAggregator, 15215 _ATTR_CFG : attrCfgAggregator, 15216 _NON_ATTRS_CFG: arrayAggregator 15217 } 15218 }; 15219 15220 // Makes sure Base and BaseCore use separate `_buildCfg` objects. 15221 Base._buildCfg = { 15222 aggregates: AGGREGATES.concat(), 15223 15224 custom: { 15225 ATTRS : attrsAggregator, 15226 _ATTR_CFG : attrCfgAggregator, 15227 _NON_ATTRS_CFG: arrayAggregator 15228 } 15229 }; 15230 15231 15232}, 'patched-v3.18.3', {"requires": ["base-base"]}); 15233 15234YUI.add('cookie', function (Y, NAME) { 15235 15236/** 15237 * Utilities for cookie management 15238 * @module cookie 15239 */ 15240 15241 //shortcuts 15242 var L = Y.Lang, 15243 O = Y.Object, 15244 NULL = null, 15245 15246 //shortcuts to functions 15247 isString = L.isString, 15248 isObject = L.isObject, 15249 isUndefined = L.isUndefined, 15250 isFunction = L.isFunction, 15251 encode = encodeURIComponent, 15252 decode = decodeURIComponent, 15253 15254 //shortcut to document 15255 doc = Y.config.doc; 15256 15257 /* 15258 * Throws an error message. 15259 */ 15260 function error(message){ 15261 throw new TypeError(message); 15262 } 15263 15264 /* 15265 * Checks the validity of a cookie name. 15266 */ 15267 function validateCookieName(name){ 15268 if (!isString(name) || name === ""){ 15269 error("Cookie name must be a non-empty string."); 15270 } 15271 } 15272 15273 /* 15274 * Checks the validity of a subcookie name. 15275 */ 15276 function validateSubcookieName(subName){ 15277 if (!isString(subName) || subName === ""){ 15278 error("Subcookie name must be a non-empty string."); 15279 } 15280 } 15281 15282 /** 15283 * Cookie utility. 15284 * @class Cookie 15285 * @static 15286 */ 15287 Y.Cookie = { 15288 15289 //------------------------------------------------------------------------- 15290 // Private Methods 15291 //------------------------------------------------------------------------- 15292 15293 /** 15294 * Creates a cookie string that can be assigned into document.cookie. 15295 * @param {String} name The name of the cookie. 15296 * @param {String} value The value of the cookie. 15297 * @param {Boolean} encodeValue True to encode the value, false to leave as-is. 15298 * @param {Object} options (Optional) Options for the cookie. 15299 * @return {String} The formatted cookie string.
15300 * @method _createCookieString 15301 * @private 15302 * @static 15303 */ 15304 _createCookieString : function (name /*:String*/, value /*:Variant*/, encodeValue /*:Boolean*/, options /*:Object*/) /*:String*/ { 15305 15306 options = options || {}; 15307 15308 var text /*:String*/ = encode(name) + "=" + (encodeValue ? encode(value) : value), 15309 expires = options.expires, 15310 path = options.path, 15311 domain = options.domain; 15312 15313 15314 if (isObject(options)){ 15315 //expiration date 15316 if (expires instanceof Date){ 15317 text += "; expires=" + expires.toUTCString(); 15318 } 15319 15320 //path 15321 if (isString(path) && path !== ""){ 15322 text += "; path=" + path; 15323 } 15324 15325 //domain 15326 if (isString(domain) && domain !== ""){ 15327 text += "; domain=" + domain; 15328 } 15329 15330 //secure 15331 if (options.secure === true){ 15332 text += "; secure"; 15333 } 15334 } 15335 15336 return text; 15337 }, 15338 15339 /** 15340 * Formats a cookie value for an object containing multiple values. 15341 * @param {Object} hash An object of key-value pairs to create a string for. 15342 * @return {String} A string suitable for use as a cookie value. 15343 * @method _createCookieHashString 15344 * @private 15345 * @static 15346 */ 15347 _createCookieHashString : function (hash /*:Object*/) /*:String*/ { 15348 if (!isObject(hash)){ 15349 error("Cookie._createCookieHashString(): Argument must be an object."); 15350 } 15351 15352 var text /*:Array*/ = []; 15353 15354 O.each(hash, function(value, key){ 15355 if (!isFunction(value) && !isUndefined(value)){ 15356 text.push(encode(key) + "=" + encode(String(value))); 15357 } 15358 }); 15359 15360 return text.join("&"); 15361 }, 15362 15363 /** 15364 * Parses a cookie hash string into an object. 15365 * @param {String} text The cookie hash string to parse (format: n1=v1&n2=v2). 15366 * @return {Object} An object containing entries for each cookie value. 15367 * @method _parseCookieHash 15368 * @private 15369 * @static 15370 */ 15371 _parseCookieHash : function (text) { 15372 15373 var hashParts = text.split("&"), 15374 hashPart = NULL, 15375 hash = {}; 15376 15377 if (text.length){ 15378 for (var i=0, len=hashParts.length; i < len; i++){ 15379 hashPart = hashParts[i].split("="); 15380 hash[decode(hashPart[0])] = decode(hashPart[1]); 15381 } 15382 } 15383 15384 return hash; 15385 }, 15386 15387 /** 15388 * Parses a cookie string into an object representing all accessible cookies. 15389 * @param {String} text The cookie string to parse. 15390 * @param {Boolean} shouldDecode (Optional) Indicates if the cookie values should be decoded or not. Default is true. 15391 * @param {Object} options (Optional) Contains settings for loading the cookie. 15392 * @return {Object} An object containing entries for each accessible cookie. 15393 * @method _parseCookieString 15394 * @private 15395 * @static 15396 */ 15397 _parseCookieString : function (text /*:String*/, shouldDecode /*:Boolean*/, options /*:Object*/) /*:Object*/ { 15398 15399 var cookies /*:Object*/ = {}; 15400 15401 if (isString(text) && text.length > 0) { 15402 15403 var decodeValue = (shouldDecode === false ? function(s){return s;} : decode), 15404 cookieParts = text.split(/;\s/g), 15405 cookieName = NULL, 15406 cookieValue = NULL, 15407 cookieNameValue = NULL; 15408 15409 for (var i=0, len=cookieParts.length; i < len; i++){ 15410 //check for normally-formatted cookie (name-value) 15411 cookieNameValue = cookieParts[i].match(/([^=]+)=/i); 15412 if (cookieNameValue instanceof Array){ 15413 try { 15414 cookieName = decode(cookieNameValue[1]); 15415 cookieValue = decodeValue(cookieParts[i].substring(cookieNameValue[1].length+1)); 15416 } catch (ex){ 15417 //intentionally ignore the cookie - the encoding is wrong 15418 } 15419 } else { 15420 //means the cookie does not have an "=", so treat it as a boolean flag 15421 cookieName = decode(cookieParts[i]); 15422 cookieValue = ""; 15423 } 15424 // don't overwrite an already loaded cookie if set by option 15425 if (!isUndefined(options) && options.reverseCookieLoa
15425ding) { 15426 if (isUndefined(cookies[cookieName])) { 15427 cookies[cookieName] = cookieValue; 15428 } 15429 } else { 15430 cookies[cookieName] = cookieValue; 15431 } 15432 } 15433 15434 } 15435 15436 return cookies; 15437 }, 15438 15439 /** 15440 * Sets the document object that the cookie utility uses for setting 15441 * cookies. This method is necessary to ensure that the cookie utility 15442 * unit tests can pass even when run on a domain instead of locally. 15443 * This method should not be used otherwise; you should use 15444 * <code>Y.config.doc</code> to change the document that the cookie 15445 * utility uses for everyday purposes. 15446 * @param {Object} newDoc The object to use as the document. 15447 * @method _setDoc 15448 * @private 15449 */ 15450 _setDoc: function(newDoc){ 15451 doc = newDoc; 15452 }, 15453 15454 //------------------------------------------------------------------------- 15455 // Public Methods 15456 //------------------------------------------------------------------------- 15457 15458 /** 15459 * Determines if the cookie with the given name exists. This is useful for 15460 * Boolean cookies (those that do not follow the name=value convention). 15461 * @param {String} name The name of the cookie to check. 15462 * @return {Boolean} True if the cookie exists, false if not. 15463 * @method exists 15464 * @static 15465 */ 15466 exists: function(name) { 15467 15468 validateCookieName(name); //throws error 15469 15470 var cookies = this._parseCookieString(doc.cookie, true); 15471 15472 return cookies.hasOwnProperty(name); 15473 }, 15474 15475 /** 15476 * Returns the cookie value for the given name. 15477 * @param {String} name The name of the cookie to retrieve. 15478 * @param {Function|Object} options (Optional) An object containing one or more 15479 * cookie options: raw (true/false), reverseCookieLoading (true/false) 15480 * and converter (a function). 15481 * The converter function is run on the value before returning it. The 15482 * function is not used if the cookie doesn't exist. The function can be 15483 * passed instead of the options object for backwards compatibility. When 15484 * raw is set to true, the cookie value is not URI decoded. 15485 * @return {Any} If no converter is specified, returns a string or null if 15486 * the cookie doesn't exist. If the converter is specified, returns the value 15487 * returned from the converter or null if the cookie doesn't exist. 15488 * @method get 15489 * @static 15490 */ 15491 get : function (name, options) { 15492 15493 validateCookieName(name); //throws error 15494 15495 var cookies, 15496 cookie, 15497 converter; 15498 15499 //if options is a function, then it's the converter 15500 if (isFunction(options)) { 15501 converter = options; 15502 options = {}; 15503 } else if (isObject(options)) { 15504 converter = options.converter; 15505 } else { 15506 options = {}; 15507 } 15508 15509 cookies = this._parseCookieString(doc.cookie, !options.raw, options); 15510 cookie = cookies[name]; 15511 15512 //should return null, not undefined if the cookie doesn't exist 15513 if (isUndefined(cookie)) { 15514 return NULL; 15515 } 15516 15517 if (!isFunction(converter)){ 15518 return cookie; 15519 } else { 15520 return converter(cookie); 15521 } 15522 }, 15523 15524 /** 15525 * Returns the value of a subcookie. 15526 * @param {String} name The name of the cookie to retrieve. 15527 * @param {String} subName The name of the subcookie to retrieve. 15528 * @param {Function} converter (Optional) A function to run on the value before returning 15529 * it. The function is not used if the cookie doesn't exist. 15530 * @param {Object} options (Optional) Containing one or more settings for cookie parsing. 15531 * @return {Any} If the cookie doesn't exist, null is returned. If the subcookie 15532 * doesn't exist, null if also returned. If no converter is specified and the 15533 * subcookie exists, a string is returned. If a converter is specified and the 15534 * subcookie exists, the value returned from the converter is returned. 15535 * @method getSub 15536 * @static 15537 */ 15538 getSub : function (name /*:String*/, subName /*:String*/, converter /*:Function*/, options /*:Object*/) /*:Variant*/ { 15539
15540 var hash /*:Variant*/ = this.getSubs(name, options); 15541 15542 if (hash !== NULL) { 15543 15544 validateSubcookieName(subName); //throws error 15545 15546 if (isUndefined(hash[subName])){ 15547 return NULL; 15548 } 15549 15550 if (!isFunction(converter)){ 15551 return hash[subName]; 15552 } else { 15553 return converter(hash[subName]); 15554 } 15555 } else { 15556 return NULL; 15557 } 15558 15559 }, 15560 15561 /** 15562 * Returns an object containing name-value pairs stored in the cookie with the given name. 15563 * @param {String} name The name of the cookie to retrieve. 15564 * @param {Object} options (Optional) Containing one or more settings for cookie parsing. 15565 * @return {Object} An object of name-value pairs if the cookie with the given name 15566 * exists, null if it does not. 15567 * @method getSubs 15568 * @static 15569 */ 15570 getSubs : function (name /*:String*/, options /*:Object*/) { 15571 15572 validateCookieName(name); //throws error 15573 15574 var cookies = this._parseCookieString(doc.cookie, false, options); 15575 if (isString(cookies[name])){ 15576 return this._parseCookieHash(cookies[name]); 15577 } 15578 return NULL; 15579 }, 15580 15581 /** 15582 * Removes a cookie from the machine by setting its expiration date to 15583 * sometime in the past. 15584 * @param {String} name The name of the cookie to remove. 15585 * @param {Object} options (Optional) An object containing one or more 15586 * cookie options: path (a string), domain (a string), 15587 * and secure (true/false). The expires option will be overwritten 15588 * by the method. 15589 * @return {String} The created cookie string. 15590 * @method remove 15591 * @static 15592 */ 15593 remove : function (name, options) { 15594 15595 validateCookieName(name); //throws error 15596 15597 //set options 15598 options = Y.merge(options || {}, { 15599 expires: new Date(0) 15600 }); 15601 15602 //set cookie 15603 return this.set(name, "", options); 15604 }, 15605 15606 /** 15607 * Removes a sub cookie with a given name. 15608 * @param {String} name The name of the cookie in which the subcookie exists. 15609 * @param {String} subName The name of the subcookie to remove. 15610 * @param {Object} options (Optional) An object containing one or more 15611 * cookie options: path (a string), domain (a string), expires (a Date object), 15612 * removeIfEmpty (true/false), and secure (true/false). This must be the same 15613 * settings as the original subcookie. 15614 * @return {String} The created cookie string. 15615 * @method removeSub 15616 * @static 15617 */ 15618 removeSub : function(name, subName, options) { 15619 15620 validateCookieName(name); //throws error 15621 15622 validateSubcookieName(subName); //throws error 15623 15624 options = options || {}; 15625 15626 //get all subcookies for this cookie 15627 var subs = this.getSubs(name); 15628 15629 //delete the indicated subcookie 15630 if (isObject(subs) && subs.hasOwnProperty(subName)){ 15631 delete subs[subName]; 15632 15633 if (!options.removeIfEmpty) { 15634 //reset the cookie 15635 15636 return this.setSubs(name, subs, options); 15637 } else { 15638 //reset the cookie if there are subcookies left, else remove 15639 for (var key in subs){ 15640 if (subs.hasOwnProperty(key) && !isFunction(subs[key]) && !isUndefined(subs[key])){ 15641 return this.setSubs(name, subs, options); 15642 } 15643 } 15644 15645 return this.remove(name, options); 15646 } 15647 } else { 15648 return ""; 15649 } 15650 15651 }, 15652 15653 /** 15654 * Sets a cookie with a given name and value. 15655 * @param {String} name The name of the cookie to set. 15656 * @param {Any} value The value to set for the cookie. 15657 * @param {Object}
15657 options (Optional) An object containing one or more 15658 * cookie options: path (a string), domain (a string), expires (a Date object), 15659 * secure (true/false), and raw (true/false). Setting raw to true indicates 15660 * that the cookie should not be URI encoded before being set. 15661 * @return {String} The created cookie string. 15662 * @method set 15663 * @static 15664 */ 15665 set : function (name, value, options) { 15666 15667 validateCookieName(name); //throws error 15668 15669 if (isUndefined(value)){ 15670 error("Cookie.set(): Value cannot be undefined."); 15671 } 15672 15673 options = options || {}; 15674 15675 var text = this._createCookieString(name, value, !options.raw, options); 15676 doc.cookie = text; 15677 return text; 15678 }, 15679 15680 /** 15681 * Sets a sub cookie with a given name to a particular value. 15682 * @param {String} name The name of the cookie to set. 15683 * @param {String} subName The name of the subcookie to set. 15684 * @param {Any} value The value to set. 15685 * @param {Object} options (Optional) An object containing one or more 15686 * cookie options: path (a string), domain (a string), expires (a Date object), 15687 * and secure (true/false). 15688 * @return {String} The created cookie string. 15689 * @method setSub 15690 * @static 15691 */ 15692 setSub : function (name, subName, value, options) { 15693 15694 validateCookieName(name); //throws error 15695 15696 validateSubcookieName(subName); //throws error 15697 15698 if (isUndefined(value)){ 15699 error("Cookie.setSub(): Subcookie value cannot be undefined."); 15700 } 15701 15702 var hash = this.getSubs(name); 15703 15704 if (!isObject(hash)){ 15705 hash = {}; 15706 } 15707 15708 hash[subName] = value; 15709 15710 return this.setSubs(name, hash, options); 15711 15712 }, 15713 15714 /** 15715 * Sets a cookie with a given name to contain a hash of name-value pairs. 15716 * @param {String} name The name of the cookie to set. 15717 * @param {Object} value An object containing name-value pairs. 15718 * @param {Object} options (Optional) An object containing one or more 15719 * cookie options: path (a string), domain (a string), expires (a Date object), 15720 * and secure (true/false). 15721 * @return {String} The created cookie string. 15722 * @method setSubs 15723 * @static 15724 */ 15725 setSubs : function (name, value, options) { 15726 15727 validateCookieName(name); //throws error 15728 15729 if (!isObject(value)){ 15730 error("Cookie.setSubs(): Cookie value must be an object."); 15731 } 15732 15733 var text /*:String*/ = this._createCookieString(name, this._createCookieHashString(value), false, options); 15734 doc.cookie = text; 15735 return text; 15736 } 15737 15738 }; 15739 15740 15741}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 15742 15743YUI.add('event-touch', function (Y, NAME) { 15744 15745/** 15746Adds touch event facade normalization properties (touches, changedTouches, targetTouches etc.) to the DOM event facade. Adds 15747touch events to the DOM events whitelist. 15748 15749@example 15750 YUI().use('event-touch', function (Y) { 15751 Y.one('#myDiv').on('touchstart', function(e) { 15752 ... 15753 }); 15754 }); 15755@module event 15756@submodule event-touch 15757 */ 15758var SCALE = "scale", 15759 ROTATION = "rotation", 15760 IDENTIFIER = "identifier", 15761 win = Y.config.win, 15762 GESTURE_MAP = {}; 15763 15764/** 15765 * Adds touch event facade normalization properties to the DOM event facade 15766 * 15767 * @method _touch 15768 * @for DOMEventFacade 15769 * @private 15770 * @param ev {Event} the DOM event 15771 * @param currentTarget {HTMLElement} the element the listener was attached to 15772 * @param wrapper {CustomEvent} the custom event wrapper for this DOM event 15773 */ 15774Y.DOMEventFacade.prototype._touch = function(e, currentTarget, wrapper) { 15775 15776 var i,l, etCached, et,touchCache; 15777 15778 15779 if (e.touches) { 15780 15781 /** 15782 * Array of individual touch events for touch points that are still in 15783 * contact with the touch surface. 15784 * 15785 * @property touches 15786 * @type {DOMEventFacade[]} 15787 */ 15788 this.touches = []; 15789 touchCache = {}; 15790 15791 for (i = 0, l = e.touches.length; i < l; ++i) { 15792 et = e.touches[i]; 15793 touchCache[Y.stamp(et)] = this.touches[i] = new Y.DOMEventFacade(et, currentTarget, wrapper); 15794 } 15795 } 15796 15797 if (e.targetTouches) { 15798 15799 /** 15800 * Array of individual touch events still in contact with the touch 15801 * surface and whose `touchstart` event occurred inside the same taregt 15802 * element as the current target element. 15803 * 15804 * @property targetTouches 15805 * @type {DOMEventFacade[]} 15806 */ 15807 this.targetTouches = []; 15808 15809 for (i = 0, l = e.targetTouches.length; i < l; ++i) { 15810 et = e.targetTouches[i]; 15811 etCached = touchCache && touchCache[Y.stamp(et, true)]; 15812 15813 this.targetTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper); 15814 15815 } 15816 } 15817 15818 if (e.changedTouches) { 15819 15820 /** 15821 An array of event-specific touch events. 15822 15823 For `touchstart`, the touch points that became active with the current 15824 event. 15825 15826 For `touchmove`, the touch points that have changed since the last 15827 event. 15828 15829 For `touchend`, the touch points that have been removed from the touch 15830 surface. 15831 15832 @property changedTouches 15833 @type {DOMEventFacade[]} 15834 **/ 15835 this.changedTouches = []; 15836 15837 for (i = 0, l = e.changedTouches.length; i < l; ++i) { 15838 et = e.changedTouches[i]; 15839 etCached = touchCache && touchCache[Y.stamp(et, true)]; 15840 15841 this.changedTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper); 15842 15843 } 15844 } 15845 15846 if (SCALE in e) { 15847 this[SCALE] = e[SCALE]; 15848 } 15849 15850 if (ROTATION in e) { 15851 this[ROTATION] = e[ROTATION]; 15852 } 15853 15854 if (IDENTIFIER in e) { 15855 this[IDENTIFIER] = e[IDENTIFIER]; 15856 } 15857}; 15858 15859//Adding MSPointer events to whitelisted DOM Events. MSPointer event payloads 15860//have the same properties as mouse events. 15861if (Y.Node.DOM_EVENTS) { 15862 Y.mix(Y.Node.DOM_EVENTS, { 15863 touchstart:1, 15864 touchmove:1, 15865 touchend:1, 15866 touchcancel:1, 15867 gesturestart:1, 15868 gesturechange:1, 15869 gestureend:1, 15870 MSPointerDown:1, 15871 MSPointerUp:1, 15872 MSPointerMove:1, 15873 MSPointerCancel:1, 15874 pointerdown:1, 15875 pointerup:1, 15876 pointermove:1, 15877 pointercancel:1 15878 }); 15879} 15880
15881//Add properties to Y.EVENT.GESTURE_MAP based on feature detection. 15882if ((win && ("ontouchstart" in win)) && !(Y.UA.chrome && Y.UA.chrome < 6)) { 15883 GESTURE_MAP.start = ["touchstart", "mousedown"]; 15884 GESTURE_MAP.end = ["touchend", "mouseup"]; 15885 GESTURE_MAP.move = ["touchmove", "mousemove"]; 15886 GESTURE_MAP.cancel = ["touchcancel", "mousecancel"]; 15887} 15888 15889else if (win && win.PointerEvent) { 15890 GESTURE_MAP.start = "pointerdown"; 15891 GESTURE_MAP.end = "pointerup"; 15892 GESTURE_MAP.move = "pointermove"; 15893 GESTURE_MAP.cancel = "pointercancel"; 15894} 15895 15896else if (win && ("msPointerEnabled" in win.navigator)) { 15897 GESTURE_MAP.start = "MSPointerDown"; 15898 GESTURE_MAP.end = "MSPointerUp"; 15899 GESTURE_MAP.move = "MSPointerMove"; 15900 GESTURE_MAP.cancel = "MSPointerCancel"; 15901} 15902 15903else { 15904 GESTURE_MAP.start = "mousedown"; 15905 GESTURE_MAP.end = "mouseup"; 15906 GESTURE_MAP.move = "mousemove"; 15907 GESTURE_MAP.cancel = "mousecancel"; 15908} 15909 15910/** 15911 * A object literal with keys "start", "end", and "move". The value for each key is a 15912 * string representing the event for that environment. For touch environments, the respective 15913 * values are "touchstart", "touchend" and "touchmove". Mouse and MSPointer environments are also 15914 * supported via feature detection. 15915 * 15916 * @property _GESTURE_MAP 15917 * @type Object 15918 * @static 15919 */ 15920Y.Event._GESTURE_MAP = GESTURE_MAP; 15921 15922 15923}, 'patched-v3.18.3', {"requires": ["node-base"]}); 15924 15925YUI.add('overlay', function (Y, NAME) { 15926 15927/** 15928 * Provides a basic Overlay widget, with Standard Module content support. The Overlay widget 15929 * provides Page XY positioning support, alignment and centering support along with basic 15930 * stackable support (z-index and shimming). 15931 * 15932 * @module overlay 15933 */ 15934 15935/** 15936 * A basic Overlay Widget, which can be positioned based on Page XY co-ordinates and is stackable (z-index support). 15937 * It also provides alignment and centering support and uses a standard module format for it's content, with header, 15938 * body and footer section support. 15939 * 15940 * @class Overlay 15941 * @constructor 15942 * @extends Widget 15943 * @uses WidgetStdMod 15944 * @uses WidgetPosition 15945 * @uses WidgetStack 15946 * @uses WidgetPositionAlign 15947 * @uses WidgetPositionConstrain 15948 * @param {Object} object The user configuration for the instance. 15949 */ 15950Y.Overlay = Y.Base.create("overlay", Y.Widget, [Y.WidgetStdMod, Y.WidgetPosition, Y.WidgetStack, Y.WidgetPositionAlign, Y.WidgetPositionConstrain]); 15951 15952 15953}, 'patched-v3.18.3', { 15954 "requires": [ 15955 "widget", 15956 "widget-stdmod", 15957 "widget-position", 15958 "widget-position-align", 15959 "widget-stack", 15960 "widget-position-constrain" 15961 ], 15962 "skinnable": true 15963}); 15964 15965YUI.add('querystring-stringify', function (Y, NAME) { 15966 15967/** 15968 * Provides Y.QueryString.stringify method for converting objects to Query Strings. 15969 * 15970 * @module querystring 15971 * @submodule querystring-stringify 15972 */ 15973 15974var QueryString = Y.namespace("QueryString"), 15975 stack = [], 15976 L = Y.Lang; 15977 15978/** 15979 * Provides Y.QueryString.escape method to be able to override default encoding 15980 * method. This is important in cases where non-standard delimiters are used, if 15981 * the delimiters would not normally be handled properly by the builtin 15982 * (en|de)codeURIComponent functions. 15983 * Default: encodeURIComponent 15984 * 15985 * @method escape 15986 * @for QueryString 15987 * @static 15988 **/ 15989QueryString.escape = encodeURIComponent; 15990 15991/** 15992 * <p>Converts an arbitrary value to a Query String representation.</p> 15993 * 15994 * <p>Objects with cyclical references will trigger an exception.</p> 15995 * 15996 * @method stringify 15997 * @for QueryString 15998 * @public 15999 * @param obj {Any} any arbitrary value to convert to query string 16000 * @param cfg {Object} (optional) Configuration object. The three 16001 * supported configurations are: 16002 * <ul><li>sep: When defined, the value will be used as the key-value 16003 * separator. The default value is "&".</li> 16004 * <li>eq: When defined, the value will be used to join the key to 16005 * the value. The default value is "=".</li> 16006 * <li>arrayKey: When set to true, the key of an array will have the 16007 * '[]' notation appended to the key. The default value is false. 16008 * </li></ul> 16009 * @param name {String} (optional) Name of the current key, for handling children recursively. 16010 * @static 16011 */ 16012QueryString.stringify = function (obj, c, name) { 16013 var begin, end, i, l, n, s, 16014 sep = c && c.sep ? c.sep : "&", 16015 eq = c && c.eq ? c.eq : "=", 16016 aK = c && c.arrayKey ? c.arrayKey : false;
16017 16018 if (L.isNull(obj) || L.isUndefined(obj) || L.isFunction(obj)) { 16019 return name ? QueryString.escape(name) + eq : ''; 16020 } 16021 16022 if (L.isBoolean(obj) || Object.prototype.toString.call(obj) === '[object Boolean]') { 16023 obj =+ obj; 16024 } 16025 16026 if (L.isNumber(obj) || L.isString(obj)) { 16027 return QueryString.escape(name) + eq + QueryString.escape(obj); 16028 } 16029 16030 if (L.isArray(obj)) { 16031 s = []; 16032 name = aK ? name + '[]' : name; 16033 l = obj.length; 16034 for (i = 0; i < l; i++) { 16035 s.push( QueryString.stringify(obj[i], c, name) ); 16036 } 16037 16038 return s.join(sep); 16039 } 16040 // now we know it's an object. 16041 16042 // Check for cyclical references in nested objects 16043 for (i = stack.length - 1; i >= 0; --i) { 16044 if (stack[i] === obj) { 16045 throw new Error("QueryString.stringify. Cyclical reference"); 16046 } 16047 } 16048 16049 stack.push(obj); 16050 s = []; 16051 begin = name ? name + '[' : ''; 16052 end = name ? ']' : ''; 16053 for (i in obj) { 16054 if (obj.hasOwnProperty(i)) { 16055 n = begin + i + end; 16056 s.push(QueryString.stringify(obj[i], c, n)); 16057 } 16058 } 16059 16060 stack.pop(); 16061 s = s.join(sep); 16062 if (!s && name) { 16063 return name + "="; 16064 } 16065 16066 return s; 16067}; 16068 16069 16070}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 16071 16072YUI.add('widget-child', function (Y, NAME) { 16073 16074/** 16075 * Extension enabling a Widget to be a child of another Widget. 16076 * 16077 * @module widget-child 16078 */ 16079 16080var Lang = Y.Lang; 16081 16082/** 16083 * Widget extension providing functionality enabling a Widget to be a 16084 * child of another Widget. 16085 * 16086 * @class WidgetChild 16087 * @param {Object} config User configuration object. 16088*/ 16089function Child() { 16090 16091 // Widget method overlap 16092 Y.after(this._syncUIChild, this, "syncUI"); 16093 Y.after(this._bindUIChild, this, "bindUI"); 16094 16095} 16096 16097Child.ATTRS = { 16098 16099 /** 16100 * @attribute selected 16101 * @type Number 16102 * @default 0 16103 * 16104 * @description Number indicating if the Widget is selected. Possible 16105 * values are: 16106 * <dl> 16107 * <dt>0</dt> <dd>(Default) Not selected</dd> 16108 * <dt>1</dt> <dd>Fully selected</dd> 16109 * <dt>2</dt> <dd>Partially selected</dd> 16110 * </dl> 16111 */ 16112 selected: { 16113 value: 0, 16114 validator: Lang.isNumber 16115 }, 16116 16117 16118 /** 16119 * @attribute index 16120 * @type Number 16121 * @readOnly 16122 * 16123 * @description Number representing the Widget's ordinal position in its 16124 * parent Widget. 16125 */ 16126 index: { 16127 readOnly: true, 16128 getter: function () { 16129 16130 var parent = this.get("parent"), 16131 index = -1; 16132 16133 if (parent) { 16134 index = parent.indexOf(this); 16135 } 16136 16137 return index; 16138 16139 } 16140 }, 16141 16142 16143 /** 16144 * @attribute parent 16145 * @type Widget 16146 * @readOnly 16147 * 16148 * @description Retrieves the parent of the Widget in the object hierarchy. 16149 */ 16150 parent: { 16151 readOnly: true 16152 }, 16153 16154 16155 /** 16156 * @attribute depth 16157 * @type Number 16158 * @default -1 16159 * @readOnly 16160 * 16161 * @description Number representing the depth of this Widget relative to 16162 * the root Widget in the object heirarchy. 16163 */ 16164 depth: { 16165 readOnly: true, 16166 getter: function () { 16167 16168 var parent = this.get("parent"), 16169 root = this.get("root"), 16170 depth = -1; 16171 16172 while (parent) { 16173 16174 depth = (depth + 1); 16175 16176 if (parent == root) { 16177 break; 16178 } 16179 16180 parent = parent.get("parent"); 16181 16182 } 16183 16184 return depth; 16185 16186 } 16187 }, 16188 16189 /** 16190 * @attribute root 16191 * @type Widget 16192 * @readOnly 16193 * 16194 * @description Returns the root Widget in the object hierarchy. If the 16195 * ROOT_TYPE property is set, the search for the root Widget will be 16196 * constrained to parent Widgets of the specified type. 16197 */ 16198 root: { 16199 readOnly: true, 16200 getter: function () { 16201 16202 var getParent = function (child) { 16203 16204 var parent = child.get("parent"), 16205 FnRootType = child.ROOT_TYPE, 16206 criteria = parent; 16207 16208 if (FnRootType) { 16209 criteria = (parent && Y.instanceOf(parent, FnRootType)); 16210 } 16211 16212 return (criteria ? getParent(parent) : child); 16213 16214 }; 16215 16216 return getParent(this); 16217 16218 } 16219 } 16220 16221}; 16222 16223Child.prototype = { 16224 16225 /** 16226 * Constructor reference used to determine the root of a Widget-based 16227 * object tree. 16228 * <p> 16229 * Currently used to control the behavior of the <code>root</code> 16230 * attribute so that recursing up the object heirarchy can be constrained 16231 * to a specific type of Widget. Widget authors should set this property 16232 * to the constructor function for a given Widget implementation. 16233 * </p> 16234 * 16235 * @property ROOT_TYPE 16236 * @type Object 16237 */ 16238 ROOT_TYPE: null, 16239 16240 /** 16241 * Returns the node on which to bind delegate listeners. 16242 * 16243 * Override of Widget's implementation of _getUIEventNode() to ensure that 16244 * all event listeners are bound to the Widget's topmost DOM element. 16245 * This ensures that the firing of each type of Widget UI event (click, 16246 * mousedown, etc.) is facilitated by a single, top-level, delegated DOM 16247 * event listener. 16248 * 16249 * @method _getUIEventNode 16250 * @for Widget 16251 * @protected 16252 */ 16253 _getUIEventNode: function () { 16254 var root = this.get("root"), 16255 returnVal; 16256 16257 if (root) { 16258 returnVal = root.get("boundingBox"); 16259 } 16260 16261 return returnVal; 16262 }, 16263 16264 /** 16265 * @method next
16266 * @description Returns the Widget's next sibling. 16267 * @param {Boolean} circular Boolean indicating if the parent's first child 16268 * should be returned if the child has no next sibling. 16269 * @return {Widget} Widget instance. 16270 */ 16271 next: function (circular) { 16272 16273 var parent = this.get("parent"), 16274 sibling; 16275 16276 if (parent) { 16277 sibling = parent.item((this.get("index")+1)); 16278 } 16279 16280 if (!sibling && circular) { 16281 sibling = parent.item(0); 16282 } 16283 16284 return sibling; 16285 16286 }, 16287 16288 16289 /** 16290 * @method previous 16291 * @description Returns the Widget's previous sibling. 16292 * @param {Boolean} circular Boolean indicating if the parent's last child 16293 * should be returned if the child has no previous sibling. 16294 * @return {Widget} Widget instance. 16295 */ 16296 previous: function (circular) { 16297 16298 var parent = this.get("parent"), 16299 index = this.get("index"), 16300 sibling; 16301 16302 if (parent && index > 0) { 16303 sibling = parent.item([(index-1)]); 16304 } 16305 16306 if (!sibling && circular) { 16307 sibling = parent.item((parent.size() - 1)); 16308 } 16309 16310 return sibling; 16311 16312 }, 16313 16314 16315 // Override of Y.WidgetParent.remove() 16316 // Sugar implementation allowing a child to remove itself from its parent. 16317 remove: function (index) { 16318 16319 var parent, 16320 removed; 16321 16322 if (Lang.isNumber(index)) { 16323 removed = Y.WidgetParent.prototype.remove.apply(this, arguments); 16324 } 16325 else { 16326 16327 parent = this.get("parent"); 16328 16329 if (parent) { 16330 removed = parent.remove(this.get("index")); 16331 } 16332 16333 } 16334 16335 return removed; 16336 16337 }, 16338 16339 16340 /** 16341 * @method isRoot 16342 * @description Determines if the Widget is the root Widget in the 16343 * object hierarchy. 16344 * @return {Boolean} Boolean indicating if Widget is the root Widget in the 16345 * object hierarchy. 16346 */ 16347 isRoot: function () { 16348 return (this == this.get("root")); 16349 }, 16350 16351 16352 /** 16353 * @method ancestor 16354 * @description Returns the Widget instance at the specified depth. 16355 * @param {number} depth Number representing the depth of the ancestor. 16356 * @return {Widget} Widget instance. 16357 */ 16358 ancestor: function (depth) { 16359 16360 var root = this.get("root"), 16361 parent; 16362 16363 if (this.get("depth") > depth) { 16364 16365 parent = this.get("parent"); 16366 16367 while (parent != root && parent.get("depth") > depth) { 16368 parent = parent.get("parent"); 16369 } 16370 16371 } 16372 16373 return parent; 16374 16375 }, 16376 16377 16378 /** 16379 * Updates the UI to reflect the <code>selected</code> attribute value. 16380 * 16381 * @method _uiSetChildSelected 16382 * @protected 16383 * @param {number} selected The selected value to be reflected in the UI. 16384 */ 16385 _uiSetChildSelected: function (selected) { 16386 16387 var box = this.get("boundingBox"), 16388 sClassName = this.getClassName("selected"); 16389 16390 if (selected === 0) { 16391 box.removeClass(sClassName); 16392 } 16393 else { 16394 box.addClass(sClassName); 16395 } 16396 16397 }, 16398 16399 16400 /** 16401 * Default attribute change listener for the <code>selected</code> 16402 * attribute, responsible for updating the UI, in response to 16403 * attribute changes. 16404 * 16405 * @method _afterChildSelectedChange 16406 * @protected 16407 * @param {EventFacade} event The event facade for the attribute change. 16408 */ 16409 _afterChildSelectedChange: function (event) { 16410 this._uiSetChildSelected(event.newVal); 16411 }, 16412 16413 16414 /** 16415 * Synchronizes the UI to match the WidgetChild state. 16416 * <p> 16417 * This method is invoked after bindUI is invoked for the Widget class 16418 * using YUI's aop infrastructure. 16419 * </p> 16420 * 16421 * @method _syncUIChild 16422 * @protected 16423 */ 16424 _syncUIChild: function () { 16425 this._uiSetChildSelected(this.get("selected")); 16426 }, 16427 16428 16429 /** 16430 * Binds event listeners responsible for updating the UI state in response 16431 * to WidgetChild related state changes. 16432 * <p> 16433 * This method is invoked after bindUI is invoked for the Widget class
16434 * using YUI's aop infrastructure. 16435 * </p> 16436 * @method _bindUIChild 16437 * @protected 16438 */ 16439 _bindUIChild: function () { 16440 this.after("selectedChange", this._afterChildSelectedChange); 16441 } 16442 16443}; 16444 16445Y.WidgetChild = Child; 16446 16447 16448}, 'patched-v3.18.3', {"requires": ["base-build", "widget"]}); 16449
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.