1(function ($) { 2 /* Inview */ 3 $.fn.isInViewport = function () { 4 var elementTop = $(this).offset().top; 5 var elementBottom = elementTop + $(this).outerHeight() / 1.1; 6 var viewportTop = $(window).scrollTop(); 7 var viewportHalf = viewportTop + $(window).height() / 1.1; 8 return elementBottom > viewportTop && elementTop < viewportHalf; 9 10 }; 11 /* //Inview */ 12 /* Divider animation */ 13 $(window).on('load resize scroll', function () { 14 $('.divider-animate').each(function () { 15 if ($(this).isInViewport()) { 16 $(this).addClass("is-active"); 17 } 18 }); 19 }); 20 /* Divider animation */ 21 22 /* Keyboard focus on CS */ 23 let usingKeyboard = false; 24 $(window).on('keydown', function (e) { 25 if (e.key === 'Tab' || e.keyCode === 9) { 26 usingKeyboard = true; 27 } 28 }); 29 $(window).on('mousedown', function () { 30 usingKeyboard = false; 31 }); 32 $('.case-list-wrap .case-category-list li a').on('focus', function () { 33 var csOffset = $('.case-list-wrap .case-category-list li a').offset().top; 34 var headerIn = $("header.header").height(); 35 if (usingKeyboard) { 36 $('html, body').stop().animate({ 37 scrollTop: csOffset - headerIn 38 }, 400); 39 } 40 }); 41 /* Keyboard focus on CS */ 42 $('a[target="_blank"]:not(.is-external)').each(function () { 43 $(this).prepend('<span class="sr-only"> click to open in a new window </span>'); 44 }); 45 46 $('.skip-to-content').click(function () { 47 $('html,body').animate({ 'scrollTop': -100 }, 1000); 48 }); 49 50 $(window).on('load resize scroll', function () { 51 $('body').addClass('is-page-loaded') 52 }); 53 54 55 56 /* -------------------------------------- 57 Footer 58 -------------------------------------- */ 59 $(window).on("load", function () { 60 var box = $(".header__top ul.List"); 61 var boxEl = box.get(0); 62 63 function updateArrowState() { 64 var scrollLeft = box.scrollLeft(); 65 var width = box.outerWidth(); 66 var scrollWidth = box.get(0).scrollWidth; 67 68 var $leftArrow = $(".header__top .arrow.left"); 69 var $rightArrow = $(".header__top .arrow.right"); 70 var SCROLL_EPSILON = 1; 71 72 if (scrollWidth - width <= SCROLL_EPSILON) { 73 $leftArrow.addClass("hide-arrow").removeClass("disabled"); 74 $rightArrow.addClass("hide-arrow").removeClass("disabled"); 75 } else { 76 $leftArrow.removeClass("hide-arrow"); 77 $rightArrow.removeClass("hide-arrow"); 78 79 $leftArrow.toggleClass("disabled", scrollLeft <= 0); 80 $rightArrow.toggleClass("disabled", scrollLeft + width >= scrollWidth - SCROLL_EPSILON); 81 } 82 } 83 84 $(".header__top .arrow").on("click", function () { 85 if ($(this).hasClass("disabled") || $(this).hasClass("hide-arrow")) return; 86 87 var scrollAmount = box.outerWidth() / 2; 88 var newScrollLeft; 89 90 if ($(this).hasClass("right")) { 91 newScrollLeft = box.scrollLeft() + scrollAmount; 92 } else { 93 newScrollLeft = box.scrollLeft() - scrollAmount; 94 } 95 96 boxEl.scrollTo({ 97 left: newScrollLeft, 98 behavior: "smooth" 99 }); 100 101 setTimeout(updateArrowState, 350); 102 }); 103 104 box.on("scroll", updateArrowState); 105 106 let resizeTimeout = null; 107 function handleResizeOrOrientation() { 108 clearTimeout(resizeTimeout); 109 resizeTimeout = setTimeout(() => { 110 updateArrowState(); 111 }, 300); 112 } 113 114 $(window).on("resize orientationchange", handleResizeOrOrientation); 115 116 setTimeout(updateArrowState, 100); 117 }); 118 119 120 121 /* -------------------------------------- 122 Footer 123 -------------------------------------- */ 124headerMain = $('.header').outerHeight(); 125 126 127 $('a[href^="#"]').off('click').on('click', function (e) { 128 e.preventDefault(); 129 130 var $target = $($(this).attr('href')); 131 132 if ($target.length) { 133 var headerMain = $('.header').outerHeight() || 0; 134 135 $('html, body').stop(true).animate({ 136 scrollTop: $target.offset().top - headerMain 137 }, 400); 138 139 history.replaceState(null, null, $(this).attr('href')); 140 } 141}); 142$(window).on('load', function () { 143 if (window.location.hash) { 144 var $target = $(window.location.hash); 145 146 if ($target.length) { 147 var headerMain = $('.header').outerHeight() || 0; 148 149 $(window).scrollTop($target.offset().top - headerMain); 150 } 151 } 152}); 153$(window).on('hashchange', function () { 154 if (window.location.hash) { 155 var $target = $(window.location.hash); 156 157 if ($target.length) { 158 var headerMain = $('.header').outerHeight() || 0; 159 160 $(window).scrollTop($target.offset().top - headerMain); 161 } 162 } 163}); 164}(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.