1jQuery(function($) { 2 3 var total_menu_items = $('.uk-navbar-nav > li').length; //Get the count of the all menu items 4 var half_position_even=total_menu_items/2; //If the count is even, just directly divide by 2 5 var half_position_odd=(total_menu_items+1)/2; //If the count is odd, just adding 1 in order to make it to be an even, then divide by 2 6 var logo = $('a.tm-logo'); //LOGO HTML 7 8 /* Detect the count number is odd or even 9 If it's divided by 2 and the result is an integer, we will know it's an even, vice versa. 10 */ 11 var ex = /^\d+$/; 12 if (ex.test(total_menu_items/2)) { 13 //When the total number of the menu items is even 14 $('.uk-navbar-nav > li:nth-child('+half_position_even+')').after('<li class="uk-text-center" data-uk-dropdown>'+logo[0].outerHTML+'</li>'); 15 logo.parent().remove(); 16 17 }else{ 18 //When the total number of the menu items is odd 19 $('.uk-navbar-nav > li:nth-child('+half_position_odd+')').after('<li class="uk-text-center" data-uk-dropdown>'+logo[0].outerHTML+'</li>'); 20 logo.parent().remove(); 21 22 } 23}); 24
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.