1$(function () { 2 var $fnav = $('.fnav'); 3 var $fbtn = $('.floc-btn'); 4 var $fvlinks = $('.fnav .links'); 5 var $fhlinks = $('.fnav .hidden-links'); 6 7 var $flocmenu = $('.floc-btn, .floc-moremenu'); 8 9 var fnumOfItems = 0; 10 var ftotalSpace = 0; 11 var fbreakWidths = []; 12 13 // Get initial state 14 $fvlinks.children().outerWidth(function (i, w) { 15 ftotalSpace += w; 16 fnumOfItems += 1; 17 fbreakWidths.push(ftotalSpace); 18 }); 19 20 var favailableSpace, fnumOfVisibleItems, frequiredSpace; 21 22 function check() { 23 // Get instant state 24 favailableSpace = $fvlinks.width() - 10; 25 fnumOfVisibleItems = $fvlinks.children().length; 26 frequiredSpace = fbreakWidths[fnumOfVisibleItems - 1]; 27 28 // There is not enought space 29 if (frequiredSpace > favailableSpace) { 30 $fvlinks.children().last().prependTo($fhlinks); 31 fnumOfVisibleItems -= 1; 32 check(); 33 // There is more than enough space 34 } else if (favailableSpace > fbreakWidths[fnumOfVisibleItems]) { 35 $fhlinks.children().first().appendTo($fvlinks); 36 fnumOfVisibleItems += 1; 37 } 38 // Update the button accordingly 39 $fbtn.attr("count", fnumOfItems - fnumOfVisibleItems); 40 if (fnumOfVisibleItems === fnumOfItems) { 41 $fbtn.addClass('hidden'); 42 } else $fbtn.removeClass('hidden'); 43 } 44 45 // Window listeners 46 $(window).resize(function () { 47 check(); 48 }); 49 50 $fbtn.on('click', function () { 51 $fhlinks.toggleClass('hidden'); 52 }); 53 54 check(); 55}); 56 57//Close more locations menu on click outside 58$(document).mouseup(function (e) { 59 var fcontainer = $(".fnav-btn-panel"); 60 if ($(".floc-moremenu").not("hidden")) { 61 if (!fcontainer.is(e.target) 62 && fcontainer.has(e.target).length === 0) { 63 $(".floc-moremenu").addClass("hidden"); 64 }; 65 }; 66}); 67
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.