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.1', {"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.1', {"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.60'); 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.60'); 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.60', {"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.60', { 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.60'); 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.60', {"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.60', {"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.60', {"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 4913 if (fieldContainer) { 4914 return field.ancestor(fieldContainer); 4915 } 4916 }, 4917 4918 /** 4919 * Focus on the invalid field. 4920 *
4921 * @method focusInvalidField 4922 */ 4923 focusInvalidField: function() { 4924 var instance = this, 4925 boundingBox = instance.get('boundingBox'), 4926 field = boundingBox.one('.' + CSS_ERROR_FIELD); 4927 4928 if (field) { 4929 if (instance.get('selectText')) { 4930 field.selectText(); 4931 } 4932 4933 field.focus(); 4934 4935 field.scrollIntoView(); 4936 } 4937 }, 4938 4939 /** 4940 * Gets a field from the form. 4941 * 4942 * @method getField 4943 * @param {Node|String} field 4944 * @return {Node} 4945 */ 4946 getField: function(field) { 4947 var instance = this; 4948 4949 if (isString(field)) { 4950 field = instance.getFieldsByName(field); 4951 4952 if (field && field.length && !field.name) { 4953 field = field[0]; 4954 } 4955 } 4956 4957 return A.one(field); 4958 }, 4959 4960 /** 4961 * Gets a list of fields based on its name. 4962 * 4963 * @method getFieldsByName 4964 * @param fieldName 4965 * @return {NodeList} 4966 */ 4967 getFieldsByName: function(fieldName) { 4968 var instance = this, 4969 domBoundingBox = instance.get('boundingBox').getDOM(); 4970 4971 return domBoundingBox.elements[fieldName]; 4972 }, 4973 4974 /** 4975 * Gets a list of fields with errors. 4976 * 4977 * @method getFieldError 4978 * @param {Node} field 4979 * @return {String} 4980 */ 4981 getFieldError: function(field) { 4982 var instance = this; 4983 4984 return instance.errors[field.get('name')]; 4985 }, 4986 4987 /** 4988 * Gets the stack error container of a field. 4989 * 4990 * @method getFieldStackErrorContainer 4991 * @param {Node|String} field 4992 * @return {Node} 4993 */ 4994 getFieldStackErrorContainer: function(field) { 4995 var instance = this, 4996 name = isNode(field) ? field.get('name') : field, 4997 stackContainers = instance._stackErrorContainers; 4998 4999 if (!stackContainers[name]) { 5000 stackContainers[name] = instance.get('stackErrorContainer'); 5001 } 5002 5003 return stackContainers[name]; 5004 }, 5005 5006 /** 5007 * Gets the error message of a field. 5008 * 5009 * @method getFieldErrorMessage 5010 * @param {Node} field 5011 * @param rule 5012 * @return {String} 5013 */ 5014 getFieldErrorMessage: function(field, rule) { 5015 var instance = this, 5016 fieldName = field.get('name'), 5017 fieldStrings = instance.get('fieldStrings')[fieldName] || {}, 5018 fieldRules = instance.get('rules')[fieldName], 5019 fieldLabel = instance._findFieldLabel(field), 5020 strings = instance.get('strings'), 5021 substituteRulesMap = {}; 5022 5023 if (fieldLabel) { 5024 substituteRulesMap.field = fieldLabel; 5025 } 5026 5027 if (rule in fieldRules) { 5028 var ruleValue = A.Array(fieldRules[rule]); 5029 5030 A.each( 5031 ruleValue, 5032 function(value, index) { 5033 substituteRulesMap[index] = [value].join(''); 5034 } 5035 ); 5036 } 5037 5038 var message = (fieldStrings[rule] || strings[rule] || strings.DEFAULT); 5039 5040 return Lang.sub(message, substituteRulesMap); 5041 }, 5042 5043 /** 5044 * Returns `true` if there are errors. 5045 * 5046 * @method hasErrors 5047 * @return {Boolean} 5048 */ 5049 hasErrors: function() { 5050 var instance = this; 5051 5052 return !isEmpty(instance.errors); 5053 }, 5054 5055 /** 5056 * Highlights a field with error or success. 5057 * 5058 * @method highlight 5059 * @param {Node} field 5060 * @param valid 5061 */ 5062 highlight: function(field, valid) { 5063 var instance = this, 5064 fieldContainer, 5065 fieldName, 5066 namedFieldNodes; 5067 5068 if (field) { 5069 fieldContainer = instance.findFieldContainer(field); 5070 5071 fieldName = field.get('name'); 5072 5073 if (this.validatable(field)) { 5074 namedFieldNodes = A.all(instance.getFieldsByName(fieldName)); 5075 5076 namedFieldNodes.each( 5077 function(node) { 5078 instance._highlightHelper( 5079 node, 5080 instance.get('errorClass'), 5081 instance.get('validClass'),
5082 valid 5083 ); 5084 } 5085 ); 5086 5087 if (fieldContainer) { 5088 instance._highlightHelper( 5089 fieldContainer, 5090 instance.get('containerErrorClass'), 5091 instance.get('containerValidClass'), 5092 valid 5093 ); 5094 } 5095 } 5096 else if (!field.val()) { 5097 instance.resetField(fieldName); 5098 } 5099 } 5100 }, 5101 5102 /** 5103 * Normalizes rule value. 5104 * 5105 * @method normalizeRuleValue 5106 * @param ruleValue 5107 * @param {Node} field 5108 */ 5109 normalizeRuleValue: function(ruleValue, field) { 5110 var instance = this; 5111 5112 return isFunction(ruleValue) ? ruleValue.apply(instance, [field]) : ruleValue; 5113 }, 5114 5115 /** 5116 * Removes the highlight of a field. 5117 * 5118 * @method unhighlight 5119 * @param {Node} field 5120 */ 5121 unhighlight: function(field) { 5122 var instance = this; 5123 5124 instance.highlight(field, true); 5125 }, 5126 5127 /** 5128 * Prints the stack error messages into a container. 5129 * 5130 * @method printStackError 5131 * @param {Node} field 5132 * @param {Node} container 5133 * @param {Array} errors 5134 */ 5135 printStackError: function(field, container, errors) { 5136 var instance = this; 5137 5138 if (!instance.get('showAllMessages')) { 5139 if (A.Array.indexOf(errors, 'required') !== -1) { 5140 errors = ['required']; 5141 } 5142 else { 5143 errors = errors.slice(0, 1); 5144 } 5145 } 5146 5147 container.empty(); 5148 5149 A.Array.each( 5150 errors, 5151 function(error) { 5152 var message = instance.getFieldErrorMessage(field, error), 5153 messageEl = instance.get('messageContainer').addClass(error); 5154 5155 container.append( 5156 messageEl.html(message) 5157 ); 5158 } 5159 ); 5160 }, 5161 5162 /** 5163 * Resets the CSS class and content of all fields. 5164 * 5165 * @method resetAllFields 5166 */ 5167 resetAllFields: function() { 5168 var instance = this; 5169 5170 instance.eachRule( 5171 function(rule, fieldName) { 5172 instance.resetField(fieldName); 5173 } 5174 ); 5175 }, 5176 5177 /** 5178 * Resets the CSS class and error status of a field. 5179 * 5180 * @method resetField 5181 * @param {Node|String} field 5182 */ 5183 resetField: function(field) { 5184 var instance = this, 5185 fieldName, 5186 namedFieldNodes, 5187 stackContainer; 5188 5189 fieldName = isNode(field) ? field.get('name') : field; 5190 5191 instance.clearFieldError(fieldName); 5192 5193 stackContainer = instance.getFieldStackErrorContainer(fieldName); 5194 5195 stackContainer.remove(); 5196 5197 namedFieldNodes = A.all(instance.getFieldsByName(fieldName)); 5198 5199 namedFieldNodes.each( 5200 function(node) { 5201 instance.resetFieldCss(node); 5202 node.removeAttribute('aria-errormessage'); 5203 node.removeAttribute('aria-invalid'); 5204 } 5205 ); 5206 }, 5207 5208 /** 5209 * Removes the CSS classes of a field. 5210 * 5211 * @method resetFieldCss 5212 * @param {Node} field 5213 */ 5214 resetFieldCss: function(field) { 5215 var instance = this, 5216 fieldContainer = instance.findFieldContainer(field); 5217 5218 var removeClasses = function(elem, classAttrs) { 5219 if (elem) { 5220 A.each(classAttrs, function(attrName) { 5221 elem.removeClass( 5222 instance.get(attrName) 5223 ); 5224 }); 5225 } 5226 }; 5227 5228 removeClasses(field, ['validClass', 'errorClass']); 5229 removeClasses(fieldContainer, ['containerValidClass', 'containerErrorClass']); 5230 }, 5231 5232 /** 5233 * Checks if a field can be validated or not. 5234 * 5235 * @method validatable 5236 * @param {Node} field 5237 * @return {Boolean} 5238 */ 5239 validatable: function(field) { 5240 var instance = this, 5241 validatable = false, 5242 fieldRules = instance.get('rules')[field.get('name')]; 5243 5244 if (fieldRules) { 5245 validatable = instance.normalizeRuleValue(fieldRules.required, field) || 5246 defaults.RULES.hasValue.apply(instance, [field.val(), field]); 5247 } 5248 5249 return !!validatable; 5250 }, 5251 5252 /** 5253 * Validates all fields. 5254 * 5255 * @method validate 5256 */ 5257 validate: function() { 5258 var instance = this; 5259 5260 instance.eachRule( 5261 function(rule, fieldName) { 5262 instance.validateField(fieldName); 5263 } 5264 ); 5265 5266 instance.focusInvalidField(); 5267 }, 5268 5269 /** 5270 * Validates a single field. 5271 * 5272 * @method validateField 5273 * @param {Node|String} field 5274 */ 5275 validateField: function(field) { 5276 var fieldNode, 5277 validatable; 5278 5279 this.resetField(field); 5280 fieldNode = isString(field) ? this.getField(field) : field; 5281 5282 if (isNode(fieldNode)) { 5283 validatable = this.validatable(fieldNode); 5284 5285 if (validatable) { 5286 this.fire('validateField', { 5287 validator: { 5288 field: fieldNode 5289 } 5290 }); 5291 } 5292 } 5293 }, 5294 5295 /** 5296 * Fires after `extractRules` attribute change. 5297 *
5298 * @method _afterExtractRulesChange 5299 * @param event 5300 * @protected 5301 */ 5302 _afterExtractRulesChange: function(event) { 5303 var instance = this; 5304 5305 instance._uiSetExtractRules(event.newVal); 5306 }, 5307 5308 /** 5309 * Fires after `validateOnBlur` attribute change. 5310 * 5311 * @method _afterValidateOnBlurChange 5312 * @param event 5313 * @protected 5314 */ 5315 _afterValidateOnBlurChange: function(event) { 5316 var instance = this; 5317 5318 instance._uiSetValidateOnBlur(event.newVal); 5319 }, 5320 5321 /** 5322 * Fires after `validateOnInput` attribute change. 5323 * 5324 * @method _afterValidateOnInputChange 5325 * @param event 5326 * @protected 5327 */ 5328 _afterValidateOnInputChange: function(event) { 5329 var instance = this; 5330 5331 instance._uiSetValidateOnInput(event.newVal); 5332 }, 5333 5334 /** 5335 * Defines an error field. 5336 * 5337 * @method _defErrorFieldFn 5338 * @param event 5339 * @protected 5340 */ 5341 _defErrorFieldFn: function(event) { 5342 var instance = this, 5343 field, 5344 label, 5345 stackContainer, 5346 target, 5347 validator; 5348 5349 label = instance.get('labelCssClass'); 5350 validator = event.validator; 5351 field = validator.field; 5352 5353 instance.highlight(field); 5354 5355 if (instance.get('showMessages')) { 5356 target = field; 5357 5358 stackContainer = instance.getFieldStackErrorContainer(field); 5359 5360 if (A.FormValidator.isCheckable(target)) { 5361 target = field.ancestor('.' + CSS_HAS_ERROR).get('lastChild'); 5362 } 5363 5364 var id = field.get('id') + 'Helper'; 5365 5366 stackContainer.set('id', id); 5367 5368 target.placeAfter(stackContainer); 5369 5370 instance.printStackError( 5371 field, 5372 stackContainer, 5373 validator.errors 5374 ); 5375 } 5376 }, 5377 5378 /** 5379 * Defines a valid field. 5380 * 5381 * @method _defValidFieldFn 5382 * @param event 5383 * @protected 5384 */ 5385 _defValidFieldFn: function(event) { 5386 var instance = this; 5387 5388 var field = event.validator.field; 5389 5390 instance.unhighlight(field); 5391 }, 5392 5393 /** 5394 * Defines the validation of a field. 5395 * 5396 * @method _defValidateFieldFn 5397 * @param event 5398 * @protected 5399 */ 5400 _defValidateFieldFn: function(event) { 5401 var instance = this; 5402 5403 var field = event.validator.field; 5404 var fieldRules = instance.get('rules')[field.get('name')]; 5405 5406 A.each( 5407 fieldRules, 5408 function(ruleValue, ruleName) { 5409 var rule = defaults.RULES[ruleName]; 5410 var fieldValue = trim(field.val()); 5411 5412 ruleValue = instance.normalizeRuleValue(ruleValue, field); 5413 5414 if (isFunction(rule) && !rule.apply(instance, [fieldValue, field, ruleValue])) { 5415 5416 instance.addFieldError(field, ruleName); 5417 } 5418 } 5419 ); 5420 5421 var fieldErrors = instance.getFieldError(field); 5422 5423 if (fieldErrors) { 5424 instance.fire('errorField', { 5425 validator: { 5426 field: field, 5427 errors: fieldErrors 5428 } 5429 }); 5430 } 5431 else { 5432 instance.fire('validField', { 5433 validator: { 5434 field: field 5435 } 5436 }); 5437 } 5438 }, 5439 5440 /** 5441 * Finds the label text of a field if existing. 5442 * 5443 * @method _findFieldLabel 5444 * @param {Node} field 5445 * @return {String} 5446 */ 5447 _findFieldLabel: function(field) { 5448 var labelCssClass = '.' + this.get('labelCssClass'),
5449 label = A.one('label[for=' + field.get('id') + ']') || 5450 field.ancestor().previous(labelCssClass); 5451 5452 if (!label) { 5453 label = field.ancestor('.' + CSS_HAS_ERROR); 5454 5455 if (label) { 5456 label = label.one(labelCssClass); 5457 } 5458 } 5459 5460 if (label) { 5461 return label.get('text'); 5462 } 5463 }, 5464 5465 /** 5466 * Sets the error/success CSS classes based on the validation of a 5467 * field. 5468 * 5469 * @method _highlightHelper 5470 * @param {Node} field 5471 * @param {String} errorClass 5472 * @param {String} validClass 5473 * @param {Boolean} valid 5474 * @protected 5475 */ 5476 _highlightHelper: function(field, errorClass, validClass, valid) { 5477 var instance = this; 5478 5479 if (valid) { 5480 field.removeClass(errorClass).addClass(validClass); 5481 5482 if (validClass === CSS_SUCCESS_FIELD) { 5483 field.removeAttribute('aria-errormessage'); 5484 field.removeAttribute('aria-invalid'); 5485 } 5486 } 5487 else { 5488 field.removeClass(validClass).addClass(errorClass); 5489 5490 if (errorClass === CSS_ERROR_FIELD) { 5491 field.set('aria-errormessage', field.get('id') + 'Helper'); 5492 field.set('aria-invalid', true); 5493 } 5494 } 5495 }, 5496 5497 /** 5498 * Extracts form rules from the DOM. 5499 * 5500 * @method _extractRulesFromMarkup 5501 * @param rules 5502 * @protected 5503 */ 5504 _extractRulesFromMarkup: function(rules) { 5505 var instance = this, 5506 domBoundingBox = instance.get('boundingBox').getDOM(), 5507 elements = domBoundingBox.elements, 5508 defaultRulesKeys = AObject.keys(defaults.RULES), 5509 defaultRulesJoin = defaultRulesKeys.join('|'), 5510 regex = getRegExp('field-(' + defaultRulesJoin + ')', 'g'), 5511 i, 5512 length, 5513 ruleNameMatch = [], 5514 ruleMatcher = function(m1, m2) { 5515 ruleNameMatch.push(m2); 5516 }; 5517 5518 for (i = 0, length = elements.length; i < length; i++) { 5519 var el = elements[i], 5520 fieldName = el.name; 5521 5522 el.className.replace(regex, ruleMatcher); 5523 5524 if (ruleNameMatch.length) { 5525 var fieldRules = rules[fieldName], 5526 j, 5527 ruleNameLength; 5528 5529 if (!fieldRules) { 5530 fieldRules = {}; 5531 rules[fieldName] = fieldRules; 5532 } 5533 for (j = 0, ruleNameLength = ruleNameMatch.length; j < ruleNameLength; j++) { 5534 var rule = ruleNameMatch[j]; 5535 5536 if (!(rule in fieldRules)) { 5537 fieldRules[rule] = true; 5538 } 5539 } 5540 ruleNameMatch.length = 0; 5541 } 5542 } 5543 5544 instance._rulesAlreadyExtracted = true; 5545 }, 5546 5547 /** 5548 * Triggers when there's an input in the field. 5549 * 5550 * @method _onFieldInput 5551 * @param event 5552 * @protected 5553 */ 5554 _onFieldInput: function(event) { 5555 var instance = this; 5556 5557 var skipValidationTargetSelector = instance.get('skipValidationTargetSelector'); 5558 5559 if (!event.relatedTarget || !event.relatedTarget.getDOMNode().matches(skipValidationTargetSelector)) { 5560 instance.validateField(event.target); 5561 } 5562 }, 5563 5564 /** 5565 * Triggers when the form is submitted. 5566 * 5567 * @method _onFormSubmit 5568 * @param event 5569 * @protected 5570 */ 5571 _onFormSubmit: function(event) { 5572 var instance = this; 5573 5574 var data = { 5575 validator: { 5576 formEvent: event 5577 } 5578 }; 5579 5580 instance.validate(); 5581 5582 if (instance.hasErrors()) { 5583 data.validator.errors = instance.errors; 5584 5585 instance.fire('submitError', data); 5586 5587 event.halt(); 5588 } 5589 else { 5590 instance.fire('submit', data); 5591 } 5592 }, 5593 5594 /** 5595 * Triggers when the form is reseted. 5596 * 5597 * @method _onFormReset 5598 * @param event 5599 * @protected 5600 */ 5601 _onFormReset: function() { 5602 var instance = this; 5603 5604 instance.resetAllFields(); 5605 }, 5606 5607 /** 5608 * Sets the aria roles. 5609 * 5610 * @method _setARIARoles 5611 * @protected 5612 */ 5613 _setARIARoles: function() { 5614 var instance = this; 5615 5616 instance.eachRule( 5617 function(rule, fieldName) { 5618 var field = instance.getField(fieldName); 5619 5620 var required = instance.normalizeRuleValue(rule.required, field); 5621 5622 if (required) { 5623 if (field && !field.attr('aria-required')) { 5624 field.attr('aria-required', true); 5625 } 5626 } 5627 } 5628 ); 5629 }, 5630 5631 /** 5632 * Sets the `extractRules` attribute on the UI. 5633 * 5634 * @method _uiSetExtractRules 5635 * @param val 5636 * @protected 5637 */ 5638 _uiSetExtractRules: function(val) { 5639 var instance = this; 5640 if (val) { 5641 instance._extractRulesFromMarkup(instance.get('rules')); 5642 } 5643 }, 5644 5645 /** 5646 * Sets the `validateOnInput` attribute on the UI. 5647 * 5648 * @method _uiSetValidateOnInput 5649 * @param val 5650 * @protected 5651 */ 5652 _uiSetValidateOnInput: function(val) { 5653 var instance = this, 5654 boundingBox = instance.get('boundingBox'); 5655 5656 if (val) { 5657 if (!instance._inputHandlers) { 5658 instance._inputHandlers = boundingBox.delegate('input', instance._onFieldInput, 5659 'input:not([type="file"]),select,textarea,button', instance); 5660 } 5661 5662 if (!instance._fileInputHandlers) { 5663 instance._fileInputHandlers = boundingBox.delegate('change', instance._onFieldInput, 5664 'input[type="file"]', instance); 5665 } 5666 } 5667 else { 5668 if (instance._inputHandlers) { 5669 instance._inputHandlers.detach(); 5670 } 5671 5672 if (instance._fileInputHandlers) { 5673 instance._fileInputHandlers.detach(); 5674 } 5675 } 5676 }, 5677 5678 /** 5679 * Sets the `validateOnBlur` attribute on the UI. 5680 * 5681 * @method _uiSetValidateOnBlur 5682 * @param val 5683 * @protected 5684 */ 5685 _uiSetValidateOnBlur: function(val) { 5686 var instance = this, 5687 boundingBox = instance.get('boundingBox'); 5688 5689 if (val) { 5690 if (!instance._blurHandlers) { 5691 instance._blurHandlers = boundingBox.delegate('blur', instance._onFieldInput, 5692 'input:not([type="file"]),select,textarea,button', instance); 5693 } 5694 5695 if (!instance._fileBlurHandlers) { 5696 instance._fileBlurHandlers = boundingBox.delegate('change', instance._onFieldInput, 5697 'input[type="file"]', instance); 5698 } 5699 } 5700 else { 5701 if (instance._blurHandlers) { 5702 instance._blurHandlers.detach(); 5703 } 5704 5705 if (instance._fileBlurHandlers) { 5706 instance._fileBlurHandlers.detach(); 5707 } 5708 } 5709 } 5710 } 5711}); 5712 5713A.each( 5714 defaults.REGEX, 5715 function(regex, key) { 5716 defaults.RULES[key] = function(val) { 5717 return defaults.REGEX[key].test(val); 5718 }; 5719 } 5720); 5721 5722A.FormValidator = FormValidator; 5723 5724 5725}, '3.1.0-deprecated.60', { 5726 "requires": [ 5727 "escape", 5728 "selector-css3", 5729 "node-event-delegate", 5730 "aui-node", 5731 "aui-component", 5732 "aui-event-input" 5733 ] 5734}); 5735 5736YUI.add('aui-node-base', function (A, NAME) { 5737 5738/** 5739 * A set of utility methods to the Node. 5740 * 5741 * @module aui-node 5742 * @submodule aui-node-base 5743 */ 5744 5745var Lang = A.Lang, 5746 isArray = Lang.isArray, 5747 isFunction = Lang.isFunction, 5748 isObject = Lang.isObject, 5749 isString = Lang.isString, 5750 isUndefined = Lang.isUndefined, 5751 isValue = Lang.isValue, 5752 5753 AArray = A.Array, 5754 ANode = A.Node, 5755 ANodeList = A.NodeList, 5756 5757 getClassName = A.getClassName, 5758 getRegExp = A.DOM._getRegExp, 5759 5760 CONFIG = A.config, 5761 DOC = CONFIG.doc, 5762 WIN = CONFIG.win, 5763 5764 NODE_PROTO = ANode.prototype, 5765 NODE_PROTO_HIDE = NODE_PROTO._hide, 5766 NODE_PROTO_SHOW = NODE_PROTO._show, 5767 NODELIST_PROTO = ANodeList.prototype, 5768 5769 ARRAY_EMPTY_STRINGS = ['', ''], 5770 5771 CSS_HIDE = getClassName('hide'), 5772 CSS_UNSELECTABLE_VALUE = 'none', 5773 CSS_SELECTABLE_VALUE = 'text', 5774 5775 SUPPORT_CLONED_EVENTS = false, 5776 5777 MAP_BORDER = { 5778 b: 'borderBottomWidth', 5779 l: 'borderLeftWidth', 5780 r: 'borderRightWidth', 5781 t: 'borderTopWidth' 5782 }, 5783 MAP_MARGIN = { 5784 b: 'marginBottom', 5785 l: 'marginLeft', 5786 r: 'marginRight', 5787 t: 'marginTop' 5788 }, 5789 MAP_PADDING = { 5790 b: 'paddingBottom', 5791 l: 'paddingLeft', 5792 r: 'paddingRight', 5793 t: 'paddingTop' 5794 }; 5795 5796/* Parts of this file are used from jQuery (http://jquery.com) 5797 * Dual-licensed under MIT/GPL 5798 */ 5799var div = DOC.createElement('div'); 5800 5801div.style.display = 'none'; 5802div.innerHTML = ' <table></table> '; 5803 5804if (div.attachEvent && div.fireEvent) { 5805 div.attachEvent( 5806 'onclick', 5807 function detach() { 5808 SUPPORT_CLONED_EVENTS = true; 5809 5810 div.detachEvent('onclick', detach); 5811 } 5812 ); 5813 5814 div.cloneNode(true).fireEvent('onclick'); 5815} 5816 5817var SUPPORT_OPTIONAL_TBODY = !div.getElementsByTagName('tbody').length; 5818 5819var REGEX_LEADING_WHITE_SPACE = /^\s+/, 5820 REGEX_IE8_ACTION = /\=([^=\x27\x22>\s]+\/)>/g, 5821 REGEX_TAGNAME = /<([\w:]+)/; 5822 5823div = null; 5824 5825var _setUnselectable = function(element, unselectable, noRecurse) { 5826 var descendants, 5827 value = unselectable ? 'on' : '', 5828 i, 5829 descendant; 5830 5831 element.setAttribute('unselectable', value); 5832 5833 if (!noRecurse) { 5834 descendants = element.getElementsByTagName('*'); 5835 5836 for (i = 0;
5837 (descendant = descendants[i]); i++) { 5838 descendant.setAttribute('unselectable', value); 5839 } 5840 } 5841}; 5842 5843/** 5844 * Augments the [YUI3 Node](Node.html) with more util methods. 5845 * 5846 * Check the [live demo](http://alloyui.com/examples/node/). 5847 * 5848 * @class A.Node 5849 * @uses Node 5850 * @constructor 5851 * @include http://alloyui.com/examples/node/basic-markup.html 5852 * @include http://alloyui.com/examples/node/basic.js 5853 */ 5854A.mix(NODE_PROTO, { 5855 5856 /** 5857 * Returns the current ancestors of the node element filtered by a 5858 * className. This is an optimized method for finding ancestors by a 5859 * specific CSS class name. 5860 * 5861 * Example: 5862 * 5863 * ``` 5864 * A.one('#nodeId').ancestorsByClassName('aui-hide'); 5865 * ``` 5866 * 5867 * @method ancestorsByClassName 5868 * @param {String} className A selector to filter the ancestor elements 5869 * against. 5870 * @param {Boolean} testSelf optional Whether or not to include the element 5871 * in the scan 5872 * @return {NodeList} 5873 */ 5874 ancestorsByClassName: function(className, testSelf) { 5875 var instance = this; 5876 5877 var ancestors = []; 5878 var cssRE = new RegExp('\\b' + className + '\\b'); 5879 var currentEl = instance.getDOM(); 5880 5881 if (!testSelf) { 5882 currentEl = currentEl.parentNode; 5883 } 5884 5885 while (currentEl && currentEl.nodeType !== 9) { 5886 if (currentEl.nodeType === 1 && cssRE.test(currentEl.className)) { 5887 ancestors.push(currentEl); 5888 } 5889 5890 currentEl = currentEl.parentNode; 5891 } 5892 5893 return A.all(ancestors); 5894 }, 5895 5896 /** 5897 * Gets or sets the value of an attribute for the first element in the set 5898 * of matched elements. If only the `name` is passed it works as a getter. 5899 * 5900 * Example: 5901 * 5902 * ``` 5903 * var node = A.one('#nodeId'); 5904 * node.attr('title', 'Setting a new title attribute'); 5905 * // Alert the value of the title attribute: 'Setting a new title attribute' 5906 * alert( node.attr('title') ); 5907 * ``` 5908 * 5909 * @method attr 5910 * @param {String} name The name of the attribute 5911 * @param {String} value The value of the attribute to be set. Optional. 5912 * @return {String} 5913 */ 5914 attr: function(name, value) { 5915 var instance = this, 5916 i; 5917 5918 if (!isUndefined(value)) { 5919 var el = instance.getDOM(); 5920 5921 if (name in el) { 5922 instance.set(name, value); 5923 } 5924 else { 5925 instance.setAttribute(name, value); 5926 } 5927 5928 return instance; 5929 } 5930 else { 5931 if (isObject(name)) { 5932 for (i in name) { 5933 if (name.hasOwnProperty(i)) { 5934 instance.attr(i, name[i]); 5935 } 5936 } 5937 5938 return instance; 5939 } 5940 5941 var currentValue = instance.get(name); 5942 5943 if (!Lang.isValue(currentValue)) { 5944 currentValue = instance.getAttribute(name); 5945 } 5946 5947 return currentValue; 5948 } 5949 }, 5950 5951 /** 5952 * Normalizes the behavior of cloning a node, which by default should not 5953 * clone the events that are attached to it. 5954 * 5955 * Example: 5956 * 5957 * ``` 5958 * var node = A.one('#nodeId'); 5959 * node.clone().appendTo('body'); 5960 * ``` 5961 * 5962 * @method clone 5963 * @return {Node} 5964 */ 5965 clone: (function() { 5966 var clone; 5967 5968 if (SUPPORT_CLONED_EVENTS) { 5969 clone = function() { 5970 var el = this.getDOM(); 5971 var clone; 5972 5973 if (el.nodeType !== 3) { 5974 var outerHTML = this.outerHTML(); 5975 5976 outerHTML = outerHTML.replace(REGEX_IE8_ACTION, '="$1">').replace(REGEX_LEADING_WHITE_SPACE, 5977 ''); 5978 5979 clone = ANode.create(outerHTML); 5980 } 5981 else { 5982 clone = A.one(el.cloneNode()); 5983 } 5984 5985 return clone; 5986 }; 5987 } 5988 else { 5989 clone = function() { 5990 return this.cloneNode(true); 5991 }; 5992 } 5993 5994 return clone; 5995 }()), 5996 5997 /** 5998 * Centralizes the current Node instance with the passed `val` Array, Node, 5999 * String, or Region, if not specified, the body will be used. 6000 * 6001 * Example: 6002 * 6003 * ``` 6004 * var node = A.one('#nodeId'); 6005 * // Center the `node` with the `#container`. 6006 * node.center('#container'); 6007 * ``` 6008 * 6009 * @method center 6010 * @chainable 6011 * @param {Array|Node|Region|String} val Array, Node, String, or Region to 6012 * center with. 6013 */ 6014 center: function(val) { 6015 var instance = this, 6016 nodeRegion = instance.get('region'), 6017 x, 6018 y; 6019 6020 if (isArray(val)) { 6021 x = val[0]; 6022 y = val[1]; 6023 } 6024 else { 6025 var region; 6026 6027 if (isObject(val) && !A.instanceOf(val, ANode)) { 6028 region = val; 6029 } 6030 else { 6031 region = (A.one(val) || A.getBody()).get('region'); 6032 } 6033 6034 x = region.left + (region.width / 2); 6035 y = region.top + (region.height / 2); 6036 } 6037 6038 instance.setXY([x - (nodeRegion.width / 2), y - (nodeRegion.height / 2)]); 6039 }, 6040 6041 /** 6042 * Removes not only child (and other descendant) elements, but also any text 6043 * within the set of matched elements. This is because, according to the DOM 6044 * specification, any string of text within an element is considered a child 6045 * node of that element. 6046 * 6047 * Example: 6048 * 6049 * ``` 6050 * var node = A.one('#nodeId'); 6051 * node.empty(); 6052 * ``` 6053 * 6054 * @method empty 6055 * @chainable 6056 */ 6057 empty: function() { 6058 var instance = this; 6059 6060 instance.all('>*').remove().purge(); 6061 6062 var el = ANode.getDOMNode(instance); 6063 6064 while (el.firstChild) { 6065 el.removeChild(el.firstChild); 6066 } 6067 6068 return instance; 6069 }, 6070 6071 /** 6072 * Retrieves the DOM node bound to a Node instance. See 6073 * [getDOMNode](Node.html#method_getDOMNode). 6074 * 6075 * @method getDOM 6076 * @return {HTMLNode} The DOM node bound to the Node instance. 6077 */ 6078 getDOM: function() { 6079 var instance = this; 6080 6081 return ANode.getDOMNode(instance); 6082 }, 6083 6084 /** 6085 * Returns the combined width of the border for the specified sides. 6086 * 6087 * @method getBorderWidth 6088 * @param {String} sides Can be t, r, b, l or any combination of those to 6089 * represent the top, right, bottom, or left sides. 6090 * @return {Number} 6091 */ 6092 getBorderWidth: function(sides) { 6093 var instance = this; 6094 6095 return instance._getBoxStyleAsNumber(sides, MAP_BORDER); 6096 }, 6097 6098 /** 6099 * Gets the current center position of the node in page coordinates. 6100 * 6101 * @method getCenterXY 6102 * @for Node 6103 * @return {Array} The XY position of the node 6104 */ 6105 getCenterXY: function() { 6106 var instance = this; 6107 var region = instance.get('region'); 6108 6109 return [(region.left + region.width / 2), (region.top + region.height / 2)]; 6110 }, 6111 6112 /** 6113 * Returns the combined size of the margin for the specified sides. 6114 * 6115 * @method getMargin 6116 * @param {String} sides Can be t, r, b, l or any combination of those to 6117 * represent the top, right, bottom, or left sides. 6118 * @return {Number} 6119 */ 6120 getMargin: function(sides) { 6121 var instance = this; 6122 6123 return instance._getBoxStyleAsNumber(sides, MAP_MARGIN); 6124 }, 6125 6126 /** 6127 * Returns the combined width of the border for the specified sides. 6128 * 6129 * @method getPadding 6130 * @param {String} sides Can be t, r, b, l or any combination of those to 6131 * represent the top, right, bottom, or left sides. 6132 * @return {Number} 6133 */ 6134 getPadding: function(sides) { 6135 var instance = this; 6136 6137 return instance._getBoxStyleAsNumber(sides, MAP_PADDING); 6138 }, 6139 6140 /** 6141 * Sets the id of the Node instance if the object does not have one. The 6142 * generated id is based on a guid created by the 6143 * [stamp](YUI.html#method_stamp) method. 6144 * 6145 * @method guid 6146 * @return {String} The current id of the node 6147 */ 6148 guid: function() { 6149 var instance = this; 6150 var currentId = instance.get('id'); 6151 6152 if (!currentId) { 6153 currentId = A.stamp(instance); 6154 6155 instance.set('id', currentId); 6156 } 6157 6158 return currentId; 6159 }, 6160 6161 /** 6162 * Creates a hover interaction. 6163 * 6164 * @method hover 6165 * @param {String} overFn 6166 * @param {String} outFn 6167 * @return {Node} The current Node instance 6168 */ 6169 hover: function(overFn, outFn) { 6170 var instance = this; 6171 6172 var hoverOptions; 6173 var defaultHoverOptions = instance._defaultHoverOptions; 6174 6175 if (isObject(overFn, true)) { 6176 hoverOptions = overFn; 6177 6178 hoverOptions = A.mix(hoverOptions, defaultHoverOptions); 6179 6180 overFn = hoverOptions.over; 6181 outFn = hoverOptions.out; 6182 } 6183 else { 6184 hoverOptions = A.mix({ 6185 over: overFn, 6186 out: outFn 6187 }, 6188 defaultHoverOptions 6189 ); 6190 } 6191 6192 instance._hoverOptions = hoverOptions; 6193 6194 hoverOptions.overTask = A.debounce(instance._hoverOverTaskFn, null, instance); 6195 hoverOptions.outTask = A.debounce(instance._hoverOutTaskFn, null, instance); 6196 6197 return new A.EventHandle( 6198 [ 6199 instance.on(hoverOptions.overEventType, instance._hoverOverHandler, instance), 6200 instance.on(hoverOptions.outEventType, instance._hoverOutHandler, instance) 6201 ] 6202 ); 6203 }, 6204 6205 /** 6206 * Gets or sets the HTML contents of the node. If the `value` is passed it's 6207 * set the content of the element, otherwise it works as a getter for the 6208 * current content. 6209 * 6210 * Example: 6211 * 6212 * ``` 6213 * var node = A.one('#nodeId'); 6214 * node.html('Setting new HTML'); 6215 * // Alert the value of the current content
6216 * alert( node.html() ); 6217 * ``` 6218 * 6219 * @method html 6220 * @param {String} value A string of html to set as the content of the node 6221 * instance. 6222 */ 6223 html: function() { 6224 var args = arguments, 6225 length = args.length; 6226 6227 if (length) { 6228 this.set('innerHTML', args[0]); 6229 } 6230 else { 6231 return this.get('innerHTML'); 6232 } 6233 6234 return this; 6235 }, 6236 6237 /** 6238 * Gets the outerHTML of a node, which islike innerHTML, except that it 6239 * actually contains the HTML of the node itself. 6240 * 6241 * @method outerHTML 6242 * @return {string} The outerHTML of the given element. 6243 */ 6244 outerHTML: function() { 6245 var instance = this; 6246 var domEl = instance.getDOM(); 6247 6248 // IE, Opera and WebKit all have outerHTML. 6249 if ('outerHTML' in domEl) { 6250 return domEl.outerHTML; 6251 } 6252 6253 var temp = ANode.create('<div></div>').append( 6254 this.clone() 6255 ); 6256 6257 try { 6258 return temp.html(); 6259 } 6260 catch (e) {} 6261 finally { 6262 temp = null; 6263 } 6264 }, 6265 6266 /** 6267 * Inserts a `newNode` after the node instance (i.e., as the next sibling). 6268 * If the reference node has no parent, then does nothing. 6269 * 6270 * Example: 6271 * 6272 * ``` 6273 * var titleNode = A.one('#titleNode'); 6274 * var descriptionNode = A.one('#descriptionNode'); 6275 * // the description is usually shown after the title 6276 * titleNode.placeAfter(descriptionNode); 6277 * ``` 6278 * 6279 * @method placeAfter 6280 * @chainable 6281 * @param {Node} newNode Node to insert. 6282 */ 6283 placeAfter: function(newNode) { 6284 var instance = this; 6285 6286 return instance._place(newNode, instance.get('nextSibling')); 6287 }, 6288 6289 /** 6290 * Inserts a `newNode` before the node instance (i.e., as the previous 6291 * sibling). If the reference node has no parent, then does nothing. 6292 * 6293 * Example: 6294 * 6295 * ``` 6296 * var descriptionNode = A.one('#descriptionNode'); 6297 * var titleNode = A.one('#titleNode'); 6298 * // the title is usually shown before the description 6299 * descriptionNode.placeBefore(titleNode); 6300 * ``` 6301 * 6302 * @method placeBefore 6303 * @chainable 6304 * @param {Node} newNode Node to insert. 6305 */ 6306 placeBefore: function(newNode) { 6307 var instance = this; 6308 6309 return instance._place(newNode, instance); 6310 }, 6311 6312 /** 6313 * Inserts the node instance to the begining of the `selector` node (i.e., 6314 * insert before the `firstChild` of the `selector`). 6315 * 6316 * Example: 6317 * 6318 * ``` 6319 * var node = A.one('#nodeId'); 6320 * node.prependTo('body'); 6321 * ``` 6322 * 6323 * @method prependTo 6324 * @chainable 6325 * @param {Node|String} selector A selector, element, HTML string, Node 6326 */ 6327 prependTo: function(selector) { 6328 var instance = this; 6329 6330 A.one(selector).prepend(instance); 6331 6332 return instance; 6333 }, 6334 6335 /** 6336 * Adds one or more CSS classes to an element and remove the class(es) from 6337 * the siblings of the element. 6338 * 6339 * @method radioClass 6340 * @chainable 6341 * @param {String} cssClass 6342 */ 6343 radioClass: function(cssClass) { 6344 var instance = this; 6345 6346 var siblings = instance.siblings(); 6347 6348 if (isString(cssClass)) { 6349 siblings.removeClass(cssClass); 6350 6351 instance.addClass(cssClass); 6352 } 6353 else if (isArray(cssClass)) { 6354 var siblingNodes = siblings.getDOM(); 6355 6356 var regex = getRegExp('(?:^|\\s+)(?:' + cssClass.join('|') + ')(?=\\s+|$)', 'g'), 6357 node, 6358 i; 6359 6360 for (i = siblingNodes.length - 1; i >= 0; i--) { 6361 node = siblingNodes[i]; 6362 node.className = node.className.replace(regex, ''); 6363 } 6364 6365 instance.addClass(cssClass.join(' ')); 6366 } 6367 6368 return instance; 6369 }, 6370 6371 /** 6372 * Generates an unique identifier and reset the id attribute of the node 6373 * instance using the new value. Invokes the [guid](Node.html#method_guid). 6374 * 6375 * @method resetId 6376 * @chainable 6377 * @param {String} prefix Optional prefix for the guid. 6378 */ 6379 resetId: function(prefix) { 6380 var instance = this; 6381 6382 instance.attr('id', A.guid(prefix)); 6383 6384 return instance; 6385 }, 6386 6387 /** 6388 * Selects a substring of text inside of the input element. 6389 * 6390 * @method selectText 6391 * @param {Number} start The index to start the selection range from 6392 * @param {Number} end The index to end the selection range at 6393 */ 6394 selectText: function(start, end) { 6395 var instance = this; 6396 6397 var textField = instance.getDOM(); 6398 var length = instance.val().length; 6399 6400 end = isValue(end) ? end : length; 6401 start = isValue(start) ? start : 0; 6402 6403 // Some form elements could throw a (NS_ERROR_FAILURE) 6404 // [nsIDOMNSHTMLInputElement.setSelectionRange] error when invoke the 6405 // setSelectionRange on firefox. Wrapping in a try/catch to prevent the 6406 // error be thrown 6407 try { 6408 if (textField.setSelectionRange) { 6409 textField.setSelectionRange(start, end); 6410 } 6411 else if (textField.createTextRange) { 6412 var range = textField.createTextRange(); 6413 6414 range.moveStart('character', start); 6415 range.moveEnd('character', end - length); 6416 6417 range.select(); 6418 } 6419 else { 6420 textField.select(); 6421 } 6422 6423 if (textField !== DOC.activeElement) { 6424 textField.focus(); 6425 } 6426 } 6427 catch (e) {} 6428 6429 return instance; 6430 }, 6431 6432 /** 6433 * Enables text selection for this element (normalized across browsers). 6434 * 6435 * @method selectable 6436 * @param noRecurse 6437 * @chainable 6438 */ 6439 selectable: function(noRecurse) { 6440 var instance = this; 6441 6442 instance.setStyles({
6443 '-webkit-user-select': CSS_SELECTABLE_VALUE, 6444 '-khtml-user-select': CSS_SELECTABLE_VALUE, 6445 '-moz-user-select': CSS_SELECTABLE_VALUE, 6446 '-ms-user-select': CSS_SELECTABLE_VALUE, 6447 '-o-user-select': CSS_SELECTABLE_VALUE, 6448 'user-select': CSS_SELECTABLE_VALUE 6449 }); 6450 6451 if (A.UA.ie || A.UA.opera) { 6452 _setUnselectable(instance._node, false, noRecurse); 6453 } 6454 6455 return instance; 6456 }, 6457 6458 /** 6459 * Stops the specified event(s) from bubbling and optionally prevents the 6460 * default action. 6461 * 6462 * Example: 6463 * 6464 * ``` 6465 * var anchor = A.one('a#anchorId'); 6466 * anchor.swallowEvent('click'); 6467 * ``` 6468 * 6469 * @method swallowEvent 6470 * @chainable 6471 * @param {String|Array} eventName An event or array of events to stop from 6472 * bubbling 6473 * @param {Boolean} preventDefault (optional) true to prevent the default 6474 * action too 6475 */ 6476 swallowEvent: function(eventName, preventDefault) { 6477 var instance = this; 6478 6479 var fn = function(event) { 6480 event.stopPropagation(); 6481 6482 if (preventDefault) { 6483 event.preventDefault(); 6484 6485 event.halt(); 6486 } 6487 6488 return false; 6489 }; 6490 6491 if (isArray(eventName)) { 6492 AArray.each( 6493 eventName, 6494 function(name) { 6495 instance.on(name, fn); 6496 } 6497 ); 6498 6499 return this; 6500 } 6501 else { 6502 instance.on(eventName, fn); 6503 } 6504 6505 return instance; 6506 }, 6507 6508 /** 6509 * Gets or sets the combined text contents of the node instance, including 6510 * it's descendants. If the `text` is passed it's set the content of the 6511 * element, otherwise it works as a getter for the current content. 6512 * 6513 * Example: 6514 * 6515 * ``` 6516 * var node = A.one('#nodeId'); 6517 * node.text('Setting new text content'); 6518 * // Alert the value of the current content 6519 * alert( node.text() ); 6520 * ``` 6521 * 6522 * @method text 6523 * @param {String} text A string of text to set as the content of the node 6524 * instance. 6525 */ 6526 text: function(text) { 6527 var instance = this; 6528 var el = instance.getDOM(); 6529 6530 if (!isUndefined(text)) { 6531 text = A.DOM._getDoc(el).createTextNode(text); 6532 6533 return instance.empty().append(text); 6534 } 6535 6536 return instance._getText(el.childNodes); 6537 }, 6538 6539 /** 6540 * Displays or hide the node instance. 6541 * 6542 * NOTE: This method assume that your node were hidden because of the 6543 * 'aui-hide' css class were being used. This won't manipulate the inline 6544 * `style.display` property. 6545 * 6546 * @method toggle 6547 * @chainable 6548 * @param {Boolean} on Whether to force the toggle. Optional. 6549 * @param {Function} callback A function to run after the visibility change. 6550 * Optional. 6551 */ 6552 toggle: function() { 6553 var instance = this; 6554 6555 instance._toggleView.apply(instance, arguments); 6556 6557 return instance; 6558 }, 6559 6560 /** 6561 * Disables text selection for this element (normalized across browsers). 6562 * 6563 * @method unselectable 6564 * @param noRecurse 6565 * @chainable 6566 */ 6567 unselectable: function(noRecurse) { 6568 var instance = this; 6569 6570 instance.setStyles({ 6571 '-webkit-user-select': CSS_UNSELECTABLE_VALUE, 6572 '-khtml-user-select': CSS_UNSELECTABLE_VALUE, 6573 '-moz-user-select': CSS_UNSELECTABLE_VALUE, 6574 '-ms-user-select': CSS_UNSELECTABLE_VALUE, 6575 '-o-user-select': CSS_UNSELECTABLE_VALUE, 6576 'user-select': CSS_UNSELECTABLE_VALUE 6577 }); 6578 6579 if (A.UA.ie || A.UA.opera) { 6580 _setUnselectable(instance._node, true, noRecurse); 6581 } 6582 6583 return instance; 6584 }, 6585 6586 /** 6587 * Gets or sets the value attribute of the node instance. If the `value` is 6588 * passed it's set the value of the element, otherwise it works as a getter 6589 * for the current value. 6590 * 6591 * Example: 6592 * 6593 * ```
6594 * var input = A.one('#inputId'); 6595 * input.val('Setting new input value'); 6596 * // Alert the value of the input 6597 * alert( input.val() ); 6598 * ``` 6599 * 6600 * @method val 6601 * @param {String} value Value to be set. Optional. 6602 */ 6603 val: function(value) { 6604 var instance = this; 6605 6606 if (isUndefined(value)) { 6607 return instance.get('value'); 6608 } 6609 else { 6610 return instance.set('value', value); 6611 } 6612 }, 6613 6614 /** 6615 * Returns the combined size of the box style for the specified sides. 6616 * 6617 * @method _getBoxStyleAsNumber 6618 * @param {String} sides Can be t, r, b, l or any combination of 6619 * those to represent the top, right, bottom, or left sides. 6620 * @param {String} map An object mapping mapping the "sides" param to the a 6621 * CSS value to retrieve 6622 * @return {Number} 6623 * @private 6624 */ 6625 _getBoxStyleAsNumber: function(sides, map) { 6626 var instance = this; 6627 6628 var sidesArray = sides.match(/\w/g), 6629 value = 0, 6630 side, 6631 sideKey, 6632 i; 6633 6634 for (i = sidesArray.length - 1; i >= 0; i--) { 6635 sideKey = sidesArray[i]; 6636 side = 0; 6637 6638 if (sideKey) { 6639 side = parseFloat(instance.getComputedStyle(map[sideKey])); 6640 side = Math.abs(side); 6641 6642 value += side || 0; 6643 } 6644 } 6645 6646 return value; 6647 }, 6648 6649 /** 6650 * Extracts text content from the passed nodes. 6651 * 6652 * @method _getText 6653 * @private 6654 * @param {Native NodeList} childNodes 6655 */ 6656 _getText: function(childNodes) { 6657 var instance = this; 6658 6659 var length = childNodes.length, 6660 childNode, 6661 str = [], 6662 i; 6663 6664 for (i = 0; i < length; i++) { 6665 childNode = childNodes[i]; 6666 6667 if (childNode && childNode.nodeType !== 8) { 6668 if (childNode.nodeType !== 1) { 6669 str.push(childNode.nodeValue); 6670 } 6671 6672 if (childNode.childNodes) { 6673 str.push(instance._getText(childNode.childNodes)); 6674 } 6675 } 6676 } 6677 6678 return str.join(''); 6679 }, 6680 6681 /** 6682 * Overrides Y.Node._hide. Adds aui-hide to the node's cssClass 6683 * 6684 * @method _hide 6685 * @private 6686 */ 6687 _hide: function() { 6688 var instance = this; 6689 6690 instance.addClass(CSS_HIDE); 6691 6692 return NODE_PROTO_HIDE.apply(instance, arguments); 6693 }, 6694 6695 /** 6696 * The event handler for the "out" function that is fired for events 6697 * attached via the hover method. 6698 * 6699 * @method _hoverOutHandler 6700 * @private 6701 * @param {EventFacade} event 6702 */ 6703 _hoverOutHandler: function(event) { 6704 var instance = this; 6705 6706 var hoverOptions = instance._hoverOptions; 6707 6708 hoverOptions.outTask.delay(hoverOptions.outDelay, event); 6709 }, 6710 6711 /** 6712 * The event handler for the "over" function that is fired for events 6713 * attached via the hover method. 6714 * 6715 * @method _hoverOverHandler 6716 * @private 6717 * @param {EventFacade} event 6718 */ 6719 _hoverOverHandler: function(event) { 6720 var instance = this; 6721 6722 var hoverOptions = instance._hoverOptions; 6723 6724 hoverOptions.overTask.delay(hoverOptions.overDelay, event); 6725 }, 6726 6727 /** 6728 * Cancels the over task, and fires the users custom "out" function for the 6729 * hover method 6730 * 6731 * @method _hoverOverHandler 6732 * @private 6733 * @param {EventFacade} event 6734 */ 6735 _hoverOutTaskFn: function(event) { 6736 var instance = this; 6737 6738 var hoverOptions = instance._hoverOptions; 6739 6740 hoverOptions.overTask.cancel(); 6741 6742 hoverOptions.out.apply(hoverOptions.context || event.currentTarget, arguments); 6743 }, 6744 6745 /** 6746 * Cancels the out task, and fires the users custom "over" function for the 6747 * hover method 6748 * 6749 * @method _hoverOverHandler 6750 * @private 6751 * @param {EventFacade} event 6752 */ 6753 _hoverOverTaskFn: function(event) { 6754 var instance = this; 6755 6756 var hoverOptions = instance._hoverOptions; 6757 6758 hoverOptions.outTask.cancel(); 6759 6760 hoverOptions.over.apply(hoverOptions.context || event.currentTarget, arguments); 6761 }, 6762 6763 /** 6764 * Places a node or html string at a specific location 6765 * 6766 * @method _place 6767 * @private 6768 * @param {Node|String} newNode 6769 * @param {Node} refNode 6770 */ 6771 _place: function(newNode, refNode) { 6772 var instance = this; 6773 6774 var parent = instance.get('parentNode'); 6775 6776 if (parent) { 6777 if (isString(newNode)) { 6778 newNode = ANode.create(newNode); 6779 } 6780 6781 parent.insertBefore(newNode, refNode); 6782 } 6783 6784 return instance; 6785 }, 6786 6787 /** 6788 * Overrides Y.Node._show. Removes aui-hide from the node's cssClass 6789 * 6790 * @method _show 6791 * @private 6792 */ 6793 _show: function() { 6794 var instance = this; 6795 6796 instance.removeClass(CSS_HIDE); 6797 6798 return NODE_PROTO_SHOW.apply(instance, arguments); 6799 }, 6800 6801 _defaultHoverOptions: { 6802 overEventType: 'mouseenter', 6803 outEventType: 'mouseleave', 6804 overDelay: 0, 6805 outDelay: 0, 6806 over: Lang.emptyFn, 6807 out: Lang.emptyFn 6808 } 6809}, true); 6810 6811NODE_PROTO.__isHidden = NODE_PROTO._isHidden; 6812 6813NODE_PROTO._isHidden = function() { 6814 var instance = this; 6815 6816 return NODE_PROTO.__isHidden.call(instance) || instance.hasClass(instance._hideClass || CSS_HIDE); 6817}; 6818 6819/** 6820 * Returns the width of the content, not including the padding, border or 6821 * margin. If a width is passed, the node's overall width is set to that size. 6822 * 6823 * Example: 6824 * 6825 * ``` 6826 * var node = A.one('#nodeId'); 6827 * node.width(); //return content width
6828 * node.width(100); // sets box width 6829 * ``` 6830 * 6831 * @method width 6832 * @return {number} 6833 */ 6834 6835/** 6836 * Returns the height of the content, not including the padding, border or 6837 * margin. If a height is passed, the node's overall height is set to that size. 6838 * 6839 * Example: 6840 * 6841 * ``` 6842 * var node = A.one('#nodeId'); 6843 * node.height(); //return content height 6844 * node.height(100); // sets box height 6845 * ``` 6846 * 6847 * @method height 6848 * @return {number} 6849 */ 6850 6851/** 6852 * Returns the size of the box from inside of the border, which is the 6853 * `offsetWidth` plus the padding on the left and right. 6854 * 6855 * Example: 6856 * 6857 * ``` 6858 * var node = A.one('#nodeId'); 6859 * node.innerWidth(); 6860 * ``` 6861 * 6862 * @method innerWidth 6863 * @return {number} 6864 */ 6865 6866/** 6867 * Returns the size of the box from inside of the border, which is offsetHeight 6868 * plus the padding on the top and bottom. 6869 * 6870 * Example: 6871 * 6872 * ``` 6873 * var node = A.one('#nodeId'); 6874 * node.innerHeight(); 6875 * ``` 6876 * 6877 * @method innerHeight 6878 * @return {number} 6879 */ 6880 6881/** 6882 * Returns the outer width of the box including the border, if true is passed as 6883 * the first argument, the margin is included. 6884 * 6885 * Example: 6886 * 6887 * ``` 6888 * var node = A.one('#nodeId'); 6889 * node.outerWidth(); 6890 * node.outerWidth(true); // includes margin 6891 * ``` 6892 * 6893 * @method outerWidth 6894 * @return {number} 6895 */ 6896 6897/** 6898 * Returns the outer height of the box including the border, if true is passed 6899 * as the first argument, the margin is included. 6900 * 6901 * Example: 6902 * 6903 * ``` 6904 * var node = A.one('#nodeId'); 6905 * node.outerHeight(); 6906 * node.outerHeight(true); // includes margin 6907 * ``` 6908 * 6909 * @method outerHeight 6910 * @return {number} 6911 */ 6912 6913A.each( 6914 ['Height', 'Width'], 6915 function(item, index) { 6916 var sides = index ? 'lr' : 'tb'; 6917 6918 var dimensionType = item.toLowerCase(); 6919 6920 NODE_PROTO[dimensionType] = function(size) { 6921 var instance = this; 6922 6923 var returnValue = instance; 6924 6925 if (isUndefined(size)) { 6926 var node = instance._node; 6927 var dimension; 6928 6929 if (node) { 6930 if ((!node.tagName && node.nodeType === 9) || node.alert) { 6931 dimension = instance.get('region')[dimensionType]; 6932 } 6933 else { 6934 dimension = instance.get('offset' + item); 6935 6936 if (!dimension) { 6937 var originalDisplay = instance.getStyle('display'); 6938 var originalPosition = instance.getStyle('position'); 6939 var originalVisibility = instance.getStyle('visibility'); 6940 6941 instance.setStyles({ 6942 display: 'block !important', 6943 position: 'absolute !important', 6944 visibility: 'hidden !important' 6945 }); 6946 6947 dimension = instance.get('offset' + item); 6948 6949 instance.setStyles({ 6950 display: originalDisplay, 6951 position: originalPosition, 6952 visibility: originalVisibility 6953 }); 6954 } 6955 6956 if (dimension) { 6957 dimension -= (instance.getPadding(sides) + instance.getBorderWidth(sides)); 6958 } 6959 } 6960 } 6961 6962 returnValue = dimension; 6963 } 6964 else { 6965 instance.setStyle(dimensionType, size); 6966 } 6967 6968 return returnValue; 6969 }; 6970 6971 NODE_PROTO['inner' + item] = function() { 6972 var instance = this; 6973 6974 return instance[dimensionType]() + instance.getPadding(sides); 6975 }; 6976 6977 NODE_PROTO['outer' + item] = function(margin) { 6978 var instance = this; 6979 6980 var innerSize = instance['inner' + item](); 6981 var borderSize = instance.getBorderWidth(sides); 6982 6983 var size = innerSize + borderSize; 6984 6985 if (margin) { 6986 size += instance.getMargin(sides); 6987 } 6988 6989 return size; 6990 }; 6991 } 6992); 6993 6994if (!SUPPORT_OPTIONAL_TBODY) { 6995 A.DOM._ADD_HTML = A.DOM.addHTML; 6996 6997 A.DOM.addHTML = function(node, content, where) { 6998 var nodeName = (node.nodeName && node.nodeName.toLowerCase()) || ''; 6999 7000 var tagName = ''; 7001 7002 if (!isUndefined(content)) { 7003 if (isString(content)) { 7004 tagName = (REGEX_TAGNAME.exec(content) || ARRAY_EMPTY_STRINGS)[1]; 7005 } 7006 else if (content.nodeType && content.nodeType === 11 && content.childNodes.length) { // a doc frag 7007 tagName = content.childNodes[0].nodeName; 7008 }
7009 else if (content.nodeName) { // a node 7010 tagName = content.nodeName; 7011 } 7012 7013 tagName = tagName && tagName.toLowerCase(); 7014 } 7015 7016 if (nodeName === 'table' && tagName === 'tr') { 7017 node = node.getElementsByTagName('tbody')[0] || node.appendChild(node.ownerDocument.createElement('tbody')); 7018 7019 var whereNodeName = ((where && where.nodeName) || '').toLowerCase(); 7020 7021 // Assuming if the "where" is a tbody node, 7022 // we're trying to prepend to a table. Attempt to 7023 // grab the first child of the tbody. 7024 if (whereNodeName === 'tbody' && where.childNodes.length > 0) { 7025 where = where.firstChild; 7026 } 7027 } 7028 7029 return A.DOM._ADD_HTML(node, content, where); 7030 }; 7031} 7032 7033/** 7034 * Augments the [YUI3 NodeList](NodeList.html) with more util methods. 7035 * 7036 * Checks the list of [Methods](NodeList.html#methods) available for AUI 7037 * NodeList. 7038 * 7039 * @class A.NodeList 7040 * @constructor 7041 * @uses A.Node 7042 */ 7043ANodeList.importMethod( 7044 NODE_PROTO, [ 7045 'after', 7046 7047 'appendTo', 7048 7049 'attr', 7050 7051 'before', 7052 7053 'empty', 7054 7055 'getX', 7056 7057 'getXY', 7058 7059 'getY', 7060 7061 'hover', 7062 7063 'html', 7064 7065 'innerHeight', 7066 7067 'innerWidth', 7068 7069 'outerHeight', 7070 7071 'outerHTML', 7072 7073 'outerWidth', 7074 7075 'prepend', 7076 7077 'prependTo', 7078 7079 'purge', 7080 7081 'selectText', 7082 7083 'selectable', 7084 7085 'setX', 7086 7087 'setXY', 7088 7089 'setY', 7090 7091 'text', 7092 7093 'toggle', 7094 7095 'unselectable', 7096 7097 'val' 7098 ] 7099); 7100 7101A.mix( 7102 NODELIST_PROTO, { 7103 /** 7104 * See [Node all](Node.html#method_all). 7105 * 7106 * @method all 7107 */ 7108 all: function(selector) { 7109 var instance = this, 7110 newNodeList = [], 7111 nodes = instance._nodes, 7112 length = nodes.length, 7113 subList, 7114 i; 7115 7116 for (i = 0; i < length; i++) { 7117 subList = A.Selector.query(selector, nodes[i]); 7118 7119 if (subList && subList.length) { 7120 newNodeList.push.apply(newNodeList, subList); 7121 } 7122 } 7123 7124 newNodeList = AArray.unique(newNodeList); 7125 7126 return A.all(newNodeList); 7127 }, 7128 7129 /** 7130 * Returns the first element in the node list collection. 7131 * 7132 * @method first 7133 * @return {Node} 7134 */ 7135 first: function() { 7136 var instance = this; 7137 7138 return instance.item(0); 7139 }, 7140 7141 /** 7142 * See [Node getDOMNode](Node.html#method_getDOMNode). 7143 * 7144 * @method getDOM 7145 */ 7146 getDOM: function() { 7147 return ANodeList.getDOMNodes(this); 7148 }, 7149 7150 /** 7151 * Returns the last element in the node list collection. 7152 * 7153 * @method last 7154 * @return {Node} 7155 */ 7156 last: function() { 7157 var instance = this; 7158 7159 return instance.item(instance._nodes.length - 1); 7160 }, 7161 7162 /** 7163 * See [Node one](Node.html#method_one). 7164 * 7165 * @method one 7166 */ 7167 one: function(selector) { 7168 var instance = this, 7169 newNode = null, 7170 nodes = instance._nodes, 7171 length = nodes.length, 7172 i; 7173 7174 for (i = 0; i < length; i++) { 7175 newNode = A.Selector.query(selector, nodes[i], true); 7176 7177 if (newNode) { 7178 newNode = A.one(newNode); 7179 7180 break; 7181 } 7182 } 7183 7184 return newNode; 7185 } 7186 } 7187); 7188 7189NODELIST_PROTO.__filter = NODELIST_PROTO.filter; 7190 7191NODELIST_PROTO.filter = function(value, context) { 7192 var instance = this; 7193 7194 var newNodeList; 7195 7196 if (isFunction(value)) { 7197 var nodes = []; 7198 7199 instance.each( 7200 function(item, index, collection) { 7201 if (value.call(context || item, item, index, collection)) { 7202 nodes.push(item._node); 7203 } 7204 } 7205 ); 7206 7207 newNodeList = A.all(nodes); 7208 } 7209 else { 7210 newNodeList = NODELIST_PROTO.__filter.call(instance, value); 7211 } 7212 7213 return newNodeList; 7214}; 7215 7216A.mix( 7217 ANodeList, { 7218 /** 7219 * Converts the passed `html` into a `NodeList` and returns the result. 7220 * 7221 * @method create 7222 * @param {String} html 7223 * @return {NodeList} 7224 */ 7225 create: function(html) { 7226 var docFrag = A.getDoc().invoke('createDocumentFragment'); 7227 7228 return docFrag.append(html).get('childNodes'); 7229 } 7230 } 7231); 7232 7233A.mix( 7234 A, { 7235 /** 7236 * Gets the body node. Shortcut to `A.one('body')`. 7237 * 7238 * @method getBody 7239 */ 7240 getBody: function() { 7241 var instance = this; 7242 7243 if (!instance._bodyNode) { 7244 instance._bodyNode = A.one(DOC.body); 7245 } 7246 7247 return instance._bodyNode; 7248 }, 7249 7250 /** 7251 * Gets the document node. Shortcut to `A.one(document)`. 7252 * 7253 * @method getDoc 7254 */ 7255 getDoc: function() { 7256 var instance = this; 7257 7258 if (!instance._documentNode) { 7259 instance._documentNode = A.one(DOC); 7260 } 7261 7262 return instance._documentNode; 7263 }, 7264 7265 /** 7266 * Gets the window node. Shortcut to `A.one(window)`. 7267 * 7268 * @method getWin 7269 */ 7270 getWin: function() { 7271 var instance = this; 7272 7273 if (!instance._windowNode) { 7274 instance._windowNode = A.one(WIN); 7275 } 7276 7277 return instance._windowNode; 7278 } 7279 } 7280); 7281 7282 7283}, '3.1.0-deprecated.60', {"requires": ["array-extras", "aui-base-lang", "aui-classnamemanager", "aui-debounce", "node"]}); 7284 7285YUI.add('aui-node-html5', function (A, NAME) { 7286 7287/** 7288 * Provides support for HTML shiv natively on the Alloy DOM methods. The HTML5 7289 * shiv just affects IE. 7290 * 7291 * @module aui-node 7292 * @submodule aui-node-html5 7293 */ 7294 7295if (A.UA.ie) { 7296 /** 7297 * An object that encapsulates util methods for HTML5 shiving. 7298 * 7299 * **What is a "shiv"?** 7300 * 7301 * To the world, a shiv is a slang term for a sharp object used as a 7302 * knife-like weapon. To Internet Explorer, a shiv is a script that, when 7303 * executed, forces the browser to recognize HTML5 elements. 7304 * 7305 * @class A.HTML5 7306 */ 7307 var HTML5 = A.namespace('HTML5'), 7308 DOM_create = A.DOM._create; 7309 7310 if (!HTML5._fragHTML5Shived) { 7311 /** 7312 * A global DocumentFragment already HTML5 shived, for performance 7313 * reasons. (i.e., all nodes and its HTML5 children appended to this 7314 * fragment iherits the styles on IE). 7315 * 7316 * @property _fragHTML5Shived 7317 * @type {DocumentFragment} 7318 * @protected 7319 */ 7320 HTML5._fragHTML5Shived = A.html5shiv( 7321 A.config.doc.createDocumentFragment() 7322 ); 7323 } 7324 7325 A.mix( 7326 HTML5, { 7327 /** 7328 * Receives a `frag` and a HTML content. This method shivs the HTML5 7329 * nodes appended to a Node or fragment which is not on the document 7330 * yet. 7331 * 7332 * @method IECreateFix 7333 * @param {Node|DocumentFragment} frag Fragment to be fixed. 7334 * @param {String} content HTML to be set (using innerHTML) on the 7335 * `frag`. 7336 * @return {Node|DocumentFragment} 7337 */ 7338 IECreateFix: function(frag, content) { 7339 var shivedFrag = HTML5._fragHTML5Shived; 7340
7341 shivedFrag.appendChild(frag); 7342 7343 frag.innerHTML = content; 7344 7345 shivedFrag.removeChild(frag); 7346 7347 return frag; 7348 }, 7349 7350 /** 7351 * AOP listener to the A.DOM._create method. This method intercepts 7352 * all the calls to the A.DOM._create and append the generated 7353 * fragment to [A.HTML._fragHTML5Shived](A.HTML5.html#property__frag 7354 * HTML5Shived), this fixes the IE bug for painting the HTML5 nodes 7355 * on the HTML fragment. 7356 * 7357 * @method _doBeforeCreate 7358 * @param {String} html HTML content 7359 * @param {String} doc 7360 * @param {String} tag 7361 * @protected 7362 * @return {DocumentFragment} 7363 */ 7364 _doBeforeCreate: function(html) { 7365 var createdFrag = DOM_create.apply(this, arguments); 7366 7367 var shivedFrag = HTML5.IECreateFix(createdFrag, html); 7368 7369 return new A.Do.Halt(null, shivedFrag); 7370 } 7371 } 7372 ); 7373 7374 A.Do.before(HTML5._doBeforeCreate, A.DOM, '_create', A.DOM); 7375} 7376/** 7377 * The Node Utility. 7378 * 7379 * @module aui-node 7380 * @submodule aui-node-html5-print 7381 */ 7382 7383var CONFIG = A.config, 7384 DOC = CONFIG.doc, 7385 WIN = CONFIG.win, 7386 UA = A.UA, 7387 IE = UA.ie, 7388 7389 isShivDisabled = function() { 7390 return WIN.AUI_HTML5_IE === false; 7391 }; 7392 7393if (!IE || IE >= 9 || isShivDisabled()) { 7394 return; 7395} 7396 7397var BUFFER_CSS_TEXT = [], 7398 7399 LOCATION = WIN.location, 7400 7401 DOMAIN = LOCATION.protocol + '//' + LOCATION.host, 7402 7403 HTML = DOC.documentElement, 7404 7405 HTML5_ELEMENTS = A.HTML5_ELEMENTS, 7406 HTML5_ELEMENTS_LENGTH = HTML5_ELEMENTS.length, 7407 HTML5_ELEMENTS_LIST = HTML5_ELEMENTS.join('|'), 7408 7409 REGEX_CLONE_NODE_CLEANUP = new RegExp('<(/?):(' + HTML5_ELEMENTS_LIST + ')', 'gi'), 7410 REGEX_ELEMENTS = new RegExp('(' + HTML5_ELEMENTS_LIST + ')', 'gi'), 7411 REGEX_ELEMENTS_FAST = new RegExp('\\b(' + HTML5_ELEMENTS_LIST + ')\\b', 'i'), 7412 7413 REGEX_PRINT_MEDIA = /print|all/, 7414 7415 REGEX_RULE = new RegExp('(^|[^\\n{}]*?\\s)(' + HTML5_ELEMENTS_LIST + ').*?{([^}]*)}', 'gim'), 7416 REGEX_TAG = new RegExp('<(\/*)(' + HTML5_ELEMENTS_LIST + ')', 'gi'), 7417 7418 SELECTOR_REPLACE_RULE = '.' + 'printfix-' + '$1', 7419 7420 STR_EMPTY = '', 7421 7422 STR_URL_DOMAIN = 'url(' + DOMAIN, 7423 7424 TAG_REPLACE_ORIGINAL = '<$1$2', 7425 TAG_REPLACE_FONT = '<$1font'; 7426 7427var html5shiv = A.html5shiv, 7428 // Yes, IE does this wackiness; converting an object 7429 // to a string should never result in undefined, but 7430 // IE's styleSheet object sometimes becomes inaccessible 7431 // after trying to print the second time 7432 isStylesheetDefined = function(obj) { 7433 return obj && (obj + STR_EMPTY !== undefined); 7434 }, 7435 7436 toggleNode = function(node, origNode, prop) { 7437 var state = origNode[prop]; 7438 7439 if (state) { 7440 node.setAttribute(prop, state); 7441 } 7442 else { 7443 node.removeAttribute(prop); 7444 } 7445 }; 7446 7447html5shiv(DOC); 7448 7449var printFix = function() { 7450 var destroy; 7451 7452 var afterPrint = function() { 7453 if (isShivDisabled()) { 7454 destroy(); 7455 } 7456 else { 7457 printFix.onAfterPrint(); 7458 } 7459 }; 7460 7461 var beforePrint = function() { 7462 if (isShivDisabled()) { 7463 destroy(); 7464 } 7465 else { 7466 printFix.onBeforePrint(); 7467 } 7468 }; 7469 7470 destroy = function() { 7471 WIN.detachEvent('onafterprint', afterPrint); 7472 WIN.detachEvent('onbeforeprint', beforePrint); 7473 }; 7474 7475 var init = function() { 7476 WIN.attachEvent('onafterprint', afterPrint); 7477 WIN.attachEvent('onbeforeprint', beforePrint); 7478 }; 7479 7480 init(); 7481 7482 printFix.destroy = destroy; 7483 printFix.init = init; 7484}; 7485 7486A.mix( 7487 printFix, { 7488 /** 7489 * Fires after a print. 7490 * 7491 * @method onAfterPrint 7492 */ 7493 onAfterPrint: function() { 7494 var instance = this; 7495 7496 instance.restoreHTML(); 7497 7498 var styleSheet = instance._getStyleSheet(); 7499 7500 styleSheet.styleSheet.cssText = ''; 7501 }, 7502 7503 /** 7504 * Fires before a print. 7505 * 7506 * @method onBeforePrint 7507 */ 7508 onBeforePrint: function() { 7509 var instance = this; 7510 7511 var styleSheet = instance._getStyleSheet(); 7512 var cssRules = instance._getAllCSSText(); 7513 7514 styleSheet.styleSheet.cssText = instance.parseCSS(cssRules); 7515 7516 instance.writeHTML(); 7517 }, 7518 7519 /** 7520 * Navigates through the CSS joining rules and replacing content. 7521 * 7522 * @method parseCSS 7523 * @param cssText 7524 * @return {String} 7525 */ 7526 parseCSS: function(cssText) { 7527 var css = ''; 7528 var rules = cssText.match(REGEX_RULE); 7529 7530 if (rules) { 7531 css = rules.join('\n').replace(REGEX_ELEMENTS, SELECTOR_REPLACE_RULE); 7532 } 7533 7534 return css; 7535 }, 7536 7537 /** 7538 * Restores the HTML from the `bodyClone` and `bodyEl` attributes. 7539 * 7540 * @method restoreHTML 7541 */ 7542 restoreHTML: function() { 7543 var instance = this; 7544 7545 var bodyClone = instance._getBodyClone(); 7546 var bodyEl = instance._getBodyEl(); 7547 7548 var newNodes = bodyClone.getElementsByTagName('IFRAME'); 7549 var originalNodes = bodyEl.getElementsByTagName('IFRAME'); 7550 7551 var length = originalNodes.length; 7552 7553 // Moving IFRAME nodes back to their original position 7554 if (length === newNodes.length) { 7555 while (length--) { 7556 var newNode = newNodes[length]; 7557 var originalNode = originalNodes[length]; 7558 7559 originalNode.swapNode(newNode); 7560 } 7561 } 7562 7563 bodyClone.innerHTML = ''; 7564 7565 HTML.removeChild(bodyClone); 7566 HTML.appendChild(bodyEl); 7567 }, 7568 7569 /** 7570 * Generates the HTML for print. 7571 * 7572 * @method writeHTML 7573 */ 7574 writeHTML: function() { 7575 var instance = this; 7576 7577 var i = -1; 7578 var j; 7579 7580 var bodyEl = instance._getBodyEl(); 7581 7582 var html5Element; 7583 7584 var cssClass; 7585 7586 var nodeList; 7587 var nodeListLength; 7588 var node; 7589 var buffer = []; 7590 7591 while (++i < HTML5_ELEMENTS_LENGTH) { 7592 html5Element = HTML5_ELEMENTS[i]; 7593 7594 nodeList = DOC.getElementsByTagName(html5Element); 7595 nodeListLength = nodeList.length; 7596 7597 j = -1; 7598 7599 while (++j < nodeListLength) { 7600 node = nodeList[j]; 7601 7602 cssClass = node.className; 7603 7604 if (cssClass.indexOf('printfix-') === -1) { 7605 buffer[0] = 'printfix-' + html5Element; 7606 buffer[1] = cssClass; 7607 7608 node.className = buffer.join(' '); 7609 } 7610 } 7611 } 7612
7613 var docFrag = instance._getDocFrag(); 7614 var bodyClone = instance._getBodyClone(); 7615 7616 docFrag.appendChild(bodyEl); 7617 HTML.appendChild(bodyClone); 7618 7619 bodyClone.className = bodyEl.className; 7620 bodyClone.id = bodyEl.id; 7621 7622 var originalNodes = bodyEl.getElementsByTagName('*'); 7623 var length = originalNodes.length; 7624 7625 // IE will throw a mixed content warning when using https 7626 // and calling clone node if the body contains elements with 7627 // an inline background-image style that is relative to the domain. 7628 if (UA.secure) { 7629 var bodyElStyle = bodyEl.style; 7630 7631 var elStyle; 7632 var backgroundImage; 7633 7634 bodyElStyle.display = 'none'; 7635 7636 for (i = 0; i < length; i++) { 7637 elStyle = originalNodes[i].style; 7638 7639 backgroundImage = elStyle.backgroundImage; 7640 7641 if (backgroundImage && 7642 backgroundImage.indexOf('url
7642(') > -1 && 7643 backgroundImage.indexOf('https') === -1) { 7644 7645 elStyle.backgroundImage = backgroundImage.replace('url(', STR_URL_DOMAIN); 7646 } 7647 } 7648 7649 bodyElStyle.display = ''; 7650 } 7651 7652 var bodyElClone = bodyEl.cloneNode(true); 7653 7654 var newNodes = bodyElClone.getElementsByTagName('*'); 7655 7656 if (length === newNodes.length) { 7657 while (length--) { 7658 var newNode = newNodes[length]; 7659 var newNodeName = newNode.nodeName; 7660 7661 if (newNodeName === 'INPUT' || newNodeName === 'OPTION' || newNodeName === 'IFRAME') { 7662 var originalNode = originalNodes[length]; 7663 var originalNodeName = originalNode.nodeName; 7664 7665 if (originalNodeName === newNodeName) { 7666 var prop = null; 7667 7668 if (newNodeName === 'OPTION') { 7669 prop = 'selected'; 7670 } 7671 else if (newNodeName === 'INPUT' && (newNode.type === 'checkbox' || newNode.type === 7672 'radio')) { 7673 prop = 'checked'; 7674 } 7675 else if (newNodeName === 'IFRAME') { 7676 newNode.src = ''; 7677 } 7678 7679 if (prop !== null) { 7680 toggleNode(newNode, originalNode, prop); 7681 } 7682 } 7683 } 7684 } 7685 } 7686 7687 var bodyHTML = bodyElClone.innerHTML; 7688 7689 bodyHTML = bodyHTML.replace(REGEX_CLONE_NODE_CLEANUP, TAG_REPLACE_ORIGINAL).replace(REGEX_TAG, 7690 TAG_REPLACE_FONT); 7691 7692 bodyClone.innerHTML = bodyHTML; 7693 7694 // Post processing the DOM in order to move IFRAME nodes 7695 7696 newNodes = bodyClone.getElementsByTagName('IFRAME'); 7697 originalNodes = bodyEl.getElementsByTagName('IFRAME'); 7698 7699 length = originalNodes.length; 7700 7701 if (length === newNodes.length) { 7702 while (length--) { 7703 var newNodeIframe = newNodes[length]; 7704 var originalNodeIframe = originalNodes[length]; 7705 7706 // According to quirksmode.org, swapNode is supported on all major IE versions 7707 originalNodeIframe.swapNode(newNodeIframe); 7708 } 7709 } 7710 }, 7711 7712 /** 7713 * Gets all CSS text from all stylesheets. 7714 * 7715 * @method _getAllCSSText 7716 * @protected 7717 * @return {Array} 7718 */ 7719 _getAllCSSText: function() { 7720 var instance = this; 7721 7722 var buffer = []; 7723 var styleSheets = instance._getAllStyleSheets(DOC.styleSheets, 'all'); 7724 var rule; 7725 var cssText; 7726 var styleSheet; 7727 7728 for (var i = 0; styleSheet = styleSheets[i]; i++) { 7729 var rules = styleSheet.rules; 7730 7731 if (rules && rules.length) { 7732 for (var j = 0, ruleLength = rules.length; j < ruleLength; j++) { 7733 rule = rules[j]; 7734 7735 if (!rule.href) { 7736 cssText = instance._getCSSTextFromRule(rule); 7737 7738 buffer.push(cssText); 7739 } 7740 } 7741 } 7742 } 7743 7744 return buffer.join(' '); 7745 }, 7746 7747 /** 7748 * Extracts the CSS text from a rule. 7749 * 7750 * @method _getCSSTextFromRule 7751 * @param rule 7752 * @protected 7753 * @return {String} 7754 */ 7755 _getCSSTextFromRule: function(rule) { 7756 var cssText = ''; 7757 7758 var ruleStyle = rule.style; 7759 var ruleCSSText; 7760 var ruleSelectorText; 7761 7762 if (ruleStyle && (ruleCSSText = ruleStyle.cssText) && (ruleSelectorText = rule.selectorText) && 7763 REGEX_ELEMENTS_FAST.test(ruleSelectorText)) { 7764 BUFFER_CSS_TEXT.length = 0; 7765 7766 BUFFER_CSS_TEXT.push(ruleSelectorText, '{', ruleCSSText, '}'); 7767 7768 cssText = BUFFER_CSS_TEXT.join(' '); 7769 } 7770 7771 return cssText; 7772 }, 7773 7774 /** 7775 * Gets all stylesheets from a page. 7776 * 7777 * @method _getAllStyleSheets 7778 * @param styleSheet, mediaType, level, buffer 7779 * @protected 7780 * @return {Array} 7781 */ 7782 _getAllStyleSheets: function(styleSheet, mediaType, level, buffer) { 7783 var instance = this; 7784 7785 level = level || 1; 7786 7787 buffer = buffer || []; 7788 7789 var i; 7790 7791 if (isStylesheetDefined(styleSheet)) { 7792 var imports = styleSheet.imports; 7793 7794 mediaType = styleSheet.mediaType || mediaType; 7795 7796 if (REGEX_PRINT_MEDIA.test(mediaType)) { 7797 var length; 7798 7799 // IE can crash when trying to access imports more than 3 levels deep 7800 if (level <= 3 && isStylesheetDefined(imports) && imports.length) { 7801 for (i = 0, length = imports.length; i < length; i++) { 7802 instance._getAllStyleSheets(imports[i], mediaType, level + 1, buffer); 7803 } 7804 } 7805 else if (styleSheet.length) { 7806 for (i = 0, length = styleSheet.length; i < length; i++) { 7807 instance._getAllStyleSheets(styleSheet[i], mediaType, level, buffer); 7808 } 7809 } 7810 else { 7811 var rules = styleSheet.rules; 7812 var ruleStyleSheet; 7813 7814 if (rules && rules.length) { 7815 for (i = 0, length = rules.length; i < length; i++) { 7816 ruleStyleSheet = rules[i].styleSheet; 7817 7818 if (ruleStyleSheet) { 7819 instance._getAllStyleSheets(ruleStyleSheet, mediaType, level, buffer); 7820 } 7821 } 7822 } 7823 } 7824 7825 if (!styleSheet.disabled && styleSheet.rules) { 7826 buffer.push(styleSheet); 7827 } 7828 } 7829 } 7830 7831 mediaType = 'all'; 7832 7833 return buffer; 7834 }, 7835 7836 /** 7837 * Gets the `<body>` element. 7838 * 7839 * @method _getBodyEl 7840 * @protected 7841 * @return {Element} 7842 */ 7843 _getBodyEl: function() { 7844 var instance = this; 7845 7846 var bodyEl = instance._bodyEl; 7847 7848 if (!bodyEl) { 7849 bodyEl = DOC.body; 7850 7851 instance._bodyEl = bodyEl; 7852 } 7853 7854 return bodyEl; 7855 }, 7856 7857 /** 7858 * Gets a clone of the `<body>` element. 7859 * 7860 * @method _getBodyClone 7861 * @protected 7862 * @return {Element} 7863 */ 7864 _getBodyClone: function() { 7865 var instance = this; 7866 7867 var bodyClone = instance._bodyClone; 7868 7869 if (!bodyClone) { 7870 bodyClone = DOC.createElement('body'); 7871 7872 instance._bodyClone = bodyClone; 7873 } 7874 7875 return bodyClone; 7876 }, 7877 7878 /** 7879 * Gets a document fragment object. 7880 * 7881 * @method _getDocFrag 7882 * @protected 7883 * @return {DocumentFragment} 7884 */ 7885 _getDocFrag: function() { 7886 var instance = this; 7887 7888 var docFrag = instance._docFrag; 7889 7890 if (!docFrag) { 7891 docFrag = DOC.createDocumentFragment(); 7892 7893 html5shiv(docFrag); 7894 7895 instance._docFrag = docFrag; 7896 } 7897 7898 return docFrag; 7899 }, 7900 7901 /** 7902 * Gets the stylesheet from the DOM. 7903 * 7904 * @method _getStyleSheet 7905 * @protected 7906 * @return {Node} 7907 */ 7908 _getStyleSheet: function() { 7909 var instance = this; 7910 7911 var styleSheet = instance._styleSheet; 7912 7913 if (!styleSheet) { 7914 styleSheet = DOC.createElement('style'); 7915 7916 var head = DOC.documentElement.firstChild; 7917 7918 head.insertBefore(styleSheet, head.firstChild); 7919 7920 styleSheet.media = 'print'; 7921 styleSheet.className = 'printfix'; 7922 7923 instance._styleSheet = styleSheet; 7924 } 7925 7926 return styleSheet; 7927 } 7928 } 7929); 7930 7931A.namespace('HTML5').printFix = printFix; 7932 7933printFix(); 7934 7935 7936}, '3.1.0-deprecated.60', {"requires": ["collection", "aui-node-base"]}); 7937 7938YUI.add('aui-selector', function (A, NAME) { 7939 7940/** 7941 * The Selector Utility. 7942 * 7943 * @module aui-selector 7944 */ 7945 7946var SELECTOR = A.Selector, 7947 7948 CSS_BOOTSTRAP_SR_ONLY = A.getClassName('sr-only'), 7949 CSS_HIDE = A.getClassName('hide'), 7950 REGEX_CLIP_RECT_ZERO = new RegExp(/rect\((0(px)?(,)?(\s)?){4}\)/i), 7951 REGEX_HIDDEN_CLASSNAMES = new RegExp(CSS_HIDE), 7952 REGEX_SR_ONLY_CLASSNAMES = new RegExp(CSS_BOOTSTRAP_SR_ONLY); 7953 7954SELECTOR._isNodeHidden = function(node) { 7955 var width = node.offsetWidth; 7956 var height = node.offsetHeight; 7957 var ignore = node.nodeName.toLowerCase() === 'tr';
7958 var className = node.className; 7959 var nodeStyle = node.style; 7960 7961 var hidden = false; 7962 7963 if (!ignore) { 7964 if (width === 0 && height === 0) { 7965 hidden = true; 7966 } 7967 else if (width > 0 && height > 0) { 7968 hidden = false; 7969 } 7970 } 7971 7972 hidden = hidden || (nodeStyle.display === 'none' || nodeStyle.visibility === 'hidden') || 7973 (nodeStyle.position === 'absolute' && REGEX_CLIP_RECT_ZERO.test(nodeStyle.clip)) || 7974 REGEX_HIDDEN_CLASSNAMES.test(className) || REGEX_SR_ONLY_CLASSNAMES.test(className); 7975 7976 return hidden; 7977}; 7978 7979var testNodeType = function(type) { 7980 return function(node) { 7981 return node.type === type; 7982 }; 7983}; 7984 7985/** 7986 * Augment the [YUI3 Selector](Selector.html) with more util methods. 7987 * 7988 * @class A.Selector 7989 * @uses Selector 7990 * @constructor 7991 */ 7992A.mix( 7993 SELECTOR.pseudos, { 7994 /** 7995 * Checks if the node is a button element or contains `type="button"`. 7996 * 7997 * @method button 7998 * @param node 7999 * @return {Boolean} 8000 */ 8001 button: function(node) { 8002 return node.type === 'button' || node.nodeName.toLowerCase() === 'button'; 8003 }, 8004 8005 /** 8006 * Checks if the node contains `type="checkbox"`. 8007 * 8008 * @method checkbox 8009 * @return {Boolean} 8010 */ 8011 checkbox: testNodeType('checkbox'), 8012 8013 /** 8014 * Checks if the node is checked or not. 8015 * 8016 * @method checked 8017 * @param node 8018 * @return {Boolean} 8019 */ 8020 checked: function(node) { 8021 return node.checked === true; 8022 }, 8023 8024 /** 8025 * Checks if the node is disabled or not. 8026 * 8027 * @method disabled 8028 * @param node 8029 * @return {Boolean} 8030 */ 8031 disabled: function(node) { 8032 return node.disabled === true; 8033 }, 8034 8035 /** 8036 * Checks if the node is empty or not. 8037 * 8038 * @method empty 8039 * @param node 8040 * @return {Boolean} 8041 */ 8042 empty: function(node) { 8043 return !node.firstChild; 8044 }, 8045 8046 /** 8047 * Checks if the node is enabled or not. 8048 * 8049 * @method enabled 8050 * @param node 8051 * @return {Boolean} 8052 */ 8053 enabled: function(node) { 8054 return node.disabled === false && node.type !== 'hidden'; 8055 }, 8056 8057 /** 8058 * Checks if the node contains `type="file"`. 8059 * 8060 * @method file 8061 * @return {Boolean} 8062 */ 8063 file: testNodeType('file'), 8064 8065 /** 8066 * Checks if the node is a header (e.g. `<h1>`, `<h2>`, ...) or not. 8067 * 8068 * @method header 8069 * @param node 8070 * @return {Boolean} 8071 */ 8072 header: function(node) { 8073 return /h\d/i.test(node.nodeName); 8074 }, 8075 8076 /** 8077 * Checks if the node is hidden or not. 8078 * 8079 * @method hidden 8080 * @param node 8081 * @return {Boolean} 8082 */ 8083 hidden: function(node) { 8084 return SELECTOR._isNodeHidden(node); 8085 }, 8086 8087 /** 8088 * Checks if the node contains `type="image"`. 8089 * 8090 * @method image 8091 * @return {Boolean} 8092 */ 8093 image: testNodeType('image'), 8094 8095 /** 8096 * Checks if the node is an input (e.g. `<textarea>`, `<input>`, ...) or not. 8097 * 8098 * @method input 8099 * @param node 8100 * @return {Boolean} 8101 */ 8102 input: function(node) { 8103 return /input|select|textarea|button/i.test(node.nodeName); 8104 }, 8105 8106 /** 8107 * Checks if the node contains a child or not. 8108 * 8109 * @method parent 8110 * @param node 8111 * @return {Boolean} 8112 */ 8113 parent: function(node) { 8114 return !!node.firstChild; 8115 }, 8116 8117 /** 8118 * Checks if the node contains `type="password"`. 8119 * 8120 * @method password 8121 * @return {Boolean} 8122 */ 8123 password: testNodeType('password'), 8124 8125 /** 8126 * Checks if the node contains `type="radio"`. 8127 * 8128 * @method radio 8129 * @return {Boolean} 8130 */ 8131 radio: testNodeType('radio'), 8132 8133 /** 8134 * Checks if the node contains `type="reset"`. 8135 * 8136 * @method reset 8137 * @return {Boolean} 8138 */ 8139 reset: testNodeType('reset'), 8140 8141 /** 8142 * Checks if the node is selected or not. 8143 * 8144 * @method selected 8145 * @param node 8146 * @return {Boolean} 8147 */ 8148 selected: function(node) { 8149 node.parentNode.selectedIndex; 8150 return node.selected === true; 8151 }, 8152 8153 /** 8154 * Checks if the node contains `type="submit"`. 8155 * 8156 * @method submit 8157 * @return {Boolean} 8158 */ 8159 submit: testNodeType('submit'), 8160 8161 /** 8162 * Checks if the node contains `type="text"`. 8163 * 8164 * @method text 8165 * @return {Boolean} 8166 */ 8167 text: testNodeType('text'), 8168 8169 /** 8170 * Checks if the node is visible or not. 8171 * 8172 * @method visible 8173 * @param node 8174 * @return {Boolean} 8175 */ 8176 visible: function(node) { 8177 return !SELECTOR._isNodeHidden(node); 8178 } 8179 } 8180); 8181 8182 8183}, '3.1.0-deprecated.60', {"requires": ["selector-css3", "aui-classnamemanager"]}); 8184 8185YUI.add('aui-timer', function (A, NAME) { 8186 8187/** 8188 * Utility for timing logics used to manage [JavaScript Timer 8189 * Congestion](http://fitzgeraldnick.com/weblog/40/) problems. 8190 * 8191 * @module aui-timer 8192 */ 8193 8194var Lang = A.Lang, 8195 now = Lang.now, 8196 isEmpty = A.Object.isEmpty, 8197 8198 aArray = A.Array; 8199 8200/** 8201 * A base class for Timer. 8202 * 8203 * @class A.Timer 8204 * @constructor 8205 */ 8206var Timer = { 8207 8208 /** 8209 * Cancels repeated action which was set up using `setInterval` function. 8210 * 8211 * @method clearInterval 8212 * @param id 8213 */ 8214 clearInterval: function(id) { 8215 var instance = Timer; 8216 8217 instance.unregister(true, id); 8218 }, 8219 8220 /**
8221 * Clears the delay set by `setTimeout` function. 8222 * 8223 * @method clearTimeout 8224 * @param id 8225 */ 8226 clearTimeout: function(id) { 8227 var instance = Timer; 8228 8229 instance.unregister(false, id); 8230 }, 8231 8232 /** 8233 * Defines the fixed time delay between each interval. 8234 * 8235 * @method intervalTime 8236 * @param newInterval 8237 * @return {Number} 8238 */ 8239 intervalTime: function(newInterval) { 8240 var instance = Timer; 8241 8242 if (arguments.length) { 8243 instance._INTERVAL = newInterval; 8244 } 8245 8246 return instance._INTERVAL; 8247 }, 8248 8249 /** 8250 * Checks if the task is repeatable or not. 8251 * 8252 * @method isRepeatable 8253 * @param task 8254 * @return {Boolean} 8255 */ 8256 isRepeatable: function(task) { 8257 return task.repeats; 8258 }, 8259 8260 /** 8261 * Calls a function after a specified delay. 8262 * 8263 * @method setTimeout 8264 * @param fn 8265 * @param ms 8266 * @param context 8267 */ 8268 setTimeout: function(fn, ms, context) { 8269 var instance = Timer; 8270 8271 var args = aArray(arguments, 3, true); 8272 8273 return instance.register(false, fn, ms, context, args); 8274 }, 8275 8276 /** 8277 * Calls a function repeatedly, with a fixed time delay between each call to 8278 * that function. 8279 * 8280 * @method setInterval 8281 * @param fn 8282 * @param ms 8283 * @param context 8284 */ 8285 setInterval: function(fn, ms, context) { 8286 var instance = Timer; 8287 8288 var args = aArray(arguments, 3, true); 8289 8290 return instance.register(true, fn, ms, context, args); 8291 }, 8292 8293 /** 8294 * Adds a new task to the timer. 8295 * 8296 * @method register 8297 * @param repeats 8298 * @param fn 8299 * @param ms 8300 * @param context 8301 * @param args 8302 */ 8303 register: function(repeats, fn, ms, context, args) { 8304 var instance = Timer; 8305 8306 var id = (++A.Env._uidx); 8307 8308 args = args || []; 8309 8310 args.unshift(fn, context); 8311 8312 instance._TASKS[id] = instance._create( 8313 repeats, instance._getNearestInterval(ms), A.rbind.apply(A, args) 8314 ); 8315 8316 instance._lazyInit(); 8317 8318 return id; 8319 }, 8320 8321 /** 8322 * Runs the task function. 8323 * 8324 * @method run 8325 * @param task 8326 */ 8327 run: function(task) { 8328 task.lastRunTime = now(); 8329 8330 return task.fn(); 8331 }, 8332 8333 /** 8334 * Removes a task from the timer. 8335 * 8336 * @method unregister 8337 * @param repeats 8338 * @param id 8339 */ 8340 unregister: function(repeats, id) { 8341 var instance = Timer; 8342 8343 var tasks = instance._TASKS; 8344 8345 var task = tasks[id]; 8346 8347 instance._lazyDestroy(); 8348 8349 return task && task.repeats === repeats && delete tasks[id]; 8350 }, 8351 8352 /** 8353 * Creates a collection of timer definitions. 8354 * 8355 * @method _create 8356 * @param repeats 8357 * @param ms 8358 * @param fn 8359 * @protected 8360 * @return {Object} 8361 */ 8362 _create: function(repeats, ms, fn) { 8363 return { 8364 fn: fn, 8365 lastRunTime: now(), 8366 next: ms, 8367 repeats: repeats, 8368 timeout: ms 8369 }; 8370 }, 8371 8372 /** 8373 * Subtracts the current time with the last run time. The result of this 8374 * operation is subtracted with the task timeout. 8375 * 8376 * @method _decrementNextRunTime 8377 * @param tasks 8378 * @protected 8379 */ 8380 _decrementNextRunTime: function(task) { 8381 return task.next = task.timeout - (now() - task.lastRunTime); 8382 }, 8383 8384 /** 8385 * Calculates the nearest interval by using the modulus of the argument with 8386 * the interval as reference. 8387 * 8388 * @method _getNearestInterval 8389 * @param num 8390 * @protected 8391 * @return {Number} 8392 */ 8393 _getNearestInterval: function(num) { 8394 var instance = Timer; 8395 8396 var interval = instance._INTERVAL; 8397 8398 var delta = num % interval; 8399 8400 var nearestInterval; 8401 8402 if (delta < interval / 2) { 8403 nearestInterval = num - delta; 8404 } 8405 else { 8406 nearestInterval = num + interval - delta; 8407 } 8408 8409 return nearestInterval; 8410 }, 8411 8412 /** 8413 * Checks if the timer is initialized and empty, then calls the 8414 * `clearTimeout` function using the global interval id. 8415 * 8416 * @method _lazyDestroy 8417 * @protected 8418 */ 8419 _lazyDestroy: function() { 8420 var instance = Timer; 8421 8422 if (instance._initialized && isEmpty(instance._TASKS)) { 8423 clearTimeout(instance._globalIntervalId); 8424 8425 instance._initialized = false;
8426 } 8427 }, 8428 8429 /** 8430 * Checks if the timer is initialized and contains a task, then calls the 8431 * `setTimeout` function and stores the global interval id. 8432 * 8433 * @method _lazyInit 8434 * @protected 8435 */ 8436 _lazyInit: function() { 8437 var instance = Timer; 8438 8439 if (!instance._initialized && !isEmpty(instance._TASKS)) { 8440 instance._lastRunTime = now(); 8441 8442 instance._globalIntervalId = setTimeout( 8443 instance._runner, instance._INTERVAL 8444 ); 8445 8446 instance._initialized = true; 8447 } 8448 }, 8449 8450 /** 8451 * Goes through all pending tasks and initializes its timer or unregisters 8452 * it depending on the task status. 8453 * 8454 * @method _loop 8455 * @param i 8456 * @param pendingTasks 8457 * @param length 8458 * @protected 8459 */ 8460 _loop: function(i, pendingTasks, length) { 8461 var instance = Timer; 8462 8463 var interval = instance._INTERVAL; 8464 var tasks = instance._TASKS; 8465 8466 var halfInterval = interval / 2; 8467 8468 for (var start = now(); i < length && now() - start < 50; i++) { 8469 var taskId = pendingTasks[i]; 8470 var task = tasks[taskId]; 8471 8472 if (task && instance._decrementNextRunTime(task) < halfInterval) { 8473 instance.run(task); 8474 8475 if (instance.isRepeatable(task)) { 8476 instance._resetNextRunTime(task); 8477 } 8478 else { 8479 instance.unregister(false, taskId); 8480 } 8481 } 8482 } 8483 8484 if (instance._initialized) { 8485 if (i < length) { 8486 instance._globalIntervalId = setTimeout(instance._loop, 10); 8487 } 8488 else { 8489 instance._globalIntervalId = setTimeout( 8490 instance._runner, interval 8491 ); 8492 } 8493 } 8494 }, 8495 8496 /** 8497 * Gets the arguments to call the `_loop` method. 8498 * 8499 * @method _runner 8500 * @protected 8501 */ 8502 _runner: function() { 8503 var instance = Timer; 8504 8505 var i = 0; 8506 var pendingTasks = A.Object.keys(instance._TASKS); 8507 var length = pendingTasks.length; 8508 8509 instance._loop(i, pendingTasks, length); 8510 }, 8511 8512 /** 8513 * Resets the next run time. 8514 * 8515 * @method _resetNextRunTime 8516 * @param task 8517 * @protected 8518 */ 8519 _resetNextRunTime: function(task) { 8520 return task.next = task.timeout; 8521 }, 8522 8523 _INTERVAL: 50, 8524 _TASKS: {}, 8525 8526 _lastRunTime: 0, 8527 _globalIntervalId: 0, 8528 _initialized: false 8529}; 8530 8531/** 8532 * Cancels repeated action which was set up using `setInterval` function. 8533 * 8534 * @method A.clearInterval 8535 * @static 8536 * @param id 8537 */ 8538A.clearInterval = Timer.clearInterval; 8539 8540/** 8541 * Clears the delay set by `setTimeout` function. 8542 * 8543 * @method A.clearTimeout 8544 * @static 8545 * @param id 8546 */ 8547A.clearTimeout = Timer.clearTimeout; 8548 8549/** 8550 * Calls a function repeatedly, with a fixed time delay between each call to 8551 * that function. 8552 * 8553 * @method A.setInterval 8554 * @static 8555 * @param fn 8556 * @param ms 8557 * @param context 8558 */ 8559A.setInterval = Timer.setInterval; 8560 8561/** 8562 * Calls a function after a specified delay. 8563 * 8564 * @method A.setTimeout 8565 * @static 8566 * @param fn 8567 * @param ms 8568 * @param context 8569 */ 8570A.setTimeout = Timer.setTimeout; 8571 8572A.Timer = Timer; 8573 8574 8575}, '3.1.0-deprecated.60', {"requires": ["oop"]}); 8576 8577(function() { 8578 var A = AUI().use('oop'); 8579 8580 var usedModules = {}; 8581 8582 var Dependency = { 8583 provide: function(obj, methodName, methodFn, modules, proto) { 8584 if (!Array.isArray(modules)) { 8585 modules = [modules]; 8586 } 8587 8588 var before; 8589 8590 var guid = A.guid(); 8591 8592 if (A.Lang.isObject(methodFn, true)) { 8593 var config = methodFn; 8594 8595 methodFn = config.fn; 8596 before = config.before; 8597 8598 if (!A.Lang.isFunction(before)) { 8599 before = null; 8600 } 8601 } 8602 8603 if (proto && A.Lang.isFunction(obj)) { 8604 obj = obj.prototype; 8605 } 8606 8607 var AOP = Dependency._getAOP(obj, methodName); 8608 8609 if (AOP) { 8610 delete obj._yuiaop[methodName]; 8611 } 8612 8613 var proxy = function() { 8614 var args = arguments; 8615 8616 var context = obj; 8617 8618 if (proto) { 8619 context = this; 8620 } 8621 8622 if (modules.length == 1) { 8623 if (modules[0] in usedModules) { 8624 Dependency._replaceMethod(obj, methodName, methodFn, context); 8625
8626 methodFn.apply(context, args); 8627 8628 return; 8629 } 8630 } 8631 8632 var firstLoad = false; 8633 8634 var queue = Dependency._proxyLoaders[guid]; 8635 8636 if (!queue) { 8637 firstLoad = true; 8638 8639 Dependency._proxyLoaders[guid] = new A.Queue(); 8640 8641 queue = Dependency._proxyLoaders[guid]; 8642 } 8643 8644 queue.add(args); 8645 8646 if (firstLoad) { 8647 modules.push(A.bind(Dependency._proxy, Liferay, obj, methodName, methodFn, context, guid, modules)); 8648 8649 A.use.apply(A, modules); 8650 } 8651 }; 8652 8653 proxy.toString = function() { 8654 return methodFn.toString(); 8655 }; 8656 8657 obj[methodName] = proxy; 8658 }, 8659 8660 _getAOP: function(obj, methodName) { 8661 var instance = this; 8662 8663 return obj._yuiaop && obj._yuiaop[methodName]; 8664 }, 8665 8666 _proxy: function(obj, methodName, methodFn, context, guid, modules, A) { 8667 var args; 8668 8669 var queue = Dependency._proxyLoaders[guid]; 8670 8671 Dependency._replaceMethod(obj, methodName, methodFn, context); 8672 8673 while ((args = queue.next())) { 8674 methodFn.apply(context, args); 8675 } 8676 8677 for (var i = modules.length - 1; i >= 0; i--) { 8678 usedModules[modules[i]] = true; 8679 } 8680 }, 8681 8682 _replaceMethod: function(obj, methodName, methodFn, context) { 8683 var instance = this; 8684 8685 var AOP = Dependency._getAOP(obj, methodName); 8686 8687 var proxy = obj[methodName]; 8688 8689 if (AOP) { 8690 proxy = AOP.method; 8691 8692 AOP.method = methodFn; 8693 } 8694 else { 8695 obj[methodName] = methodFn; 8696 } 8697 8698 A.mix(methodFn, proxy); 8699 }, 8700 8701 _proxyLoaders: {} 8702 }; 8703 8704 Liferay.Dependency = Dependency; 8705 8706 Liferay.provide = Dependency.provide; 8707})(); 8708"use strict"; 8709 8710;(function (Liferay) { 8711 var DOMTaskRunner = { 8712 addTask: function addTask(task) { 8713 var instance = this; 8714 8715 instance._scheduledTasks.push(task); 8716 }, 8717 8718 addTaskState: function addTaskState(state) { 8719 var instance = this; 8720 8721 instance._taskStates.push(state); 8722 }, 8723 8724 reset: function reset() { 8725 var instance = this; 8726 8727 instance._taskStates.length = 0; 8728 instance._scheduledTasks.length = 0; 8729 }, 8730 8731 runTasks: function runTasks(node) { 8732 var instance = this; 8733 8734 var scheduledTasks = instance._scheduledTasks; 8735 var taskStates = instance._taskStates; 8736 8737 var tasksLength = scheduledTasks.length; 8738 var taskStatesLength = taskStates.length; 8739 8740 for (var i = 0; i < tasksLength; i++) { 8741 var task = scheduledTasks[i]; 8742 8743 var taskParams = task.params; 8744 8745 for (var j = 0; j < taskStatesLength; j++) { 8746 var state = taskStates[j]; 8747 8748 if (task.condition(state, taskParams, node)) { 8749 task.action(state, taskParams, node); 8750 } 8751 } 8752 } 8753 }, 8754 8755 _scheduledTasks: [], 8756 _taskStates: [] 8757 }; 8758 8759 Liferay.DOMTaskRunner = DOMTaskRunner; 8760})(Liferay); 8761'use strict'; 8762 8763Liferay.on = function () {}; 8764 8765Liferay.fire = function () {}; 8766 8767Liferay.detach = function () {}; 8768 8769;(function (A, Liferay) { 8770 var CLICK_EVENTS = {}; 8771 8772 var DOC = A.config.doc; 8773 8774 Liferay.provide(Liferay, 'delegateClick', function (id, fn) { 8775 var el = DOC.getElementById(id); 8776 8777 if (!el || el.id != id) { 8778 return; 8779 } 8780 8781 var guid = A.one(el).addClass('lfr-delegate-click').guid(); 8782 8783 CLICK_EVENTS[guid] = fn; 8784 8785 if (!Liferay._baseDelegateHandle) { 8786 Liferay._baseDelegateHandle = A.getBody().delegate('click', Liferay._baseDelegate, '.lfr-delegate-click'); 8787 } 8788 }, ['aui-base']); 8789 8790 Liferay._baseDelegate = function (event) { 8791 var id = event.currentTarget.attr('id'); 8792 8793 var fn = CLICK_EVENTS[id]; 8794 8795 if (fn) { 8796 fn.apply(this, arguments); 8797 } 8798 }; 8799 8800 Liferay._CLICK_EVENTS = CLICK_EVENTS; 8801 8802 A.use('attribute', 'oop', function (A) { 8803 A.augment(Liferay, A.Attribute, true); 8804 }); 8805})(AUI(), Liferay); 8806;(function(A, Liferay) { 8807 var Language = {}; 8808 8809 Language.get = function(key) { 8810 return key; 8811 }; 8812 8813 A.use( 8814 'io-base', 8815 function(A) { 8816 Language.get = A.cached( 8817 function(key, extraParams) { 8818 var instance = this; 8819 8820 var url = themeDisplay.getPathContext() + '/language/' + themeDisplay.getLanguageId() + '/' + key + '/'; 8821 8822 if (extraParams) { 8823 if (typeof extraParams == 'string') { 8824 url += extraParams; 8825 } 8826 else if (Array.isArray(extraParams)) { 8827 url += extraParams.join('/'); 8828 } 8829 } 8830 8831 var headers = { 8832 'X-CSRF-Token': Liferay.authToken 8833 }; 8834 8835 var value = ''; 8836 8837 A.io( 8838 url, 8839 { 8840 headers: headers, 8841 method: 'GET', 8842 on: { 8843 complete: function(i, o) { 8844 value = o.responseText; 8845 } 8846 }, 8847 sync: true 8848 } 8849 ); 8850 8851 return value; 8852 } 8853 ); 8854 } 8855 ); 8856 8857 Liferay.Language = Language; 8858})(AUI(), Liferay); 8859'use strict'; 8860 8861(function (Liferay) { 8862 Liferay.lazyLoad = function () { 8863 var failureCallback; 8864 8865 var isFunction = function isFunction(val) { 8866 return typeof val === 'function'; 8867 }; 8868 8869 var modules; 8870 var successCallback; 8871 8872 if (Array.isArray(arguments[0])) { 8873 modules = arguments[0]; 8874 8875 successCallback = isFunction(arguments[1]) ? arguments[1] : null; 8876 failureCallback = isFunction(arguments[2]) ? arguments[2] : null; 8877 } else { 8878 modules = []; 8879 8880 for (var i = 0; i < arguments.length; ++i) { 8881 if (typeof arguments[i] === 'string') { 8882 modules[i] = arguments[i]; 8883 } else if (isFunction(arguments[i])) { 8884 successCallback = arguments[i]; 8885 failureCallback = isFunction(arguments[++i]) ? arguments[i] : null; 8886 break; 8887 } 8888 } 8889 } 8890 8891 return function () { 8892 var args = []; 8893 8894 for (var i = 0; i < arguments.length; ++i) { 8895 args.push(arguments[i]); 8896 } 8897 8898 Liferay.Loader.require(modules, function () { 8899 for (var i = 0; i < arguments.length; ++i) { 8900 args.splice(i, 0, arguments[i]); 8901 } 8902 8903 successCallback.apply(successCallback, args); 8904 }, failureCallback); 8905 }; 8906 }; 8907})(Liferay); 8908'use strict'; 8909 8910var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 8911 8912Liferay = window.Liferay || {}; 8913 8914(function ($, Liferay) { 8915 var isFunction = function isFunction(val) { 8916 return typeof val === 'function'; 8917 }; 8918 8919 var isNode = function isNode(node) { 8920 return node && (node._node || node.jquery || node.nodeType); 8921 }; 8922 8923 var REGEX_METHOD_GET = /^get$/i; 8924 8925 var STR_MULTIPART = 'multipart/form-data'; 8926 8927 Liferay.namespace = function namespace(obj, path) { 8928 if (path === undefined) { 8929 path = obj; 8930 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 8952 $.ajaxPrefilter(function (options) { 8953 if (options.crossDomain) { 8954 options.contents.script = false;
8955 } 8956 8957 if (options.url) { 8958 options.url = Liferay.Util.getURLWithSessionId(options.url); 8959 } 8960 }); 8961 8962 var jqueryInit = $.prototype.init; 8963 8964 $.prototype.init = function (selector, context, root) { 8965 if (selector === '#') { 8966 selector = ''; 8967 } 8968 8969 return new jqueryInit(selector, context, root); 8970 }; 8971 8972 $(document).on('show.bs.collapse', function (event) { 8973 var target = $(event.target); 8974 8975 var ancestor = target.parents('.panel-group'); 8976 8977 if (target.hasClass('panel-collapse') && ancestor.length) { 8978 var openChildren = ancestor.find('.panel-collapse.in').not(target); 8979 8980 if (openChildren.length && ancestor.find('[data-parent="#' + ancestor.attr('id') + '"]').length) { 8981 openChildren.removeClass('in'); 8982 } 8983 } 8984 8985 if (target.hasClass('in')) { 8986 target.addClass('show'); 8987 target.removeClass('in'); 8988 8989 target.collapse('hide'); 8990 8991 return false; 8992 } 8993 }); 8994 8995 $(document).on('show.bs.dropdown', function () { 8996 Liferay.fire('dropdownShow', { 8997 src: 'BootstrapDropdown' 8998 }); 8999 }); 9000 9001 Liferay.on('dropdownShow', function (event) { 9002 if (event.src !== 'BootstrapDropdown') { 9003 $('.dropdown.show .dropdown-toggle').dropdown('toggle'); 9004 } 9005 }); 9006 9007 /** 9008 * OPTIONS 9009 * 9010 * Required 9011 * 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. 9012 * 9013 * Optional 9014 * 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. 9015 * successCallback {function}: A function to execute when the server returns a response. It receives a JSON object as it's first parameter. 9016 * 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. 9017 */ 9018 9019 var Service = function Service() { 9020 var instance = this; 9021 9022 var args = Service.parseInvokeArgs(Array.prototype.slice.call(arguments, 0)); 9023 9024 return Service.invoke.apply(Service, args); 9025 }; 9026 9027 Service.URL_INVOKE = themeDisplay.getPathContext() + '/api/jsonws/invoke'; 9028 9029 Service.bind = function () { 9030 var args = Array.prototype.slice.call(arguments, 0); 9031 9032 return function () { 9033 var newArgs = Array.prototype.slice.call(arguments, 0); 9034 9035 return Service.apply(Service, args.concat(newArgs)); 9036 }; 9037 }; 9038 9039 Service.parseInvokeArgs = function (args) { 9040 var instance = this; 9041 9042 var payload = args[0]; 9043 9044 var ioConfig = instance.parseIOConfig(args); 9045 9046 if (typeof payload === 'string') { 9047 payload = instance.parseStringPayload(args); 9048 9049 instance.parseIOFormConfig(ioConfig, args); 9050 9051 var lastArg = args[args.length - 1]; 9052 9053 if ((typeof lastArg === 'undefined' ? 'undefined' : _typeof(lastArg)) === 'object' && lastArg.method) { 9054 ioConfig.method = lastArg.method; 9055 } 9056 } 9057 9058 return [payload, ioConfig]; 9059 }; 9060 9061 Service.parseIOConfig = function (args) { 9062 var instance = this; 9063 9064 var payload = args[0]; 9065 9066 var ioConfig = payload.io || {}; 9067 9068 delete payload.io; 9069 9070 if (!ioConfig.success) { 9071 var callbacks = args.filter(isFunction); 9072 9073 var callbackException = callbacks[1]; 9074 var callbackSuccess = callbacks[0]; 9075 9076 if (!callbackException) { 9077 callbackException = callbackSuccess; 9078 } 9079 9080 ioConfig.complete = function (xhr) { 9081 var response = xhr.responseJSON; 9082 9083 if (response !== null && !response.hasOwnProperty('exception')) { 9084 if (callbackSuccess) { 9085 callbackSuccess.call(this, response); 9086 } 9087 } else if (callbackException) { 9088 var exception = response ? response.exception : 'The server returned an empty response'; 9089 9090 callbackException.call(this, exception, response); 9091 } 9092 }; 9093 } 9094 9095 if (!ioConfig.hasOwnProperty('cache') && REGEX_METHOD_GET.test(ioConfig.type)) { 9096 ioConfig.cache = false; 9097 } 9098 9099 if (Liferay.PropsValues.NTLM_AUTH_ENABLED && Liferay.Browser.isIe()) { 9100 ioConfig.type = 'GET'; 9101 } 9102 9103 return ioConfig; 9104 }; 9105 9106 Service.parseIOFormConfig = function (ioConfig, args) { 9107 var instance = this; 9108 9109 var form = args[1]; 9110 9111 if (isNode(form)) { 9112 ioConfig.form = form; 9113 9114 if (ioConfig.form.enctype == STR_MULTIPART) { 9115 ioConfig.contentType = false;
9116 ioConfig.processData = false; 9117 } 9118 } 9119 }; 9120 9121 Service.parseStringPayload = function (args) { 9122 var params = {}; 9123 var payload = {}; 9124 9125 var config = args[1]; 9126 9127 if (!isFunction(config) && !isNode(config)) { 9128 params = config; 9129 } 9130 9131 payload[args[0]] = params; 9132 9133 return payload; 9134 }; 9135 9136 Service.invoke = function (payload, ioConfig) { 9137 var instance = this; 9138 9139 var cmd = JSON.stringify(payload); 9140 var p_auth = Liferay.authToken; 9141 9142 ioConfig = Object.assign({ 9143 data: { 9144 cmd: cmd, 9145 p_auth: p_auth 9146 }, 9147 dataType: 'JSON' 9148 }, ioConfig); 9149 9150 if (ioConfig.form) { 9151 if (ioConfig.form.enctype == STR_MULTIPART && isFunction(window.FormData)) { 9152 ioConfig.data = new FormData(ioConfig.form); 9153 9154 ioConfig.data.append('cmd', cmd); 9155 ioConfig.data.append('p_auth', p_auth); 9156 } else { 9157 $(ioConfig.form).serializeArray().forEach(function (item) { 9158 ioConfig.data[item.name] = item.value; 9159 }); 9160 } 9161 9162 delete ioConfig.form; 9163 } 9164 9165 return $.ajax(instance.URL_INVOKE, ioConfig); 9166 }; 9167 9168 ['get', 'delete', 'post', 'put', 'update'].forEach(function (item) { 9169 var methodName = item; 9170 9171 if (item === 'delete') { 9172 methodName = 'del'; 9173 } 9174 9175 Service[methodName] = function () { 9176 var args = Array.prototype.slice.call(arguments, 0); 9177 9178 var method = { method: item }; 9179 9180 args.push(method); 9181 9182 return Service.apply(Service, args); 9183 }; 9184 }); 9185 9186 Liferay.Service = Service; 9187 9188 var componentDestroyConfigs = {}; 9189 var componentPromiseWrappers = {}; 9190 var components = {}; 9191 var componentsFn = {}; 9192 9193 var _createPromiseWrapper = function _createPromiseWrapper(value) { 9194 var promiseWrapper; 9195 9196 if (value) { 9197 promiseWrapper = { 9198 promise: Promise.resolve(value), 9199 resolve: function resolve() {} 9200 }; 9201 } else { 9202 var promiseResolve; 9203 var promise = new Promise(function (resolve) { 9204 promiseResolve = resolve; 9205 }); 9206 9207 promiseWrapper = { 9208 promise: promise, 9209 resolve: promiseResolve 9210 }; 9211 } 9212 9213 return promiseWrapper; 9214 }; 9215 9216 Liferay.component = function (id, value, destroyConfig) { 9217 var retVal; 9218 9219 if (arguments.length === 1) { 9220 var component = components[id]; 9221 9222 if (component && isFunction(component)) { 9223 componentsFn[id] = component; 9224 9225 component = component(); 9226 9227 components[id] = component; 9228 } 9229 9230 retVal = component; 9231 } else { 9232 if (components[id] && value !== null) { 9233 delete componentDestroyConfigs[id]; 9234 delete componentPromiseWrappers[id]; 9235 9236 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.'); 9237 } 9238 9239 retVal = components[id] = value; 9240 9241 if (value === null) { 9242 delete componentDestroyConfigs[id]; 9243 delete componentPromiseWrappers[id]; 9244 } else { 9245 componentDestroyConfigs[id] = destroyConfig; 9246 9247 Liferay.fire(id + ':registered'); 9248 9249 var componentPromiseWrapper = componentPromiseWrappers[id]; 9250 9251 if (componentPromiseWrapper) { 9252 componentPromiseWrapper.resolve(value); 9253 } else { 9254 componentPromiseWrappers[id] = _createPromiseWrapper(value); 9255 } 9256 } 9257 } 9258 9259 return retVal; 9260 }; 9261 9262 /** 9263 * Retrieves a list of component instances after they've been registered. 9264 * 9265 * @param {...string} componentId The ids of the components to be received 9266 * @return {Promise} A promise to be resolved with all the requested component 9267 * instances after they've been successfully registered 9268 * @review 9269 */ 9270 9271 Liferay.componentReady = function () { 9272 var component; 9273 var componentPromise; 9274 9275 if (arguments.length === 1) { 9276 component = arguments[0]; 9277 } else { 9278 component = []; 9279 9280 for (var i = 0; i < arguments.length; i++) { 9281 component[i] = arguments[i]; 9282 } 9283 } 9284 9285 if (Array.isArray(component)) { 9286 componentPromise = Promise.all(component.map(function (id) { 9287 return Liferay.componentReady(id); 9288 })); 9289 } else { 9290 var componentPromiseWrapper = componentPromiseWrappers[component]; 9291 9292 if (!componentPromiseWrapper) { 9293 componentPromiseWrappers[component] = componentPromiseWrapper = _createPromiseWrapper(); 9294 } 9295 9296 componentPromise = componentPromiseWrapper.promise; 9297 } 9298 9299 return componentPromise; 9300 }; 9301 9302 /** 9303 * Destroys the component registered by the provided component id. Invokes the 9304 * component's own destroy lifecycle methods (destroy or dispose) and deletes 9305 * the internal references to the component in the component registry. 9306 * 9307 * @param {string} componentId The id of the component to destroy 9308 * @review 9309 */ 9310 9311 Liferay.destroyComponent = function (componentId) { 9312 var component = components[componentId]; 9313 9314 if (component) { 9315 var destroyFn = component.destroy || component.dispose; 9316 9317 if (destroyFn) { 9318 destroyFn.call(component); 9319 } 9320 9321 delete componentDestroyConfigs[componentId]; 9322 delete componentPromiseWrappers[componentId]; 9323 delete componentsFn[componentId]; 9324 delete components[componentId]; 9325 } 9326 }; 9327 9328 /** 9329 * Destroys registered components matching the provided filter function. If 9330 * no filter function is provided, it will destroy all registered components. 9331 * 9332 * @param {Function} filterFn A method that receives a component destroy options 9333 * and the component itself and returns true if the component should be destroyed 9334 * @review 9335 */ 9336 9337 Liferay.destroyComponents = function (filterFn) { 9338 var componentIds = Object.keys(components); 9339 9340 if (filterFn) { 9341 componentIds = componentIds.filter(function (componentId) { 9342 return filterFn(components[componentId], componentDestroyConfigs[componentId] || {}); 9343 }); 9344 } 9345 9346 componentIds.forEach(Liferay.destroyComponent); 9347 }; 9348 9349 /** 9350 * Clears the component promises map to make sure pending promises won't get 9351 * accidentally resolved at a later stage if a component with the same id appears 9352 * causing stale code to run. 9353 */ 9354 9355 Liferay.destroyUnfulfilledPromises = function () { 9356 componentPromiseWrappers = {}; 9357 }; 9358 9359 Liferay._components = components; 9360 Liferay._componentsFn = components; 9361 9362 Liferay.Template = { 9363 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>' 9364 }; 9365})(AUI.$, Liferay); 9366 9367(function (A, Liferay) { 9368 A.mix(A.namespace('config.io'), { 9369 method: 'POST', 9370 uriFormatter: function uriFormatter(value) { 9371 return Liferay.Util.getURLWithSessionId(value); 9372 } 9373 }, true); 9374})(AUI(), Liferay); 9375;(function(A, $, Liferay) { 9376 A.use('aui-base-lang'); 9377 9378 var AArray = A.Array; 9379 9380 var Lang = A.Lang; 9381 9382 var EVENT_CLICK = 'click'; 9383 9384 var MAP_TOGGLE_STATE = { 9385 false: { 9386 cssClass: 'controls-hidden', 9387 iconCssClass: 'hidden', 9388 state: 'hidden' 9389 }, 9390 true: { 9391 cssClass: 'controls-visible', 9392 iconCssClass: 'view', 9393 state: 'visible' 9394 } 9395 }; 9396 9397 var REGEX_PORTLET_ID = /^(?:p_p_id)?_(.*)_.*$/; 9398 9399 var REGEX_SUB = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g; 9400 9401 var SRC_HIDE_LINK = { 9402 src: 'hideLink' 9403 }; 9404 9405 var STR_CHECKED = 'checked'; 9406 9407 var STR_RIGHT_SQUARE_BRACKET = ']'; 9408 9409 var TPL_LEXICON_ICON = '<svg class="lexicon-icon lexicon-icon-{0} {1}" focusable="false" role="image">' + 9410 '<use data-href="' + themeDisplay.getPathThemeImages() + '/lexicon/icons.svg#{0}" />' + 9411 '<title>{0}</title>' + 9412 '</svg>'; 9413 9414 var Window = { 9415 getById: function(id) { 9416 var instance = this; 9417 9418 return instance._map[id]; 9419 }, 9420 9421 _map: {} 9422 }; 9423 9424 var Util = { 9425 submitCountdown: 0, 9426 9427 addInputCancel: function() { 9428 A.use( 9429 'aui-button-search-cancel', 9430 function(A) { 9431 new A.ButtonSearchCancel( 9432 { 9433 trigger: 'input[type=password], input[type=search], input.clearable, input.search-query' 9434 } 9435 ); 9436 } 9437 ); 9438 9439 Util.addInputCancel = function() { 9440 }; 9441 }, 9442 9443 addParams: function(params, url) { 9444 if (typeof params === 'object') { 9445 params = $.param(params, true); 9446 } 9447 else { 9448 params = String(params).trim(); 9449 } 9450 9451 var loc = url || location.href; 9452 9453 var finalUrl = loc; 9454 9455 if (params) { 9456 var anchorHash; 9457 9458 if (loc.indexOf('#') > -1) { 9459 var locationPieces = loc.split('#'); 9460 9461 loc = locationPieces[0]; 9462 anchorHash = locationPieces[1]; 9463 } 9464 9465 if (loc.indexOf('?') == -1) { 9466 params = '?' + params; 9467 } 9468 else { 9469 params = '&' + params; 9470 } 9471 9472 if (loc.indexOf(params) == -1) { 9473 finalUrl = loc + params; 9474 9475 if (anchorHash) { 9476 finalUrl += '#' + anchorHash; 9477 } 9478 if (!url) { 9479 location.href = finalUrl; 9480 } 9481 9482 } 9483 } 9484 9485 return finalUrl; 9486 }, 9487 9488 checkAll: function(form, name, allBox, selectClassName) { 9489 if (form) { 9490 form = Util.getDOM(form); 9491 allBox = Util.getDOM(allBox); 9492 9493 var selector; 9494 9495 if (Array.isArray(name)) { 9496 selector = 'input[name=' + name.join('], input[name=') + STR_RIGHT_SQUARE_BRACKET; 9497 } 9498 else { 9499 selector = 'input[name=' + name + STR_RIGHT_SQUARE_BRACKET; 9500 } 9501 9502 form = $(form); 9503 9504 var allBoxChecked = $(allBox).prop(STR_CHECKED); 9505 9506 form.find(selector).each( 9507 function(index, item) { 9508 item = $(item); 9509 9510 if (!item.prop('disabled')) { 9511 item.prop(STR_CHECKED, allBoxChecked); 9512 } 9513 } 9514 ); 9515 9516 if (selectClassName) { 9517 form.find(selectClassName).toggleClass('info', allBoxChecked); 9518 } 9519 } 9520 }, 9521 9522 checkAllBox: function(form, name, allBox) { 9523 var totalOn = 0; 9524 9525 if (form) { 9526 form = Util.getDOM(form); 9527 allBox = Util.getDOM(allBox); 9528 9529 form = $(form); 9530 9531 var allBoxNodes = $(allBox); 9532 9533 if (!allBoxNodes.length) { 9534 allBoxNodes = form.find('input[name="' + allBox + '"]'); 9535 } 9536 9537 var totalBoxes = 0; 9538 9539 var inputs = form.find('input[type=checkbox]'); 9540 9541 if (!Array.isArray(name)) { 9542 name = [name]; 9543 } 9544 9545 inputs.each( 9546 function(index, item) { 9547 item = $(item); 9548 9549 if (!item.is(allBoxNodes) && name.indexOf(item.attr('name')) > -1) { 9550 totalBoxes++; 9551 9552 if (item.prop(STR_CHECKED)) { 9553 totalOn++; 9554 } 9555 } 9556 } 9557 ); 9558 9559 allBoxNodes.prop(STR_CHECKED, totalBoxes == totalOn); 9560 } 9561 9562 return totalOn; 9563 }, 9564 9565 checkTab: function(box) { 9566 if (document.all && window.event.keyCode == 9) { 9567 box.selection = document.selection.createRange(); 9568 9569 setTimeout( 9570 function() { 9571 Util.processTab(box.id); 9572 }, 9573 0 9574 ); 9575 } 9576 }, 9577 9578 disableElements: function(el) { 9579 var currentElement = $(el)[0]; 9580 9581 if (currentElement) { 9582 var children = currentElement.getElementsByTagName('*'); 9583 9584 var emptyFnFalse = function() { 9585 return false;
9586 }; 9587 9588 for (var i = children.length - 1; i >= 0; i--) { 9589 var item = children[i]; 9590 9591 item.style.cursor = 'default'; 9592 9593 item.onclick = emptyFnFalse; 9594 item.onmouseover = emptyFnFalse; 9595 item.onmouseout = emptyFnFalse; 9596 item.onmouseenter = emptyFnFalse; 9597 item.onmouseleave = emptyFnFalse; 9598 9599 item.action = ''; 9600 item.disabled = true; 9601 item.href = 'javascript:;'; 9602 item.onsubmit = emptyFnFalse; 9603 9604 $(item).off(); 9605 } 9606 } 9607 }, 9608 9609 disableEsc: function() { 9610 if (document.all && window.event.keyCode == 27) { 9611 window.event.returnValue = false; 9612 } 9613 }, 9614 9615 disableFormButtons: function(inputs, form) { 9616 inputs.attr('disabled', true); 9617 inputs.setStyle('opacity', 0.5); 9618 9619 if (A.UA.gecko) { 9620 A.getWin().on( 9621 'unload', 9622 function(event) { 9623 inputs.attr('disabled', false); 9624 } 9625 ); 9626 } 9627 else if (A.UA.safari) { 9628 A.use( 9629 'node-event-html5', 9630 function(A) { 9631 A.getWin().on( 9632 'pagehide', 9633 function(event) { 9634 Util.enableFormButtons(inputs, form); 9635 } 9636 ); 9637 } 9638 ); 9639 } 9640 }, 9641 9642 disableToggleBoxes: function(checkBoxId, toggleBoxId, checkDisabled) { 9643 var checkBox = $('#' + checkBoxId); 9644 var toggleBox = $('#' + toggleBoxId); 9645 9646 toggleBox.prop('disabled', checkDisabled && checkBox.prop(STR_CHECKED)); 9647 9648 checkBox.on( 9649 EVENT_CLICK, 9650 function() { 9651 toggleBox.prop('disabled', !toggleBox.prop('disabled')); 9652 } 9653 ); 9654 }, 9655 9656 enableFormButtons: function(inputs) { 9657 Util._submitLocked = null; 9658 9659 Util.toggleDisabled(inputs, false); 9660 }, 9661 9662 escapeCDATA: function(str) { 9663 return str.replace( 9664 /<!\[CDATA\[|\]\]>/gi, 9665 function(match) { 9666 var str = ''; 9667 9668 if (match == ']]>') { 9669 str = ']]>'; 9670 } 9671 else if (match == '<![CDATA[') { 9672 str = '<![CDATA['; 9673 } 9674 9675 return str; 9676 } 9677 ); 9678 }, 9679 9680 focusFormField: function(el) { 9681 var doc = $(document); 9682 9683 var interacting = false; 9684 9685 el = Util.getDOM(el); 9686 9687 el = $(el); 9688 9689 doc.on( 9690 'click.focusFormField', 9691 function(event) { 9692 interacting = true; 9693 9694 doc.off('click.focusFormField'); 9695 } 9696 ); 9697 9698 if (!interacting && Util.inBrowserView(el)) { 9699 var form = el.closest('form'); 9700 9701 var focusable = !el.is(':disabled') && !el.is(':hidden') && !el.parents(':disabled').length; 9702 9703 if (!form.length || focusable) { 9704 el.focus(); 9705 } 9706 else { 9707 var portletName = form.data('fm-namespace'); 9708 9709 var formReadyEventName = portletName + 'formReady'; 9710 9711 var formReadyHandler = function(event) { 9712 var elFormName = form.attr('name'); 9713 var formName = event.formName; 9714 9715 if (elFormName === formName) { 9716 el.focus(); 9717 9718 Liferay.detach(formReadyEventName, formReadyHandler); 9719 } 9720 }; 9721 9722 Liferay.on(formReadyEventName, formReadyHandler); 9723 } 9724 } 9725 }, 9726 9727 forcePost: function(link) { 9728 link = Util.getDOM(link); 9729 9730 link = $(link); 9731 9732 if (link.length) { 9733 var url = link.attr('href'); 9734 9735 var newWindow = link.attr('target') == '_blank'; 9736 9737 var hrefFm = $(document.hrefFm); 9738 9739 if (newWindow) { 9740 hrefFm.attr('target', '_blank'); 9741 } 9742 9743 submitForm(hrefFm, url, !newWindow); 9744 9745 Util._submitLocked = null; 9746 } 9747 }, 9748 9749 getAttributes: function(el, attributeGetter) { 9750 var instance = this; 9751 9752 var result = null; 9753 9754 if (el) { 9755 el = Util.getDOM(el); 9756 9757 if (el.jquery) { 9758 el = el[0]; 9759 } 9760 9761 result = {}; 9762 9763 var getterFn = this.isFunction(attributeGetter); 9764 var getterString = typeof attributeGetter === 'string'; 9765 9766 var attrs = el.attributes; 9767 var length = attrs.length; 9768 9769 while (length--) { 9770 var attr = attrs[length]; 9771 var name = attr.nodeName.toLowerCase(); 9772 var value = attr.nodeValue; 9773 9774 if (getterString) { 9775 if (name.indexOf(attributeGetter) === 0) { 9776 name = name.substr(attributeGetter.length); 9777 } 9778 else { 9779 continue; 9780 } 9781 } 9782 else if (getterFn) { 9783 value = attributeGetter(value, name, attrs); 9784 9785 if (value === false) { 9786 continue; 9787 } 9788 } 9789 9790 result[name] = value; 9791 } 9792 } 9793 9794 return result; 9795 }, 9796 9797 getColumnId: function(str) { 9798 var columnId = str.replace(/layout-column_/, ''); 9799 9800 return columnId; 9801 }, 9802 9803 getDOM: function(el) { 9804 if (el._node || el._nodes) { 9805 el = el.getDOM(); 9806 } 9807 9808 return el; 9809 }, 9810 9811 getGeolocation: function(success, fallback, options) { 9812 if (success && navigator.geolocation) { 9813 navigator.geolocation.getCurrentPosition( 9814 function(position) { 9815 success( 9816 position.coords.latitude, 9817 position.coords.longitude, 9818 position 9819 ); 9820 }, 9821 fallback, 9822 options 9823 ); 9824 } 9825 else if (fallback) { 9826 fallback(); 9827 } 9828 }, 9829 9830 getLexiconIcon: function(icon, cssClass) { 9831 var instance = this; 9832 9833 return $(instance.getLexiconIconTpl(icon, cssClass))[0]; 9834 }, 9835 9836 getLexiconIconTpl: function(icon, cssClass) { 9837 var instance = this; 9838 9839 return Liferay.Util.sub(TPL_LEXICON_ICON, icon, cssClass || ''); 9840 }, 9841 9842 getOpener: function() { 9843 var openingWindow = Window._opener; 9844 9845 if (!openingWindow) { 9846 var topUtil = Liferay.Util.getTop().Liferay.Util; 9847 9848 var windowName = Liferay.Util.getWindowName(); 9849 9850 var dialog = topUtil.Window.getById(windowName); 9851 9852 if (dialog) { 9853 openingWindow = dialog._opener; 9854 9855 Window._opener = openingWindow; 9856 } 9857 } 9858 9859 return openingWindow || window.opener || window.parent; 9860 }, 9861 9862 getPortletId: function(portletId) { 9863 return String(portletId).replace(REGEX_PORTLET_ID, '$1'); 9864 }, 9865 9866 getPortletNamespace: function(portletId) { 9867 return '_' + portletId + '_'; 9868 }, 9869 9870 getTop: function() { 9871 var topWindow = Util._topWindow; 9872 9873 if (!topWindow) { 9874 var parentWindow = window.parent; 9875 9876 var parentThemeDisplay; 9877 9878 while (parentWindow != window) { 9879 try { 9880 if (typeof parentWindow.location.href == 'undefined') { 9881 break; 9882 } 9883 9884 parentThemeDisplay = parentWindow.themeDisplay; 9885 } 9886 catch (e) { 9887 break; 9888 } 9889 9890 if (!parentThemeDisplay || window.name === 'simulationDeviceIframe') { 9891 break; 9892 } 9893 else if (!parentThemeDisplay.isStatePopUp() || parentWindow == parentWindow.parent) { 9894 topWindow = parentWindow; 9895 9896 break; 9897 } 9898 9899 parentWindow = parentWindow.parent; 9900 } 9901 9902 if (!topWindow) { 9903 topWindow = window; 9904 } 9905 9906 Util._topWindow = topWindow; 9907 } 9908 9909 return topWindow; 9910 }, 9911 9912 getURLWithSessionId: function(url) { 9913 if (!themeDisplay.isAddSessionIdToURL()) { 9914 return url; 9915 } 9916 9917 // LEP-4787 9918 9919 var x = url.indexOf(';'); 9920 9921 if (x > -1) { 9922 return url; 9923 } 9924 9925 var sessionId = ';jsessionid=' + themeDisplay.getSessionId(); 9926 9927 x = url.indexOf('?'); 9928 9929 if (x > -1) { 9930 return url.substring(0, x) + sessionId + url.substring(x); 9931 } 9932 9933 // In IE6, http://www.abc.com;jsessionid=XYZ does not work, but 9934 // http://www.abc.com/;jsessionid=XYZ does work. 9935 9936 x = url.indexOf('//'); 9937 9938 if (x > -1) { 9939 var y = url.lastIndexOf('/'); 9940 9941 if (x + 1 == y) { 9942 return url + '/' + sessionId; 9943 } 9944 } 9945 9946 return url + sessionId; 9947 }, 9948 9949 getWindow: function(id) { 9950 if (!id) { 9951 id = Util.getWindowName(); 9952 } 9953 9954 return Util.getTop().Liferay.Util.Window.getById(id); 9955 }, 9956 9957 getWindowName: function() { 9958 return window.name || Window._name || ''; 9959 }, 9960 9961 getWindowWidth: function() { 9962 return window.innerWidth > 0 ? window.innerWidth : screen.width; 9963 }, 9964 9965 inBrowserView: function(node, win, nodeRegion) { 9966 var viewable = false;
9967 9968 node = $(node); 9969 9970 if (node.length) { 9971 if (!nodeRegion) { 9972 nodeRegion = node.offset(); 9973 9974 nodeRegion.bottom = nodeRegion.top + node.outerHeight(); 9975 nodeRegion.right = nodeRegion.left + node.outerWidth(); 9976 } 9977 9978 if (!win) { 9979 win = window; 9980 } 9981 9982 win = $(win); 9983 9984 var winRegion = {}; 9985 9986 winRegion.left = win.scrollLeft(); 9987 winRegion.right = winRegion.left + win.width(); 9988 9989 winRegion.top = win.scrollTop(); 9990 winRegion.bottom = winRegion.top + win.height(); 9991 9992 viewable = nodeRegion.bottom <= winRegion.bottom && 9993 nodeRegion.left >= winRegion.left && 9994 nodeRegion.right <= winRegion.right && 9995 nodeRegion.top >= winRegion.top; 9996 9997 if (viewable) { 9998 var frameEl = $(win.prop('frameElement')); 9999 10000 if (frameEl.length) { 10001 var frameOffset = frameEl.offset(); 10002 10003 var xOffset = frameOffset.left - winRegion.left; 10004 10005 nodeRegion.left += xOffset; 10006 nodeRegion.right += xOffset; 10007 10008 var yOffset = frameOffset.top - winRegion.top; 10009 10010 nodeRegion.top += yOffset; 10011 nodeRegion.bottom += yOffset; 10012 10013 viewable = Util.inBrowserView(node, win.prop('parent'), nodeRegion); 10014 } 10015 } 10016 } 10017 10018 return viewable; 10019 }, 10020 10021 isFunction: function(val) { 10022 return typeof val === 'function'; 10023 }, 10024 10025 isPhone: function() { 10026 var instance = this; 10027 10028 return instance.getWindowWidth() < Liferay.BREAKPOINTS.PHONE; 10029 }, 10030 10031 isTablet: function() { 10032 var instance = this; 10033 10034 return instance.getWindowWidth() < Liferay.BREAKPOINTS.TABLET; 10035 }, 10036 10037 listCheckboxesExcept: function(form, except, name, checked) { 10038 form = Util.getDOM(form); 10039 10040 var selector = 'input[type=checkbox]'; 10041 10042 if (name) { 10043 selector += '[name=' + name + ']'; 10044 } 10045 10046 return $(form).find(selector).toArray().reduce( 10047 function(prev, item, index) { 10048 item = $(item); 10049 10050 var val = item.val(); 10051 10052 if (val && item.attr('name') != except && item.prop('checked') == checked && !item.prop('disabled')) { 10053 prev.push(val); 10054 } 10055 10056 return prev; 10057 }, 10058 [] 10059 ).join(); 10060 }, 10061 10062 listCheckedExcept: function(form, except, name) { 10063 return Util.listCheckboxesExcept(form, except, name, true); 10064 }, 10065 10066 listSelect: function(select, delimeter) { 10067 select = Util.getDOM(select); 10068 10069 return $(select).find('option').toArray().reduce( 10070 function(prev, item, index) { 10071 var val = $(item).val(); 10072 10073 if (val) { 10074 prev.push(val); 10075 } 10076 10077 return prev; 10078 }, 10079 [] 10080 ).join(delimeter || ','); 10081 }, 10082 10083 listUncheckedExcept: function(form, except, name) { 10084 return Util.listCheckboxesExcept(form, except, name, false); 10085 }, 10086 10087 normalizeFriendlyURL: function(text) { 10088 var newText = text.replace(/[^a-zA-Z0-9_-]/g, '-'); 10089 10090 if (newText[0] === '-') { 10091 newText = newText.replace(/^-+/, ''); 10092 } 10093 10094 newText = newText.replace(/--+/g, '-'); 10095 10096 return newText.toLowerCase(); 10097 }, 10098 10099 openInDialog: function(event, config) { 10100 event.preventDefault(); 10101 10102 var currentTarget = Util.getDOM(event.currentTarget); 10103 10104 currentTarget = $(currentTarget); 10105 10106 config = A.mix(A.merge({}, currentTarget.data()), config); 10107 10108 if (!config.uri) { 10109 config.uri = currentTarget.data('href') || currentTarget.attr('href'); 10110 } 10111 10112 if (!config.title) { 10113 config.title = currentTarget.attr('title'); 10114 } 10115 10116 Liferay.Util.openWindow(config); 10117 }, 10118 10119 openWindow: function(config, callback) { 10120 config.openingWindow = window; 10121 10122 var top = Util.getTop(); 10123 10124 var topUtil = top.Liferay.Util; 10125 10126 topUtil._openWindowProvider(config, callback); 10127 }, 10128 10129 processTab: function(id) { 10130 document.all[id].selection.text = String.fromCharCode(9); 10131 document.all[id].focus(); 10132 }, 10133 10134 randomInt: function() { 10135 return Math.ceil(Math.random() * (new Date()).getTime()); 10136 }, 10137 10138 removeEntitySelection: function(entityIdString, entityNameString, removeEntityButton, namespace) { 10139 $('#' + namespace + entityIdString).val(0); 10140 10141 $('#' + namespace + entityNameString).val(''); 10142 10143 Liferay.Util.toggleDisabled(removeEntityButton, true); 10144 10145 Liferay.fire('entitySelectionRemoved'); 10146 }, 10147 10148 reorder: function(box, down) { 10149 box = Util.getDOM(box); 10150 10151 box = $(box); 10152 10153 if (box.prop('selectedIndex') == -1) { 10154 box.prop('selectedIndex', 0); 10155 } 10156 else { 10157 var selectedItems = box.find('option:selected'); 10158 10159 if (down) {
10160 selectedItems.get().reverse().forEach( 10161 function(item, index) { 10162 item = $(item); 10163 10164 var itemIndex = item.prop('index'); 10165 10166 var lastIndex = box.find('option').length - 1; 10167 10168 if (itemIndex === lastIndex) { 10169 box.prepend(item); 10170 } 10171 else { 10172 item.insertAfter(item.next()); 10173 } 10174 } 10175 ); 10176 } 10177 else { 10178 selectedItems.get().forEach( 10179 function(item, index) { 10180 item = $(item); 10181 10182 var itemIndex = item.prop('index'); 10183 10184 if (itemIndex === 0) { 10185 box.append(item); 10186 } 10187 else { 10188 item.insertBefore(item.prev()); 10189 } 10190 } 10191 ); 10192 } 10193 } 10194 }, 10195 10196 rowCheckerCheckAllBox: function(ancestorTable, ancestorRow, checkboxesIds, checkboxAllIds, cssClass) { 10197 Util.checkAllBox(ancestorTable, checkboxesIds, checkboxAllIds); 10198 10199 if (ancestorRow) { 10200 ancestorRow.toggleClass(cssClass); 10201 } 10202 }, 10203 10204 savePortletTitle: function(params) { 10205 params = Object.assign( 10206 { 10207 doAsUserId: 0, 10208 plid: 0, 10209 portletId: 0, 10210 title: '', 10211 url: themeDisplay.getPathMain() + '/portal/update_portlet_title' 10212 }, 10213 params 10214 ); 10215 10216 $.ajax( 10217 params.url, 10218 { 10219 data: { 10220 doAsUserId: params.doAsUserId, 10221 p_auth: Liferay.authToken, 10222 p_l_id: params.plid, 10223 portletId: params.portletId, 10224 title: params.title 10225 } 10226 } 10227 ); 10228 }, 10229 10230 selectEntityHandler: function(container, selectEventName, disableButton) { 10231 container = $(container); 10232 10233 var openingLiferay = Util.getOpener().Liferay; 10234 10235 var selectorButtons = container.find('.selector-button'); 10236 10237 container.on( 10238 'click', 10239 '.selector-button', 10240 function(event) { 10241 var target = $(event.target); 10242 10243 if (!target.attr('data-prevent-selection')) { 10244 var currentTarget = $(event.currentTarget); 10245 10246 var confirmSelection = currentTarget.attr('data-confirm-selection') === 'true'; 10247 var confirmSelectionMessage = currentTarget.attr('data-confirm-selection-message'); 10248 10249 if (!confirmSelection || confirm(confirmSelectionMessage)) { 10250 if (disableButton !== false) { 10251 selectorButtons.prop('disabled', false); 10252 10253 currentTarget.prop('disabled', true); 10254 } 10255 10256 var result = Util.getAttributes(currentTarget, 'data-'); 10257 10258 openingLiferay.fire(selectEventName, result); 10259 10260 Util.getWindow().hide(); 10261 } 10262 } 10263 } 10264 ); 10265 10266 openingLiferay.on( 10267 'entitySelectionRemoved', 10268 function(event) { 10269 selectorButtons.prop('disabled', false); 10270 } 10271 ); 10272 }, 10273 10274 selectFolder: function(folderData, namespace) { 10275 $('#' + namespace + folderData.idString).val(folderData.idValue); 10276 10277 var name = Liferay.Util.unescape(folderData.nameValue); 10278 10279 $('#' + namespace + folderData.nameString).val(name); 10280 10281 var button = $('#' + namespace + 'removeFolderButton'); 10282 10283 Liferay.Util.toggleDisabled(button, false); 10284 }, 10285 10286 setCursorPosition: function(el, position) { 10287 var instance = this; 10288 10289 instance.setSelectionRange(el, position, position); 10290 }, 10291 10292 setSelectionRange: function(el, selectionStart, selectionEnd) { 10293 var instance = this; 10294 10295 el = Util.getDOM(el); 10296 10297 if (el.jquery) { 10298 el = el[0]; 10299 } 10300 10301 if (el.setSelectionRange) { 10302 el.focus(); 10303 10304 el.setSelectionRange(selectionStart, selectionEnd); 10305 } 10306 else if (el.createTextRange) { 10307 var textRange = el.createTextRange(); 10308 10309 textRange.collapse(true); 10310 10311 textRange.moveEnd('character', selectionEnd); 10312 textRange.moveEnd('character', selectionStart); 10313 10314 textRange.select(); 10315 } 10316 }, 10317 10318 showCapsLock: function(event, span) { 10319 var keyCode = event.keyCode ? event.keyCode : event.which; 10320 10321 var shiftKeyCode = keyCode === 16; 10322 10323 var shiftKey = event.shiftKey ? event.shiftKey : shiftKeyCode; 10324 10325 var display = 'none'; 10326 10327 if (keyCode >= 65 && keyCode <= 90 && !shiftKey || keyCode >= 97 && keyCode <= 122 && shiftKey) { 10328 display = ''; 10329 } 10330 10331 $('#' + span).css('display', display); 10332 }, 10333 10334 sortByAscending: function(a, b) { 10335 a = a[1].toLowerCase(); 10336 b = b[1].toLowerCase(); 10337 10338 if (a > b) { 10339 return 1; 10340 } 10341 10342 if (a < b) { 10343 return -1; 10344 } 10345 10346 return 0; 10347 }, 10348 10349 sub: function(string, data) { 10350 if (arguments.length > 2 || (typeof data !== 'object' && typeof data !== 'function')) { 10351 data = Array.prototype.slice.call(arguments, 1); 10352 } 10353 10354 return string.replace ? string.replace( 10355 REGEX_SUB, 10356 function(match, key) { 10357 return data[key] === undefined ? match : data[key]; 10358 } 10359 ) : string; 10360 }, 10361 10362 submitForm: function(form) { 10363 form.submit(); 10364 }, 10365 10366 toggleBoxes: function(checkBoxId, toggleBoxId, displayWhenUnchecked, toggleChildCheckboxes) { 10367 var checkBox = $('#' + checkBoxId); 10368 var toggleBox = $('#' + toggleBoxId); 10369 10370 var checked = checkBox.prop(STR_CHECKED); 10371 10372 if (displayWhenUnchecked) { 10373 checked = !checked; 10374 } 10375 10376 toggleBox.toggleClass('hide', !checked); 10377 10378 checkBox.on( 10379 EVENT_CLICK, 10380 function() { 10381 toggleBox.toggleClass('hide'); 10382 10383 if (toggleChildCheckboxes) { 10384 var childCheckboxes = toggleBox.find('input[type=checkbox]'); 10385 10386 childCheckboxes.prop(STR_CHECKED, checkBox.prop(STR_CHECKED)); 10387 } 10388 } 10389 ); 10390 }, 10391 10392 toggleDisabled: function(button, state) { 10393 button = Util.getDOM(button); 10394 10395 button = $(button); 10396 10397 button.each( 10398 function(index, item) { 10399 item = $(item); 10400 10401 item.prop('disabled', state); 10402 10403 item.toggleClass('disabled', state); 10404 } 10405 ); 10406 }, 10407 10408 toggleRadio: function(radioId, showBoxIds, hideBoxIds) { 10409 var radioButton = $('#' + radioId); 10410 10411 var showBoxes; 10412 10413 if (showBoxIds) { 10414 if (Array.isArray(showBoxIds)) { 10415 showBoxIds = showBoxIds.join(',#'); 10416 } 10417 10418 showBoxes = $('#' + showBoxIds); 10419 10420 showBoxes.toggleClass('hide', !radioButton.prop(STR_CHECKED)); 10421 } 10422 10423 radioButton.on( 10424 'change', 10425 function() { 10426 if (showBoxes) { 10427 showBoxes.removeClass('hide'); 10428 } 10429 10430 if (hideBoxIds) { 10431 if (Array.isArray(hideBoxIds)) { 10432 hideBoxIds = hideBoxIds.join(',#'); 10433 } 10434 10435 $('#' + hideBoxIds).addClass('hide'); 10436 } 10437 } 10438 ); 10439 }, 10440 10441 toggleSearchContainerButton: function(buttonId, searchContainerId, form, ignoreFieldName) { 10442 $(searchContainerId).on( 10443 EVENT_CLICK, 10444 'input[type=checkbox]', 10445 function() { 10446 Util.toggleDisabled(buttonId, !Util.listCheckedExcept(form, ignoreFieldName)); 10447 } 10448 ); 10449 }, 10450 10451 toggleSelectBox: function(selectBoxId, value, toggleBoxId) { 10452 var selectBox = $('#' + selectBoxId); 10453 var toggleBox = $('#' + toggleBoxId); 10454 10455 var dynamicValue = this.isFunction(value); 10456 10457 var toggle = function() { 10458 var currentValue = selectBox.val(); 10459 10460 var visible = value == currentValue; 10461 10462 if (dynamicValue) { 10463 visible = value(currentValue, value); 10464 } 10465 10466 toggleBox.toggleClass('hide', !visible); 10467 }; 10468 10469 toggle(); 10470 10471 selectBox.on('change', toggle); 10472 }, 10473 10474 toNumber: function(value) { 10475 return parseInt(value, 10) || 0; 10476 }, 10477 10478 _defaultPreviewArticleFn: function(event) { 10479 var instance = this; 10480 10481 event.preventDefault(); 10482 10483 Util.defaultPreviewArticleFn(event); 10484 }, 10485 10486 _defaultSubmitFormFn: function(event) { 10487 var form = event.form; 10488 10489 var hasErrors = false;
10490 10491 if (event.validate) { 10492 var liferayForm = Liferay.Form.get(form.attr('id')); 10493 10494 if (liferayForm) { 10495 var validator = liferayForm.formValidator; 10496 10497 if (A.instanceOf(validator, A.FormValidator)) { 10498 validator.validate(); 10499 10500 hasErrors = validator.hasErrors(); 10501 10502 if (hasErrors) { 10503 validator.focusInvalidField(); 10504 } 10505 } 10506 } 10507 } 10508 10509 if (!hasErrors) { 10510 var action = event.action || form.attr('action'); 10511 10512 var singleSubmit = event.singleSubmit; 10513 10514 var inputs = form.all('button[type=submit], input[type=button], input[type=image], input[type=reset], input[type=submit]'); 10515 10516 Util.disableFormButtons(inputs, form); 10517 10518 if (singleSubmit === false) { 10519 Util._submitLocked = A.later( 10520 1000, 10521 Util, 10522 Util.enableFormButtons, 10523 [inputs, form] 10524 ); 10525 } 10526 else { 10527 Util._submitLocked = true; 10528 } 10529 10530 var actionURL = new A.Url(action); 10531 10532 var authToken = actionURL.getParameter('p_auth') || ''; 10533 10534 form.append('<input name="p_auth" type="hidden" value="' + authToken + '" />'); 10535 10536 if (authToken) { 10537 actionURL.removeParameter('p_auth'); 10538 10539 action = actionURL.toString(); 10540 } 10541 10542 form.attr('action', action); 10543 10544 Util.submitForm(form); 10545 10546 form.attr('target', ''); 10547 10548 Util._submitLocked = null; 10549 } 10550 }, 10551 10552 _getEditableInstance: function(title) { 10553 var editable = Util._EDITABLE; 10554 10555 if (!editable) { 10556 editable = new A.Editable( 10557 { 10558 after: { 10559 contentTextChange: function(event) { 10560 var instance = this; 10561 10562 if (!event.initial) { 10563 var title = instance.get('node'); 10564 10565 var portletTitleEditOptions = title.getData('portletTitleEditOptions'); 10566 10567 Util.savePortletTitle( 10568 { 10569 doAsUserId: portletTitleEditOptions.doAsUserId, 10570 plid: portletTitleEditOptions.plid, 10571 portletId: portletTitleEditOptions.portletId, 10572 title: event.newVal 10573 } 10574 ); 10575 } 10576 }, 10577 startEditing: function(event) { 10578 var instance = this; 10579 10580 var Layout = Liferay.Layout; 10581 10582 if (Layout) { 10583 instance._dragListener = Layout.getLayoutHandler().on( 10584 'drag:start', 10585 function(event) { 10586 instance.fire('save'); 10587 } 10588 ); 10589 } 10590 }, 10591 stopEditing: function(event) { 10592 var instance = this; 10593 10594 if (instance._dragListener) { 10595 instance._dragListener.detach(); 10596 } 10597 } 10598 }, 10599 cssClass: 'lfr-portlet-title-editable', 10600 node: title 10601 } 10602 ); 10603 10604 Util._EDITABLE = editable; 10605 } 10606 10607 return editable; 10608 } 10609 }; 10610 10611 Liferay.provide( 10612 Util, 10613 'afterIframeLoaded', 10614 function(event) { 10615 var nodeInstances = A.Node._instances; 10616 10617 var docEl = event.doc; 10618 10619 var docUID = docEl._yuid; 10620 10621 if (docUID in nodeInstances) { 10622 delete nodeInstances[docUID]; 10623 } 10624 10625 var iframeDocument = A.one(docEl); 10626 10627 var iframeBody = iframeDocument.one('body'); 10628 10629 var dialog = event.dialog; 10630 10631 var lfrFormContent = iframeBody.one('.lfr-form-content'); 10632 10633 iframeBody.addClass('dialog-iframe-popup'); 10634 10635 if (lfrFormContent && iframeBody.one('.button-holder.dialog-footer')) { 10636 iframeBody.addClass('dialog-with-footer'); 10637 10638 var stagingAlert = iframeBody.one('.portlet-body > .lfr-portlet-message-staging-alert'); 10639 10640 if (stagingAlert) { 10641 stagingAlert.remove(); 10642 10643 lfrFormContent.prepend(stagingAlert); 10644 } 10645 } 10646 10647 iframeBody.addClass(dialog.iframeConfig.bodyCssClass); 10648 10649 event.win.focus(); 10650 10651 var detachEventHandles = function() { 10652 AArray.invoke(eventHandles, 'detach'); 10653 10654 iframeDocument.purge(true); 10655 }; 10656 10657 var eventHandles = [ 10658 iframeBody.delegate('submit', detachEventHandles, 'form'), 10659 10660 iframeBody.delegate( 10661 EVENT_CLICK, 10662 function(event) { 10663 dialog.set( 10664 'visible', 10665 false, 10666 event.currentTarget.hasClass('lfr-hide-dialog') ? SRC_HIDE_LINK : null 10667 ); 10668 10669 detachEventHandles(); 10670 }, 10671 '.btn-cancel,.lfr-hide-dialog' 10672 ) 10673 ]; 10674 }, 10675 ['aui-base'] 10676 ); 10677 10678 Liferay.provide( 10679 Util, 10680 'openDDMPortlet', 10681 function(config, callback) { 10682 var instance = this; 10683 10684 var defaultValues = { 10685 eventName: 'selectStructure' 10686 }; 10687 10688 config = A.merge(defaultValues, config); 10689 10690 var ddmURL; 10691 10692 if (config.basePortletURL) { 10693 ddmURL = Liferay.PortletURL.createURL(config.basePortletURL); 10694 } 10695 else { 10696 ddmURL = Liferay.PortletURL.createRenderURL(); 10697 } 10698 10699 ddmURL.setEscapeXML(false); 10700 10701 ddmURL.setDoAsGroupId(config.doAsGroupId || themeDisplay.getScopeGroupId()); 10702 10703 ddmURL.setParameter('classNameId', config.classNameId); 10704 ddmURL.setParameter('classPK', config.classPK); 10705 ddmURL.setParameter('resourceClassNameId', config.resourceClassNameId); 10706 ddmURL.setParameter('eventName', config.eventName); 10707 ddmURL.setParameter('groupId', config.groupId); 10708 ddmURL.setParameter('mode', config.mode); 10709 10710 if (config.mvcPath) { 10711 ddmURL.setParameter('mvcPath', config.mvcPath); 10712 } 10713 else { 10714 ddmURL.setParameter('mvcPath', '/view.jsp'); 10715 } 10716 10717 if ('navigationStartsOn' in config) { 10718 ddmURL.setParameter('navigationStartsOn', config.navigationStartsOn); 10719 } 10720 10721 ddmURL.setParameter('portletResourceNamespace', config.portletResourceNamespace); 10722 10723 if ('redirect' in config) { 10724 ddmURL.setParameter('redirect', config.redirect); 10725 } 10726 10727 if ('refererPortletName' in config) { 10728 ddmURL.setParameter('refererPortletName', config.refererPortletName); 10729 } 10730 10731 if ('refererWebDAVToken' in config) { 10732 ddmURL.setParameter('refererWebDAVToken', config.refererWebDAVToken); 10733 } 10734 10735 ddmURL.setParameter('scopeTitle', config.title); 10736 10737 if ('searchRestriction' in config) { 10738 ddmURL.setParameter('searchRestriction', config.searchRestriction); 10739 ddmURL.setParameter('searchRestrictionClassNameId', config.searchRestrictionClassNameId); 10740 ddmURL.setParameter('searchRestrictionClassPK', config.searchRestrictionClassPK); 10741 } 10742 10743 if ('showAncestorScopes' in config) { 10744 ddmURL.setParameter('showAncestorScopes', config.showAncestorScopes); 10745 } 10746 10747 if ('showBackURL' in config) { 10748 ddmURL.setParameter('showBackURL', config.showBackURL); 10749 } 10750 10751 if ('showCacheableInput' in config) { 10752 ddmURL.setParameter('showCacheableInput', config.showCacheableInput); 10753 } 10754 10755 if ('showHeader' in config) { 10756 ddmURL.setParameter('showHeader', config.showHeader); 10757 } 10758 10759 if ('showManageTemplates' in config) { 10760 ddmURL.setParameter('showManageTemplates', config.showManageTemplates); 10761 } 10762 10763 ddmURL.setParameter('structureAvailableFields', config.structureAvailableFields); 10764 ddmURL.setParameter('templateId', config.templateId); 10765 10766 ddmURL.setPortletId(Liferay.PortletKeys.DYNAMIC_DATA_MAPPING); 10767 ddmURL.setWindowState('pop_up'); 10768 10769 config.uri = ddmURL.toString(); 10770 10771 var dialogConfig = config.dialog; 10772 10773 if (!dialogConfig) { 10774 dialogConfig = {}; 10775 10776 config.dialog = dialogConfig; 10777 } 10778 10779 var eventHandles = [Liferay.once(config.eventName, callback)]; 10780 10781 var detachSelectionOnHideFn = function(event) { 10782 if (!event.newVal) { 10783 (new A.EventHandle(eventHandles)).detach(); 10784 } 10785 }; 10786 10787 Util.openWindow( 10788 config, 10789 function(dialogWindow) { 10790 eventHandles.push(dialogWindow.after(['destroy', 'visibleChange'], detachSelectionOnHideFn)); 10791 } 10792 ); 10793 }, 10794 ['liferay-portlet-url'] 10795 ); 10796 10797 Liferay.provide( 10798 Util, 10799 'openDocument', 10800 function(webDavUrl, onSuccess, onError) { 10801 if (A.UA.ie) { 10802 try { 10803 var executor = new A.config.win.ActiveXObject('SharePoint.OpenDocuments'); 10804 10805 executor.EditDocument(webDavUrl); 10806 10807 if (Lang.isFunction(onSuccess)) { 10808 onSuccess(); 10809 } 10810 10811 } 10812 catch (e) { 10813 if (Lang.isFunction(onError)) { 10814 onError(e); 10815 } 10816 } 10817 } 10818 }, 10819 ['aui-base'] 10820 ); 10821 10822 Liferay.provide( 10823 Util, 10824 'portletTitleEdit', 10825 function(options) { 10826 var obj = options.obj; 10827 10828 if (obj) { 10829 var title = obj.one('.portlet-title-text'); 10830 10831 if (title && !title.hasClass('not-editable')) { 10832 title.addClass('portlet-title-editable'); 10833 10834 title.on( 10835 EVENT_CLICK, 10836 function(event) { 10837 var editable = Util._getEditableInstance(title); 10838 10839 var rendered = editable.get('rendered'); 10840 10841 if (rendered) { 10842 editable.fire('stopEditing'); 10843 } 10844 10845 editable.set('node', event.currentTarget); 10846 10847 if (rendered) { 10848 editable.syncUI(); 10849 } 10850 10851 editable._startEditing(event); 10852 } 10853 ); 10854 10855 title.setData('portletTitleEditOptions', options); 10856 } 10857 } 10858 }, 10859 ['aui-editable-deprecated'] 10860 ); 10861 10862 Liferay.provide( 10863 Util, 10864 'editEntity', 10865 function(config, callback) { 10866 var dialog = Util.getWindow(config.id); 10867 10868 var eventName = config.eventName || config.id; 10869 10870 var eventHandles = [Liferay.on(eventName, callback)]; 10871 10872 var detachSelectionOnHideFn = function(event) { 10873 if (!event.newVal) { 10874 (new A.EventHandle(eventHandles)).detach(); 10875 } 10876 }; 10877 10878 if (dialog) { 10879 eventHandles.push(dialog.after(['destroy', 'visibleChange'], detachSelectionOnHideFn)); 10880 10881 dialog.show(); 10882 } 10883 else { 10884 var destroyDialog = function(event) { 10885 var dialogId = config.id; 10886 10887 var dialogWindow = Util.getWindow(dialogId); 10888 10889 if (dialogWindow && Util.getPortletId(dialogId) === event.portletId) { 10890 dialogWindow.destroy(); 10891 10892 Liferay.detach('destroyPortlet', destroyDialog); 10893 } 10894 }; 10895 10896 var editURL = new Liferay.PortletURL.createURL( 10897 config.uri, 10898 A.merge( 10899 { 10900 eventName: eventName 10901 },
10902 config.urlParams 10903 ) 10904 ); 10905 10906 config.uri = editURL.toString(); 10907 10908 config.dialogIframe = A.merge( 10909 { 10910 bodyCssClass: 'dialog-with-footer' 10911 }, 10912 config.dialogIframe || {} 10913 ); 10914 10915 Util.openWindow( 10916 config, 10917 function(dialogWindow) { 10918 eventHandles.push( 10919 dialogWindow.after(['destroy', 'visibleChange'], detachSelectionOnHideFn) 10920 ); 10921 10922 Liferay.on('destroyPortlet', destroyDialog); 10923 } 10924 ); 10925 } 10926 }, 10927 ['aui-base', 'liferay-portlet-url', 'liferay-util-window'] 10928 ); 10929 10930 Liferay.provide( 10931 Util, 10932 'selectEntity', 10933 function(config, callback) { 10934 var dialog = Util.getWindow(config.id); 10935 10936 var eventName = config.eventName || config.id; 10937 10938 var eventHandles = [Liferay.on(eventName, callback)]; 10939 10940 var selectedData = config.selectedData; 10941 10942 if (selectedData) { 10943 config.dialog.destroyOnHide = true; 10944 } 10945 10946 var detachSelectionOnHideFn = function(event) { 10947 if (!event.newVal) { 10948 (new A.EventHandle(eventHandles)).detach(); 10949 } 10950 }; 10951 10952 var disableSelectedAssets = function(event) { 10953 if (selectedData && selectedData.length) { 10954 var currentWindow = event.currentTarget.node.get('contentWindow.document'); 10955 10956 var selectorButtons = currentWindow.all('.lfr-search-container-wrapper .selector-button'); 10957 10958 A.some( 10959 selectorButtons, 10960 function(item, index) { 10961 var assetEntryId = item.attr('data-entityid') || item.attr('data-entityname'); 10962 10963 var assetEntryIndex = selectedData.indexOf(assetEntryId); 10964 10965 if (assetEntryIndex > -1) { 10966 item.attr('data-prevent-selection', true); 10967 item.attr('disabled', true); 10968 10969 selectedData.splice(assetEntryIndex, 1); 10970 } 10971 10972 return !selectedData.length; 10973 } 10974 ); 10975 } 10976 }; 10977 10978 if (dialog) { 10979 eventHandles.push(dialog.after(['destroy', 'visibleChange'], detachSelectionOnHideFn)); 10980 10981 dialog.show(); 10982 } 10983 else { 10984 var destroyDialog = function(event) { 10985 var dialogId = config.id; 10986 10987 var dialogWindow = Util.getWindow(dialogId); 10988 10989 if (dialogWindow && Util.getPortletId(dialogId) === event.portletId) { 10990 dialogWindow.destroy(); 10991 10992 Liferay.detach('destroyPortlet', destroyDialog); 10993 } 10994 }; 10995 10996 Util.openWindow( 10997 config, 10998 function(dialogWindow) { 10999 eventHandles.push( 11000 dialogWindow.after(['destroy', 'visibleChange'], detachSelectionOnHideFn), 11001 dialogWindow.iframe.after(['load'], disableSelectedAssets) 11002 ); 11003 11004 Liferay.on('destroyPortlet', destroyDialog); 11005 } 11006 ); 11007 } 11008 }, 11009 ['aui-base', 'liferay-util-window'] 11010 ); 11011 11012 Liferay.provide( 11013 Util, 11014 'toggleControls', 11015 function(node) { 11016 var docBody = A.getBody(); 11017 11018 node = node || docBody; 11019 11020 var trigger = node.one('.toggle-controls'); 11021 11022 if (trigger) { 11023 var controlsVisible = Liferay._editControlsState === 'visible'; 11024 11025 var currentState = MAP_TOGGLE_STATE[controlsVisible]; 11026 11027 var icon = trigger.one('.lexicon-icon'); 11028 11029 if (icon) { 11030 currentState.icon = icon; 11031 } 11032 11033 docBody.addClass(currentState.cssClass); 11034 11035 Liferay.fire( 11036 'toggleControls', 11037 { 11038 enabled: controlsVisible 11039 } 11040 ); 11041 11042 trigger.on( 11043 'tap', 11044 function(event) { 11045 controlsVisible = !controlsVisible; 11046 11047 var prevState = currentState; 11048 11049 currentState = MAP_TOGGLE_STATE[controlsVisible]; 11050 11051 docBody.toggleClass(prevState.cssClass); 11052 docBody.toggleClass(currentState.cssClass); 11053 11054 var editControlsIconClass = currentState.iconCssClass; 11055 var editControlsState = currentState.state; 11056 11057 if (icon) { 11058 var newIcon = currentState.icon; 11059 11060 if (!newIcon) { 11061 newIcon = Util.getLexiconIcon(editControlsIconClass); 11062 11063 newIcon = A.one(newIcon); 11064 11065 currentState.icon = newIcon; 11066 } 11067 11068 icon.replace(newIcon); 11069 11070 icon = newIcon; 11071 } 11072 11073 Liferay._editControlsState = editControlsState; 11074 11075 Liferay.Store('com.liferay.frontend.js.web_toggleControls', editControlsState); 11076 11077 Liferay.fire( 11078 'toggleControls', 11079 { 11080 enabled: controlsVisible, 11081 src: 'ui' 11082 } 11083 ); 11084 } 11085 ); 11086 } 11087 }, 11088 ['event-tap', 'liferay-store'] 11089 ); 11090 11091 Liferay.provide( 11092 window, 11093 'submitForm', 11094 function(form, action, singleSubmit, validate) { 11095 if (!Util._submitLocked) { 11096 if (form.jquery) { 11097 form = form[0]; 11098 } 11099 11100 Liferay.fire( 11101 'submitForm', 11102 { 11103 action: action, 11104 form: A.one(form), 11105 singleSubmit: singleSubmit, 11106 validate: validate !== false 11107 } 11108 ); 11109 } 11110 }, 11111 ['aui-base', 'aui-form-validator', 'aui-url', 'liferay-form'] 11112 ); 11113 11114 Liferay.publish( 11115 'submitForm', 11116 { 11117 defaultFn: Util._defaultSubmitFormFn 11118 } 11119 ); 11120 11121 Liferay.provide( 11122 Util, 11123 'defaultPreviewArticleFn', 11124 function(event) { 11125 var instance = this; 11126 11127 var urlPreview = instance._urlPreview; 11128 11129 if (!urlPreview) { 11130 urlPreview = new Liferay.UrlPreview( 11131 { 11132 title: Util.escapeHTML(event.title), 11133 url: event.uri 11134 } 11135 ); 11136 11137 instance._urlPreview = urlPreview; 11138 } 11139 else { 11140 urlPreview.set('title', Util.escapeHTML(event.title)); 11141 urlPreview.set('url', event.uri); 11142 } 11143 11144 urlPreview.open(); 11145 }, 11146 ['liferay-url-preview'] 11147 ); 11148 11149 Liferay.publish( 11150 'previewArticle', 11151 { 11152 defaultFn: Util._defaultPreviewArticleFn 11153 } 11154 ); 11155 11156 Liferay.provide( 11157 Util, 11158 '_openWindowProvider', 11159 function(config, callback) { 11160 var dialog = Window.getWindow(config); 11161 11162 if (Lang.isFunction(callback)) { 11163 callback(dialog); 11164 } 11165 }, 11166 ['liferay-util-window'] 11167 ); 11168 11169 Liferay.after( 11170 'closeWindow', 11171 function(event) {
11172 var id = event.id; 11173 11174 var dialog = Liferay.Util.getTop().Liferay.Util.Window.getById(id); 11175 11176 if (dialog && dialog.iframe) { 11177 var dialogWindow = dialog.iframe.node.get('contentWindow').getDOM(); 11178 11179 var openingWindow = dialogWindow.Liferay.Util.getOpener(); 11180 var redirect = event.redirect; 11181 11182 if (redirect) { 11183 openingWindow.Liferay.Util.navigate(redirect); 11184 } 11185 else { 11186 var refresh = event.refresh; 11187 11188 if (refresh && openingWindow) { 11189 var data; 11190 11191 if (!event.portletAjaxable) { 11192 data = { 11193 portletAjaxable: false 11194 }; 11195 } 11196 11197 openingWindow.Liferay.Portlet.refresh('#p_p_id_' + refresh + '_', data); 11198 } 11199 } 11200 11201 dialog.hide(); 11202 } 11203 } 11204 ); 11205 11206 Util.Window = Window; 11207 11208 Liferay.Util = Util; 11209 11210 Liferay.BREAKPOINTS = { 11211 PHONE: 768, 11212 TABLET: 980 11213 }; 11214 11215 Liferay.STATUS_CODE = { 11216 BAD_REQUEST: 400, 11217 INTERNAL_SERVER_ERROR: 500, 11218 OK: 200, 11219 SC_DUPLICATE_FILE_EXCEPTION: 490, 11220 SC_FILE_ANTIVIRUS_EXCEPTION: 494, 11221 SC_FILE_EXTENSION_EXCEPTION: 491, 11222 SC_FILE_NAME_EXCEPTION: 492, 11223 SC_FILE_SIZE_EXCEPTION: 493, 11224 SC_UPLOAD_REQUEST_SIZE_EXCEPTION: 495 11225 }; 11226 11227 // 0-200: Theme Developer 11228 // 200-400: Portlet Developer 11229 // 400+: Liferay 11230 11231 Liferay.zIndex = { 11232 ALERT: 430, 11233 DOCK: 10, 11234 DOCK_PARENT: 20, 11235 DRAG_ITEM: 460, 11236 DROP_AREA: 440, 11237 DROP_POSITION: 450, 11238 MENU: 5000, 11239 OVERLAY: 1000, 11240 POPOVER: 1600, 11241 TOOLTIP: 10000, 11242 WINDOW: 1200 11243 }; 11244})(AUI(), AUI.$, Liferay); 11245!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=9)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("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(18);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),i=s(n(19)),a=s(n(20)),u=s(n(23)),c=s(n(24)),l=s(n(25));function s(t){return t&&t.__esModule?t:{default:t}}e.array=i.default,e.async=a.default,e.Disposable=u.default,e.object=c.default,e.string=l.default,e.default=o.default},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,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CancellablePromise=void 0;var r=a(n(16)),o=a(n(17)),i=n(1);function a(t){return t&&t.__esModule?t:{default:t}}var u=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)}},c=function t(e,n){if(this.state_=t.State_.PENDING,this.result_=void 0,this.parent_=null,this.callbackEntries_=null,this.callbackEntriesTail_=null,this.executing_=!1,t.UNHANDLED_REJECTION_DELAY>0?this.unhandledRejectionId_=0:0==t.UNHANDLED_REJECTION_DELAY&&(this.hadUnhandledRejection_=!1),t.LONG_STACK_TRACES&&(this.stack_=[],this.addStackTrace_(new Error("created")),this.currentStep_=0),e!=i.nullFunction)try{var r=this;e.call(n,function(e){r.resolve_(t.State_.FULFILLED,e)},function(e){if(!e.IS_CANCELLATION_ERROR)try{throw e instanceof Error?e:new Error("Promise rejected.")}catch(t){}r.resolve_(t.State_.REJECTED,e)})}catch(e){this.resolve_(t.State_.REJECTED,e)}};c.LONG_STACK_TRACES=!1,c.UNHANDLED_REJECTION_DELAY=0,c.State_={PENDING:0,BLOCKED:1,FULFILLED:2,REJECTED:3},(c.CallbackEntry_=function(){this.child=null,this.onFulfilled=null,this.onRejected=null,this.context=null,this.next=null,this.always=!1}).prototype.reset=function(){this.child=null,this.onFulfilled=null,this.onRejected=null,this.context=null,this.always=!1},c.DEFAULT_MAX_UNUSED=100,c.freelist_=new r.default(function(){return new c.CallbackEntry_},function(t){t.reset()},c.DEFAULT_MAX_UNUSED),c.getCallbackEntry_=function(t,e,n){var r=c.freelist_.get();return r.onFulfilled=t,r.onRejected=e,r.context=n,r},c.returnEntry_=function(t){c.freelist_.put(t)},c.resolve=function(t){if(t instanceof c)return t;var e=new c(i.nullFunction);return e.resolve_(c.State_.FULFILLED,t),e}
11245,c.reject=function(t){return new c(function(e,n){n(t)})},c.resolveThen_=function(t,e,n){c.maybeThen_(t,e,n,null)||i.async.run(u(e,t))},c.race=function(t){return new c(function(e,n){t.length||e(void 0);for(var r,o=0;o<t.length;o++)r=t[o],c.resolveThen_(r,e,n)})},c.all=function(t){return new c(function(e,n){var r=t.length,o=[];if(r)for(var i,a=function(t,n){r--,o[t]=n,0==r&&e(o)},l=function(t){n(t)},s=0;s<t.length;s++)i=t[s],c.resolveThen_(i,u(a,s),l);else e(o)})},c.allSettled=function(t){return new c(function(e,n){var r=t.length,o=[];if(r)for(var i,a=function(t,n,i){r--,o[t]=n?{fulfilled:!0,value:i}:{fulfilled:!1,reason:i},0==r&&e(o)},l=0;l<t.length;l++)i=t[l],c.resolveThen_(i,u(a,l,!0),u(a,l,!1));else e(o)})},c.firstFulfilled=function(t){return new c(function(e,n){var r=t.length,o=[];if(r)for(var i,a=function(t){e(t)},l=function(t,e){r--,o[t]=e,0==r&&n(o)},s=0;s<t.length;s++)i=t[s],c.resolveThen_(i,a,u(l,s));else e(void 0)})},c.withResolver=function(){var t=void 0,e=void 0,n=new c(function(n,r){t=n,e=r});return new c.Resolver_(n,t,e)},c.prototype.then=function(t,e,n){return c.LONG_STACK_TRACES&&this.addStackTrace_(new Error("then")),this.addChildPromise_((0,i.isFunction)(t)?t:null,(0,i.isFunction)(e)?e:null,n)},o.default.addImplementation(c),c.prototype.thenVoid=function(t,e,n){c.LONG_STACK_TRACES&&this.addStackTrace_(new Error("then")),this.addCallbackEntry_(c.getCallbackEntry_(t||i.nullFunction,e||null,n))},c.prototype.thenAlways=function(t,e){c.LONG_STACK_TRACES&&this.addStackTrace_(new Error("thenAlways"));var n=c.getCallbackEntry_(t,t,e);return n.always=!0,this.addCallbackEntry_(n),this},c.prototype.thenCatch=function(t,e){return c.LONG_STACK_TRACES&&this.addStackTrace_(new Error("thenCatch")),this.addChildPromise_(null,t,e)},c.prototype.catch=c.prototype.thenCatch,c.prototype.cancel=function(t){this.state_==c.State_.PENDING&&i.async.run(function(){var e=new c.CancellationError(t);e.IS_CANCELLATION_ERROR=!0,this.cancelInternal_(e)},this)},c.prototype.cancelInternal_=function(t){this.state_==c.State_.PENDING&&(this.parent_?(this.parent_.cancelChild_(this,t),this.parent_=null):this.resolve_(c.State_.REJECTED,t))},c.prototype.cancelChild_=function(t,e){if(this.callbackEntries_){for(var n=0,r=null,o=null,i=this.callbackEntries_;i&&(i.always||(n++,i.child==t&&(r=i),!(r&&n>1)));i=i.next)r||(o=i);r&&(this.state_==c.State_.PENDING&&1==n?this.cancelInternal_(e):(o?this.removeEntryAfter_(o):this.popEntry_(),this.executeCallback_(r,c.State_.REJECTED,e)))}},c.prototype.addCallbackEntry_=function(t){this.hasEntry_()||this.state_!=c.State_.FULFILLED&&this.state_!=c.State_.REJECTED||this.scheduleCallbacks_(),this.queueEntry_(t)},c.prototype.addChildPromise_=function(t,e,n){var r=c.getCallbackEntry_(null,null,null);return r.child=new c(function(o,a){r.onFulfilled=t?function(e){try{var r=t.call(n,e);o(r)}catch(t){a(t)}}:o,r.onRejected=e?function(t){try{var r=e.call(n,t);!(0,i.isDef)(r)&&t.IS_CANCELLATION_ERROR?a(t):o(r)}catch(t){a(t)}}:a}),r.child.parent_=this,this.addCallbackEntry_(r),r.child},c.prototype.unblockAndFulfill_=function(t){this.state_=c.State_.PENDING,this.resolve_(c.State_.FULFILLED,t)},c.prototype.unblockAndReject_=function(t){this.state_=c.State_.PENDING,this.resolve_(c.State_.REJECTED,t)},c.prototype.resolve_=function(t,e){this.state_==c.State_.PENDING&&(this===e&&(t=c.State_.REJECTED,e=new TypeError("Promise cannot resolve to itself")),this.state_=c.State_.BLOCKED,c.maybeThen_(e,this.unblockAndFulfill_,this.unblockAndReject_,this)||(this.result_=e,this.state_=t,this.parent_=null,this.scheduleCallbacks_(),t!=c.State_.REJECTED||e.IS_CANCELLATION_ERROR||c.addUnhandledRejection_(this,e)))},c.maybeThen_=function(t,e,n,r){if(t instanceof c)return t.thenVoid(e,n,r),!0;if(o.default.isImplementedBy(t))return(t=t).then(e,n,r),!0;if((0,i.isObject)(t))try{var a=t.then;if((0,i.isFunction)(a))return c.tryThen_(t,a,e,n,r),!0}catch(t){return n.call(r,t),!0}return!1},c.tryThen_=function(t,e,n,r,o){var i=!1,a=function(t){i||(i=!0,r.call(o,t))};try{e.call(t,function(t){i||(i=!0,n.call(o,t))},a)}catch(t){a(t)}},c.prototype.scheduleCallbacks_=function(){this.executing_||(this.executing_=!0,i.async.run(this.executeCallbacks_,this))},c.prototype.hasEntry_=function(){return!!this.callbackEntries_},c.prototype.queueEntry_=function(t){this.callbackEntriesTail_?(this.callbackEntriesTail_.next=t,this.callbackEntriesTail_=t):(this.callbackEntries_=t,this.callbackEntriesTail_=t)},c.prototype.popEntry_=function(){var t=null;return this.callbackEntries_&&(t=this.callbackEntries_,this.callbackEntries_=t.next,t.next=null),this.callbackEntries_||(this.callbackEntriesTail_=null),t},c.prototype.removeEntryAfter_=function(t){t.next==this.callbackEntriesTail_&&(this.callbackEntriesTail_=t),t.next=t.next.next},c.prototype.executeCallbacks_=function(){for(var t=null;t=this.popEntry_();)c.LONG_STACK_TRACES&&this.currentStep_++,this.executeCallback_(t,this.state_,this.result_);this.executing_=!1},c.prototype.executeCallback_=function(t,e,n){if(e==c.State_.REJECTED&&t.onRejected&&!t.always&&this.removeUnhandledRejection_(),t.child)t.child.parent_=null,c.invokeCallback_(t,e,n);else try{t.always?t.onFulfilled.call(t.context):c.invokeCallback_(t,e,n)}catch(t){c.handleRejection_.call(null,t)}c.returnEntry_(t)},c.invokeCallback_=function(t,e,n){e==c.State_.FULFILLED?t.onFulfilled.call(t.context,n):t.onRejected&&t.onRejected.call(t.context,n)},c.prototype.addStackTrace_=function(t){if(c.LONG_STACK_TRACES&&(0,i.isString)(t.stack)){var e=t.stack.split("\n",4)[3],n=t.message;n+=Array(11-n.length).join(" "),this.stack_.push(n+e)}},c.prototype.appendLongStack_=function(t){if(c.LONG_STACK_TRACES&&t&&(0,i.isString)(t.stack)&&this.stack_.length){for(var e=["Promise trace:"],n=this;n;n=n.parent_){for(var r=this.currentStep_;r>=0;
11245r--)e.push(n.stack_[r]);e.push("Value: ["+(n.state_==c.State_.REJECTED?"REJECTED":"FULFILLED")+"] <"+String(n.result_)+">")}t.stack+="\n\n"+e.join("\n")}},c.prototype.removeUnhandledRejection_=function(){if(c.UNHANDLED_REJECTION_DELAY>0)for(var t=this;t&&t.unhandledRejectionId_;t=t.parent_)clearTimeout(t.unhandledRejectionId_),t.unhandledRejectionId_=0;else if(0==c.UNHANDLED_REJECTION_DELAY)for(t=this;t&&t.hadUnhandledRejection_;t=t.parent_)t.hadUnhandledRejection_=!1},c.addUnhandledRejection_=function(t,e){c.UNHANDLED_REJECTION_DELAY>0?t.unhandledRejectionId_=setTimeout(function(){t.appendLongStack_(e),c.handleRejection_.call(null,e)},c.UNHANDLED_REJECTION_DELAY):0==c.UNHANDLED_REJECTION_DELAY&&(t.hadUnhandledRejection_=!0,i.async.run(function(){t.hadUnhandledRejection_&&(t.appendLongStack_(e),c.handleRejection_.call(null,e))}))},c.handleRejection_=i.async.throwException,c.setUnhandledRejectionHandler=function(t){c.handleRejection_=t},(c.CancellationError=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=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,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return t&&(n.message=t),n}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,Error),e}()).prototype.name="cancel",c.Resolver_=function(t,e,n){this.promise=t,this.resolve=e,this.reject=n},e.CancellablePromise=c,e.default=c},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=a,e.getCompatibilityModeData=function(){void 0===r&&"undefined"!=typeof window&&window.__METAL_COMPATIBILITY__&&a(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 i=e.hasOwnProperty(n)?e[n]:null;e.__proto__&&!e.__proto__.isPrototypeOf(Function)&&(i=r(i,t(e.__proto__,n,r))),e[o]=i}return e[o]},e.getUid=function(t,e){if(t){var n=t[i];return e&&!t.hasOwnProperty(i)&&(n=null),n||(t[i]=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,i=e.UID_PROPERTY="core_"+(1e9*Math.random()>>>0);function a(){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(5))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!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:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var c,l=[],s=!1,f=-1;
11245function d(){s&&c&&(s=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!s){var t=u(d);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===a||!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(p)},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,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={EDIT:"edit",HELP:"help",VIEW:"view",MAXIMIZED:"maximized",MINIMIZED:"minimized",NORMAL:"normal",FULL:"cacheLevelFull",PAGE:"cacheLevelPage",PORTLET:"cacheLevelPortlet"};e.PortletConstants=r,e.default=r},function(t,e,n){"use strict";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="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},o=n(1);var i=function(t,e){for(var n=[],r=function(r){var o=e.elements[r],i=o.name,a=o.nodeName.toUpperCase(),u="INPUT"===a?o.type.toUpperCase():"",c=o.value;if(i&&!o.disabled&&"FILE"!==u)if("SELECT"===a&&o.multiple)[].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(o.options)).forEach(function(e){if(e.checked){var r=e.value,o=encodeURIComponent(t+i)+"="+encodeURIComponent(r);n.push(o)}});else if("CHECKBOX"!==u&&"RADIO"!==u||o.checked){var l=encodeURIComponent(t+i)+"="+encodeURIComponent(c);n.push(l)}},o=0;o<e.elements.length;o++)r(o);return n.join("&")},a=function(t,e){var n="";if(Array.isArray(e))if(0===e.length)n+="&"+encodeURIComponent(t)+"=";else{var r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;n+="&"+encodeURIComponent(t),n+=null===c?"=":"="+encodeURIComponent(c)}}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}}return n},u=function(t,e,n,r,o){var i="";if(t.portlets&&t.portlets[e]){var u=t.portlets[e];if(u&&u.state&&u.state.parameters){var c=u.state.parameters[n];void 0!==c&&(i+=a("p_r_p_"===r?o:"priv_r_p_"===r?e+"priv_r_p_"+n:e+n,c))}}return i},c=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},l=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},s=function(t,e,n,r){var o=!1;if(t&&t.portlets){var i=t.portlets[e];if(n.parameters[r]&&i.state.parameters[r]){var a=n.parameters[r],u=i.state.parameters[r];o=l(a,u)}}return o},f=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: "+e);if(e.porletMode!==o.portletMode||e.windowState!==o.windowState)r=!0;
11245else{var i=Object.keys(e.parameters),a=!0,u=!1,c=void 0;try{for(var s,f=i[Symbol.iterator]();!(a=(s=f.next()).done);a=!0){var d=s.value,p=e.parameters[d],h=o.parameters[d];l(p,h)||(r=!0)}}catch(t){u=!0,c=t}finally{try{!a&&f.return&&f.return()}finally{if(u)throw c}}var v=Object.keys(o.parameters),y=!0,_=!1,m=void 0;try{for(var b,g=v[Symbol.iterator]();!(y=(b=g.next()).done);y=!0){var w=b.value;e.parameters[w]||(r=!0)}}catch(t){_=!0,m=t}finally{try{!y&&g.return&&g.return()}finally{if(_)throw m}}}}return r},p=function(t){if(!(0,o.isDefAndNotNull)(t))throw new TypeError("The parameter object is: "+(void 0===t?"undefined":r(t)));var e=Object.keys(t),n=!0,i=!1,a=void 0;try{for(var u,c=e[Symbol.iterator]();!(n=(u=c.next()).done);n=!0){var l=u.value;if(!Array.isArray(t[l]))throw new TypeError(l+" parameter is not an array");if(!t[l].length)throw new TypeError(l+" parameter is an empty array")}}catch(t){i=!0,a=t}finally{try{!n&&c.return&&c.return()}finally{if(i)throw a}}};e.decodeUpdateString=function(t,e){var n=t&&t.portlets?t.portlets:{};try{var r=JSON.parse(e);if(r.portlets){var o=Object.keys(n),i=!0,a=!1,u=void 0;try{for(var c,l=o[Symbol.iterator]();!(i=(c=l.next()).done);i=!0){var s=c.value,f=r.portlets[s].state,p=n[s].state;if(!f||!p)throw new Error("Invalid update string.\nold state="+p+"\nnew state="+f);d(t,f,s)&&(n[s]=r.portlets[s])}}catch(t){a=!0,u=t}finally{try{!i&&l.return&&l.return()}finally{if(a)throw u}}}}catch(t){}return n},e.encodeFormAsString=i,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+="&"+a:e+="?"+a,r.url=e):(r.body=a,r.headers={"Content-Type":"application/x-www-form-urlencoded"})}return r},e.generatePortletModeAndWindowStateString=c,e.getUpdatedPublicRenderParameters=function(t,e,n){var r={};if(t&&t.portlets){var o=t.portlets[e];if(o&&o.pubParms){var i=o.pubParms,a=Object.keys(i),u=!0,c=!1,l=void 0;try{for(var f,d=a[Symbol.iterator]();!(u=(f=d.next()).done);u=!0){var p=f.value;s(t,e,n,p)||(r[i[p]]=n.parameters[p])}}catch(t){c=!0,l=t}finally{try{!u&&d.return&&d.return()}finally{if(c)throw l}}}}return r},e.getUrl=function(t,e,n,r,o,i){var l="cacheLevelPage",s="",d="";if(t&&t.portlets){"RENDER"===e&&void 0===n&&(n=null);var p=t.portlets[n];if(p&&("RESOURCE"===e?(d=decodeURIComponent(p.encodedResourceURL),o&&(l=o),d+="&p_p_cacheability="+encodeURIComponent(l),i&&(d+="&p_p_resource_id="+encodeURIComponent(i))):"RENDER"===e&&null!==n?d=decodeURIComponent(p.encodedRenderURL):"RENDER"===e?d=decodeURIComponent(t.encodedCurrentURL):"ACTION"===e?(d=decodeURIComponent(p.encodedActionURL),d+="&p_p_hub="+encodeURIComponent("0")):"PARTIAL_ACTION"===e&&(d=decodeURIComponent(p.encodedActionURL),d+="&p_p_hub="+encodeURIComponent("1")),"RESOURCE"!==e||"cacheLevelFull"!==l)){if(n&&(d+=c(t,n)),n&&(s="",p.state&&p.state.parameters)){var h=p.state.parameters,v=Object.keys(h),y=!0,_=!1,m=void 0;try{for(var b,g=v[Symbol.iterator]();!(y=(b=g.next()).done);y=!0){var w=b.value;f(t,n,w)||(s+=u(t,n,w,"priv_r_p_"))}}catch(t){_=!0,m=t}finally{try{!y&&g.return&&g.return()}finally{if(_)throw m}}d+=s}if(t.prpMap){s="";var E={},j=Object.keys(t.prpMap),S=!0,T=!1,O=void 0;try{for(var k,I=j[Symbol.iterator]();!(S=(k=I.next()).done);S=!0){var A=k.value,P=Object.keys(t.prpMap[A]),C=!0,R=!1,L=void 0;try{for(var M,x=P[Symbol.iterator]();!(C=(M=x.next()).done);C=!0){var U=M.value,D=t.prpMap[A][U].split("|");E.hasOwnProperty(A)||(E[A]=u(t,D[0],D[1],"p_r_p_",A),s+=E[A])}}catch(t){R=!0,L=t}finally{try{!C&&x.return&&x.return()}finally{if(R)throw L}}}}catch(t){T=!0,O=t}finally{try{!S&&I.return&&I.return()}finally{if(T)throw O}}d+=s}}}if(r){s="";var N=Object.keys(r),F=!0,z=!1,$=void 0;try{for(var G,W=N[Symbol.iterator]();!(F=(G=W.next()).done);F=!0){var J=G.value;s+=a(n+J,r[J])}}catch(t){z=!0,$=t}finally{try{!F&&W.return&&W.return()}finally{if(z)throw $}}d+=s}return Promise.resolve(d)},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,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(t.length<e)throw new TypeError("Too few arguments provided: Number of arguments: "+t.length);if(t.length>n)throw new TypeError("Too many arguments provided: "+[].join.call(t,", "));if(Array.isArray(o))for(var i=Math.min(t.length,o.length)-1;i>=0;i--){if(r(t[i])!==o[i])throw new TypeError("Parameter "+i+" is of type "+r(t[i])+" rather than the expected type "+o[i]);if(null===t[i]||void 0===t[i])throw new TypeError("Argument is "+r(t[i]))}},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 "+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 "+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
11245st use enctype = 'multipart/form-data' with input type FILE.")},e.validateParameters=p,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]:{};p(t.parameters);var n=t.portletMode;if(!(0,o.isString)(n))throw new TypeError("Invalid parameters. portletMode is "+(void 0===n?"undefined":r(n)));var i=e.allowedPM;if(!i.includes(n.toLowerCase()))throw new TypeError("Invalid portletMode="+n+" is not in "+i);var a=t.windowState;if(!(0,o.isString)(a))throw new TypeError("Invalid parameters. windowState is "+(void 0===a?"undefined":r(a)));var u=e.allowedWS;if(!u.includes(a.toLowerCase()))throw new TypeError("Invalid windowState="+a+" is not in "+u)}},function(t,e,n){(function(e){var n="Expected a function",r="__lodash_hash_undefined__",o="[object Function]",i="[object GeneratorFunction]",a=/^\[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=Array.prototype,f=Function.prototype,d=Object.prototype,p=l["__core-js_shared__"],h=function(){var t=/[^.]+$/.exec(p&&p.keys&&p.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),v=f.toString,y=d.hasOwnProperty,_=d.toString,m=RegExp("^"+v.call(y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),b=s.splice,g=I(l,"Map"),w=I(Object,"create");function E(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 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 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=t.length;n--;)if(P(t[n][0],e))return n;return-1}function O(t){return!(!C(t)||function(t){return!!h&&h in t}(t))&&(function(t){var e=C(t)?_.call(t):"";return e==o||e==i}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?m:a).test(function(t){if(null!=t){try{return v.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function k(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map}function I(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return O(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],i=r.cache;if(i.has(o))return i.get(o);
11245var a=t.apply(this,n);return r.cache=i.set(o,a),a};return r.cache=new(A.Cache||S),r}function P(t,e){return t===e||t!=t&&e!=e}function C(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}E.prototype.clear=function(){this.__data__=w?w(null):{}},E.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},E.prototype.get=function(t){var e=this.__data__;if(w){var n=e[t];return n===r?void 0:n}return y.call(e,t)?e[t]:void 0},E.prototype.has=function(t){var e=this.__data__;return w?void 0!==e[t]:y.call(e,t)},E.prototype.set=function(t,e){return this.__data__[t]=w&&void 0===e?r:e,this},j.prototype.clear=function(){this.__data__=[]},j.prototype.delete=function(t){var e=this.__data__,n=T(e,t);return!(n<0||(n==e.length-1?e.pop():b.call(e,n,1),0))},j.prototype.get=function(t){var e=this.__data__,n=T(e,t);return n<0?void 0:e[n][1]},j.prototype.has=function(t){return T(this.__data__,t)>-1},j.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 E,map:new(g||j),string:new E}},S.prototype.delete=function(t){return k(this,t).delete(t)},S.prototype.get=function(t){return k(this,t).get(t)},S.prototype.has=function(t){return k(this,t).has(t)},S.prototype.set=function(t,e){return k(this,t).set(t,e),this},A.Cache=S,t.exports=A}).call(this,n(0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.portlet=void 0;var r=d(n(10)),o=d(n(11)),i=d(n(12)),a=d(n(13)),u=d(n(32)),c=d(n(33)),l=d(n(34)),s=d(n(35)),f=d(n(36));function d(t){return t&&t.__esModule?t:{default:t}}Liferay.Util.escape=r.default,Liferay.Util.groupBy=o.default,Liferay.Util.isEqual=i.default,Liferay.Util.navigate=u.default,Liferay.Util.ns=c.default,Liferay.Util.objectToFormData=l.default,Liferay.Util.toCharCode=s.default,Liferay.Util.openToast=function(){for(var t=arguments.length,e=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=f.default,e.portlet=a.default},function(t,e,n){(function(e){var n=1/0,r="[object Symbol]",o=/[&<>"'`]/g,i=RegExp(o.source),a="object"==typeof e&&e&&e.Object===Object&&e,u="object"==typeof self&&self&&self.Object===Object&&self,c=a||u||Function("return this")();var l=function(t){return function(e){return null==t?void 0:t[e]}}({"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"}),s=Object.prototype.toString,f=c.Symbol,d=f?f.prototype:void 0,p=d?d.toString:void 0;function h(t){if("string"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&s.call(t)==r}(t))return p?p.call(t):"";var e=t+"";return"0"==e&&1/t==-n?"-0":e}t.exports=function(t){return(t=function(t){return null==t?"":h(t)}(t))&&i.test(t)?t.replace(o,l):t}}).call(this,n(0))},function(t,e,n){(function(t,n){var r=200,o="Expected a function",i="__lodash_hash_undefined__",a=1,u=2,c=1/0,l=9007199254740991,s="[object Arguments]",f="[object Array]",d="[object Boolean]",p="[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]",S="[object ArrayBuffer]",T="[object DataView]",O=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,k=/^\w*$/,I=/^\./,A=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,P=/\\(\\)?/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[S]=L[d]=L[T]=L[p]=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,x="object"==typeof self&&self&&self.Object===Object&&self,U=M||x||Function("return this")(),D="object"==typeof e&&e&&!e.nodeType&&e,N=D&&"object"==typeof n&&n&&!n.nodeType&&n,F=N&&N.exports===D&&M.process,z=function(){try{return F&&F.binding("util")}catch(t){}}(),$=z&&z.isTypedArray;function G(t,e,n,r){for(var o=-1,i=t?t.length:0;++o<i;){var a=t[o];e(r,a,n(a),t)}return r}function W(t,e){for(var n=-1,r=t?t.length:0;++n<r;)if(e(t[n],n,t))return!0;return!1}function J(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function B(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function H(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var V=Array.prototype,q=Function.prototype,K=Object.prototype,Y=U["__core-js_shared__"],Q=function(){var t=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");
11245return t?"Symbol(src)_1."+t:""}(),X=q.toString,Z=K.hasOwnProperty,tt=K.toString,et=RegExp("^"+X.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=U.Symbol,rt=U.Uint8Array,ot=K.propertyIsEnumerable,it=V.splice,at=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),ut=zt(U,"DataView"),ct=zt(U,"Map"),lt=zt(U,"Promise"),st=zt(U,"Set"),ft=zt(U,"WeakMap"),dt=zt(Object,"create"),pt=qt(ut),ht=qt(ct),vt=qt(lt),yt=qt(st),_t=qt(ft),mt=nt?nt.prototype:void 0,bt=mt?mt.valueOf:void 0,gt=mt?mt.toString:void 0;function wt(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 Et(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 jt(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.__data__=new jt;++e<n;)this.add(t[e])}function Tt(t){this.__data__=new Et(t)}function Ot(t,e){var n=Zt(t)||Xt(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 i in t)!e&&!Z.call(t,i)||o&&("length"==i||Gt(i,r))||n.push(i);return n}function kt(t,e){for(var n=t.length;n--;)if(Qt(t[n][0],e))return n;return-1}function It(t,e,n,r){return At(t,function(t,o,i){e(r,t,n(t),i)}),r}wt.prototype.clear=function(){this.__data__=dt?dt(null):{}},wt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},wt.prototype.get=function(t){var e=this.__data__;if(dt){var n=e[t];return n===i?void 0:n}return Z.call(e,t)?e[t]:void 0},wt.prototype.has=function(t){var e=this.__data__;return dt?void 0!==e[t]:Z.call(e,t)},wt.prototype.set=function(t,e){return this.__data__[t]=dt&&void 0===e?i:e,this},Et.prototype.clear=function(){this.__data__=[]},Et.prototype.delete=function(t){var e=this.__data__,n=kt(e,t);return!(n<0||(n==e.length-1?e.pop():it.call(e,n,1),0))},Et.prototype.get=function(t){var e=this.__data__,n=kt(e,t);return n<0?void 0:e[n][1]},Et.prototype.has=function(t){return kt(this.__data__,t)>-1},Et.prototype.set=function(t,e){var n=this.__data__,r=kt(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},jt.prototype.clear=function(){this.__data__={hash:new wt,map:new(ct||Et),string:new wt}},jt.prototype.delete=function(t){return Ft(this,t).delete(t)},jt.prototype.get=function(t){return Ft(this,t).get(t)},jt.prototype.has=function(t){return Ft(this,t).has(t)},jt.prototype.set=function(t,e){return Ft(this,t).set(t,e),this},St.prototype.add=St.prototype.push=function(t){return this.__data__.set(t,i),this},St.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.clear=function(){this.__data__=new Et},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Et){var o=n.__data__;if(!ct||o.length<r-1)return o.push([t,e]),this;n=this.__data__=new jt(o)}return n.set(t,e),this};var At=function(t,e){return function(n,r){if(null==n)return n;if(!te(n))return t(n,r);for(var o=n.length,i=e?o:-1,a=Object(n);(e?i--:++i<o)&&!1!==r(a[i],i,a););return n}}(function(t,e){return t&&Pt(t,e,ue)}),Pt=function(t){return function(e,n,r){for(var o=-1,i=Object(e),a=r(e),u=a.length;u--;){var c=a[t?u:++o];if(!1===n(i[c],c,i))break}return e}}();function Ct(t,e){for(var n=0,r=(e=Wt(e,t)?[e]:Dt(e)).length;null!=t&&n<r;)t=t[Vt(e[n++])];return n&&n==r?t:void 0}function Rt(t,e){return null!=t&&e in Object(t)}function Lt(t,e,n,r,o){return t===e||(null==t||null==e||!re(t)&&!oe(e)?t!=t&&e!=e:function(t,e,n,r,o,i){var c=Zt(t),l=Zt(e),v=f,y=f;c||(v=(v=$t(t))==s?b:v);l||(y=(y=$t(e))==s?b:y);var O=v==b&&!J(t),k=y==b&&!J(e),I=v==y;if(I&&!O)return i||(i=new Tt),c||ae(t)?Nt(t,e,n,r,o,i):function(t,e,n,r,o,i,c){switch(n){case T:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case S:return!(t.byteLength!=e.byteLength||!r(new rt(t),new rt(e)));case d:case p:case m:return Qt(+t,+e);case h:return t.name==e.name&&t.message==e.message;case g:case E:return t==e+"";case _:var l=B;case w:var s=i&u;if(l||(l=H),t.size!=e.size&&!s)return!1;var f=c.get(t);if(f)return f==e;i|=a,c.set(t,e);var v=Nt(l(t),l(e),r,o,i,c);return c.delete(t),v;case j:if(bt)return bt.call(t)==bt.call(e)}return!1}(t,e,v,n,r,o,i);if(!(o&u)){var A=O&&Z.call(t,"__wrapped__"),P=k&&Z.call(e,"__wrapped__");
11245if(A||P){var C=A?t.value():t,R=P?e.value():e;return i||(i=new Tt),n(C,R,r,o,i)}}if(!I)return!1;return i||(i=new Tt),function(t,e,n,r,o,i){var a=o&u,c=ue(t),l=c.length,s=ue(e).length;if(l!=s&&!a)return!1;for(var f=l;f--;){var d=c[f];if(!(a?d in e:Z.call(e,d)))return!1}var p=i.get(t);if(p&&i.get(e))return p==e;var h=!0;i.set(t,e),i.set(e,t);for(var v=a;++f<l;){d=c[f];var y=t[d],_=e[d];if(r)var m=a?r(_,y,d,e,t,i):r(y,_,d,t,e,i);if(!(void 0===m?y===_||n(y,_,r,o,i):m)){h=!1;break}v||(v="constructor"==d)}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,i)}(t,e,Lt,n,r,o))}function Mt(t){return!(!re(t)||function(t){return!!Q&&Q in t}(t))&&(ee(t)||J(t)?et:C).test(qt(t))}function xt(t){return"function"==typeof t?t:null==t?ce:"object"==typeof t?Zt(t)?function(t,e){if(Wt(t)&&Jt(e))return Bt(Vt(t),e);return function(n){var r=function(t,e,n){var r=null==t?void 0:Ct(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){var r,o=-1,i=(e=Wt(e,t)?[e]:Dt(e)).length;for(;++o<i;){var a=Vt(e[o]);if(!(r=null!=t&&n(t,a)))break;t=t[a]}if(r)return r;return!!(i=t?t.length:0)&&ne(i)&&Gt(a,i)&&(Zt(t)||Xt(t))}(t,e,Rt)}(n,t):Lt(e,r,void 0,a|u)}}(t[0],t[1]):function(t){var e=function(t){var e=ue(t),n=e.length;for(;n--;){var r=e[n],o=t[r];e[n]=[r,o,Jt(o)]}return e}(t);if(1==e.length&&e[0][2])return Bt(e[0][0],e[0][1]);return function(n){return n===t||function(t,e,n,r){var o=n.length,i=o,c=!r;if(null==t)return!i;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<i;){var s=(l=n[o])[0],f=t[s],d=l[1];if(c&&l[2]){if(void 0===f&&!(s in t))return!1}else{var p=new Tt;if(r)var h=r(f,d,s,t,e,p);if(!(void 0===h?Lt(d,f,r,a|u,p):h))return!1}}return!0}(n,t,e)}}(t):function(t){return Wt(t)?function(t){return function(e){return null==e?void 0:e[t]}}(Vt(t)):function(t){return function(e){return Ct(e,t)}}(t)}(t)}function Ut(t){if(!function(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||K;return t===n}(t))return at(t);var e=[];for(var n in Object(t))Z.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Dt(t){return Zt(t)?t:Ht(t)}function Nt(t,e,n,r,o,i){var c=o&u,l=t.length,s=e.length;if(l!=s&&!(c&&s>l))return!1;var f=i.get(t);if(f&&i.get(e))return f==e;var d=-1,p=!0,h=o&a?new St:void 0;for(i.set(t,e),i.set(e,t);++d<l;){var v=t[d],y=e[d];if(r)var _=c?r(y,v,d,e,t,i):r(v,y,d,t,e,i);if(void 0!==_){if(_)continue;p=!1;break}if(h){if(!W(e,function(t,e){if(!h.has(e)&&(v===t||n(v,t,r,o,i)))return h.add(e)})){p=!1;break}}else if(v!==y&&!n(v,y,r,o,i)){p=!1;break}}return i.delete(t),i.delete(e),p}function Ft(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map}function zt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Mt(n)?n:void 0}var $t=function(t){return tt.call(t)};function Gt(t,e){return!!(e=null==e?l:e)&&("number"==typeof t||R.test(t))&&t>-1&&t%1==0&&t<e}function Wt(t,e){if(Zt(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ie(t))||(k.test(t)||!O.test(t)||null!=e&&t in Object(e))}function Jt(t){return t==t&&!re(t)}function Bt(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}(ut&&$t(new ut(new ArrayBuffer(1)))!=T||ct&&$t(new ct)!=_||lt&&"[object Promise]"!=$t(lt.resolve())||st&&$t(new st)!=w||ft&&"[object WeakMap]"!=$t(new ft))&&($t=function(t){var e=tt.call(t),n=e==b?t.constructor:void 0,r=n?qt(n):void 0;if(r)switch(r){case pt:return T;case ht:return _;case vt:return"[object Promise]";case yt:return w;case _t:return"[object WeakMap]"}return e});var Ht=Yt(function(t){t=function(t){return null==t?"":function(t){if("string"==typeof t)return t;if(ie(t))return gt?gt.call(t):"";var e=t+"";return"0"==e&&1/t==-c?"-0":e}(t)}(t);var e=[];return I.test(t)&&e.push(""),t.replace(A,function(t,n,r,o){e.push(r?o.replace(P,"$1"):n||t)}),e});function Vt(t){if("string"==typeof t||ie(t))return t;var e=t+"";return"0"==e&&1/t==-c?"-0":e}function qt(t){if(null!=t){try{return X.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var Kt=function(t,e){return function(n,r){var o=Zt(n)?G:It,i=e?e():{};return o(n,t,xt(r),i)}}(function(t,e,n){Z.call(t,n)?t[n].push(e):t[n]=[e]});function Yt(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],i=n.cache;if(i.has(o))return i.get(o);
11245var a=t.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(Yt.Cache||jt),n}function Qt(t,e){return t===e||t!=t&&e!=e}function Xt(t){return function(t){return oe(t)&&te(t)}(t)&&Z.call(t,"callee")&&(!ot.call(t,"callee")||tt.call(t)==s)}Yt.Cache=jt;var Zt=Array.isArray;function te(t){return null!=t&&ne(t.length)&&!ee(t)}function ee(t){var e=re(t)?tt.call(t):"";return e==v||e==y}function ne(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function re(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function oe(t){return!!t&&"object"==typeof t}function ie(t){return"symbol"==typeof t||oe(t)&&tt.call(t)==j}var ae=$?function(t){return function(e){return t(e)}}($):function(t){return oe(t)&&ne(t.length)&&!!L[tt.call(t)]};function ue(t){return te(t)?Ot(t):Ut(t)}function ce(t){return t}n.exports=Kt}).call(this,n(0),n(2)(t))},function(t,e,n){(function(t,n){var r=200,o="__lodash_hash_undefined__",i=1,a=2,u=9007199254740991,c="[object Arguments]",l="[object Array]",s="[object AsyncFunction]",f="[object Boolean]",d="[object Date]",p="[object Error]",h="[object Function]",v="[object GeneratorFunction]",y="[object Map]",_="[object Number]",m="[object Null]",b="[object Object]",g="[object Proxy]",w="[object RegExp]",E="[object Set]",j="[object String]",S="[object Symbol]",T="[object Undefined]",O="[object ArrayBuffer]",k="[object DataView]",I=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,P={};P["[object Float32Array]"]=P["[object Float64Array]"]=P["[object Int8Array]"]=P["[object Int16Array]"]=P["[object Int32Array]"]=P["[object Uint8Array]"]=P["[object Uint8ClampedArray]"]=P["[object Uint16Array]"]=P["[object Uint32Array]"]=!0,P[c]=P[l]=P[O]=P[f]=P[k]=P[d]=P[p]=P[h]=P[y]=P[_]=P[b]=P[w]=P[E]=P[j]=P["[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="object"==typeof e&&e&&!e.nodeType&&e,x=M&&"object"==typeof n&&n&&!n.nodeType&&n,U=x&&x.exports===M,D=U&&C.process,N=function(){try{return D&&D.binding&&D.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,e){return t.has(e)}function G(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 J=Array.prototype,B=Function.prototype,H=Object.prototype,V=L["__core-js_shared__"],q=B.toString,K=H.hasOwnProperty,Y=function(){var t=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Q=H.toString,X=RegExp("^"+q.call(K).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Z=U?L.Buffer:void 0,tt=L.Symbol,et=L.Uint8Array,nt=H.propertyIsEnumerable,rt=J.splice,ot=tt?tt.toStringTag:void 0,it=Object.getOwnPropertySymbols,at=Z?Z.isBuffer:void 0,ut=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),ct=Ut(L,"DataView"),lt=Ut(L,"Map"),st=Ut(L,"Promise"),ft=Ut(L,"Set"),dt=Ut(L,"WeakMap"),pt=Ut(Object,"create"),ht=zt(ct),vt=zt(lt),yt=zt(st),_t=zt(ft),mt=zt(dt),bt=tt?tt.prototype:void 0,gt=bt?bt.valueOf:void 0;function wt(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 Et(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 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 St(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new jt;++e<n;)this.add(t[e])}function Tt(t){var e=this.__data__=new Et(t);this.size=e.size}function Ot(t,e){var n=Wt(t),r=!n&&Gt(t),o=!n&&!r&&Jt(t),i=!n&&!r&&!o&&Kt(t),a=n||r||o||i,u=a?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)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ft(l,c))||u.push(l);return u}function kt(t,e){for(var n=t.length;n--;)if($t(t[n][0],e))return n;return-1}function It(t){return null==t?void 0===t?T:m:ot&&ot in Object(t)?function(t){var e=K.call(t,ot),n=t[ot];try{t[ot]=void 0;var r=!0}catch(t){}var o=Q.call(t);r&&(e?t[ot]=n:delete t[ot]);return o}(t):function(t){return Q.call(t)}(t)}function At(t){return qt(t)&&It(t)==c}function Pt(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=Wt(t),h=Wt(e),v=s?l:Nt(t),m=h?l:Nt(e),g=(v=v==c?b:v)==b,T=(m=m==c?b:m)==b,I=v==m;if(I&&Jt(t)){if(!Jt(e))return!1;s=!0,g=!1}if(I&&!g)return u||(u=new Tt),s||Kt(t)?Lt(t,e,n,r,o,u):function(t,e,n,r,o,u,c){switch(n){case k:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case O:return!(t.byteLength!=e.byteLength||!u(new et(t),new et(e)));case f:case d:case _:return $t(+t,+e);case p:return t.name==e.name&&t.message==e.message;case w:case j:return t==e+"";case y:var l=G;case E:var s=r&i;if(l||(l=W),t.size!=e.size&&!s)return!1;var h=c.get(t);if(h)return h==e;r|=a,c.set(t,e);var v=Lt(l(t),l(e),r,o,u,c);return c.delete(t),v;case S:if(gt)return gt.call(t)==gt.call(e)}return!1}(t,e,v,n,r,o,u);if(!(n&i)){var A=g&&K.call(t,"__wrapped__"),P=T&&K.call(e,"__wrapped__");
11245if(A||P){var C=A?t.value():t,R=P?e.value():e;return u||(u=new Tt),o(C,R,n,r,u)}}if(!I)return!1;return u||(u=new Tt),function(t,e,n,r,o,a){var u=n&i,c=Mt(t),l=c.length,s=Mt(e).length;if(l!=s&&!u)return!1;for(var f=l;f--;){var d=c[f];if(!(u?d in e:K.call(e,d)))return!1}var p=a.get(t);if(p&&a.get(e))return p==e;var h=!0;a.set(t,e),a.set(e,t);for(var v=u;++f<l;){d=c[f];var y=t[d],_=e[d];if(r)var m=u?r(_,y,d,e,t,a):r(y,_,d,t,e,a);if(!(void 0===m?y===_||o(y,_,n,r,a):m)){h=!1;break}v||(v="constructor"==d)}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,u)}(t,e,n,r,Pt,o))}function Ct(t){return!(!Vt(t)||function(t){return!!Y&&Y in t}(t))&&(Bt(t)?X:I).test(zt(t))}function Rt(t){if(!function(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||H;return t===n}(t))return ut(t);var e=[];for(var n in Object(t))K.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Lt(t,e,n,r,o,u){var c=n&i,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 d=-1,p=!0,h=n&a?new St:void 0;for(u.set(t,e),u.set(e,t);++d<l;){var v=t[d],y=e[d];if(r)var _=c?r(y,v,d,e,t,u):r(v,y,d,t,e,u);if(void 0!==_){if(_)continue;p=!1;break}if(h){if(!z(e,function(t,e){if(!$(h,e)&&(v===t||o(v,t,n,r,u)))return h.push(e)})){p=!1;break}}else if(v!==y&&!o(v,y,n,r,u)){p=!1;break}}return u.delete(t),u.delete(e),p}function Mt(t){return function(t,e,n){var r=e(t);return Wt(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,Yt,Dt)}function xt(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map}function Ut(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Ct(n)?n:void 0}wt.prototype.clear=function(){this.__data__=pt?pt(null):{},this.size=0},wt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},wt.prototype.get=function(t){var e=this.__data__;if(pt){var n=e[t];return n===o?void 0:n}return K.call(e,t)?e[t]:void 0},wt.prototype.has=function(t){var e=this.__data__;return pt?void 0!==e[t]:K.call(e,t)},wt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=pt&&void 0===e?o:e,this},Et.prototype.clear=function(){this.__data__=[],this.size=0},Et.prototype.delete=function(t){var e=this.__data__,n=kt(e,t);return!(n<0||(n==e.length-1?e.pop():rt.call(e,n,1),--this.size,0))},Et.prototype.get=function(t){var e=this.__data__,n=kt(e,t);return n<0?void 0:e[n][1]},Et.prototype.has=function(t){return kt(this.__data__,t)>-1},Et.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},jt.prototype.clear=function(){this.size=0,this.__data__={hash:new wt,map:new(lt||Et),string:new wt}},jt.prototype.delete=function(t){var e=xt(this,t).delete(t);return this.size-=e?1:0,e},jt.prototype.get=function(t){return xt(this,t).get(t)},jt.prototype.has=function(t){return xt(this,t).has(t)},jt.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},St.prototype.add=St.prototype.push=function(t){return this.__data__.set(t,o),this},St.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.clear=function(){this.__data__=new Et,this.size=0},Tt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Et){var o=n.__data__;if(!lt||o.length<r-1)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new jt(o)}return n.set(t,e),this.size=n.size,this};var Dt=it?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i}(it(t),function(e){return nt.call(t,e)}))}:function(){return[]},Nt=It;function Ft(t,e){return!!(e=null==e?u:e)&&("number"==typeof t||A.test(t))&&t>-1&&t%1==0&&t<e}function zt(t){if(null!=t){try{return q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function $t(t,e){return t===e||t!=t&&e!=e}(ct&&Nt(new ct(new ArrayBuffer(1)))!=k||lt&&Nt(new lt)!=y||st&&"[object Promise]"!=Nt(st.resolve())||ft&&Nt(new ft)!=E||dt&&"[object WeakMap]"!=Nt(new dt))&&(Nt=function(t){var e=It(t),n=e==b?t.constructor:void 0,r=n?zt(n):"";if(r)switch(r){case ht:return k;case vt:return y;case yt:return"[object Promise]";case _t:return E;case mt:return"[object WeakMap]"}return e});var Gt=At(function(){return arguments}())?At:function(t){return qt(t)&&K.call(t,"callee")&&!nt.call(t,"callee")},Wt=Array.isArray;var Jt=at||function(){return!1};function Bt(t){if(!Vt(t))return!1;var e=It(t);return e==h||e==v||e==s||e==g}function Ht(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=u}function Vt(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)&&Ht(t.length)&&!!P[It(t)]};function Yt(t){return function(t){return null!=t&&Ht(t.length)&&!Bt(t)}(t)?Ot(t):Rt(t)}n.exports=function(t,e){return Pt(t,e)}}).call(this,n(0),n(2)(t))},function(t,e,n){"use strict";
11245Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{default:t}}(n(14));e.default={register:r.default}},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.register=void 0;var r=a(n(15)),o=a(n(27)),i=n(7);function a(t){return t&&t.__esModule?t:{default:t}}var u=function(e){(0,i.validateArguments)(arguments,1,1,["string"]);var n=t.portlet.data.pageRenderState;return new r.default(function(t,r){(0,i.validatePortletId)(n,e)?t(new o.default(e)):r(new Error("Invalid portlet ID"))})};e.register=u,e.default=u}).call(this,n(0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressPromise=e.CancellablePromise=void 0;var r=i(n(3)),o=i(n(26));function i(t){return t&&t.__esModule?t:{default:t}}e.CancellablePromise=r.default,e.ProgressPromise=o.default,e.default=r.default},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(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.limit_=r,this.create_=e,this.reset_=n,this.occupants_=0,this.head_=null}return r(t,[{key:"get",value:function(){var t=void 0;return this.occupants_>0?(this.occupants_--,t=this.head_,this.head_=t.next,t.next=null):t=this.create_(),t}},{key:"put",value:function(t){this.reset_(t),this.occupants_<this.limit_&&(this.occupants_++,t.next=this.head_,this.head_=t)}},{key:"occupants",value:function(){return this.occupants_}}]),t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){};r.prototype.then=function(){},r.IMPLEMENTED_BY_PROP="$goog_Thenable",r.addImplementation=function(t){t.prototype.then=t.prototype.then,t.prototype.$goog_Thenable=!0},r.isImplementedBy=function(t){if(!t)return!1;try{return!!t.$goog_Thenable}catch(t){return!1}},e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.core=void 0;var r=n(4);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(4),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 i=e;n&&(i=e.bind(n)),i=o.nextTick.wrapCallback_(i),o.nextTick.setImmediate_||("function"==typeof t&&(0,r.isServerSide)({checkEnv:!1})?o.nextTick.setImmediate_=t:o.nextTick.setImmediate_=o.nextTick.getSetImmediateEmulator_()),o.nextTick.setImmediate_(i)},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,i=function(t){t.origin!==o&&t.data!==r||this.port1.onmessage()}.bind(this);e.addEventListener("message",i,!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(21).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.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(22),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=1,i={},a=!1,u=t.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(t);c=c&&c.setTimeout?c:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){s(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}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&s(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),r=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){s(t.data)},r=function(e){t.port2.postMessage(e)}}():u&&"onreadystatechange"in u.createElement("script")?function(){var t=u.documentElement;
11245r=function(e){var n=u.createElement("script");n.onreadystatechange=function(){s(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():r=function(t){setTimeout(s,0,t)},c.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 a={callback:t,args:e};return i[o]=a,r(o),o++},c.clearImmediate=l}function l(t){delete i[t]}function s(t){if(a)setTimeout(s,0,t);else{var e=i[t];if(e){a=!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{l(t),a=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(0),n(5))},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),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),i=1;i<r;i++)o[i-1]=arguments[i];for(var a=0;a<o.length;a++)for(e in n=o[a])t[e]=n[e];return t}},{key:"getObjectByName",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return t.split(".").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){"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}}(),o=function(t){return t&&t.__esModule?t:{default:t}}(n(3)),i=n(1);var a=function(t){function e(t,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t){i.async.nextTick(function(){o.setProgress_(t)})},o=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,(e.__proto__||Object.getPrototypeOf(e)).call(this,function(e,n){t(e,n,r)},n));return o.listeners_=[],o.progress_=0,o}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,o.default),r(e,[{key:"addChildPromise_",value:function(t,n,r){var a=o.default.getCallbackEntry_(null,null,null);return a.child=new e(function(e,o){a.onFulfilled=t?function(n){try{var i=t.call(r,n);e(i)}catch(t){o(t)}}:e,a.onRejected=n?function(t){try{var a=n.call(r,t);!(0,i.isDef)(a)&&t.IS_CANCELLATION_ERROR?o(t):e(a)}catch(t){o(t)}}:o}),a.child.parent_=this,this.addCallbackEntry_(a),a.child}},{key:"callChildProgressListeners_",value:function(t){this.callbackEntries_&&this.callbackEntries_.child&&this.callProgressListeners_(t,this.callbackEntries_.child.listeners_)}},{key:"callProgressListeners_",value:function(t,e){e.length&&e.forEach(function(e){e(t)})}},{key:"getProgress",value:function(){return this.progress_}},{key:"progress",value:function(t){return this.listeners_.push(t),this}},{key:"setProgress_",value:function(t){if(t>1||t<0)throw new TypeError("The progress percentage should be a number between 0 and 1");
11245if(t<this.progress_)throw new Error("The progress percentage can't be lower than the previous percentage");t!==this.progress_&&1!==t&&(this.progress_=t,this.callProgressListeners_(t,this.listeners_),this.callChildProgressListeners_(t))}}]),e}();e.default=a},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.PortletInit=void 0;var r="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},o=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}}(),i=n(1),a=s(n(28)),u=s(n(6)),c=n(7),l=s(n(31));function s(t){return t&&t.__esModule?t:{default:t}}function f(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var d=window.history&&window.history.pushState,p=!1,h={},v=[],y=void 0,_=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({},u.default),y||(y=t.portlet.data.pageRenderState,this._updateHistory(!0)),this.portletModes=y.portlets[this._portletId].allowedPM.slice(0),this.windowStates=y.portlets[this._portletId].allowedWS.slice(0)}return o(e,[{key:"_executeAction",value:function(t,e){var n=this;return new Promise(function(r,o){(0,c.getUrl)(y,"ACTION",n._portletId,t).then(function(t){var i=(0,c.generateActionUrl)(n._portletId,t,e);fetch(i.url,i).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(h).map(function(t){return h[t].id}).includes(t)}},{key:"_reportError",value:function(t,e){Object.keys(h).map(function(n){var r=h[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,i.isString)(e))throw new TypeError("Invalid update string: "+e);this._updatePageState(e,t).then(function(t){n._updatePortletStates(t)},function(e){p=!1,n._reportError(t,e)})}}
11245,{key:"_setState",value:function(t){var e=(0,c.getUpdatedPublicRenderParameters)(y,this._portletId,t),n=[],r=Object.keys(e),o=!0,i=!1,a=void 0;try{for(var u,l=r[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var s=u.value,d=e[s],p=y.prpMap[s],h=Object.keys(p),v=!0,_=!1,m=void 0;try{for(var b,g=h[Symbol.iterator]();!(v=(b=g.next()).done);v=!0){var w=b.value;if(w!==this._portletId){var E=p[w].split("|"),j=E[0],S=E[1];void 0===d?delete y.portlets[j].state.parameters[S]:y.portlets[j].state.parameters[S]=[].concat(f(d)),n.push(j)}}}catch(t){_=!0,m=t}finally{try{!v&&g.return&&g.return()}finally{if(_)throw m}}}}catch(t){i=!0,a=t}finally{try{!o&&l.return&&l.return()}finally{if(i)throw a}}var T=this._portletId;y.portlets[T].state=t,n.push(T);var O=!0,k=!1,I=void 0;try{for(var A,P=n[Symbol.iterator]();!(O=(A=P.next()).done);O=!0){var C=A.value;y.portlets[C].renderData.content=null}}catch(t){k=!0,I=t}finally{try{!O&&P.return&&P.return()}finally{if(k)throw I}}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: "+this._portletId,name:"NotInitializedException"};return p=!0,this._executeAction(t,e).then(function(t){return n._updatePortletStates(t).then(function(t){return p=!1,t})},function(t){p=!1,n._reportError(n._portletId,t)})}},{key:"_updateHistory",value:function(t){d&&(0,c.getUrl)(y,"RENDER",null,{}).then(function(e){var n=JSON.stringify(y);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: "+t.message))}})}},{key:"_updatePageStateFromString",value:function(t,e){var n=(0,c.decodeUpdateString)(y,t),r=[],o=!1,i=Object.keys(n),a=!0,u=!1,l=void 0;try{for(var s,f=i[Symbol.iterator]();!(a=(s=f.next()).done);a=!0){var d=s.value,p=n[d];y.portlets[d]=p,r.push(d),o=!0}}catch(t){u=!0,l=t}finally{try{!a&&f.return&&f.return()}finally{if(u)throw l}}return o&&e&&this._updateHistory(),r}},{key:"_updatePortletStates",value:function(t){var e=this;return new Promise(function(n,r){if(0===t.length)p=!1;else{var o=!0,i=!1,a=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){i=!0,a=t}finally{try{!o&&c.return&&c.return()}finally{if(i)throw a}}}n(t)})}},{key:"_updateState",value:function(t){var e=this;if(p)throw{message:"Operation in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: "+this._portletId,name:"NotInitializedException"};p=!0,this._setState(t).then(function(t){e._updatePortletStates(t)}).catch(function(t){p=!1,e._reportError(e._portletId,t)})}},{key:"_updateStateForPortlet",value:function(t){var e=v.map(function(t){return t.handle}),n=Object.keys(h),r=!0,o=!1,i=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value,s=h[c];"portlet.onStateChange"===s.type&&(s.id!==t||e.includes(c)||v.push(s))}}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}v.length>0&&setTimeout(function(){for(p=!0;v.length>0;){var t=v.shift(),e=t.handler,n=t.id;if(y.portlets[n]){var r=y.portlets[n].renderData,o=new l.default(y.portlets[n].state);r&&r.content?e("portlet.onStateChange",o,r):e("portlet.onStateChange",o)}}p=!1})}},{key:"action",value:function(){for(var t=null,e=0,n=null,r=arguments.length,o=Array(r),a=0;a<r;a++)o[a]=arguments[a];var u=!0,l=!1,s=void 0;try{for(var f,d=o[Symbol.iterator]();!(u=(f=d.next()).done);u=!0){var p=f.value;if(p instanceof HTMLFormElement){if(null!==n)throw new TypeError("Too many [object HTMLFormElement] arguments: "+p+", "+n);n=p}else if((0,i.isObject)(p)){if((0,c.validateParameters)(p),null!==t)throw new TypeError("Too many parameters arguments");t=p}else if(void 0!==p){var h=Object.prototype.toString.call(p);throw new TypeError("Invalid argument type. Argument "+(e+1)+" is of type "+h)}e++}}catch(t){l=!0,s=t}finally{try{!u&&d.return&&d.return()}finally{if(l)throw s}}return n&&(0,c.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,i.isString)(t)||!(0,i.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 invali
11245d: "+t);var r=(0,a.default)(),o={handle:r,handler:e,id:n,type:t};return h[r]=o,"portlet.onStateChange"===t&&this._updateStateForPortlet(this._portletId),r}},{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,i.isObject)(t))throw new TypeError("Invalid argument type. Resource parameters must be a parameters object.");(0,c.validateParameters)(t)}var r=null;if(e){if(!(0,i.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: "+e);r=e}if(r||(r="cacheLevelPage"),n&&!(0,i.isString)(n))throw new TypeError("Invalid argument type. Resource ID argument must be a string.");return(0,c.getUrl)(y,"RESOURCE",this._portletId,t,r,n)}},{key:"dispatchClientEvent",value:function(t,e){if((0,c.validateArguments)(arguments,2,2,["string"]),t.match(new RegExp("^portlet[.].*")))throw new TypeError("The event type is invalid: "+t);return Object.keys(h).reduce(function(n,r){var o=h[r];return t.match(o.type)&&(o.handler(t,e),n++),n},0)}},{key:"isInProgress",value:function(){return p}},{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]=[].concat(f(t[n])))}),e}},{key:"newState",value:function(t){return new l.default(t)}},{key:"removeEventListener",value:function(t){if(arguments.length>1)throw new TypeError("Too many arguments passed to removeEventListener");if(!(0,i.isDefAndNotNull)(t))throw new TypeError("The event handle provided is "+(void 0===t?"undefined":r(t)));var e=!1;if((0,i.isObject)(h[t])&&h[t].id===this._portletId){delete h[t];for(var n=v.length,o=0;o<n;o++){var a=v[o];a&&a.handle===t&&v.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,c.validateArguments)(arguments,1,1,["object"]),y.portlets&&y.portlets[this._portletId]){var e=y.portlets[this._portletId];(0,c.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,i.isObject)(t))throw new TypeError("Invalid argument type. Argument is of type "+(void 0===t?"undefined":r(t)));(0,c.validateParameters)(t),n=t}if(!0===p)throw{message:"Operation in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: "+this._portletId,name:"NotInitializedException"};p=!0;var o={setPageState:function(t){e._setPageState(e._portletId,t)},url:""};return(0,c.getUrl)(y,"PARTIAL_ACTION",this._portletId,n).then(function(t){return o.url=t,o})}}]),e}();e.PortletInit=_,e.default=_}).call(this,n(0))},function(t,e,n){var r,o,i=n(29),a=n(30),u=0,c=0;t.exports=function(t,e,n){var l=e&&n||0,s=e||[],f=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:o;if(null==f||null==d){var p=i();null==f&&(f=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[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&&(d=d+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=d;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++]=d>>>8|128,s[l++]=255&d;for(var b=0;b<6;++b)s[l+b]=f[b];return e||a(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){"use strict";
11245Object.defineProperty(e,"__esModule",{value:!0}),e.RenderState=void 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}}(),o=n(1),i=function(t){return t&&t.__esModule?t:{default:t}}(n(6));var a=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=i.default.VIEW,this.windowState=i.default.NORMAL)}return r(t,[{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!==i.default.EDIT&&t!==i.default.HELP&&t!==i.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!==i.default.MAXIMIZED&&t!==i.default.MINIMIZED&&t!==i.default.NORMAL||(this.windowState=t)}}]),t}();e.RenderState=a,e.default=a},function(t,e,n){"use strict";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){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r="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.default=function(t,e){var n=void 0;"object"!==(void 0===e?"undefined":r(e))?n=i(t,e):(n={},Object.keys(e).forEach(function(r){var o=r;r=i(t,r),n[r]=e[o]}));return n};var o=function(t){return t&&t.__esModule?t:{default:t}}(n(8));var i=function(t){return(0,o.default)(t,function(){for(var t=arguments.length,e=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){return void 0!==e&&0!==e.lastIndexOf(t,0)&&(e=""+t+e),e})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();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 i=arguments[2];Object.entries(e).forEach(function(e){var a=r(e,2),u=a[0],c=a[1],l=i?i+"["+u+"]":u;
11245Array.isArray(c)?c.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}({},l,e),n)}):!(0,o.isObject)(c)||c instanceof File?n.append(l,c):t(c,n,l)});return n};var o=n(1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=(0,function(t){return t&&t.__esModule?t:{default:t}}(n(8)).default)(function(t){return t.split("").map(function(t){return t.charCodeAt()}).join("")});e.default=r},function(t,e,n){(function(e){var n=1/0,r="[object Symbol]",o=/&(?:amp|lt|gt|quot|#39|#96);/g,i=RegExp(o.source),a="object"==typeof e&&e&&e.Object===Object&&e,u="object"==typeof self&&self&&self.Object===Object&&self,c=a||u||Function("return this")();var l=function(t){return function(e){return null==t?void 0:t[e]}}({"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"}),s=Object.prototype.toString,f=c.Symbol,d=f?f.prototype:void 0,p=d?d.toString:void 0;function h(t){if("string"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&s.call(t)==r}(t))return p?p.call(t):"";var e=t+"";return"0"==e&&1/t==-n?"-0":e}t.exports=function(t){return(t=function(t){return null==t?"":h(t)}(t))&&i.test(t)?t.replace(o,l):t}}).call(this,n(0))}])); 11246'use strict'; 11247 11248;(function (A, Liferay) { 11249 var Tabs = Liferay.namespace('Portal.Tabs'); 11250 var ToolTip = Liferay.namespace('Portal.ToolTip'); 11251 11252 var BODY_CONTENT = 'bodyContent'; 11253 11254 var TRIGGER = 'trigger'; 11255 11256 Liferay.Portal.Tabs._show = function (event) { 11257 var names = event.names; 11258 var namespace = event.namespace; 11259 11260 var selectedIndex = event.selectedIndex; 11261 11262 var tabItem = event.tabItem; 11263 var tabSection = event.tabSection; 11264 11265 if (tabItem) { 11266 tabItem.radioClass('active'); 11267 } 11268 11269 if (tabSection) { 11270 tabSection.show(); 11271 } 11272 11273 var tabTitle = A.one('#' + event.namespace + 'dropdownTitle'); 11274 11275 if (tabTitle) { 11276 tabTitle.html(tabItem.one('a').text()); 11277 } 11278 11279 names.splice(selectedIndex, 1); 11280 11281 var el; 11282 11283 for (var i = 0; i < names.length; i++) { 11284 el = A.one('#' + namespace + Liferay.Util.toCharCode(names[i]) + 'TabsSection'); 11285 11286 if (el) { 11287 el.hide(); 11288 } 11289 } 11290 }; 11291 11292 Liferay.provide(Tabs, 'show', function (namespace, names, id, callback) { 11293 var namespacedId = namespace + Liferay.Util.toCharCode(id); 11294 11295 var tab = A.one('#' + namespacedId + 'TabsId'); 11296 var tabSection = A.one('#' + namespacedId + 'TabsSection'); 11297 11298 var details = { 11299 id: id, 11300 names: names, 11301 namespace: namespace, 11302 selectedIndex: names.indexOf(id), 11303 tabItem: tab, 11304 tabSection: tabSection 11305 }; 11306 11307 if (callback && A.Lang.isFunction(callback)) { 11308 callback.call(this, namespace, names, id, details); 11309 } 11310 11311 Liferay.fire('showTab', details); 11312 }, ['aui-base']); 11313 11314 Liferay.publish('showTab', { 11315 defaultFn: Liferay.Portal.Tabs._show 11316 }); 11317 11318 ToolTip._getText = function (id) { 11319 var node = A.one('#' + id); 11320 11321 var text = ''; 11322 11323 if (node) { 11324 var toolTipTextNode = node.next('.taglib-text'); 11325 11326 if (toolTipTextNode) { 11327 text = toolTipTextNode.html(); 11328 } 11329 } 11330 11331 return text; 11332 }; 11333 11334 ToolTip.hide = function () { 11335 var instance = this; 11336 11337 var cached = instance._cached; 11338 11339 if (cached) { 11340 cached.hide(); 11341 } 11342 }; 11343 11344 Liferay.provide(ToolTip, 'show', function (obj, text, tooltipConfig) { 11345 var instance = this; 11346 11347 var cached = instance._cached; 11348 var hideTooltipTask = instance._hideTooltipTask; 11349 11350 if (!cached) { 11351 var config = A.merge({ 11352 cssClass: 'tooltip-help', 11353 html: true, 11354 opacity: 1, 11355 stickDuration: 100, 11356 visible: false, 11357 zIndex: Liferay.zIndex.TOOLTIP 11358 }, tooltipConfig); 11359 11360 cached = new A.Tooltip(config).render(); 11361 11362 cached.after('visibleChange', A.bind('_syncUIPosAlign', cached)); 11363 11364 hideTooltipTask = A.debounce('_onBoundingBoxMouseleave', cached.get('stickDuration'), cached); 11365 11366 instance._hideTooltipTask = hideTooltipTask; 11367 11368 instance._cached = cached; 11369 } else { 11370 cached.setAttrs(tooltipConfig); 11371 } 11372 11373 hideTooltipTask.cancel(); 11374 11375 if (obj.jquery) { 11376 obj = obj[0]; 11377 } 11378 11379 obj = A.one(obj); 11380 11381 if (text == null) { 11382 text = instance._getText(obj.guid()); 11383 } 11384 11385 cached.set(BODY_CONTENT, text); 11386 cached.set(TRIGGER, obj); 11387 11388 var boundingBox = cached.get('boundingBox'); 11389 11390 boundingBox.detach('hover'); 11391 obj.detach('hover'); 11392 11393 obj.on('hover', A.bind('_onBoundingBoxMouseenter', cached), hideTooltipTask); 11394 11395 boundingBox.on('hover', function (event) { 11396 hideTooltipTask.cancel(); 11397 11398 obj.once('mouseenter', hideTooltipTask.cancel); 11399 }, hideTooltipTask); 11400 11401 cached.show(); 11402 }, ['aui-tooltip-base']); 11403})(AUI(), Liferay); 11404'use strict'; 11405 11406;(function (A, Liferay) { 11407 var Lang = A.Lang; 11408 11409 var Util = Liferay.Util; 11410 11411 var STR_HEAD = 'head'; 11412 11413 var TPL_NOT_AJAXABLE = '<div class="alert alert-info">{0}</div>'; 11414 11415 var Portlet = { 11416 list: [], 11417 11418 readyCounter: 0, 11419 11420 destroyComponents: function destroyComponents(portletId) { 11421 Liferay.destroyComponents(function (component, destroyConfig) { 11422 return portletId === destroyConfig.portletId; 11423 }); 11424 }, 11425 11426 isStatic: function isStatic(portletId) { 11427 var instance = this; 11428 11429 var id = Util.getPortletId(portletId.id || portletId); 11430 11431 return id in instance._staticPortlets; 11432 }, 11433 11434 refreshLayout: function refreshLayout(portletBoundary) {}, 11435 11436 register: function register(portletId) { 11437 var instance = this; 11438 11439 if (instance.list.indexOf(portletId) < 0) { 11440 instance.list.push(portletId); 11441 } 11442 }, 11443 11444 _defCloseFn: function _defCloseFn(event) { 11445 var instance = this; 11446 11447 event.portlet.remove(true); 11448 11449 if (!event.nestedPortlet) { 11450 A.io.request(themeDisplay.getPathMain() + '/portal/update_layout', { 11451 after: { 11452 success: function success() { 11453 Liferay.fire('updatedLayout'); 11454 } 11455 }, 11456 data: { 11457 cmd: 'delete', 11458 doAsUserId: event.doAsUserId, 11459 p_auth: Liferay.authToken, 11460 p_l_id: event.plid, 11461 p_p_id: event.portletId, 11462 p_v_l_s_g_id: themeDisplay.getSiteGroupId() 11463 } 11464 }); 11465 } 11466 }, 11467 11468 _loadMarkupHeadElements: function _loadMarkupHeadElements(response, loadHTML) { 11469 var markupHeadElements = response.markupHeadElements; 11470 11471 if (markupHeadElements && markupHeadElements.length) { 11472 var head = A.one(STR_HEAD); 11473 11474 head.append(markupHeadElements); 11475 11476 var container = A.Node.create('<div />'); 11477 11478 container.plug(A.Plugin.ParseContent); 11479 11480 container.setContent(markupHeadElements); 11481 } 11482 }, 11483 11484 _loadPortletFiles: function _loadPortletFiles(response, loadHTML) { 11485 var footerCssPaths = response.footerCssPaths || []; 11486 var headerCssPaths = response.headerCssPaths || []; 11487 11488 var javascriptPaths = response.headerJavaScriptPaths || []; 11489 11490 javascriptPaths = javascriptPaths.concat(response.footerJavaScriptPaths || []); 11491 11492 var body = A.getBody(); 11493 11494 var head = A.one(STR_HEAD); 11495 11496 if (headerCssPaths.length) { 11497 A.Get.css(headerCssPaths, { 11498 insertBefore: head.get('firstChild').getDOM() 11499 }); 11500 } 11501 11502 var lastChild = body.get('lastChild').getDOM(); 11503 11504 if (footerCssPaths.length) { 11505 A.Get.css(footerCssPaths, {
11506 insertBefore: lastChild 11507 }); 11508 } 11509 11510 var responseHTML = response.portletHTML; 11511 11512 if (javascriptPaths.length) { 11513 A.Get.script(javascriptPaths, { 11514 onEnd: function onEnd(obj) { 11515 loadHTML(responseHTML); 11516 } 11517 }); 11518 } else { 11519 loadHTML(responseHTML); 11520 } 11521 }, 11522 11523 _mergeOptions: function _mergeOptions(portlet, options) { 11524 options = options || {}; 11525 11526 options.doAsUserId = options.doAsUserId || themeDisplay.getDoAsUserIdEncoded(); 11527 options.plid = options.plid || themeDisplay.getPlid(); 11528 options.portlet = portlet; 11529 options.portletId = portlet.portletId; 11530 11531 return options; 11532 }, 11533 11534 _staticPortlets: {} 11535 }; 11536 11537 Liferay.provide(Portlet, 'add', function (options) { 11538 var instance = this; 11539 11540 Liferay.fire('initLayout'); 11541 11542 var doAsUserId = options.doAsUserId || themeDisplay.getDoAsUserIdEncoded(); 11543 var plid = options.plid || themeDisplay.getPlid(); 11544 var portletData = options.portletData; 11545 var portletId = options.portletId; 11546 var portletItemId = options.portletItemId; 11547 11548 var placeHolder = options.placeHolder; 11549 11550 if (!placeHolder) { 11551 placeHolder = A.Node.create('<div class="loading-animation" />'); 11552 } else { 11553 placeHolder = A.one(placeHolder); 11554 } 11555 11556 var beforePortletLoaded = options.beforePortletLoaded; 11557 var onCompleteFn = options.onComplete; 11558 11559 var onComplete = function onComplete(portlet, portletId) { 11560 if (onCompleteFn) { 11561 onCompleteFn(portlet, portletId); 11562 } 11563 11564 instance.list.push(portlet.portletId); 11565 11566 if (portlet) { 11567 portlet.attr('data-qa-id', 'app-loaded'); 11568 } 11569 11570 Liferay.fire('addPortlet', { 11571 portlet: portlet 11572 }); 11573 }; 11574 11575 var container = null; 11576 11577 if (Liferay.Layout && Liferay.Layout.INITIALIZED) { 11578 container = Liferay.Layout.getActiveDropContainer(); 11579 } 11580 11581 if (!container) { 11582 return; 11583 } 11584 11585 var currentColumnId = Util.getColumnId(container.attr('id')); 11586 11587 var portletPosition = 0; 11588 11589 if (options.placeHolder) { 11590 var column = placeHolder.get('parentNode'); 11591 11592 if (!column) { 11593 return; 11594 } 11595 11596 placeHolder.addClass('portlet-boundary'); 11597 11598 var columnPortlets = column.all('.portlet-boundary'); 11599 var nestedPortlets = column.all('.portlet-nested-portlets'); 11600 11601 portletPosition = columnPortlets.indexOf(placeHolder); 11602 11603 var nestedPortletOffset = 0; 11604 11605 nestedPortlets.some(function (nestedPortlet) { 11606 var nestedPortletIndex = columnPortlets.indexOf(nestedPortlet); 11607 11608 if (nestedPortletIndex !== -1 && nestedPortletIndex < portletPosition) { 11609 nestedPortletOffset += nestedPortlet.all('.portlet-boundary').size(); 11610 } else if (nestedPortletIndex >= portletPosition) { 11611 return true; 11612 } 11613 }); 11614 11615 portletPosition -= nestedPortletOffset; 11616 11617 currentColumnId = Util.getColumnId(column.attr('id')); 11618 } 11619 11620 var url = themeDisplay.getPathMain() + '/portal/update_layout'; 11621 11622 var data = { 11623 cmd: 'add', 11624 dataType: 'JSON', 11625 doAsUserId: doAsUserId, 11626 p_auth: Liferay.authToken, 11627 p_l_id: plid, 11628 p_p_col_id: currentColumnId, 11629 p_p_col_pos: portletPosition, 11630 p_p_i_id: portletItemId, 11631 p_p_id: portletId, 11632 p_p_isolated: true, 11633 p_v_l_s_g_id: themeDisplay.getSiteGroupId(), 11634 portletData: portletData 11635 }; 11636 11637 var firstPortlet = container.one('.portlet-boundary'); 11638 var hasStaticPortlet = firstPortlet && firstPortlet.isStatic; 11639 11640 if (!options.placeHolder && !options.plid) { 11641 if (!hasStaticPortlet) { 11642 container.prepend(placeHolder); 11643 } else { 11644 firstPortlet.placeAfter(placeHolder); 11645 } 11646 } 11647 11648 if (themeDisplay.isFreeformLayout()) { 11649 container.prepend(placeHolder); 11650 } 11651 11652 data.currentURL = Liferay.currentURL; 11653 11654 instance.addHTML({ 11655 beforePortletLoaded: beforePortletLoaded, 11656 data: data, 11657 onComplete: onComplete, 11658 placeHolder: placeHolder, 11659 url: url 11660 }); 11661 }, ['aui-base']); 11662 11663 Liferay.provide(Portlet, 'addHTML', function (options) { 11664 var instance = this; 11665 11666 var portletBoundary = null; 11667 11668 var beforePortletLoaded = options.beforePortletLoaded; 11669 var data = options.data; 11670 var dataType = 'HTML'; 11671 var onComplete = options.onComplete; 11672 var placeHolder = options.placeHolder; 11673 var url = options.url; 11674 11675 if (data && Lang.isString(data.dataType)) { 11676 dataType = data.dataType; 11677 } 11678 11679 dataType = dataType.toUpperCase(); 11680 11681 var addPortletReturn = function addPortletReturn(html) { 11682 var container = placeHolder.get('parentNode'); 11683 11684 var portletBound = A.Node.create('<div></div>'); 11685 11686 portletBound.plug(A.Plugin.ParseContent); 11687 11688 portletBound.setContent(html); 11689 11690 portletBound = portletBound.one('> *'); 11691 11692 var portletId; 11693 11694 if (portletBound) { 11695 var id = portletBound.attr('id'); 11696 11697 portletId = Util.getPortletId(id); 11698 11699 portletBound.portletId = portletId; 11700 11701 placeHolder.hide(); 11702 placeHolder.placeAfter(portletBound); 11703 11704 placeHolder.remove(); 11705 11706 instance.refreshLayout(portletBound); 11707 11708 if (window.location.hash) { 11709 window.location.href = window.location.hash; 11710 } 11711 11712 portletBoundary = portletBound; 11713 11714 var Layout = Liferay.Layout; 11715 11716 if (Layout && Layout.INITIALIZED) { 11717 Layout.updateCurrentPortletInfo(portletBoundary); 11718 11719 if (container) { 11720 Layout.syncEmptyColumnClassUI(container); 11721 } 11722 11723 Layout.syncDraggableClassUI(); 11724 Layout.updatePortletDropZones(portletBoundary); 11725 } 11726 11727 if (onComplete) { 11728 onComplete(portletBoundary, portletId); 11729 } 11730 } else { 11731 placeHolder.remove(); 11732 } 11733 11734 return portletId; 11735 }; 11736 11737 if (beforePortletLoaded) { 11738 beforePortletLoaded(placeHolder); 11739 } 11740 11741 A.io.request(url, { 11742 after: { 11743 success: function success() { 11744 if (!data || !data.preventNotification) { 11745 Liferay.fire('updatedLayout'); 11746 } 11747 } 11748 }, 11749 data: data, 11750 dataType: dataType, 11751 on: { 11752 failure: function failure(event, id, obj) { 11753 var statusText = obj.statusText; 11754 11755 if (statusText) { 11756 var status = 'Se\x20ha\x20producido\x20un\x20error\x20inesperado\x2e\x20Por\x20favor\x2c\x20refresque\x20la\x20página\x20actual\x2e'; 11757 11758 if (statusText == 'timeout') { 11759 status = 'Tiempo\x20de\x20espera\x20superado'; 11760 } 11761 11762 placeHolder.hide(); 11763 11764 placeHolder.placeAfter('<div class="alert alert-danger">' + status + '</div>'); 11765 } 11766 }, 11767 success: function success(event, id, obj) { 11768 var instance = this; 11769 11770 var response = instance.get('responseData'); 11771 11772 if (dataType == 'HTML') { 11773 addPortletReturn(response); 11774 } else if (response.refresh) { 11775 addPortletReturn(response.portletHTML); 11776 } else { 11777 Portlet._loadMarkupHeadElements(response); 11778 Portlet._loadPortletFiles(response, addPortletReturn); 11779 } 11780 } 11781 } 11782 }); 11783 }, ['aui-io-request', 'aui-parse-content']); 11784 11785 Liferay.provide(Portlet, 'close', function (portlet, skipConfirm, options) { 11786 var instance = this; 11787 11788 portlet = A.one(portlet); 11789 11790 if (portlet && (skipConfirm || confirm('\xbfEstá\x20seguro\x20de\x20que\x20desea\x20quitar\x20este\x20componente\x3f'))) { 11791 var portletId = portlet.portletId; 11792 11793 var portletIndex = instance.list.indexOf(portletId); 11794 11795 if (portletIndex >= 0) { 11796 instance.list.splice(portletIndex, 1); 11797 } 11798 11799 options = Portlet._mergeOptions(portlet, options); 11800 11801 Portlet.destroyComponents(portletId); 11802 11803 Liferay.fire('destroyPortlet', options); 11804 11805 Liferay.fire('closePortlet', options); 11806 } else { 11807 A.config.win.focus(); 11808 } 11809 }, ['aui-io-request']); 11810 11811 Liferay.provide(Portlet, 'destroy', function (portlet, options) { 11812 portlet = A.one(portlet); 11813 11814 if (portlet) { 11815 var portletId = portlet.portletId || Util.getPortletId(portlet.attr('id')); 11816 11817 Portlet.destroyComponents(portletId); 11818 11819 Liferay.fire('destroyPortlet', Portlet._mergeOptions(portlet, options)); 11820 } 11821 }, ['aui-node-base']); 11822 11823 Liferay.provide(Portlet, 'minimize', function (portlet, el, options) { 11824 var instance = this; 11825 11826 options = options || {}; 11827 11828 var doAsUserId = options.doAsUserId || themeDisplay.getDoAsUserIdEncoded(); 11829 var plid = options.plid || themeDisplay.getPlid(); 11830 11831 portlet = A.one(portlet); 11832 11833 if (portlet) { 11834 var content = portlet.one('.portlet-content-container'); 11835 11836 if (content) { 11837 var restore = content.hasClass('hide'); 11838
11839 content.toggle(); 11840 portlet.toggleClass('portlet-minimized'); 11841 11842 var link = A.one(el); 11843 11844 if (link) { 11845 var title = restore ? 'Minimizar' : 'Restaurar'; 11846 11847 link.attr('alt', title); 11848 link.attr('title', title); 11849 11850 var linkText = link.one('.taglib-text-icon'); 11851 11852 if (linkText) { 11853 linkText.html(title); 11854 } 11855 11856 var icon = link.one('i'); 11857 11858 if (icon) { 11859 icon.removeClass('icon-minus icon-resize-vertical'); 11860 11861 if (restore) { 11862 icon.addClass('icon-minus'); 11863 } else { 11864 icon.addClass('icon-resize-vertical'); 11865 } 11866 } 11867 } 11868 11869 A.io.request(themeDisplay.getPathMain() + '/portal/update_layout', { 11870 after: { 11871 success: function success() { 11872 if (restore) { 11873 var data = { 11874 doAsUserId: doAsUserId, 11875 p_l_id: plid, 11876 p_p_boundary: false, 11877 p_p_id: portlet.portletId, 11878 p_p_isolated: true 11879 }; 11880 11881 portlet.plug(A.Plugin.ParseContent); 11882 11883 portlet.load(themeDisplay.getPathMain() + '/portal/render_portlet?' + A.QueryString.stringify(data)); 11884 } 11885 } 11886 }, 11887 data: { 11888 cmd: 'minimize', 11889 doAsUserId: doAsUserId, 11890 p_auth: Liferay.authToken, 11891 p_l_id: plid, 11892 p_p_id: portlet.portletId, 11893 p_p_restore: restore, 11894 p_v_l_s_g_id: themeDisplay.getSiteGroupId() 11895 } 11896 }); 11897 } 11898 } 11899 }, ['aui-io', 'aui-parse-content', 'node-load', 'querystring-stringify']); 11900 11901 Liferay.provide(Portlet, 'onLoad', function (options) { 11902 var instance = this; 11903 11904 var canEditTitle = options.canEditTitle; 11905 var columnPos = options.columnPos; 11906 var isStatic = options.isStatic == 'no' ? null : options.isStatic; 11907 var namespacedId = options.namespacedId; 11908 var portletId = options.portletId; 11909 var refreshURL = options.refreshURL; 11910 var refreshURLData = options.refreshURLData; 11911 11912 if (isStatic) { 11913 instance.registerStatic(portletId); 11914 } 11915 11916 var portlet = A.one('#' + namespacedId); 11917 11918 if (portlet && !portlet.portletProcessed) { 11919 portlet.portletProcessed = true; 11920 portlet.portletId = portletId; 11921 portlet.columnPos = columnPos; 11922 portlet.isStatic = isStatic; 11923 portlet.refreshURL = refreshURL; 11924 portlet.refreshURLData = refreshURLData; 11925 11926 // Functions to run on portlet load 11927 11928 if (canEditTitle) { 11929 11930 // https://github.com/yui/yui3/issues/1808 11931 11932 var events = 'focus'; 11933 11934 if (!A.UA.touch) { 11935 events = ['focus', 'mousemove']; 11936 } 11937 11938 var handle = portlet.on(events, function (event) { 11939 Util.portletTitleEdit({ 11940 doAsUserId: themeDisplay.getDoAsUserIdEncoded(), 11941 obj: portlet, 11942 plid: themeDisplay.getPlid(), 11943 portletId: portletId 11944 }); 11945 11946 handle.detach(); 11947 }); 11948 } 11949 } 11950 11951 Liferay.fire('portletReady', { 11952 portlet: portlet, 11953 portletId: portletId 11954 }); 11955 11956 instance.readyCounter++; 11957 11958 if (instance.readyCounter === instance.list.length) { 11959 Liferay.fire('allPortletsReady', { 11960 portletId: portletId 11961 }); 11962 } 11963 }, ['aui-base', 'aui-timer', 'event-move']); 11964 11965 Liferay.provide(Portlet, 'refresh', function (portlet, data) { 11966 var instance = this; 11967 11968 portlet = A.one(portlet); 11969 11970 if (portlet) { 11971 data = data || portlet.refreshURLData || {}; 11972 11973 if (!data.hasOwnProperty('portletAjaxable')) { 11974 data.portletAjaxable = true; 11975 } 11976 11977 var id = portlet.attr('portlet'); 11978 11979 var url = portlet.refreshURL; 11980 11981 var placeHolder = A.Node.create('<div class="loading-animation" id="p_p_id' + id + '" />'); 11982 11983 if (data.portletAjaxable && url) { 11984 portlet.placeBefore(placeHolder); 11985 11986 portlet.remove(true); 11987 11988 Portlet.destroyComponents(portlet.portletId); 11989 11990 var params = {}; 11991 11992 var urlPieces = url.split('?'); 11993 11994 if (urlPieces.length > 1) { 11995 params = A.QueryString.parse(urlPieces[1]); 11996 11997 delete params.dataType; 11998 11999 url = urlPieces[0]; 12000 } 12001 12002 instance.addHTML({ 12003 data: A.mix(params, data, true), 12004 onComplete: function onComplete(portlet, portletId) { 12005 portlet.refreshURL = url; 12006 12007 if (portlet) { 12008 portlet.attr('data-qa-id', 'app-refreshed'); 12009 } 12010 12011 Liferay.fire(portlet.portletId + ':portletRefreshed', { 12012 portlet: portlet, 12013 portletId: portletId 12014 }); 12015 }, 12016 placeHolder: placeHolder, 12017 url: url 12018 }); 12019 } else if (!portlet.getData('pendingRefresh')) { 12020 portlet.setData('pendingRefresh', true); 12021 12022 var nonAjaxableContentMessage = Lang.sub(TPL_NOT_AJAXABLE, ['Este\x20cambio\x20será\x20aplicado\x20cuando\x20la\x20página\x20sea\x20recargada\x2e']); 12023 12024 var portletBody = portlet.one('.portlet-body'); 12025 12026 portletBody.placeBefore(nonAjaxableContentMessage); 12027 12028 portletBody.hide(); 12029 } 12030 } 12031 }, ['aui-base', 'querystring-parse']); 12032 12033 Liferay.provide(Portlet, 'registerStatic', function (portletId) { 12034 var instance = this; 12035 12036 var Node = A.Node; 12037 12038 if (Node && portletId instanceof Node) { 12039 portletId = portletId.attr('id'); 12040 } else if (portletId.id) { 12041 portletId = portletId.id; 12042 } 12043 12044 var id = Util.getPortletId(portletId); 12045 12046 instance._staticPortlets[id] = true; 12047 }, ['aui-base']); 12048 12049 Liferay.provide(Portlet, 'openWindow', function (options) { 12050 var instance = this; 12051 12052 var bodyCssClass = options.bodyCssClass; 12053 var destroyOnHide = options.destroyOnHide; 12054 var namespace = options.namespace; 12055 var portlet = options.portlet; 12056 var subTitle = options.subTitle; 12057 var title = options.title; 12058 var uri = options.uri; 12059 12060 portlet = A.one(portlet); 12061 12062 if (portlet && uri) { 12063 var portletTitle = portlet.one('.portlet-title') || portlet.one('.portlet-title-default'); 12064 12065 var titleHtml = title; 12066 12067 if (portletTitle) { 12068 if (portlet.one('#cpPortletTitle')) { 12069 titleHtml = portletTitle.one('.portlet-title-text').outerHTML() + ' - ' + titleHtml; 12070 } else { 12071 titleHtml = portletTitle.text() + ' - ' + titleHtml; 12072 } 12073 } 12074 12075 if (subTitle) { 12076 titleHtml += '<div class="portlet-configuration-subtitle small"><span class="portlet-configuration-subtitle-text">' + subTitle + '</span></div>'; 12077 } 12078 12079 Liferay.Util.openWindow({ 12080 cache: false, 12081 dialog: { 12082 destroyOnHide: destroyOnHide 12083 }, 12084 dialogIframe: { 12085 bodyCssClass: bodyCssClass, 12086 id: namespace + 'configurationIframe', 12087 uri: uri 12088 }, 12089 id: namespace + 'configurationIframeDialog', 12090 title: titleHtml, 12091 uri: uri 12092 }, function (dialog) { 12093 dialog.once('drag:init', function () { 12094 dialog.dd.addInvalid('.portlet-configuration-subtitle-text'); 12095 }); 12096 }); 12097 } 12098 }, ['liferay-util-window']); 12099 12100 Liferay.publish('closePortlet', { 12101 defaultFn: Portlet._defCloseFn 12102 }); 12103 12104 Liferay.publish('allPortletsReady', { 12105 fireOnce: true 12106 }); 12107 12108 // Backwards compatability 12109 12110 Portlet.ready = function (fn) { 12111 Liferay.on('portletReady', function (event) { 12112 fn(event.portletId, event.portlet); 12113 }); 12114 }; 12115 12116 Liferay.Portlet = Portlet; 12117})(AUI(), Liferay); 12118"use strict"; 12119 12120Liferay.Workflow = { 12121 ACTION_PUBLISH: 1, 12122 12123 ACTION_SAVE_DRAFT: 2, 12124 12125 STATUS_ANY: -1, 12126 12127 STATUS_APPROVED: 0, 12128 12129 STATUS_DENIED: 4, 12130 12131 STATUS_DRAFT: 2, 12132 12133 STATUS_EXPIRED: 3, 12134 12135 STATUS_PENDING: 1 12136}; 12137AUI.add( 12138 'liferay-address', 12139 function(A) { 12140 Liferay.Address = { 12141 getCountries: function(callback) { 12142 Liferay.Service( 12143 '/country/get-countries', 12144 { 12145 active: true 12146 }, 12147 callback 12148 ); 12149 }, 12150 12151 getRegions: function(callback, selectKey) { 12152 Liferay.Service( 12153 '/region/get-regions', 12154 { 12155 active: true, 12156 countryId: Number(selectKey) 12157 }, 12158 callback 12159 ); 12160 } 12161 }; 12162 }, 12163 '', 12164 { 12165 requires: [] 12166 } 12167); 12168AUI.add( 12169 'liferay-form', 12170 function(A) { 12171 var AArray = A.Array; 12172 12173 var Lang = A.Lang; 12174 12175 var formConfig; 12176 12177 var DEFAULTS_FORM_VALIDATOR = A.config.FormValidator; 12178 12179 var defaultAcceptFiles = DEFAULTS_FORM_VALIDATOR.RULES.acceptFiles; 12180 12181 var TABS_SECTION_STR = 'TabsSection'; 12182 12183 var REGEX_NUMBER = /^[+\-]?(\d+)([.|,]\d+)*([eE][+-]?\d+)?$/; 12184 12185 var REGEX_URL = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(https?\:\/\/|www.|[-;
12185:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))((.*):(\d*)\/?(.*))?)/; 12186 12187 var acceptFiles = function(val, node, ruleValue) { 12188 if (ruleValue == '*') { 12189 return true; 12190 } 12191 12192 return defaultAcceptFiles(val, node, ruleValue); 12193 }; 12194 12195 var maxFileSize = function(val, node, ruleValue) { 12196 var nodeType = node.get('type').toLowerCase(); 12197 12198 if (nodeType === 'file') { 12199 return (ruleValue === 0 || node._node.files[0].size <= ruleValue); 12200 } 12201 12202 return true; 12203 }; 12204 12205 var number = function(val, node, ruleValue) { 12206 return REGEX_NUMBER && REGEX_NUMBER.test(val); 12207 }; 12208 12209 var url = function(val, node, ruleValue) { 12210 return REGEX_URL && REGEX_URL.test(val); 12211 }; 12212 12213 A.mix( 12214 DEFAULTS_FORM_VALIDATOR.RULES, 12215 { 12216 acceptFiles: acceptFiles, 12217 maxFileSize: maxFileSize, 12218 number: number, 12219 url: url 12220 }, 12221 true 12222 ); 12223 12224 A.mix( 12225 DEFAULTS_FORM_VALIDATOR.STRINGS, 12226 { 12227 DEFAULT: 'Por\x20favor\x2c\x20arregle\x20este\x20campo\x2e', 12228 acceptFiles: 'Especifique\x20un\x20archivo\x20con\x20una\x20extensión\x20válida\x20\x28\x7b0\x7d\x29\x2e', 12229 alpha: 'Por\x20favor\x2c\x20introduzca\x20sólo\x20letras\x2e', 12230 alphanum: 'Por\x20favor\x2c\x20introduzca\x20sólo\x20caracteres\x20alfanuméricos\x2e', 12231 date: 'Por\x20favor\x2c\x20introduzca\x20una\x20fecha\x20válida\x2e', 12232 digits: 'Por\x20favor\x2c\x20introduzca\x20sólo\x20dÃÂgitos\x2e', 12233 email: 'Por\x20favor\x2c\x20introduzca\x20una\x20dirección\x20de\x20correo\x20electrónico\x20válida\x2e', 12234 equalTo: 'Por\x20favor\x2c\x20introduzca\x20el\x20mismo\x20valor\x20otra\x20vez\x2e', 12235 max: 'Por\x20favor\x2c\x20introduzca\x20un\x20valor\x20menor\x20o\x20igual\x20que\x20\x7b0\x7d\x2e', 12236 maxFileSize: 'Especifique\x20un\x20archivo\x20con\x20un\x20tamaño\x20de\x20archivo\x20válido\x20que\x20no\x20sea\x20superior\x20a\x20\x7b0\x7d\x2e', 12237 maxLength: 'Por\x20favor\x2c\x20introduzca\x20menos\x20de\x20\x7b0\x7d\x20caracteres\x2e', 12238 min: 'Por\x20favor\x2c\x20introduzca\x20un\x20valor\x20mayor\x20o\x20igual\x20que\x20\x7b0\x7d\x2e', 12239 minLength: 'Por\x20favor\x2c\x20introduzca\x20al\x20menos\x20\x7b0\x7d\x20caracteres\x2e', 12240 number: 'Por\x20favor\x2c\x20introduzca\x20un\x20número\x20válido\x2e', 12241 range: 'Por\x20favor\x2c\x20introduzca\x20un\x20valor\x20entre\x20\x7b0\x7d\x20y\x20\x7b1\x7d\x2e', 12242 rangeLength: 'Por\x20favor\x2c\x20introduzca\x20sólo\x20un\x20valor\x20de\x20entre\x20\x7b0\x7d\x20y\x20\x7b1\x7d\x20caracteres\x20de\x20largo\x2e', 12243 required: 'Este\x20campo\x20es\x20obligatorio\x2e', 12244 url: 'Por\x20favor\x2c\x20introduzca\x20una\x20URL\x20válida\x2e' 12245 }, 12246 true 12247 ); 12248 12249 var Form = A.Component.create( 12250 { 12251 ATTRS: { 12252 fieldRules: { 12253 setter: function(val) { 12254 var instance = this; 12255 12256 instance._processFieldRules(val); 12257 12258 return val; 12259 } 12260 }, 12261 id: {}, 12262 namespace: {}, 12263 onSubmit: { 12264 valueFn: function() { 12265 var instance = this; 12266 12267 return instance._onSubmit; 12268 } 12269 }, 12270 validateOnBlur: { 12271 validator: Lang.isBoolean, 12272 value: true 12273 } 12274 }, 12275 12276 EXTENDS: A.Base, 12277 12278 prototype: { 12279 initializer: function() { 12280 var instance = this; 12281 12282 var id = instance.get('id'); 12283 12284 var form = document[id]; 12285 var formNode = A.one(form); 12286 12287 instance.form = form; 12288 instance.formNode = formNode; 12289 12290 if (formNode) { 12291 var formValidator = new A.FormValidator( 12292 { 12293 boundingBox: formNode, 12294 validateOnBlur: instance.get('validateOnBlur') 12295 } 12296 ); 12297 12298 A.Do.before('_focusInvalidFieldTab', formValidator, 'focusInvalidField', instance); 12299 12300 instance.formValidator = formValidator; 12301 12302 instance._processFieldRules(); 12303 12304 instance._bindForm(); 12305 } 12306 }, 12307 12308 addRule: function(fieldName, validatorName, errorMessage, body, custom) { 12309 var instance = this; 12310 12311 var fieldRules = instance.get('fieldRules'); 12312 12313 var ruleIndex = instance._findRuleIndex(fieldRules, fieldName, validatorName); 12314 12315 if (ruleIndex == -1) { 12316 fieldRules.push( 12317 { 12318 body: body || '', 12319 custom: custom || false, 12320 errorMessage: errorMessage || '', 12321 fieldName: fieldName, 12322 validatorName: validatorName 12323 } 12324 ); 12325 12326 instance._processFieldRules(fieldRules); 12327 } 12328 }, 12329 12330 removeRule: function(fieldName, validatorName) { 12331 var instance = this; 12332 12333 var fieldRules = instance.get('fieldRules'); 12334 12335 var ruleIndex = instance._findRuleIndex(fieldRules, fieldName, validatorName); 12336 12337 if (ruleIndex != -1) { 12338 var rule = fieldRules[ruleIndex]; 12339 12340 instance.formValidator.resetField(rule.fieldName); 12341 12342 fieldRules.splice(ruleIndex, 1); 12343 12344 instance._processFieldRules(fieldRules); 12345 } 12346 }, 12347 12348 _afterGetFieldsByName: function(fieldName) { 12349 var instance = this; 12350 12351 var editorString = 'Editor'; 12352 12353 if (fieldName.lastIndexOf(editorString) === (fieldName.length - editorString.length)) { 12354 var formNode = instance.formNode; 12355 12356 return new A.Do.AlterReturn( 12357 'Return editor dom element', 12358 formNode.one('#' + fieldName) 12359 ); 12360 } 12361 }, 12362 12363 _bindForm: function() { 12364 var instance = this; 12365 12366 var formNode = instance.formNode; 12367 var formValidator = instance.formValidator; 12368 12369 formValidator.on('submit', A.bind('_onValidatorSubmit', instance)); 12370 formValidator.on('submitError', A.bind('_onSubmitError', instance)); 12371 12372 formNode.delegate(['blur', 'focus'], A.bind('_onFieldFocusChange', instance), 'button,input,select,textarea'); 12373 formNode.delegate(['blur', 'input'], A.bind('_onEditorBlur', instance), 'div[contenteditable="true"]'); 12374 12375 A.Do.after('_afterGetFieldsByName', formValidator, 'getFieldsByName', instance); 12376 }, 12377 12378 _defaultSubmitFn: function(event) { 12379 var instance = this; 12380 12381 if (!event.stopped) { 12382 submitForm(instance.form); 12383 } 12384 }, 12385 12386 _findRuleIndex: function(fieldRules, fieldName, validatorName) { 12387 var ruleIndex = -1; 12388 12389 AArray.some( 12390 fieldRules, 12391 function(element, index) { 12392 if (element.fieldName === fieldName && 12393 element.validatorName === validatorName) { 12394 ruleIndex = index; 12395 12396 return true; 12397 } 12398 } 12399 ); 12400 12401 return ruleIndex; 12402 }, 12403 12404 _focusInvalidFieldTab: function() { 12405 var instance = this; 12406 12407 var formNode = instance.formNode; 12408 12409 var field = formNode.one('.' + instance.formValidator.get('errorClass')); 12410 12411 if (field) { 12412 var formTabs = formNode.one('.lfr-nav'); 12413 12414 if (formTabs) { 12415 var tabs = formTabs.all('.tab'); 12416 var tabsNamespace = formTabs.getAttribute('data-tabs-namespace'); 12417 12418 var tabNames = AArray.map( 12419 tabs._nodes, 12420 function(tab) { 12421 return tab.getAttribute('data-tab-name'); 12422 } 12423 ) 12424 12425 var fieldWrapper = field.ancestor('form > div'); 12426 12427 var fieldWrapperId = fieldWrapper.getAttribute('id').slice(0, -TABS_SECTION_STR.length); 12428 12429 var fieldTabId = AArray.find( 12430 tabs._nodes, 12431 function(tab) { 12432 return tab.getAttribute('id').indexOf(fieldWrapperId) !== -1; 12433 } 12434 ) 12435 12436 Liferay.Portal.Tabs.show(tabsNamespace, tabNames, fieldTabId.getAttribute('data-tab-name')); 12437 } 12438 } 12439 }, 12440 12441 _onEditorBlur: function(event) { 12442 var instance = this; 12443 12444 var formValidator = instance.formValidator; 12445 12446 formValidator.validateField(event.target); 12447 }, 12448 12449 _onFieldFocusChange: function(event) { 12450 var instance = this; 12451 12452 var row = event.currentTarget.ancestor('.field'); 12453 12454 if (row) { 12455 row.toggleClass('field-focused', event.type === 'focus'); 12456 } 12457 }, 12458 12459 _onSubmit: function(event) { 12460 var instance = this; 12461 12462 event.preventDefault(); 12463 12464 setTimeout( 12465 function() { 12466 instance._defaultSubmitFn(event); 12467 }, 12468 0 12469 ); 12470 }, 12471 12472 _onSubmitError: function(event) { 12473 var instance = this; 12474 12475 var collapsiblePanels = instance.formNode.all('.panel-collapse'); 12476 12477 collapsiblePanels.each( 12478 function(panel) { 12479 var errorFields = panel.get('children').all('.has-error'); 12480 12481 if (errorFields.size() > 0 && !panel.hasClass('in')) { 12482 var panelNode = panel.getDOM(); 12483 12484 AUI.$(panelNode).collapse('show'); 12485 } 12486 } 12487 ); 12488 }, 12489 12490 _onValidatorSubmit: function(event) { 12491 var instance = this; 12492 12493 var onSubmit = instance.get('onSubmit'); 12494 12495 onSubmit.call(instance, event.validator.formEvent); 12496 }, 12497 12498 _processFieldRule: function(rules, strings, rule) { 12499 var instance = this; 12500 12501 var value = true; 12502 12503 var fieldName = rule.fieldName;
12504 var validatorName = rule.validatorName; 12505 12506 if ((rule.body || rule.body === 0) && !rule.custom) { 12507 value = rule.body; 12508 } 12509 12510 var fieldRules = rules[fieldName]; 12511 12512 if (!fieldRules) { 12513 fieldRules = {}; 12514 12515 rules[fieldName] = fieldRules; 12516 } 12517 12518 fieldRules[validatorName] = value; 12519 12520 if (rule.custom) { 12521 DEFAULTS_FORM_VALIDATOR.RULES[validatorName] = rule.body; 12522 } 12523 12524 var errorMessage = rule.errorMessage; 12525 12526 if (errorMessage) { 12527 var fieldStrings = strings[fieldName]; 12528 12529 if (!fieldStrings) { 12530 fieldStrings = {}; 12531 12532 strings[fieldName] = fieldStrings; 12533 } 12534 12535 fieldStrings[validatorName] = errorMessage; 12536 } 12537 }, 12538 12539 _processFieldRules: function(fieldRules) { 12540 var instance = this; 12541 12542 if (!fieldRules) { 12543 fieldRules = instance.get('fieldRules'); 12544 } 12545 12546 var fieldStrings = {}; 12547 var rules = {}; 12548 12549 for (var rule in fieldRules) { 12550 instance._processFieldRule(rules, fieldStrings, fieldRules[rule]); 12551 } 12552 12553 var formValidator = instance.formValidator; 12554 12555 if (formValidator) { 12556 formValidator.set('fieldStrings', fieldStrings); 12557 formValidator.set('rules', rules); 12558 } 12559 } 12560 }, 12561 12562 get: function(id) { 12563 var instance = this; 12564 12565 return instance._INSTANCES[id]; 12566 }, 12567 12568 register: function(config) { 12569 var instance = this; 12570 12571 formConfig = config; 12572 12573 var form = new Liferay.Form(config); 12574 12575 var formName = config.id || config.namespace; 12576 12577 instance._INSTANCES[formName] = form; 12578 12579 Liferay.fire( 12580 'form:registered', 12581 { 12582 form: form, 12583 formName: formName 12584 } 12585 ); 12586 12587 return form; 12588 }, 12589 12590 _INSTANCES: {} 12591 } 12592 ); 12593 12594 Liferay.Form = Form; 12595 }, 12596 '', 12597 { 12598 requires: ['aui-base', 'aui-form-validator'] 12599 } 12600); 12601AUI.add( 12602 'liferay-form-placeholders', 12603 function(A) { 12604 var ANode = A.Node; 12605 12606 var CSS_PLACEHOLDER = 'text-placeholder'; 12607 12608 var MAP_IGNORE_ATTRS = { 12609 id: 1, 12610 name: 1, 12611 type: 1 12612 }; 12613 12614 var SELECTOR_PLACEHOLDER_INPUTS = 'input[placeholder], textarea[placeholder]'; 12615 12616 var STR_BLANK = ''; 12617 12618 var STR_DATA_TYPE_PASSWORD_PLACEHOLDER = 'data-type-password-placeholder'; 12619 12620 var STR_FOCUS = 'focus'; 12621 12622 var STR_PASSWORD = 'password'; 12623 12624 var STR_PLACEHOLDER = 'placeholder'; 12625 12626 var STR_SPACE = ' '; 12627 12628 var STR_TYPE = 'type'; 12629 12630 var Placeholders = A.Component.create( 12631 { 12632 EXTENDS: A.Plugin.Base, 12633 12634 NAME: 'placeholders', 12635 12636 NS: STR_PLACEHOLDER, 12637 12638 prototype: { 12639 initializer: function(config) { 12640 var instance = this; 12641 12642 var host = instance.get('host'); 12643 12644 var formNode = host.formNode; 12645 12646 if (formNode) { 12647 var placeholderInputs = formNode.all(SELECTOR_PLACEHOLDER_INPUTS); 12648 12649 placeholderInputs.each( 12650 function(item, index) { 12651 if (!item.val()) { 12652 if (item.attr(STR_TYPE) === STR_PASSWORD) { 12653 instance._initializePasswordNode(item); 12654 } 12655 else { 12656 item.addClass(CSS_PLACEHOLDER); 12657 12658 item.val(item.attr(STR_PLACEHOLDER)); 12659 } 12660 } 12661 } 12662 ); 12663 12664 instance.host = host; 12665 12666 instance.beforeHostMethod('_onValidatorSubmit', instance._removePlaceholders, instance); 12667 instance.beforeHostMethod('_onFieldFocusChange', instance._togglePlaceholders, instance); 12668 } 12669 }, 12670 12671 _initializePasswordNode: function(field) { 12672 var placeholder = ANode.create('<input name="' + field.attr('name') + '_pass_placeholder" type="text" />'); 12673 12674 Liferay.Util.getAttributes( 12675 field, 12676 function(value, name, attrs) { 12677 var result = false;
12678 12679 if (!MAP_IGNORE_ATTRS[name]) { 12680 if (name === 'class') { 12681 value += STR_SPACE + CSS_PLACEHOLDER; 12682 } 12683 12684 placeholder.setAttribute(name, value); 12685 } 12686 12687 return result; 12688 } 12689 ); 12690 12691 placeholder.val(field.attr(STR_PLACEHOLDER)); 12692 12693 placeholder.attr(STR_DATA_TYPE_PASSWORD_PLACEHOLDER, true); 12694 12695 field.placeBefore(placeholder); 12696 12697 field.hide(); 12698 }, 12699 12700 _removePlaceholders: function() { 12701 var instance = this; 12702 12703 var formNode = instance.host.formNode; 12704 12705 var placeholderInputs = formNode.all(SELECTOR_PLACEHOLDER_INPUTS); 12706 12707 placeholderInputs.each( 12708 function(item, index) { 12709 if (item.val() == item.attr(STR_PLACEHOLDER)) { 12710 item.val(STR_BLANK); 12711 } 12712 } 12713 ); 12714 }, 12715 12716 _toggleLocalizedPlaceholders: function(event, currentTarget) { 12717 var placeholder = currentTarget.attr(STR_PLACEHOLDER); 12718 12719 if (placeholder) { 12720 var value = currentTarget.val(); 12721 12722 if (event.type === STR_FOCUS) { 12723 if (value === placeholder) { 12724 currentTarget.removeClass(CSS_PLACEHOLDER); 12725 } 12726 } 12727 else if (!value) { 12728 currentTarget.val(placeholder); 12729 12730 currentTarget.addClass(CSS_PLACEHOLDER); 12731 } 12732 } 12733 }, 12734 12735 _togglePasswordPlaceholders: function(event, currentTarget) { 12736 var placeholder = currentTarget.attr(STR_PLACEHOLDER); 12737 12738 if (placeholder) { 12739 if (event.type === STR_FOCUS) { 12740 if (currentTarget.hasAttribute(STR_DATA_TYPE_PASSWORD_PLACEHOLDER)) { 12741 currentTarget.hide(); 12742 12743 var passwordField = currentTarget.next(); 12744 12745 passwordField.show(); 12746 12747 setTimeout( 12748 function() { 12749 Liferay.Util.focusFormField(passwordField); 12750 }, 12751 0 12752 ); 12753 } 12754 } 12755 else if (currentTarget.attr(STR_TYPE) === STR_PASSWORD) { 12756 var value = currentTarget.val(); 12757 12758 if (!value) { 12759 currentTarget.hide(); 12760 12761 currentTarget.previous().show(); 12762 } 12763 } 12764 } 12765 }, 12766 12767 _togglePlaceholders: function(event) { 12768 var instance = this; 12769 12770 var currentTarget = event.currentTarget; 12771 12772 if (currentTarget.hasAttribute(STR_DATA_TYPE_PASSWORD_PLACEHOLDER) || currentTarget.attr(STR_TYPE) === STR_PASSWORD) { 12773 instance._togglePasswordPlaceholders(event, currentTarget); 12774 } 12775 else if (currentTarget.hasClass('language-value')) { 12776 instance._toggleLocalizedPlaceholders(event, currentTarget); 12777 } 12778 else { 12779 var placeholder = currentTarget.attr(STR_PLACEHOLDER); 12780 12781 if (placeholder) { 12782 var value = currentTarget.val(); 12783 12784 if (event.type === STR_FOCUS) { 12785 if (value === placeholder) { 12786 currentTarget.val(STR_BLANK); 12787 12788 currentTarget.removeClass(CSS_PLACEHOLDER); 12789 } 12790 } 12791 else if (!value) { 12792 currentTarget.val(placeholder); 12793 12794 currentTarget.addClass(CSS_PLACEHOLDER); 12795 } 12796 } 12797 } 12798 } 12799 } 12800 } 12801 ); 12802 12803 Liferay.Form.Placeholders = Placeholders; 12804 12805 A.Base.plug(Liferay.Form, Placeholders); 12806 }, 12807 '', 12808 { 12809 requires: ['liferay-form', 'plugin'] 12810 } 12811); 12812AUI.add( 12813 'liferay-icon', 12814 function(A) { 12815 var _ICON_REGISTRY = {}; 12816 12817 var Icon = { 12818 register: function(config) { 12819 var instance = this; 12820 12821 var doc = A.one(A.config.doc); 12822 12823 _ICON_REGISTRY[config.id] = config; 12824 12825 if (!instance._docClickHandler) { 12826 instance._docClickHandler = doc.delegate('click', instance._handleDocClick, '.lfr-icon-item', instance); 12827 } 12828 12829 if (!instance._docHoverHandler) { 12830 instance._docHoverHandler = doc.delegate('hover', instance._handleDocMouseOver, instance._handleDocMouseOut, '.lfr-icon-item', instance); 12831 } 12832 12833 Liferay.once( 12834 'screenLoad', 12835 function() { 12836 delete _ICON_REGISTRY[config.id]; 12837 } 12838 ); 12839 }, 12840 12841 _forcePost: function(event) { 12842 var instance = this; 12843 12844 if (!Liferay.SPA || !Liferay.SPA.app) { 12845 Liferay.Util.forcePost(event.currentTarget); 12846 12847 event.preventDefault(); 12848 } 12849 }, 12850 12851 _getConfig: function(event) { 12852 var instance = this; 12853 12854 return _ICON_REGISTRY[event.currentTarget.attr('id')]; 12855 }, 12856 12857 _handleDocClick: function(event) { 12858 var instance = this; 12859 12860 var config = instance._getConfig(event); 12861 12862 if (config) { 12863 event.preventDefault(); 12864 12865 if (config.useDialog) { 12866 instance._useDialog(event); 12867 } 12868 else { 12869 instance._forcePost(event); 12870 } 12871 } 12872 }, 12873 12874 _handleDocMouseOut: function(event) { 12875 var instance = this; 12876 12877 var config = instance._getConfig(event); 12878 12879 if (config && config.srcHover) { 12880 instance._onMouseHover(event, config.src); 12881 } 12882 }, 12883 12884 _handleDocMouseOver: function(event) { 12885 var instance = this; 12886 12887 var config = instance._getConfig(event); 12888 12889 if (config && config.srcHover) { 12890 instance._onMouseHover(event, config.srcHover); 12891 } 12892 }, 12893 12894 _onMouseHover: function(event, src) { 12895 var instance = this; 12896 12897 var img = event.currentTarget.one('img'); 12898 12899 if (img) { 12900 img.attr('src', src); 12901 } 12902 }, 12903 12904 _useDialog: function(event) { 12905 Liferay.Util.openInDialog( 12906 event, 12907 { 12908 dialog: { 12909 destroyOnHide: true 12910 }, 12911 dialogIframe: { 12912 bodyCssClass: 'dialog-with-footer' 12913 } 12914 } 12915 ); 12916 } 12917 }; 12918 12919 Liferay.Icon = Icon; 12920 }, 12921 '', 12922 { 12923 requires: ['aui-base', 'liferay-util-window'] 12924 } 12925); 12926AUI.add( 12927 'liferay-menu', 12928 function(A) { 12929 var Util = Liferay.Util; 12930 12931 var ARIA_ATTR_ROLE = 'role'; 12932 12933 var ATTR_CLASS_NAME = 'className'; 12934 12935 var AUTO = 'auto'; 12936 12937 var CSS_BTN_PRIMARY = 'btn-primary'; 12938 12939 var CSS_EXTENDED = 'lfr-extended'; 12940 12941 var CSS_OPEN = 'open'; 12942 12943 var CSS_PORTLET = '.portlet'; 12944 12945 var DEFAULT_ALIGN_POINTS = ['tl', 'bl']; 12946 12947 var EVENT_CLICK = 'click'; 12948 12949 var PARENT_NODE = 'parentNode'; 12950 12951 var STR_BOTTOM = 'b'; 12952 12953 var STR_LEFT = 'l'; 12954 12955 var STR_LTR = 'ltr'; 12956 12957 var STR_RIGHT = 'r'; 12958 12959 var STR_RTL = 'rtl'; 12960 12961 var STR_TOP = 't'; 12962 12963 var MAP_ALIGN_HORIZONTAL_OVERLAY = { 12964 left: STR_RIGHT, 12965 right: STR_LEFT 12966 }; 12967 12968 var MAP_ALIGN_HORIZONTAL_OVERLAY_RTL = { 12969 left: STR_LEFT, 12970 right: STR_RIGHT 12971 }; 12972 12973 var MAP_ALIGN_HORIZONTAL_TRIGGER = { 12974 left: STR_LEFT, 12975 right: STR_RIGHT 12976 }; 12977 12978 var MAP_ALIGN_HORIZONTAL_TRIGGER_RTL = { 12979 left: STR_RIGHT, 12980 right: STR_LEFT 12981 }; 12982 12983 var MAP_ALIGN_VERTICAL_OVERLAY = { 12984 down: STR_TOP, 12985 up: STR_BOTTOM 12986 }; 12987 12988 var MAP_ALIGN_VERTICAL_TRIGGER = { 12989 down: STR_BOTTOM, 12990 up: STR_TOP 12991 }; 12992 12993 var MAP_LIVE_SEARCH = {}; 12994 12995 var REGEX_DIRECTION = /\bdirection-(down|left|right|up)\b/; 12996 12997 var REGEX_MAX_DISPLAY_ITEMS = /max-display-items-(\d+)/; 12998 12999 var SELECTOR_ANCHOR = 'a'; 13000 13001 var SELECTOR_LIST_ITEM = 'li'; 13002 13003 var SELECTOR_SEARCH_CONTAINER = '.lfr-menu-list-search-container'; 13004 13005 var TPL_MENU = '<div class="open" />'; 13006 13007 var Menu = function() { 13008 var instance = this; 13009 13010 instance._handles = []; 13011 13012 if (!Menu._INSTANCE) { 13013 Menu._INSTANCE = instance; 13014 } 13015 }; 13016 13017 Menu.prototype = { 13018 _closeActiveMenu: function() { 13019 var instance = this; 13020 13021 var menu = instance._activeMenu; 13022 13023 if (menu) { 13024 var handles = instance._handles; 13025 13026 A.Array.invoke(handles, 'detach'); 13027 13028 handles.length = 0; 13029
13030 var overlay = instance._overlay; 13031 13032 if (overlay) { 13033 overlay.hide(); 13034 } 13035 13036 var trigger = instance._activeTrigger; 13037 13038 instance._activeMenu = null; 13039 instance._activeTrigger = null; 13040 13041 if (trigger.hasClass(CSS_EXTENDED)) { 13042 trigger.removeClass(CSS_BTN_PRIMARY); 13043 } 13044 else { 13045 trigger.get(PARENT_NODE).removeClass(CSS_OPEN); 13046 13047 var portlet = trigger.ancestor(CSS_PORTLET); 13048 13049 if (portlet) { 13050 portlet.removeClass(CSS_OPEN); 13051 } 13052 } 13053 } 13054 }, 13055 13056 _getAlignPoints: A.cached( 13057 function(cssClass) { 13058 var instance = this; 13059 13060 var alignPoints = DEFAULT_ALIGN_POINTS; 13061 13062 var defaultOverlayHorizontalAlign = STR_RIGHT; 13063 13064 var defaultTriggerHorizontalAlign = STR_LEFT; 13065 13066 var mapAlignHorizontalOverlay = MAP_ALIGN_HORIZONTAL_OVERLAY; 13067 13068 var mapAlignHorizontalTrigger = MAP_ALIGN_HORIZONTAL_TRIGGER; 13069 13070 var langDir = Liferay.Language.direction[themeDisplay.getLanguageId()] || STR_LTR; 13071 13072 if (langDir === STR_RTL) { 13073 defaultOverlayHorizontalAlign = STR_LEFT; 13074 defaultTriggerHorizontalAlign = STR_RIGHT; 13075 13076 mapAlignHorizontalOverlay = MAP_ALIGN_HORIZONTAL_OVERLAY_RTL; 13077 mapAlignHorizontalTrigger = MAP_ALIGN_HORIZONTAL_TRIGGER_RTL; 13078 } 13079 13080 if (cssClass.indexOf(AUTO) === -1) { 13081 var directionMatch = cssClass.match(REGEX_DIRECTION); 13082 13083 var direction = directionMatch && directionMatch[1] || AUTO; 13084 13085 var overlayHorizontal = mapAlignHorizontalOverlay[direction] || defaultOverlayHorizontalAlign; 13086 var overlayVertical = MAP_ALIGN_VERTICAL_OVERLAY[direction] || STR_TOP; 13087 13088 var triggerHorizontal = mapAlignHorizontalTrigger[direction] || defaultTriggerHorizontalAlign; 13089 var triggerVertical = MAP_ALIGN_VERTICAL_TRIGGER[direction] || STR_TOP; 13090 13091 alignPoints = [overlayVertical + overlayHorizontal, triggerVertical + triggerHorizontal]; 13092 } 13093 13094 return alignPoints; 13095 } 13096 ), 13097 13098 _getMenu: function(trigger) { 13099 var instance = this; 13100 13101 var overlay = instance._overlay; 13102 13103 if (!overlay) { 13104 var MenuOverlay = A.Component.create( 13105 { 13106 AUGMENTS: [ 13107 A.WidgetCssClass, 13108 A.WidgetPosition, 13109 A.WidgetStdMod, 13110 A.WidgetModality, 13111 A.WidgetPositionAlign, 13112 A.WidgetPositionConstrain, 13113 A.WidgetStack 13114 ], 13115 13116 CSS_PREFIX: 'overlay', 13117 13118 EXTENDS: A.Widget, 13119 13120 NAME: 'overlay' 13121 } 13122 ); 13123 13124 overlay = new MenuOverlay( 13125 { 13126 align: { 13127 node: trigger, 13128 points: DEFAULT_ALIGN_POINTS 13129 }, 13130 constrain: true, 13131 hideClass: false, 13132 preventOverlap: true, 13133 zIndex: Liferay.zIndex.MENU 13134 } 13135 ).render(); 13136 13137 Liferay.once( 13138 'beforeScreenFlip', 13139 function() { 13140 overlay.destroy(); 13141 13142 instance._overlay = null; 13143 } 13144 ); 13145 13146 instance._overlay = overlay; 13147 } 13148 else { 13149 overlay.set('align.node', trigger); 13150 } 13151 13152 var listContainer = trigger.getData('menuListContainer'); 13153 var menu = trigger.getData('menu'); 13154 var menuHeight = trigger.getData('menuHeight'); 13155 13156 var liveSearch = menu && MAP_LIVE_SEARCH[menu.guid()]; 13157 13158 if (liveSearch) { 13159 liveSearch.reset(); 13160 } 13161 13162 var listItems; 13163 13164 if (!menu || !listContainer) { 13165 listContainer = trigger.next('ul'); 13166 13167 listItems = listContainer.all(SELECTOR_LIST_ITEM); 13168 13169 menu = A.Node.create(TPL_MENU); 13170 13171 listContainer.placeBefore(menu); 13172 13173 listItems.last().addClass('last'); 13174 13175 menu.append(listContainer); 13176 13177 trigger.setData('menuListContainer', listContainer); 13178 trigger.setData('menu', menu); 13179 13180 instance._setARIARoles(trigger, menu, listContainer); 13181 13182 if (trigger.hasClass('select')) { 13183 listContainer.delegate( 13184 'click', 13185 function(event) { 13186 var selectedListItem = event.currentTarget; 13187 13188 var selectedListItemIcon = selectedListItem.one('i'); 13189 13190 var triggerIcon = trigger.one('i'); 13191 13192 if (selectedListItemIcon && triggerIcon) { 13193 var selectedListItemIconClass = selectedListItemIcon.attr('class'); 13194 13195 triggerIcon.attr('class', selectedListItemIconClass); 13196 } 13197 13198 var selectedListItemMessage = selectedListItem.one('.lfr-icon-menu-text'); 13199 13200 var triggerMessage = trigger.one('.lfr-icon-menu-text'); 13201 13202 if (selectedListItemMessage && triggerMessage) { 13203 triggerMessage.setContent(selectedListItemMessage.text()); 13204 } 13205 }, 13206 SELECTOR_LIST_ITEM 13207 ); 13208 } 13209 } 13210 13211 overlay.setStdModContent(A.WidgetStdMod.BODY, menu); 13212 13213 if (!menuHeight) { 13214 menuHeight = instance._getMenuHeight(trigger, menu, listItems || listContainer.all
13214(SELECTOR_LIST_ITEM)); 13215 13216 trigger.setData('menuHeight', menuHeight); 13217 13218 if (menuHeight !== AUTO) { 13219 listContainer.setStyle('maxHeight', menuHeight); 13220 } 13221 } 13222 13223 instance._getFocusManager(); 13224 13225 return menu; 13226 }, 13227 13228 _getMenuHeight: function(trigger, menu, listItems) { 13229 var instance = this; 13230 13231 var cssClass = trigger.attr(ATTR_CLASS_NAME); 13232 13233 var height = AUTO; 13234 13235 if (cssClass.indexOf('lfr-menu-expanded') === -1) { 13236 var params = REGEX_MAX_DISPLAY_ITEMS.exec(cssClass); 13237 13238 var maxDisplayItems = params && parseInt(params[1], 10); 13239 13240 if (maxDisplayItems && listItems.size() > maxDisplayItems) { 13241 instance._getLiveSearch(trigger, trigger.getData('menu')); 13242 13243 height = 0; 13244 13245 var heights = listItems.slice(0, maxDisplayItems).get('offsetHeight'); 13246 13247 for (var i = heights.length - 1; i >= 0; i--) { 13248 height += heights[i]; 13249 } 13250 } 13251 } 13252 13253 return height; 13254 }, 13255 13256 _positionActiveMenu: function() { 13257 var instance = this; 13258 13259 var menu = instance._activeMenu; 13260 var trigger = instance._activeTrigger; 13261 13262 if (menu) { 13263 var cssClass = trigger.attr(ATTR_CLASS_NAME); 13264 13265 var overlay = instance._overlay; 13266 13267 var align = overlay.get('align'); 13268 13269 var listNode = menu.one('ul'); 13270 13271 var listNodeHeight = listNode.get('offsetHeight'); 13272 var listNodeWidth = listNode.get('offsetWidth'); 13273 13274 var modalMask = false; 13275 13276 align.points = instance._getAlignPoints(cssClass); 13277 13278 menu.addClass('lfr-icon-menu-open'); 13279 13280 if (Util.isPhone() || Util.isTablet()) { 13281 overlay.hide(); 13282 13283 modalMask = true; 13284 } 13285 13286 overlay.setAttrs( 13287 { 13288 align: align, 13289 centered: false, 13290 height: listNodeHeight, 13291 modal: modalMask, 13292 width: listNodeWidth 13293 } 13294 ); 13295 13296 if (!Util.isPhone() && !Util.isTablet()) { 13297 var focusManager = overlay.bodyNode.focusManager; 13298 13299 if (focusManager) { 13300 focusManager.focus(0); 13301 } 13302 } 13303 13304 overlay.show(); 13305 13306 if (cssClass.indexOf(CSS_EXTENDED) > -1) { 13307 trigger.addClass(CSS_BTN_PRIMARY); 13308 } 13309 else { 13310 trigger.get(PARENT_NODE).addClass(CSS_OPEN); 13311 13312 var portlet = trigger.ancestor(CSS_PORTLET); 13313 13314 if (portlet) { 13315 portlet.addClass(CSS_OPEN); 13316 } 13317 } 13318 } 13319 }, 13320 13321 _setARIARoles: function(trigger, menu, listContainer) { 13322 var links = menu.all(SELECTOR_ANCHOR); 13323 13324 var searchContainer = menu.one(SELECTOR_SEARCH_CONTAINER); 13325 13326 var listNode = menu.one('ul'); 13327 13328 var ariaLinksAttr = 'menuitem'; 13329 var ariaListNodeAttr = 'menu'; 13330 13331 if (searchContainer) { 13332 ariaListNodeAttr = 'listbox'; 13333 ariaListNodeAttr = 'option'; 13334 } 13335 13336 listNode.setAttribute(ARIA_ATTR_ROLE, ariaListNodeAttr); 13337 links.set(ARIA_ATTR_ROLE, ariaLinksAttr); 13338 13339 trigger.attr( 13340 { 13341 'aria-haspopup': true, 13342 role: 'button' 13343 } 13344 ); 13345 13346 listNode.setAttribute('aria-labelledby', trigger.guid()); 13347 } 13348 }; 13349 13350 Menu.handleFocus = function(id) { 13351 var node = A.one(id); 13352 13353 if (node) { 13354 node.delegate('mouseenter', A.rbind(Menu._targetLink, node, 'focus'), SELECTOR_LIST_ITEM); 13355 node.delegate('mouseleave', A.rbind(Menu._targetLink, node, 'blur'), SELECTOR_LIST_ITEM); 13356 } 13357 }; 13358 13359 var buffer = []; 13360 13361 Menu.register = function(id) { 13362 var menuNode = document.getElementById(id); 13363 13364 if (menuNode) { 13365 if (!Menu._INSTANCE) { 13366 new Menu(); 13367 } 13368 13369 buffer.push(menuNode); 13370 13371 Menu._registerTask(); 13372 } 13373 }; 13374 13375 Menu._registerTask = A.debounce( 13376 function() { 13377 if (buffer.length) { 13378 var nodes = A.all(buffer); 13379 13380 nodes.on(EVENT_CLICK, A.bind('_registerMenu', Menu)); 13381 13382 buffer.length = 0; 13383 } 13384 }, 13385 100 13386 ); 13387 13388 Menu._targetLink = function(event, action) { 13389 var anchor = event.currentTarget.one(SELECTOR_ANCHOR); 13390 13391 if (anchor) { 13392 anchor[action](); 13393 } 13394 }; 13395 13396 Liferay.provide( 13397 Menu, 13398 '_getFocusManager', 13399 function() { 13400 var menuInstance = Menu._INSTANCE; 13401 13402 var focusManager = menuInstance._focusManager; 13403 13404 if (!focusManager) { 13405 var bodyNode = menuInstance._overlay.bodyNode; 13406 13407 bodyNode.plug( 13408 A.Plugin.NodeFocusManager, 13409 { 13410 circular: true, 13411 descendants: 'li:not(.hide) a,input', 13412 focusClass: 'focus', 13413 keys: { 13414 next: 'down:40', 13415 previous: 'down:38' 13416 } 13417 } 13418 ); 13419 13420 bodyNode.on( 13421 'key', 13422 function(event) { 13423 var activeTrigger = menuInstance._activeTrigger; 13424 13425 if (activeTrigger) { 13426 menuInstance._closeActiveMenu(); 13427 13428 activeTrigger.focus(); 13429 } 13430 }, 13431 'down:27,9' 13432 ); 13433 13434 focusManager = bodyNode.focusManager; 13435 13436 bodyNode.delegate( 13437 'mouseenter', 13438 function(event) { 13439 if (focusManager.get('focused')) { 13440 focusManager.focus(event.currentTarget.one(SELECTOR_ANCHOR)); 13441 } 13442 }, 13443 SELECTOR_LIST_ITEM 13444 ); 13445 13446 focusManager.after( 13447 'activeDescendantChange', 13448 function(event) {
13449 var descendants = focusManager.get('descendants'); 13450 13451 var selectedItem = descendants.item(event.newVal); 13452 13453 if (selectedItem) { 13454 var overlayList = bodyNode.one('ul'); 13455 13456 if (overlayList) { 13457 overlayList.setAttribute('aria-activedescendant', selectedItem.guid()); 13458 } 13459 } 13460 } 13461 ); 13462 13463 menuInstance._focusManager = focusManager; 13464 } 13465 13466 focusManager.refresh(); 13467 }, 13468 ['node-focusmanager'], 13469 true 13470 ); 13471 13472 Liferay.provide( 13473 Menu, 13474 '_getLiveSearch', 13475 function(trigger, menu) { 13476 var instance = this; 13477 13478 var id = menu.guid(); 13479 13480 var liveSearch = MAP_LIVE_SEARCH[id]; 13481 13482 if (!liveSearch) { 13483 var listNode = menu.one('ul'); 13484 13485 var results = []; 13486 13487 listNode.all('li').each( 13488 function(node) { 13489 results.push( 13490 { 13491 name: node.one('.taglib-text-icon').text().trim(), 13492 node: node 13493 } 13494 ); 13495 } 13496 ); 13497 13498 liveSearch = new Liferay.MenuFilter( 13499 { 13500 content: listNode, 13501 minQueryLength: 0, 13502 queryDelay: 0, 13503 resultFilters: 'phraseMatch', 13504 resultTextLocator: 'name', 13505 source: results 13506 } 13507 ); 13508 13509 liveSearch.get('inputNode').swallowEvent('click'); 13510 13511 MAP_LIVE_SEARCH[id] = liveSearch; 13512 } 13513 }, 13514 ['liferay-menu-filter'], 13515 true 13516 ); 13517 13518 Liferay.provide( 13519 Menu, 13520 '_registerMenu', 13521 function(event) { 13522 var menuInstance = Menu._INSTANCE; 13523 13524 var handles = menuInstance._handles; 13525 13526 var trigger = event.currentTarget; 13527 13528 var activeTrigger = menuInstance._activeTrigger; 13529 13530 if (activeTrigger) { 13531 if (activeTrigger != trigger) { 13532 activeTrigger.removeClass(CSS_BTN_PRIMARY); 13533 13534 activeTrigger.get(PARENT_NODE).removeClass(CSS_OPEN); 13535 13536 var portlet = activeTrigger.ancestor(CSS_PORTLET); 13537 13538 if (portlet) { 13539 portlet.removeClass(CSS_OPEN); 13540 } 13541 } 13542 else { 13543 menuInstance._closeActiveMenu(); 13544 13545 return; 13546 } 13547 } 13548 13549 if (!trigger.hasClass('disabled')) { 13550 var menu = menuInstance._getMenu(trigger); 13551 13552 menuInstance._activeMenu = menu; 13553 menuInstance._activeTrigger = trigger; 13554 13555 if (!handles.length) { 13556 var listContainer = trigger.getData('menuListContainer'); 13557 13558 A.Event.defineOutside('touchend'); 13559 13560 handles.push( 13561 A.getWin().on('resize', A.debounce(menuInstance._positionActiveMenu, 200, menuInstance)), 13562 A.getDoc().on(EVENT_CLICK, menuInstance._closeActiveMenu, menuInstance), 13563 listContainer.on( 13564 'touchendoutside', 13565 function(event) { 13566 event.preventDefault(); 13567 13568 menuInstance._closeActiveMenu(); 13569 }, 13570 menuInstance 13571 ), 13572 Liferay.on( 13573 'dropdownShow', 13574 function(event) { 13575 if (event.src !== 'LiferayMenu') { 13576 menuInstance._closeActiveMenu(); 13577 } 13578 } 13579 ) 13580 ); 13581 13582 var DDM = A.DD && A.DD.DDM; 13583 13584 if (DDM) { 13585 handles.push(DDM.on('ddm:start', menuInstance._closeActiveMenu, menuInstance)); 13586 } 13587 } 13588 13589 menuInstance._positionActiveMenu(); 13590 13591 Liferay.fire( 13592 'dropdownShow', 13593 { 13594 src: 'LiferayMenu' 13595 } 13596 ); 13597 13598 event.halt(); 13599 } 13600 }, 13601 ['aui-widget-cssclass', 'event-outside', 'event-touch', 'widget', 'widget-modality', 'widget-position', 'widget-position-align', 'widget-position-constrain', 'widget-stack', 'widget-stdmod'] 13602 ); 13603 13604 Liferay.Menu = Menu; 13605 }, 13606 '', 13607 { 13608 requires: ['array-invoke', 'aui-debounce', 'aui-node', 'portal-available-languages'] 13609 } 13610); 13611AUI.add( 13612 'liferay-notice', 13613 function(A) { 13614 var ADOM = A.DOM; 13615 var ANode = A.Node; 13616 var Do = A.Do; 13617 var Lang = A.Lang; 13618 13619 var CSS_ALERTS = 'has-alerts'; 13620 13621 var STR_CLICK = 'click'; 13622 13623 var STR_EMPTY = ''; 13624 13625 var STR_HIDE = 'hide'; 13626 13627 var STR_PX = 'px'; 13628 13629 var STR_SHOW = 'show'; 13630 13631 /** 13632 * @deprecated 13633 * 13634 * OPTIONS 13635 * 13636 * Required 13637 * content {string}: The content of the toolbar. 13638 * 13639 * Optional 13640 * 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. 13641 * 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.
13642 * noticeClass {string}: A class to add to the notice toolbar. 13643 * 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. 13644 * toggleText {object}: The text to use for the "hide" and "show" button. Set to false to not have a hide button. 13645 * type {String}: One of 'warning' or 'notice'. If not set, default notice type will be 'notice' 13646 * 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. 13647 * 13648 * Callbacks 13649 * onClose {function}: Called when the toolbar is closed. 13650 */ 13651 13652 var Notice = function(options) { 13653 var instance = this; 13654 13655 options = options || {}; 13656 13657 instance._closeText = options.closeText; 13658 instance._node = options.node; 13659 instance._noticeType = options.type || 'notice'; 13660 instance._noticeClass = 'alert-notice'; 13661 instance._onClose = options.onClose; 13662 instance._useCloseButton = true; 13663 13664 if (options.useAnimation) { 13665 instance._noticeClass += ' popup-alert-notice'; 13666 13667 if (!Lang.isNumber(options.timeout)) { 13668 options.timeout = 5000; 13669 } 13670 } 13671 13672 instance._animationConfig = options.animationConfig || { 13673 duration: 2, 13674 easing: 'ease-out', 13675 top: '50px' 13676 }; 13677 13678 instance._useAnimation = options.useAnimation; 13679 13680 instance._timeout = options.timeout; 13681 13682 instance._body = A.getBody(); 13683 13684 instance._useToggleButton = false; 13685 instance._hideText = STR_EMPTY; 13686 instance._showText = STR_EMPTY; 13687 13688 if (options.toggleText !== false) { 13689 instance.toggleText = A.mix( 13690 options.toggleText, 13691 { 13692 hide: null, 13693 show: null 13694 } 13695 ); 13696 13697 instance._useToggleButton = true; 13698 } 13699 13700 if (instance._noticeType == 'warning') { 13701 instance._noticeClass = 'alert-danger popup-alert-warning'; 13702 } 13703 13704 if (options.noticeClass) { 13705 instance._noticeClass += ' ' + options.noticeClass; 13706 } 13707 13708 instance._content = options.content || STR_EMPTY; 13709 13710 instance._createHTML(); 13711 13712 return instance._notice; 13713 }; 13714 13715 Notice.prototype = { 13716 close: function() { 13717 var instance = this; 13718 13719 var notice = instance._notice; 13720 13721 notice.hide(); 13722 13723 instance._body.removeClass(CSS_ALERTS); 13724 13725 if (instance._onClose) { 13726 instance._onClose(); 13727 } 13728 }, 13729 13730 setClosing: function() { 13731 var instance = this; 13732 13733 var alerts = A.all('.popup-alert-notice, .popup-alert-warning'); 13734 13735 if (alerts.size()) { 13736 instance._useCloseButton = true; 13737 13738 if (!instance._body) { 13739 instance._body = A.getBody(); 13740 } 13741 13742 instance._body.addClass(CSS_ALERTS); 13743 13744 alerts.each(instance._addCloseButton, instance); 13745 } 13746 }, 13747 13748 _addCloseButton: function(notice) { 13749 var instance = this; 13750 13751 var closeButton; 13752 13753 if (instance._closeText !== false) { 13754 instance._closeText = instance._closeText || 'Cerrar'; 13755 } 13756 else { 13757 instance._useCloseButton = false; 13758 instance._closeText = STR_EMPTY; 13759 } 13760 13761 if (instance._useCloseButton) { 13762 var html = '<button class="btn btn-default submit popup-alert-close">' + 13763 instance._closeText + 13764 '</button>'; 13765 13766 closeButton = notice.append(html); 13767 } 13768 else { 13769 closeButton = notice.one('.close'); 13770 } 13771 13772 if (closeButton) { 13773 closeButton.on(STR_CLICK, instance.close, instance); 13774 } 13775 }, 13776 13777 _addToggleButton: function(notice) { 13778 var instance = this; 13779 13780 if (instance._useToggleButton) { 13781 instance._hideText = instance._toggleText.hide || 'Ocultar'; 13782 instance._showText = instance._toggleText.show || 'Mostrar'; 13783 13784 var toggleButton = ANode.create('<a class="toggle-button" href="javascript:;"><span>' + instance._hideText + '</span></a>'); 13785 var toggleSpan = toggleButton.one('span'); 13786 13787 var visible = 0; 13788 13789 var hideText = instance._hideText; 13790 var showText = instance._showText; 13791 13792 toggleButton.on( 13793 STR_CLICK, 13794 function(event) { 13795 var text = showText; 13796 13797 if (visible === 0) { 13798 text = hideText; 13799 13800 visible = 1; 13801 } 13802 else { 13803 visible = 0; 13804 } 13805
13806 notice.toggle(); 13807 toggleSpan.text(text); 13808 } 13809 ); 13810 13811 notice.append(toggleButton); 13812 } 13813 }, 13814 13815 _afterNoticeShow: function(event) { 13816 var instance = this; 13817 13818 instance._preventHide(); 13819 13820 var notice = instance._notice; 13821 13822 if (instance._useAnimation) { 13823 var animationConfig = instance._animationConfig; 13824 13825 var left = animationConfig.left; 13826 var top = animationConfig.top; 13827 13828 if (!left) { 13829 var noticeRegion = ADOM.region(ANode.getDOMNode(notice)); 13830 13831 left = (ADOM.winWidth() / 2) - (noticeRegion.width / 2); 13832 13833 top = -noticeRegion.height; 13834 13835 animationConfig.left = left + STR_PX; 13836 } 13837 13838 notice.setXY([left, top]); 13839 13840 notice.transition( 13841 instance._animationConfig, 13842 function() { 13843 instance._hideHandle = A.later(instance._timeout, notice, STR_HIDE); 13844 } 13845 ); 13846 } 13847 else if (instance._timeout > -1) { 13848 instance._hideHandle = A.later(instance._timeout, notice, STR_HIDE); 13849 } 13850 13851 Liferay.fire( 13852 'noticeShow', 13853 { 13854 notice: instance, 13855 useAnimation: instance._useAnimation 13856 } 13857 ); 13858 }, 13859 13860 _beforeNoticeHide: function(event) { 13861 var instance = this; 13862 13863 var returnVal; 13864 13865 if (instance._useAnimation) { 13866 var animationConfig = A.merge( 13867 instance._animationConfig, 13868 { 13869 top: -instance._notice.get('offsetHeight') + STR_PX 13870 } 13871 ); 13872 13873 instance._notice.transition( 13874 animationConfig, 13875 function() { 13876 instance._notice.toggle(false); 13877 } 13878 ); 13879 13880 returnVal = new Do.Halt(null); 13881 } 13882 13883 Liferay.fire( 13884 'noticeHide', 13885 { 13886 notice: instance, 13887 useAnimation: instance._useAnimation 13888 } 13889 ); 13890 13891 return returnVal; 13892 }, 13893 13894 _beforeNoticeShow: function(event) { 13895 var instance = this; 13896 13897 instance._notice.toggle(true); 13898 }, 13899 13900 _createHTML: function() { 13901 var instance = this; 13902 13903 var content = instance._content; 13904 var node = A.one(instance._node); 13905 13906 var notice = node || ANode.create('<div class="alert alert-warning" dynamic="true"></div>'); 13907 13908 if (content) { 13909 notice.html(content); 13910 } 13911 13912 instance._noticeClass.split(' ').forEach( 13913 function(item, index) { 13914 notice.addClass(item); 13915 } 13916 ); 13917 13918 instance._addCloseButton(notice); 13919 instance._addToggleButton(notice); 13920 13921 if (!node || (node && !node.inDoc())) { 13922 instance._body.prepend(notice); 13923 } 13924 13925 instance._body.addClass(CSS_ALERTS); 13926 13927 Do.before(instance._beforeNoticeHide, notice, STR_HIDE, instance); 13928 13929 Do.before(instance._beforeNoticeShow, notice, STR_SHOW, instance); 13930 13931 Do.after(instance._afterNoticeShow, notice, STR_SHOW, instance); 13932 13933 instance._notice = notice; 13934 }, 13935 13936 _preventHide: function() { 13937 var instance = this; 13938 13939 if (instance._hideHandle) { 13940 instance._hideHandle.cancel(); 13941 13942 instance._hideHandle = null; 13943 } 13944 } 13945 }; 13946 13947 Liferay.Notice = Notice; 13948 }, 13949 '', 13950 { 13951 requires: ['aui-base'] 13952 } 13953); 13954AUI.add( 13955 'liferay-poller', 13956 function(A) { 13957 var AObject = A.Object; 13958 13959 var _browserKey = Liferay.Util.randomInt(); 13960 var _enabled = false; 13961 var _encryptedUserId = null; 13962 var _supportsComet = false;
13963 13964 var _delayAccessCount = 0; 13965 var _delayIndex = 0; 13966 var _delays = [1, 2, 3, 4, 5, 7, 10]; 13967 13968 var _getEncryptedUserId = function() { 13969 return _encryptedUserId; 13970 }; 13971 13972 var _frozen = false; 13973 var _locked = false; 13974 13975 var _maxDelay = _delays.length - 1; 13976 13977 var _portletIdsMap = {}; 13978 13979 var _metaData = { 13980 browserKey: _browserKey, 13981 companyId: themeDisplay.getCompanyId(), 13982 portletIdsMap: _portletIdsMap, 13983 startPolling: true 13984 }; 13985 13986 var _customDelay = null; 13987 var _portlets = {}; 13988 var _requestDelay = _delays[0]; 13989 var _sendQueue = []; 13990 var _suspended = false; 13991 var _timerId = null; 13992 13993 var _url = themeDisplay.getPathContext() + '/poller'; 13994 13995 var _receiveChannel = _url + '/receive'; 13996 var _sendChannel = _url + '/send'; 13997 13998 var _closeCurlyBrace = '}'; 13999 var _openCurlyBrace = '{'; 14000 14001 var _escapedCloseCurlyBrace = '[$CLOSE_CURLY_BRACE$]'; 14002 var _escapedOpenCurlyBrace = '[$OPEN_CURLY_BRACE$]'; 14003 14004 var _cancelRequestTimer = function() { 14005 clearTimeout(_timerId); 14006 14007 _timerId = null; 14008 }; 14009 14010 var _createRequestTimer = function() { 14011 _cancelRequestTimer(); 14012 14013 if (_enabled) { 14014 if (Poller.isSupportsComet()) { 14015 _receive(); 14016 } 14017 else { 14018 _timerId = setTimeout(_receive, Poller.getDelay()); 14019 } 14020 } 14021 }; 14022 14023 var _freezeConnection = function() { 14024 _frozen = true; 14025 14026 _cancelRequestTimer(); 14027 }; 14028 14029 var _getReceiveUrl = function() { 14030 return _receiveChannel; 14031 }; 14032 14033 var _getSendUrl = function() { 14034 return _sendChannel; 14035 }; 14036 14037 var _processResponse = function(id, obj) { 14038 var response = JSON.parse(obj.responseText); 14039 var send = false; 14040 14041 if (Array.isArray(response)) { 14042 var meta = response.shift(); 14043 14044 for (var i = 0; i < response.length; i++) { 14045 var chunk = response[i].payload; 14046 14047 var chunkData = chunk.data; 14048 14049 var portletId = chunk.portletId; 14050 14051 var portlet = _portlets[portletId]; 14052 14053 if (portlet) { 14054 var currentPortletId = _portletIdsMap[portletId]; 14055 14056 if (chunkData && currentPortletId) { 14057 chunkData.initialRequest = portlet.initialRequest; 14058 } 14059 14060 portlet.listener.call(portlet.scope || Poller, chunkData, chunk.chunkId); 14061 14062 if (chunkData && chunkData.pollerHintHighConnectivity) { 14063 _requestDelay = _delays[0]; 14064 _delayIndex = 0; 14065 } 14066 14067 if (portlet.initialRequest && currentPortletId) { 14068 send = true; 14069 14070 portlet.initialRequest = false; 14071 } 14072 } 14073 } 14074 14075 if ('startPolling' in _metaData) { 14076 delete _metaData.startPolling; 14077 } 14078 14079 if (send) { 14080 _send(); 14081 } 14082 14083 if (!meta.suspendPolling) { 14084 _thawConnection(); 14085 } 14086 else { 14087 _freezeConnection(); 14088 } 14089 } 14090 }; 14091 14092 var _receive = function() { 14093 if (!_suspended && !_frozen) { 14094 _metaData.userId = _getEncryptedUserId(); 14095 _metaData.timestamp = (new Date()).getTime(); 14096 14097 AObject.each(_portlets, _updatePortletIdsMap); 14098 14099 var requestStr = JSON.stringify([_metaData]); 14100 14101 A.io( 14102 _getReceiveUrl(), 14103 { 14104 data: { 14105 pollerRequest: requestStr 14106 }, 14107 method: A.config.io.method, 14108 on: { 14109 success: _processResponse 14110 } 14111 } 14112 ); 14113 } 14114 }; 14115 14116 var _releaseLock = function() { 14117 _locked = false; 14118 }; 14119 14120 var _sendComplete = function() { 14121 _releaseLock(); 14122 _send(); 14123 }; 14124 14125 var _send = function() { 14126 if (_enabled && !_locked && _sendQueue.length && !_suspended && !_frozen) { 14127 _locked = true; 14128 14129 var data = _sendQueue.shift(); 14130 14131 _metaData.userId = _getEncryptedUserId(); 14132 _metaData.timestamp = (new Date()).getTime(); 14133 14134 AObject.each(_portlets, _updatePortletIdsMap); 14135 14136 var requestStr = JSON.stringify([_metaData].concat(data)); 14137 14138 A.io( 14139 _getSendUrl(), 14140 { 14141 data: { 14142 pollerRequest: requestStr 14143 }, 14144 method: A.config.io.method, 14145 on: { 14146 complete: _sendComplete 14147 } 14148 } 14149 ); 14150 } 14151 }; 14152 14153 var _thawConnection = function() { 14154 _frozen = false; 14155 14156 _createRequestTimer(); 14157 }; 14158 14159 var _updatePortletIdsMap = function(item, index) { 14160 _portletIdsMap[index] = item.initialRequest; 14161 }; 14162 14163 var Poller = { 14164 init: function(options) { 14165 var instance = this; 14166 14167 instance.setEncryptedUserId(options.encryptedUserId); 14168 instance.setSupportsComet(options.supportsComet); 14169 }, 14170 14171 addListener: function(key, listener, scope) { 14172 _portlets[key] = { 14173 initialRequest: true, 14174 listener: listener, 14175 scope: scope 14176 }; 14177 14178 if (!_enabled) { 14179 _enabled = true; 14180 14181 _receive(); 14182 } 14183 }, 14184 14185 cancelCustomDelay: function() { 14186 _customDelay = null; 14187 }, 14188 14189 getDelay: function() { 14190 if (_customDelay !== null) {
14191 _requestDelay = _customDelay; 14192 } 14193 else if (_delayIndex <= _maxDelay) { 14194 _requestDelay = _delays[_delayIndex]; 14195 _delayAccessCount++; 14196 14197 if (_delayAccessCount == 3) { 14198 _delayIndex++; 14199 _delayAccessCount = 0; 14200 } 14201 } 14202 14203 return _requestDelay * 1000; 14204 }, 14205 14206 getReceiveUrl: _getReceiveUrl, 14207 getSendUrl: _getSendUrl, 14208 14209 isSupportsComet: function() { 14210 return _supportsComet; 14211 }, 14212 14213 processResponse: _processResponse, 14214 14215 removeListener: function(key) { 14216 var instance = this; 14217 14218 if (key in _portlets) { 14219 delete _portlets[key]; 14220 } 14221 14222 if (AObject.keys(_portlets).length === 0) { 14223 _enabled = false; 14224 14225 _cancelRequestTimer(); 14226 } 14227 }, 14228 14229 resume: function() { 14230 _suspended = false; 14231 14232 _createRequestTimer(); 14233 }, 14234 14235 setCustomDelay: function(delay) { 14236 if (delay === null) { 14237 _customDelay = delay; 14238 } 14239 else { 14240 _customDelay = delay / 1000; 14241 } 14242 }, 14243 14244 setDelay: function(delay) { 14245 _requestDelay = delay / 1000; 14246 }, 14247 14248 setEncryptedUserId: function(encryptedUserId) { 14249 _encryptedUserId = encryptedUserId; 14250 }, 14251 14252 setSupportsComet: function(supportsComet) { 14253 _supportsComet = supportsComet; 14254 }, 14255 14256 setUrl: function(url) { 14257 _url = url; 14258 }, 14259 14260 submitRequest: function(key, data, chunkId) { 14261 if (!_frozen && key in _portlets) { 14262 for (var i in data) { 14263 if (data.hasOwnProperty(i)) { 14264 var content = data[i]; 14265 14266 if (content.replace) { 14267 content = content.replace(_openCurlyBrace, _escapedOpenCurlyBrace); 14268 content = content.replace(_closeCurlyBrace, _escapedCloseCurlyBrace); 14269 14270 data[i] = content; 14271 } 14272 } 14273 } 14274 14275 var requestData = { 14276 data: data, 14277 portletId: key 14278 }; 14279 14280 if (chunkId) { 14281 requestData.chunkId = chunkId; 14282 } 14283 14284 _sendQueue.push(requestData); 14285 14286 _send(); 14287 } 14288 }, 14289 14290 suspend: function() { 14291 _cancelRequestTimer(); 14292 14293 _suspended = true; 14294 }, 14295 14296 url: _url 14297 }; 14298 14299 A.getWin().on( 14300 'focus', 14301 function(event) { 14302 _metaData.startPolling = true; 14303 14304 _thawConnection(); 14305 } 14306 ); 14307 14308 Liferay.Poller = Poller; 14309 }, 14310 '', 14311 { 14312 requires: ['aui-base', 'io', 'json'] 14313 } 14314);
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.