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