1/** 2 * @file 3 */ 4 5(($, Drupal, drupalSettings) => { 6 Drupal.behaviors.views_accordion = { 7 attach() { 8 if (drupalSettings.views_accordion) { 9 $.each(drupalSettings.views_accordion, function processViews() { 10 const $display = $(`${this.display}:not(.ui-accordion)`); 11 12 /* The row count to be used if Row to display opened on start is set to random */ 13 let rowCount = 0; 14 15 /* Prepare our markup for jquery ui accordion */ 16 $(this.header, $display).each(function processHeader() { 17 // Wrap the accordion content within a div if necessary. 18 if (!this.usegroupheader) { 19 $(this).siblings().wrapAll('<div></div>'); 20 rowCount += 1; 21 } 22 }); 23 24 if (this.rowstartopen === 'random') { 25 this.rowstartopen = Math.floor(Math.random() * rowCount); 26 } 27 28 // The settings for the accordion. 29 const accordionSettings = { 30 header: this.header, 31 animate: { 32 easing: this.animated, 33 duration: parseInt(this.duration, 10), 34 }, 35 active: this.rowstartopen, 36 collapsible: this.collapsible, 37 heightStyle: this.heightStyle, 38 event: this.event, 39 icons: false, 40 }; 41 if (this.useHeaderIcons) { 42 accordionSettings.icons = { 43 header: this.iconHeader, 44 activeHeader: this.iconActiveHeader, 45 }; 46 } 47 48 /* jQuery UI accordion call */ 49 $display.accordion(accordionSettings); 50 }); 51 } 52 }, 53 }; 54})(jQuery, Drupal, drupalSettings);
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.