1( function( $ ) { 2 "use strict"; 3 4 function get_height( $el ) { 5 var height; 6 height = $el.outerHeight(); 7 8 if ( height > 0 ) { 9 height += "px"; 10 return height; 11 } 12 13 return 0; 14 } 15 function is_hidden( $el ) { 16 var height = $el.outerHeight(); 17 if ( 0 == height ) 18 return true; 19 20 return false; 21 } 22 23 $(document).ready(function(){ 24 $('.wc-shortcodes-accordion').each( function() { 25 var $accordion = $(this); 26 var $trigger = $accordion.find('.wc-shortcodes-accordion-trigger'); 27 var $content = $accordion.find('.wc-shortcodes-accordion-content-wrapper'); 28 29 var startState = $accordion.data('startState'); 30 var behavior = $accordion.data('behavior'); 31 32 if ( 'collapse' == startState ) { 33 // nothing, leave hidden 34 } 35 else { 36 $trigger.first().addClass('wc-shortcodes-accordion-header-active'); 37 $content.first().css('height','auto'); 38 } 39 40 $trigger.click(function( event ){ 41 event.preventDefault(); 42 43 var $this = $(this); 44 var $next = $this.next(); 45 var height = 0; 46 47 if ( 'autoclose' == behavior ) { 48 $trigger.removeClass('wc-shortcodes-accordion-header-active'); 49 50 if ( is_hidden( $next ) ) { 51 $this.addClass('wc-shortcodes-accordion-header-active'); 52 height = get_height( $next.children() ); 53 $next.animate({height:height},'fast','linear',function() {$(this).css('height','auto')}); 54 $content.not($next).animate({height:0},'fast','linear'); 55 } 56 else { 57 $next.animate({height:0},'fast','linear'); 58 } 59 60 } 61 else { 62 if ( is_hidden( $next ) ) { 63 $this.addClass('wc-shortcodes-accordion-header-active'); 64 height = get_height( $next.children() ); 65 $next.animate({height:height},'fast','linear',function() {$(this).css('height','auto')}); 66 } 67 else { 68 $this.removeClass('wc-shortcodes-accordion-header-active'); 69 $next.animate({height:0},'fast','linear'); 70 } 71 } 72 73 return false; 74 }); 75 }); 76 }); 77} )( 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.