1(function() { 2 3 "use strict"; 4 5 var app = { 6 7 init: function() { 8 9 app.menu(); 10 $(window).resize(app.debounce(app.menu)); 11 12 }, 13 14 menu: function() { 15 16 if($(window).width() >= 1200) { 17 18 var container = $(".main-mnu"), 19 list = container.find(".main-mnu-list"); 20 21 app.restore(list); 22 23 container.addClass('main-mnu-js-init'); 24 var listWidth = list.width(); 25 list.addClass('hide'); 26 var containerWidth = container.width(); 27 28 if (listWidth > containerWidth) { 29 30 var moreButton = list.find('.menu-item-more'); 31 if(!moreButton.length) { 32 var moreButton = $('<li class="menu-item menu-item-has-children menu-item-more"><div><i class="material-icons md-24">more_horiz</i></div><ul class="sub-menu"></ul></li>'); 33 } 34 35 while (listWidth > containerWidth) { 36 37 var itemLastChild = list.find(">li").last(); 38 moreButton.find('>ul').prepend(itemLastChild.clone()); 39 itemLastChild.remove(); 40 41 list.removeClass('hide'); 42 listWidth = list.width(); 43 list.addClass('hide'); 44 45 } 46 47 list.append(moreButton); 48 49 } 50 51 list.removeClass('hide'); 52 53 } 54 55 }, 56 57 restore: function(list) { 58 59 var menuItemMore = $('.menu-item-more'); 60 61 if( menuItemMore.length ) { 62 63 $.each(menuItemMore.find('>ul>li'), function() { 64 65 list.append($(this).clone()); 66 67 }); 68 69 menuItemMore.remove(); 70 71 } 72 73 }, 74 75 debounce: function(func) { 76 77 var timer; 78 79 return function(event) { 80 if(timer) clearTimeout(timer); 81 timer = setTimeout(func, 100, event); 82 }; 83 84 } 85 86 } 87 88 app.init(); 89 90}());
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.