1;(function ( $, window, document, undefined ) { 2 3 'use strict'; 4 5 $.fn.themifyDropdown = function( options ) { 6 7 var settings = $.extend( { }, options ); 8 9 return this.each(function(){ 10 if( $(this).hasClass( 'with-sub-arrow' ) ) 11 return; 12 13 $(this).addClass( 'with-sub-arrow' ) 14 .find( 'li.menu-item-has-children > a:not(.lightbox)' ) 15 .append( '<span class="sub-arrow closed" />' ); 16 }); 17 }; 18 19 $( 'body' ).on( 'click touchstart', '.sub-arrow', function(e){ 20 e.stopPropagation(); 21 22 var menu_item = $( this ).closest( 'li' ); 23 var active_tree = $( this ).parents( '.dropdown-open' ); 24 $( this ).closest( '.with-sub-arrow' ) // get the menu container 25 .find( 'li.dropdown-open' ).not( active_tree ) // find open (if any) dropdowns 26 .each(function(){ 27 close_dropdown( $( this ) ); 28 }); 29 30 if( menu_item.hasClass( 'dropdown-open' ) ) { 31 close_dropdown( menu_item ); 32 } else { 33 open_dropdown( menu_item ); 34 } 35 36 return false; 37 } ) 38 // clicking menu items where the URL is only "#" is the same as clicking the dropdown arrow 39 .on( 'click touchstart', '.with-sub-arrow a', function(e){ 40 if( $( this ).attr( 'href' ) == '#' ) { 41 e.stopPropagation(); 42 $( this ).find( '> .sub-arrow' ).click(); 43 return false; 44 } 45 } ); 46 47 function open_dropdown( $li ) { 48 var dropdown = $li.find( '.sub-menu' ).first() 49 .show().css( 'visibility', 'visible' ); 50 51 $li.addClass( 'dropdown-open' ); 52 $li.find( '> a .sub-arrow' ).removeClass( 'closed' ).addClass( 'open' ); 53 } 54 55 function close_dropdown( $li ) { 56 var dropdown = $li.find( '.sub-menu' ).first() 57 .hide().css( 'visibility', 'hidden' ); 58 59 $li.removeClass( 'dropdown-open' ); 60 $li.find( '> a .sub-arrow' ).removeClass( 'open' ).addClass( 'closed' ); 61 } 62})( jQuery, window, document );
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.