1(function ($) { 2 var // $ = require('jquery'), 3 // ResizeObserver = require('resize-observer-polyfill'), 4 mobileBreakpoint = 900, 5 $window = $(window), 6 $stickSidebar = $('.js-stick-sidebar'), 7 $sidebar = $stickSidebar.parent(), 8 $stickStopper = $('footer'), 9 $bodyheight = 166, 10 generalSidebarHeight, 11 stickTop, 12 stickOffset = 70, 13 stickStopperPosition, 14 stopPoint, 15 diff, 16 ro; 17 18 function initVars() { 19 generalSidebarHeight = $stickSidebar.outerHeight(); 20 stickTop = $stickSidebar.offset().top; 21 if($('.article-detail__content').length){ 22 $bodyheight = $('.article-detail__content').height(); 23 } else if ($('.field--name-field-landing-main').length) { 24 $bodyheight = $('.field--name-field-landing-main').height(); 25 } else if ($('.o-layout__main > .is-active').length) { 26 $bodyheight = $('.o-layout__main > .is-active').height(); 27 //$('.o-layout__main > .is-active').parent().css({ "border": "2px solid #f70404"}); 28 29 $('.o-layout__main > .is-active').parent().children('div[id^="block-"]').each(function(){ 30 $bodyheight += $(this).outerHeight(); 31 }); 32 } else if ($('.region.region-content').length) { 33 $bodyheight = $('.region.region-content').height(); 34 //$('.o-layout__main > .is-active').parent().css({ "border": "2px solid #f70404"}); 35 36 $('.o-layout__main').parent().children('div[id^="block-"]').each(function(){ 37 $bodyheight += $(this).outerHeight(); 38 }); 39 } 40 41 stickStopperPosition = $stickStopper.length ? $stickStopper.offset().top : Number.MAX_VALUE; 42 stopPoint = stickStopperPosition - generalSidebarHeight - (2 * stickOffset); 43 diff = stopPoint + stickOffset; 44 if ($window.width() < mobileBreakpoint) { 45 $stickSidebar.css({position: 'static', top: 'initial', width: 'auto'}); 46 } else { 47 $stickSidebar.css({width:'300px'}); 48 } 49 } 50 51 function initSidebar() { 52 $sidebar.css({ 'min-height': generalSidebarHeight }); 53 scrollHandler(); 54 } 55 56 function resizeHandler() { 57 if ($window.width() < mobileBreakpoint) { 58 $window.off('scroll'); 59 $stickSidebar.css({position: 'static', top: 'initial', width: 'auto'}); 60 } else { 61 $stickSidebar.css({width:'300px'}); 62 $window.on('scroll', scrollHandler); 63 } 64 } 65 66 function scrollHandler() { 67 var windowTop = $window.scrollTop(); 68 69 if (generalSidebarHeight > $bodyheight){ 70 $stickSidebar.css({ position: 'static', top: 'initial' }); 71 } else if (stopPoint < windowTop) { 72 $sidebar.css({position:'relative'}) 73 $stickSidebar.css({ position: 'absolute', top: 'auto', bottom: '0px'}); 74 } else if (stickTop < windowTop+stickOffset) { 75 $stickSidebar.css({ position: 'fixed', top: stickOffset, width:'300px' }); 76 } else { 77 $stickSidebar.css({ position: 'static', top: 'initial' }); 78 } 79 } 80 81 if ($stickSidebar.length) { 82 83 initVars(); 84 initSidebar(); 85 $window.on('scroll', scrollHandler); 86 $window.resize(resizeHandler); 87 $(document).on('switchTabs', initVars); 88 89 ro = new ResizeObserver(function(entries) { 90 initVars(); 91 }); 92 ro.observe(document.body); 93 } 94 95})(jQuery);
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.