1var Ddl_Menu_Cell_Front_End = Ddl_Menu_Cell_Front_End || {}; 2 3Ddl_Menu_Cell_Front_End.Main = function(){ 4 var self = this; 5 6 self.init = function(){ 7 self.fix_link_behaviour(); 8 self.add_class_open(); 9 self.fix_wpml_link(); 10 }; 11 12 self.fix_link_behaviour = function(){ 13 jQuery( ".ddl-dropdown-submenu-layouts" ).on('click', function(event) { 14 var $this = jQuery(this); 15 16 if( jQuery( this ).parent().find(".ddl-dropdown-submenu-layouts").hasClass('open') ) { 17 jQuery( this ).parent().find(".ddl-dropdown-submenu-layouts").removeClass('open'); 18 jQuery( this ).find(".ddl-dropdown-submenu-layouts").removeClass('open'); 19 } else { 20 jQuery( this ).parent().find(".ddl-dropdown-submenu-layouts").removeClass('open'); 21 jQuery( this ).find(".ddl-dropdown-submenu-layouts").removeClass('open'); 22 if ( jQuery(window).width() > 768 ){ 23 var current_offset = $this.offset(); 24 var left_offset = $this.width(); 25 if ( ($this.offset().left+$this.find("ul").width()+120) > jQuery(window).width() ){ 26 left_offset = '-'+$this.find("ul").width(); 27 } 28 $this.find("ul").css({ 'left':left_offset+'px', top:($this.height()/4)+'px'}); 29 } 30 31 event.stopPropagation(); 32 jQuery( this ).find(".ddl-dropdown-submenu-layouts").removeClass('open'); 33 jQuery( this ).parents(".ddl-dropdown-submenu-layouts").addClass('open'); 34 jQuery( this ).toggleClass('open'); 35 } 36 37 return jQuery(event.target).closest('li').find('ul').length === 0; 38 }); 39 }; 40 41 self.add_class_open = function(){ 42 jQuery( ".ddl-dropdown" ).click(function(event) { 43 jQuery( this ).find(".ddl-dropdown-submenu-layouts").removeClass('open'); 44 }); 45 }; 46 47 self.fix_wpml_link = function(){ 48 var $wpml_menu = jQuery('.ddl-nav-wrap').find('.menu-item-language-current').eq(0), 49 open = false; 50 51 if( $wpml_menu.length === 0 ) return; 52 53 jQuery('.ddl-nav-wrap .menu-item-language').show(); 54 55 var $a = $wpml_menu.find('a').eq(0), $ul = $wpml_menu.find('ul').eq(0); 56 57 if( $a.length ) { 58 $wpml_menu.addClass('menu-item-has-children ddl-dropdown'); 59 jQuery.data( $a[0], 'toggle', 'dropdown' ); 60 jQuery.data( $a[0], 'target', '#' ); 61 jQuery.data( $a[0], 'open', false ); 62 var caret = jQuery('<b class="caret"></b>'); 63 $a.append(caret); 64 caret.css('margin-left', '4px'); 65 $a.removeAttr('onclick'); 66 $a.addClass('ddl-dropdown-toggle'); 67 $ul.addClass('ddl-dropdown-menu'); 68 $a.on('click', function(event){ 69 if( $a.data('open') == false ){ 70 jQuery.data( this, 'open', true ); 71 $ul.show(); 72 } else { 73 jQuery.data( this, 'open', false ); 74 $ul.hide(); 75 } 76 }); 77 78 jQuery(document).on('click', function(event){ 79 if( 80 event.target === $a[0] || 81 event.target === $wpml_menu[0] 82 ){ 83 return false; 84 } else{ 85 $ul.hide(); 86 jQuery.data( $a[0], 'open', false ); 87 } 88 }); 89 } 90 }; 91 92 93 self.init(); 94}; 95 96 97jQuery(function(){ 98 Ddl_Menu_Cell_Front_End.main = new Ddl_Menu_Cell_Front_End.Main(); 99});
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.