1(function () { 2 3 function animateSideNavigation(sideMenu) { 4 5 var menuItems = sideMenu.find("a"); 6 7 // Anchors corresponding to menu items 8 var scrollItems = menuItems.map(function () { 9 var item = jQuery(jQuery(this).attr("href")); 10 if (item.length) { 11 return item; 12 } 13 }); 14 15 16 var fromTop = jQuery(this).scrollTop() + window.innerHeight / 2; 17 var cur = scrollItems.map(function () { 18 if (jQuery(this).offset().top < fromTop) { 19 return this; 20 } 21 }); 22 23 cur = cur[cur.length - 1]; 24 var id = cur && cur.length ? cur[0].id : ""; 25 26 if (!sideMenu.is('.no-activation')) { 27 menuItems.parent().removeClass("active").end().filter("[href='#" + id + "']").parent().addClass("active"); 28 } 29 30 var showAfterScroll = sideMenu.find('ul').attr('data-after-scroll'); 31 var headerHeight = jQuery('.header-wrapper').outerHeight(); 32 33 var showSideNavFrom = jQuery(this).scrollTop() + window.innerHeight * 0.2; 34 35 if (showAfterScroll === 'true' && showSideNavFrom < headerHeight) { 36 sideMenu.css('right', '-220px'); 37 } else { 38 sideMenu.css('right', '0'); 39 40 if (!jQuery('.page-content div[data-export-id][data-bullets-visibility]').length) { 41 sideMenu.hide(); 42 } else { 43 sideMenu.show(); 44 } 45 46 } 47 48 } 49 50 window.highlight_makeSidebarNavigation = function () { 51 var $ = jQuery, 52 sections = $('.page-content div[data-export-id][data-bullets-visibility]'), 53 sideMenu = jQuery("#side-navigation"); 54 55 56 sections = sections.map(function (index, item) { 57 return { 58 "data-label": $(item).data('label'), 59 "data-id": $(item).attr('id'), 60 "data-visible": !!$(item).attr('data-bullets-visibility') 61 } 62 }); 63 64 if (sideMenu.length) { 65 sideMenu.find('li:not(.hero-bullet)').remove(); 66 sections.each(function (index, section) { 67 var listElement = $('<li data-ssid=' + section['data-id'] + '><a href="#' + section['data-id'] + '">' + section['data-label'] + '</a></li>'); 68 if (!section['data-visible']) { 69 listElement.addClass('hidden-bullet'); 70 } 71 sideMenu.find('ul').append(listElement); 72 }); 73 } 74 75 return sideMenu; 76 }; 77 78 79 window.mesmerizeDomReady(function () { 80 81 var $ = jQuery; 82 83 84 var sideMenu = window.highlight_makeSidebarNavigation(); 85 86 animateSideNavigation(sideMenu); 87 88 // Bind to scroll 89 jQuery(window).scroll(function () { 90 animateSideNavigation(sideMenu); 91 }); 92 // Bind to resize 93 jQuery(window).resize(function () { 94 animateSideNavigation(sideMenu); 95 }); 96 97 98 sideMenu.on('click tap', 'li, a', function (e) { 99 e.preventDefault(); 100 e.stopPropagation(); 101 102 sideMenu.addClass('no-activation'); 103 var target = "#", 104 link = $(this); 105 if (jQuery(this).is('li')) { 106 link = jQuery(this).find('a'); 107 target = link.attr('href'); 108 109 } else { 110 target = link.attr('href'); 111 } 112 113 link.closest('li').addClass('active').siblings().removeClass('active'); 114 115 jQuery([document.documentElement, document.body]).animate( 116 { 117 scrollTop: jQuery(target).offset().top 118 }, 119 500, 120 'swing', 121 function () { 122 sideMenu.removeClass('no-activation'); 123 link.closest('li').addClass('active'); 124 } 125 ); 126 127 return false; 128 }); 129 130 }); 131 132 133})();
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.