1var transEnd = "transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd"; 2var animEnd = "webkitAnimationEnd oanimationend oAnimationEnd msAnimationnEnd animationend"; 3 4// store the hash (DON'T put this code inside the $() function, it has to be executed 5// right away before the browser can start scrolling! 6var target = window.location.hash, 7 target = target.replace('#', ''); 8 9// scroll to anchor on load 10setTimeout(function() { 11 scrollOnLoad(); 12},200); 13 14/** 15* Keyboard accessibility 16*/ 17function a11yClick(event){ 18 if(event.type === 'click'){ 19 return true; 20 } 21 else if(event.type === 'keypress'){ 22 var code = event.charCode || event.keyCode; 23 if((code === 32)|| (code === 13)){ 24 return true; 25 } 26 } 27 else{ 28 return false; 29 } 30} 31 32/** 33* Focus trap for modals and menu 34*/ 35function focusTrap(elem) { 36 37 var tabbable = elem.find('select, input, textarea, button, a, [role="button"]').filter(':visible'); 38 39 var firstTabbable = tabbable.first(); 40 var lastTabbable = tabbable.last(); 41 // set focus on first input 42 firstTabbable.focus(); 43 44 // redirect last tab to first input 45 lastTabbable.on('keydown', function (e) { 46 if ((e.which === 9 && !e.shiftKey)) { 47 e.preventDefault(); 48 firstTabbable.focus(); 49 } 50 }); 51 52 // redirect first shift+tab to last input 53 firstTabbable.on('keydown', function (e) { 54 if ((e.which === 9 && e.shiftKey)) { 55 e.preventDefault(); 56 lastTabbable.focus(); 57 } 58 }); 59 60 // allow escape key to close elem 61 elem.on('keyup', function(e){ 62 if (e.keyCode === 27 ) { 63 $('body').removeClass('menuOpen modalOpen cartOpen'); 64 }; 65 }); 66} 67 68/** 69 * Init BT tab hash update, smoothScroll to anchor and update URL on click 70 */ 71 72function scrollOnLoad() { 73 var newUrl; 74 var url = target.replace(/\/$/, ""); 75 76 // console.log('TARGET: '+target); 77 78 if (target.length) { 79 // console.log('WORKING: '+target); 80 // smooth scroll to the anchor id 81 setTimeout(function() { 82 window.scrollTo(0, 0); 83 $('html, body').animate({ 84 scrollTop: $("#" + url).offset().top - 77 85 }, 2000); 86 }, 1); 87 88 // change active tab if exists 89 newUrl = '#'+target.replace(/\/$/, ""); 90 $('a.nav-link[href="'+newUrl+'"]').tab("show"); 91 history.replaceState(null, null, newUrl); 92 // const hash = url.split("#"); 93 // console.log(newUrl); 94 } 95} 96 97/** 98 * Init BT tab hash update, smoothScroll to anchor and update URL on click 99 */ 100 101function scrollOnLoad() { 102 var newUrl; 103 var url = target.replace(/\/$/, ""); 104 105 // console.log('TARGET: '+target); 106 107 if (target.length) { 108 // console.log('WORKING: '+target); 109 // smooth scroll to the anchor id 110 setTimeout(function() { 111 window.scrollTo(0, 0); 112 $('html, body').animate({ 113 scrollTop: $("#" + url).offset().top - 77 114 }, 2000); 115 }, 1); 116 117 // change active tab if exists 118 newUrl = '#'+target.replace(/\/$/, ""); 119 // $('a.nav-link[href="'+newUrl+'"]').tab("show"); 120 history.replaceState(null, null, newUrl); 121 // const hash = url.split("#"); 122 // console.log(newUrl); 123 } 124} 125 126 127/** 128* Smooth Scroll to anchor 129*/ 130function smoothScroll(){ 131 // Add smooth scrolling to all links 132 $(".scrollLink a, .scrollTo").on('click', function(event) { 133 134 // Make sure this.hash has a value before overriding default behavior 135 if (this.hash !== "") { 136 // Prevent default anchor click behavior 137 // event.preventDefault(); 138 139 // Store hash 140 var hash = this.hash; 141 142 // Using jQuery's animate() method to add smooth page scroll 143 // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area 144 $('html, body').animate({ 145 scrollTop: $(hash).offset().top-150 146 }, 800, function(){ 147 148 // Add hash (#) to URL when done scrolling (default click behavior) 149 window.location.hash = hash; 150 }); 151 } // End if 152 }); 153} 154 155 156/** 157* Scroll reveal calls 158*/ 159function scrollReveal(){ 160 ScrollReveal().reveal('.post-item', { duration: 2000, interval: 100, opacity: 0}); 161 ScrollReveal().reveal('.post-list', { duration: 2000, interval: 100, opacity: 0}); 162 // ScrollReveal().reveal('.post-book-list', { duration: 2000, interval: 100, opacity: 0}); 163 // ScrollReveal().reveal('.preview-card', { duration: 2000, interval: 100, opacity: 0}); 164 ScrollReveal().reveal('.wp-block-media-text__media', { duration: 2000, interval: 100, distance: '25px', opacity: 0}); 165 ScrollReveal().reveal('.wp-block-getwid-images-slider', { duration: 2000, interval: 100, distance: '25px', opacity: 0}); 166 ScrollReveal().reveal('.wp-block-getwid-image-box', { duration: 2000, interval: 100, distance: '25px', opacity: 0}); 167 ScrollReveal().reveal('.single--image img', { duration: 2000, distance: '25px', scale: 1.1, opacity: 0}); 168 ScrollReveal().reveal('.img-mask img', { duration: 2000, distance: '25px', scale: 1.1, opacity: 0});
169 ScrollReveal().reveal('.post-list--thumbnail_mask img', { duration: 2000, distance: '25px', scale: 1.1, opacity: 0}); 170 ScrollReveal().reveal('.wp-block-image img', { duration: 2000, distance: '25px', scale: 1.1, opacity: 0}); 171 ScrollReveal().reveal('.wp-block-video', { duration: 2000, distance: '25px', scale: 1.1, opacity: 0}); 172 ScrollReveal().reveal('.wp-block-getwid-images-stack__media-wrapper img', { duration: 2000, distance: '25px', scale: 1.1, opacity: 0}); 173 // ScrollReveal().reveal('.book-cover img', { duration: 2000, scale: 1.1, interval: 100, opacity: 0}); 174 ScrollReveal().reveal('.banner-img img', { duration: 2000, scale: 1.1, opacity: 0}); 175 // ScrollReveal().reveal('.wp-block-cover__video-background', { duration: 2000, scale: 1.1, opacity: 0}); 176} 177 178/** 179* Smooth Scroll to anchor 180*/ 181// function smoothScroll(){ 182// // Add smooth scrolling to all links 183// $("a.icon--arrow").on('click', function(event) { 184 185// // Make sure this.hash has a value before overriding default behavior 186// if (this.hash !== "") { 187// // Prevent default anchor click behavior 188// // event.preventDefault(); 189 190// // Store hash 191// var hash = this.hash; 192 193// // Using jQuery's animate() method to add smooth page scroll 194// // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area 195// $('html, body').animate({ 196// scrollTop: $(hash).offset().top 197// }, 800, function(){ 198 199// // Add hash (#) to URL when done scrolling (default click behavior) 200// window.location.hash = hash; 201// }); 202// } // End if 203// }); 204// } 205 206 207 208function reInitJS(){ 209 /** 210 * Animate before page load 211 */ 212 $('a:not([download]):not([data-toggle="modal"]):not([target="_blank"]):not([href*="#"]):not([href*="tel"]):not([href*="mailto"]):not([id*="mmenu-toggle"]):not(.wp-block-getwid-video-popup__link)').on('click', function () { 213 event.preventDefault(); 214 var newUrl = $(this).attr('href'); 215 var container = $('#main'); 216 217 console.log(newUrl); 218 container.addClass('is-exiting'); 219 container.on(animEnd, 220 function() { 221 // Animation complete - move to new URL 222 window.location = newUrl; 223 }); 224 225 return false; 226 }); 227 228 229 $('.hrs-link').on('click', function () { 230 event.preventDefault(); 231 console.log(this); 232 $(this).parent().next('.hrs-text').slideToggle(); 233 }); 234 235 236 /** 237 * Sticky navs 238 */ 239 var $nav = $('header'); 240 var $win = $(window); 241 242 // Hide Header on on scroll down 243 var didScroll; 244 var lastScrollTop = 0; 245 var delta = 0; 246 var $nav = $('header'); 247 var navbarHeight = $nav.outerHeight()/2; 248 var $scrollyNav = $('.sticky-nav'); 249 // console.log($scrollyNav.parent().offset().top); 250 251 function checkScroll(){ 252 if ($(window).scrollTop() > 0) { 253 $nav.addClass("sticky"); 254 // $('.site_wide_notice').addClass('sticky'); 255 } else { 256 $nav.removeClass("sticky"); 257 // $('.site_wide_notice').removeClass('sticky'); 258 } 259 260 if ($('#marker').length && $(window).scrollTop() > $('#marker').offset().top) { 261 $scrollyNav.addClass("sticky"); 262 // console.log('past point'); 263 // $('.site_wide_notice').addClass('sticky'); 264 } else { 265 $scrollyNav.removeClass("sticky"); 266 // console.log($scrollyNav.parent().offset().top); 267 // $('.site_wide_notice').removeClass('sticky'); 268 } 269 } 270 271 checkScroll(); 272 $win.scroll(function(event){ 273 didScroll = true; 274 checkScroll(); 275 }); 276 277 setInterval(function() { 278 if (didScroll) { 279 hasScrolled(); 280 didScroll = false; 281 } 282 }, 250); 283 284 function hasScrolled() { 285 var st = $(this).scrollTop(); 286 287 // Make sure they scroll more than delta 288 if(Math.abs(lastScrollTop - st) <= delta) 289 return; 290 291 // If they scrolled down and are past the navbar, add class .nav-up. 292 // This is necessary so you never see what is "behind" the navbar. 293 if (st > lastScrollTop && st > navbarHeight){ 294 // Scroll Down 295 $('header').removeClass('nav-down').addClass('nav-up'); 296 } else { 297 // Scroll Up 298 if(st + $(window).height() < $(document).height()) { 299 $('header').removeClass('nav-up').addClass('nav-down'); 300 } 301 } 302 303 lastScrollTop = st; 304 } 305 306 /** 307 * Offcanvas menu open/close 308 */ 309 310 var $btnMenu = $('.menuToggle'); 311 var $menuWrapper = $('.offCanvas'); 312 313 // add sub menu button and hide sub-menu links from tabindex 314 $menuWrapper.find('.menu-item-has-children').each(function() { 315 var $subMenu = $(this), 316 $sectionTitle = $subMenu.find('> a').text(); 317 318 $subMenu.find('.sub-menu a').attr('tabindex', '-1'); 319 $subMenu.append('<span class="childMenuToggle" role="button" tabindex="-1"></span>'); 320 $('<li class="parentMenuToggle" role="button" tabindex="-1"><span></span>'+$sectionTitle+'</li>').prependTo($subMenu.children('.sub-menu')); 321 }); 322 323 // hide menu items from tabindex on document init 324 $menuWrapper.find('a, [role="button"]').attr('tabindex', '-1'); 325 326 // open/close menu and toggle tabindex 327 $btnMenu.on('click keypress', function(){ 328 $('body').toggleClass('menuOpen'); 329 $(this).attr('title', function (i, attr) {
330 return attr == 'Open Menu' ? 'Close Menu' : 'Open Menu' 331 }); 332 focusTrap($menuWrapper); 333 event.preventDefault(); 334 if($('body.menuOpen').length) { 335 $menuWrapper.find('> li > a, > li > [role="button"]').attr('tabindex', '0'); 336 $('#main, #cart-toggle').on("click keypress", function(event){ 337 var $notMenu = $(this); 338 if ($notMenu.has(event.target)) { 339 $("body").removeClass("menuOpen"); 340 $btnMenu.attr('title', function (i, attr) { 341 return attr == 'Open Menu' ? 'Close Menu' : 'Open Menu' 342 }); 343 $menuWrapper.find('a, [role="button"]').attr('tabindex', '-1'); 344 $menuWrapper.find('.sub-menu').removeClass('submenuOpen'); 345 } 346 }); 347 348 // allow escape key to close menu 349 $(document).keyup(function(e) { 350 if (e.key === "Escape") { 351 $('body').removeClass('menuOpen'); 352 $btnMenu.attr('title', function (i, attr) { 353 return attr == 'Open Menu' ? 'Close Menu' : 'Open Menu' 354 }); 355 $menuWrapper.find('a, [role="button"]').attr('tabindex', '-1'); 356 $menuWrapper.find('.sub-menu').removeClass('submenuOpen'); 357 } 358 }); 359 } else { 360 $menuWrapper.find('a, [role="button"]').attr('tabindex', '-1'); 361 $menuWrapper.find('.sub-menu').removeClass('submenuOpen'); 362 } 363 }); 364 365 // open sub menu on click/keypress 366 $('.childMenuToggle').on('click keypress', function(){ 367 var $subMenu = $(this); 368 369 $subMenu.prev('.sub-menu') 370 .addClass('submenuOpen') 371 .find('a, [role="button"]').attr('tabindex', '0'); 372 focusTrap($subMenu.prev('.sub-menu')); 373 }); 374 375 // close sub menu on click/keypress 376 $menuWrapper.find('.parentMenuToggle').on('click keypress', function(){ 377 $(this).closest('.sub-menu') 378 .removeClass('submenuOpen') 379 .find('a, [role="button"]').attr('tabindex', '-1'); 380 focusTrap($menuWrapper); 381 }); 382 383 384 /** 385 * Open/close filters tray 386 */ 387 $('#openFilters').click(function(e) { 388 e.preventDefault(); 389 var text = $(this).find('span'); 390 // $(this).find('span').toggleText('Filter', 'Close'); 391 $('#filter').addClass('filterTrayOpen'); 392 }); 393 $('#closeFilters').click(function(e) { 394 e.preventDefault(); 395 $('#filter').removeClass('filterTrayOpen'); 396 }); 397} 398 399 400(function($) { 401 $(function() { 402 reInitJS(); 403 smoothScroll(); 404 scrollReveal(); 405 // accordion('accordion'); 406 }); 407})(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.