1/* eslint-disable no-undef */ 2(function ($) { 3 'use strict'; 4 // show body on click head 5 $(document).on('click', '.aab__accordion_head', function () { 6 const $this = $(this); 7 const $parent = $this.parent(); 8 const $icon = $this 9 .children('.aab__accordion_icon') 10 .children('.aab__icon'); 11 const $body = $parent.children('.aab__accordion_body'); 12 // icons 13 if ($icon.hasClass('dashicons-plus-alt2')) { 14 $icon.removeClass('dashicons-plus-alt2'); 15 $icon.addClass('dashicons-minus'); 16 } else if ($icon.hasClass('dashicons-minus')) { 17 $icon.removeClass('dashicons-minus'); 18 $icon.addClass('dashicons-plus-alt2'); 19 } else if ($icon.hasClass('dashicons-arrow-down-alt2')) { 20 $icon.removeClass('dashicons-arrow-down-alt2'); 21 $icon.addClass('dashicons-arrow-up-alt2'); 22 } else if ($icon.hasClass('dashicons-arrow-up-alt2')) { 23 $icon.removeClass('dashicons-arrow-up-alt2'); 24 $icon.addClass('dashicons-arrow-down-alt2'); 25 } else if ($icon.hasClass('dashicons-arrow-down')) { 26 $icon.removeClass('dashicons-arrow-down'); 27 $icon.addClass('dashicons-arrow-up'); 28 } else if ($icon.hasClass('dashicons-arrow-up')) { 29 $icon.removeClass('dashicons-arrow-up'); 30 $icon.addClass('dashicons-arrow-down'); 31 } else if ($icon.hasClass('dashicons-plus-alt')) { 32 $icon.removeClass('dashicons-plus-alt'); 33 $icon.addClass('dashicons-dismiss'); 34 } else if ($icon.hasClass('dashicons-dismiss')) { 35 $icon.removeClass('dashicons-dismiss'); 36 $icon.addClass('dashicons-plus-alt'); 37 } else if ($icon.hasClass('dashicons-insert')) { 38 $icon.removeClass('dashicons-insert'); 39 $icon.addClass('dashicons-remove'); 40 } else if ($icon.hasClass('dashicons-remove')) { 41 $icon.removeClass('dashicons-remove'); 42 $icon.addClass('dashicons-insert'); 43 } 44 // toggle body 45 $body.slideToggle(); 46 // adding active class 47 $($this).toggleClass('active'); 48 }); 49 50 $(document).on('keydown', '.wp-block-aab-accordion-block', function (e) { 51 if (e.target !== this) { 52 return; 53 } 54 if (e.key === 'Enter' || e.key === ' ') { 55 e.preventDefault(); 56 const $accordionHead = $(this).find('.aab__accordion_head'); 57 $accordionHead?.trigger('click'); 58 } 59 }); 60})(jQuery);
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.