1/* Igloo Theme 3.1 */ 2var body = document.body; 3var IglooApp = function () { 4 /*====================================== 5 #Set browser class 6 ======================================*/ 7 try { 8 navigator.browserSpecs = (function () { 9 var ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; 10 if (/trident/i.test(M[1])) { 11 tem = /\brv[ :]+(\d+)/g.exec(ua) || []; 12 return { name: 'IE', version: (tem[1] || '') }; 13 } 14 if (M[1] === 'Chrome') { 15 tem = ua.match(/\b(OPR|Edge)\/(\d+)/); 16 if (tem != null) 17 return { name: tem[1].replace('OPR', 'Opera'), version: tem[2] }; 18 } 19 M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; 20 if ((tem = ua.match(/version\/(\d+)/i)) != null) 21 M.splice(1, 1, tem[1]); 22 return { name: M[0], version: M[1] }; 23 })(); 24 (function () { 25 var OSName = "os"; 26 if (navigator.appVersion.indexOf("Win") != -1) 27 OSName = "windows"; 28 else if (navigator.appVersion.indexOf("Mac") != -1) 29 OSName = "macos"; 30 else if (navigator.appVersion.indexOf("X11") != -1) 31 OSName = "unix"; 32 else if (navigator.appVersion.indexOf("Linux") != -1) 33 OSName = "linux"; 34 body.classList.add(OSName); 35 if ((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1) { 36 body.classList.add('browser-opera'); 37 } 38 else if (navigator.userAgent.indexOf("Chrome") != -1) { 39 body.classList.add('browser-chrome'); 40 } 41 else if (navigator.userAgent.indexOf("Safari") != -1) { 42 body.classList.add('browser-safari'); 43 } 44 else if (navigator.userAgent.indexOf("Firefox") != -1) { 45 body.classList.add('browser-firefox'); 46 } 47 else if ((navigator.userAgent.indexOf("MSIE") != -1) || (!!document.documentMode == true)) { 48 body.classList.add('browser-explorer'); 49 } 50 else if (navigator.userAgent.indexOf("Edge") != -1) { 51 body.classList.add('browser-edge'); 52 } 53 if (navigator.browserSpecs.version) { 54 body.classList.add('browser-version-' + navigator.browserSpecs.version); 55 } 56 var el = document.createElement('div'); 57 el.setAttribute('ongesturestart', 'return;'); 58 if (typeof el.ongesturestart == "function") { 59 body.classList.add("touch"); 60 } 61 else { 62 body.classList.add("no-touch"); 63 } 64 })(); 65 } 66 catch (err) { 67 console.error(err); 68 } 69 /*====================================== 70 #Set .scroll class on scroll 71 ======================================*/ 72 //Add the .scroll class to body when passing the io-hook placed over the header 73 var ioHook = document.querySelector(".io-hook"); 74 if (ioHook) { 75 var observer = new IntersectionObserver(function (entries) { 76 if (entries[0].boundingClientRect.y < 0) { 77 body.classList.add('scroll'); 78 } 79 else { 80 body.classList.remove('scroll'); 81 } 82 }); 83 observer.observe(ioHook); 84 } 85 /*====================================== 86 #Toggle mobile nav 87 ======================================*/ 88 (function () { 89 //Toggle mobile navigation 90 var hamburger = document.querySelector(".hamburger"); 91 if (hamburger) { 92 hamburger.addEventListener("click", function (e) { 93 e.preventDefault(); 94 body.classList.toggle("mobile-nav-visible"); 95 }); 96 } 97 // Toggle second level mobile navigation 98 var expand = document.querySelectorAll(".main-nav ul li a .expand");
99 expand.forEach(function (item) { 100 item.addEventListener("click", function (e) { 101 e.preventDefault(); 102 var ul = item.closest("li").querySelector("ul"); 103 item.classList.toggle("open"); 104 ul.classList.toggle("mobile-open"); 105 if (ul.style.display == 'block') { 106 ul.style.display = 'none'; 107 } 108 else { 109 ul.style.display = 'block'; 110 } 111 }); 112 }); 113 })(); 114 /*====================================== 115 #Adjust offscreen navigation 116 ======================================*/ 117 window.addEventListener('load', function () { 118 var navItems = document.querySelectorAll(".main-nav .main-nav__ul .main-nav__ul"); 119 var screenWidth = window.outerWidth; 120 navItems.forEach(function (item) { 121 var rightEdge = item.getBoundingClientRect().right; 122 // Change position of dropdown if it is positioned outside viewport 123 if (rightEdge > screenWidth) { 124 item.classList.add("go-right"); 125 } 126 }); 127 }); 128 /*====================================== 129 #Navigation touch support 130 ======================================*/ 131 (function () { 132 var items = document.querySelectorAll(".main-nav ul li .main-nav__a, .pre-top__list li a"); 133 var navAllLi = document.querySelectorAll(".main-nav__li, .pre-top__list li"); 134 items.forEach(function (item) { 135 item.addEventListener("focus", handler, { passive: true }); 136 item.addEventListener("touchstart", handler, { passive: true }); 137 }); 138 function handler(e) { 139 var navLi = e.target.parentElement; 140 var dropExist = navLi.querySelector("ul"); 141 if (!navLi.classList.contains('touch-open') && dropExist && !body.classList.contains("mobile-nav-visible")) { 142 e.preventDefault(); 143 var parentLis_1 = getParents(navLi, ".touch-open"); 144 navAllLi.forEach(function (liEl) { 145 if (parentLis_1[0] != liEl && parentLis_1[1] != liEl) { 146 liEl.classList.remove('touch-open'); 147 } 148 }); 149 navLi.classList.add('touch-open'); 150 } 151 else if (dropExist) { 152 navAllLi.forEach(function (liEl) { 153 liEl.classList.remove('touch-open'); 154 }); 155 } 156 } 157 })(); 158 /*====================================== 159 #Scroll to top 160 ======================================*/ 161 (function () { 162 var toTop = document.querySelector(".to-top"); 163 if (toTop) { 164 toTop.addEventListener("click", function (e) { 165 e.preventDefault(); 166 window.scrollTo({ 'behavior': 'smooth', 'left': 0, 'top': 0 }); 167 }); 168 } 169 })(); 170 /*====================================== 171 #Responsive video 172 ======================================*/ 173 fluidvids.init({ 174 //selector: ['iframe', 'object'], 175 selector: ['.makeFluid', 'object'], 176 players: ['www.youtube.com', 'player.vimeo.com'] 177 }); 178 /*====================================== 179 #Googlemap 180 ======================================*/ 181 (function () { 182 var maps = document.querySelectorAll(".map .map__canvas"); 183 maps.forEach(function (map) { 184 var mapCanvas = map, lat = map.dataset.lat, long = map.dataset.long, pin = map.dataset.pin, zoom = parseInt(map.dataset.zoom); 185 var mapOptions = { 186 center: new google.maps.LatLng(lat, long), 187 zoom: zoom, 188 scrollwheel: false 189 }; 190 var mapobj = new google.maps.Map(mapCanvas, mapOptions); 191 if (pin == "no") { 192 var marker = new google.maps.Marker({ 193 position: new google.maps.LatLng(lat, long), 194 map: mapobj 195 }); 196 } 197 else { 198 var image = { 199 url: pin, 200 scaledSize: new google.maps.Size(50, 50) 201 }; 202 var marker = new google.maps.Marker({ 203 position: new google.maps.LatLng(lat, long), 204 map: mapobj, 205 optimized: false, 206 icon: image 207 }); 208 } 209 }); 210 })(); 211 /*====================================== 212 #Instagram 213 ======================================*/ 214 (function () { 215 var instagramFeeds = document.querySelectorAll("#instafeed"); 216 instagramFeeds.forEach(function (instafeed) { 217 var count = instafeed.dataset.count, link = instafeed.dataset.link, icon = instafeed.dataset.icon, token = instafeed.dataset.token, username = instafeed.dataset.username, imagewidth = instafeed.dataset.imagewidth, template = "", linkstart = "", linkend = "", iconlink = ""; 218 if (link == "1") { 219 linkstart = '<a href="{{link}}" class="instagram-image-link" target="_blank">'; 220 linkend = '</a>'; 221 } 222 if (icon == "1") { 223 iconlink = '<a target="_blank" class="instagram-user-link" href="https://www.instagram.com/' + username + '"><i class="fa fa-instagram" aria-hidden="true"></a></i>'; 224 } 225 template = '<div class="col-' + imagewidth + '"><div class="gallery__item"><figure>' + iconlink + '' + linkstart + '<span class="bg" style="display:block;background-size:cover;background-position:center; padding-top: 100%; width: 100%; height: 100% ;background-image: url({{image}});" alt="{{caption}}"></span>' + linkend + '</figure></div></div>'; 226 // Get images 227 var feed = new Instafeed({ 228 accessToken: token, 229 limit: parseInt(count), 230 template: template 231 }); 232 feed.run(); 233 }); 234 })(); 235 /*====================================== 236 #PhotoSwipe gallery 237 ======================================*/ 238 (function () { 239 var gallery = document.querySelectorAll(".gallery, .pswp-gallery"); 240 var pswp = document.querySelector(".pswp");
241 gallery.forEach(function (pic) { 242 var getItems = function () { 243 var items = []; 244 var aItems = pic.querySelectorAll("a"); 245 aItems.forEach(function (aItem) { 246 var href = aItem.getAttribute("href"); 247 var size = aItem.getAttribute("data-size").split('x'); 248 var width = size[0]; 249 var height = size[1]; 250 var item = { 251 src: href, 252 w: width, 253 h: height 254 }; 255 items.push(item); 256 }); 257 return items; 258 }; 259 var items = getItems(); 260 var figures = pic.querySelectorAll("figure"); 261 figures.forEach(function (figure, index) { 262 figure.addEventListener("click", function (e) { 263 e.preventDefault(); 264 var options = { 265 index: index, 266 bgOpacity: 0.9, 267 showHideOpacity: true, 268 shareEl: false, 269 getThumbBoundsFn: function (index) { 270 var thumbnail = document.querySelectorAll('.gallery__item img')[index]; 271 var pageYScroll = window.pageYOffset || document.documentElement.scrollTop; 272 var rect = thumbnail.getBoundingClientRect(); 273 return { x: rect.left, y: rect.top + pageYScroll, w: rect.width }; 274 } 275 }; 276 // Initialize PhotoSwipe 277 var lightBox = new PhotoSwipe(pswp, PhotoSwipeUI_Default, items, options); 278 lightBox.init(); 279 }); 280 }); 281 }); 282 })(); 283 /*====================================== 284 #Accordion 285 ======================================*/ 286 (function () { 287 var accItems = document.querySelectorAll(".acc__head"); 288 accItems.forEach(function (acc) { 289 acc.addEventListener("click", function (e) { 290 e.preventDefault(); 291 acc.closest(".acc").classList.toggle("acc--open"); 292 }); 293 }); 294 })(); 295 /*====================================== 296 #Share modals 297 ======================================*/ 298 (function () { 299 var shareButtons = document.querySelectorAll(".share-list a[data-width]"); 300 shareButtons.forEach(function (item) { 301 item.addEventListener("click", function (e) { 302 if (window.outerWidth > 768) { 303 e.preventDefault(); 304 var targetUrl = item.getAttribute("href"); 305 var winWidth = item.dataset.width; 306 var winHeight = item.dataset.height; 307 PopupCenter(targetUrl, 'sharer', winWidth, winHeight); 308 } 309 }); 310 }); 311 function PopupCenter(url, title, w, h) { 312 var dualScreenLeft = window.screenLeft; 313 var dualScreenTop = window.screenTop; 314 var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; 315 var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; 316 var left = ((width / 2) - (w / 2)) + dualScreenLeft; 317 var top = ((height / 2) - (h / 2)) + dualScreenTop; 318 var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); 319 if (window.focus) { 320 newWindow.focus(); 321 } 322 } 323 })(); 324 /*====================================== 325 #Contact Form 326 ======================================*/ 327 (function () { 328 var contactForms = document.querySelectorAll("#contact-form");
329 contactForms.forEach(function (item) { 330 item.addEventListener("submit", function (e) { 331 e.preventDefault(); 332 var form = this; 333 if (form.checkValidity()) { 334 form.querySelector(".button").classList.add("button--loading"); 335 var formData = new FormData(form); 336 var url = form.getAttribute("action"); 337 var object = {}; 338 formData.forEach(function (value, key) { object[key] = value; }); 339 axios({ 340 url: url, 341 method: "POST", 342 data: object 343 }).then(function (response) { 344 if (response.data.Success) { 345 form.innerHTML = '<svg aria-hidden="true" class="checkmark-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52"><circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/><path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/></svg><h4 class="success-color text-center">' + form.dataset.thankyoumessage + '</h4>'; 346 } 347 else { 348 form.innerHTML = form.innerHTML + '<div class="col-100 text-center"><p><strong class="error-color">' + response.data.Message + '</strong></p></div>'; 349 } 350 })["catch"](function (error) { 351 console.log(error); 352 }); 353 } 354 }); 355 }); 356 })(); 357 /*====================================== 358 #Newsletter 359 ======================================*/ 360 (function () { 361 var newsletterForms = document.querySelectorAll(".newsletter form"); 362 newsletterForms.forEach(function (item) { 363 item.addEventListener("submit", function (e) { 364 e.preventDefault(); 365 var form = this; 366 if (form.checkValidity()) { 367 form.querySelector(".button").classList.add("button--loading"); 368 var formData = new FormData(form); 369 var url = form.getAttribute("action"); 370 var object = {}; 371 formData.forEach(function (value, key) { object[key] = value; }); 372 axios({ 373 url: url, 374 method: "POST", 375 contentType: "application/json; charset=utf-8", 376 dataType: "JSON", 377 data: object 378 }).then(function (response) { 379 if (response.data.Success) { 380 form.parentElement.innerHTML = '<svg aria-hidden="true" class="checkmark-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52"><circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/><path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/></svg><h4 class="success-color text-center">' + form.dataset.thankyoumessage + '</h4>'; 381 } 382 else { 383 form.parentElement.innerHTML = form.parentElement.innerHTML + '<div class="col-100 text-center"><p><strong class="error-color">' + response.data.Message + '</strong></p></div>'; 384 } 385 }); 386 } 387 }); 388 }); 389 })(); 390 /*====================================== 391 #Search Header 392 ======================================*/ 393 (function () { 394 var toggleSearchButtons = document.querySelectorAll(".toggle-search a, .show-search, .search__close, .search-overlay"); 395 var searchInput = document.querySelector(".search__stage .search__input"); 396 var autocomplete = document.querySelector(".search__autocomplete"); 397 var loader = document.querySelector(".search__loader"); 398 // Toogle search modal 399 toggleSearchButtons.forEach(function (toggleSearchButton) { 400 toggleSearchButton.addEventListener("click", function (e) { 401 e.preventDefault(); 402 body.classList.toggle("search-visible");
403 //Set focus to search field 404 if (body.classList.contains("search-visible")) { 405 setTimeout(function () { 406 searchInput.focus(); 407 }, 400); 408 } 409 }); 410 }); 411 // Close search model on ESC 412 document.addEventListener("keyup", function (e) { 413 if (e.keyCode == 27) { 414 body.classList.remove("search-visible"); 415 } 416 }); 417 // Autocomplete Header 418 var searchTimeout = null; 419 if (searchInput) { 420 searchInput.addEventListener("input", function (e) { 421 var query = searchInput.value; 422 // Show/hide search results 423 if (query.length > 2) { 424 autocomplete.style.display = "block"; 425 } 426 else { 427 autocomplete.style.display = "none"; 428 } 429 // Show loader 430 loader.classList.add("loading"); 431 if (searchTimeout != null) { 432 clearTimeout(searchTimeout); 433 } 434 // Do the search! 435 searchTimeout = setTimeout(function () { 436 doSearch(query); 437 }, 300); 438 }); 439 } 440 })(); 441 function doSearch(query) { 442 var searchTimeout = null; 443 var loader = document.querySelector(".search__loader"); 444 var noResults = document.querySelector(".search__no-results"); 445 var button = document.querySelector(".search__autocomplete .button"); 446 var suggest = document.querySelector(".search__suggest"); 447 var resultCount = document.querySelector(".search__result-count"); 448 axios({ 449 url: "/Umbraco/Api/IglooSearch/Search?Query=" + query + "&Amount=6&Page=1&SiteId=" + body.dataset.siteid + "&Culture=" + body.dataset.culture, 450 method: "GET" 451 }).then(function (response) { 452 // Clear suggest list 453 suggest.innerHTML = ""; 454 if (response.data.Result.length == 0) { 455 button.style.display = "none"; 456 suggest.style.display = "none"; 457 noResults.style.display = "block"; 458 } 459 else { 460 button.style.display = "block"; 461 suggest.style.display = "block"; 462 noResults.style.display = "none"; 463 for (var i = 0; i < response.data.Result.length; i++) { 464 suggest.innerHTML += '<li><a href="' + response.data.Result[i].Url + '"><span class="search__suggest-info"><span class="search__suggest-title">' + response.data.Result[i].Title + '</span><span class="search__suggest-desc">' + response.data.Result[i].Description + '</span></span></a></li>'; 465 } 466 } 467 // Hide loader 468 loader.classList.remove("loading"); 469 // Update result count 470 resultCount.innerHTML = ("(" + response.data.ResultCount + ")"); 471 })["catch"](function () { 472 loader.classList.remove("loading"); 473 }); 474 } 475 /*====================================== 476 #Full Search 477 ======================================*/ 478 (function () { 479 var searchInput = document.querySelector(".search-block .search__form .search__input"); 480 var pager = document.querySelector(".search-pagination-container button"); 481 if (searchInput) { 482 //Preform search on page load 483 doFullSearch(searchInput.value, 1); 484 //Preform search on input change 485 searchInput.addEventListener("input", function (e) { 486 doFullSearch(searchInput.value, 1); 487 document.querySelector(".query").innerHTML = '"' + searchInput.value + '"'; 488 }); 489 //pager 490 pager.addEventListener("click", function (e) { 491 pager.dataset.currentPage = (pager.dataset.currentPage ? parseInt(pager.dataset.currentPage) + 1 : 2).toString(); 492 doFullSearch(searchInput.value, parseInt(pager.dataset.currentPage)); 493 }); 494 } 495 })(); 496 function doFullSearch(query, page) { 497 var resultLabelSingle = document.querySelector(".search-results-count-label.single"); 498 var resultLabelMultible = document.querySelector(".search-results-count-label.multi"); 499 var resultLabelCount = document.querySelector(".search-results-count"); 500 var resultLabelQuery = document.querySelector(".search-result-info strong.query"); 501 var searchEmpty = document.querySelector(".search-empty"); 502 var pager = document.querySelector(".search-pagination-container"); 503 var amountPerPageElement = document.querySelector(".search-pagination-amount"); 504 var amountPerPage = parseInt(amountPerPageElement.value); 505 axios({ 506 url: "/Umbraco/Api/IglooSearch/Search?Query=" + query + "&Amount=" + amountPerPage + "&Page=" + page + "&SiteId=" + body.dataset.siteid + "&Culture=" + body.dataset.culture + "&ExtendedModel=true", 507 method: "GET" 508 }).then(function (response) { 509 if (response.data.ResultCount == 1) { 510 resultLabelSingle.style.display = 'inline-block'; 511 resultLabelMultible.style.display = 'none'; 512 } 513 else { 514 resultLabelMultible.style.display = 'inline-block'; 515 resultLabelSingle.style.display = 'none'; 516 } 517 resultLabelCount.textContent = '"' + query + '"'; 518 resultLabelCount.textContent = response.data.ResultCount; 519 // No results 520 if (response.data.ResultCount == 0) { 521 searchEmpty.style.display = 'block'; 522 document.querySelectorAll('.search-result, .search-result-container').forEach(function (e) { return e.remove(); }); 523 pager.style.display = 'none'; 524 } 525 else { 526 searchEmpty.style.display = 'none'; 527 if (page == 1) { 528 document.querySelectorAll('.search-result, .search-result-container').forEach(function (e) { return e.remove(); }); 529 } 530 var template = document.querySelector(".search-results template"); 531 for (var i = 0; i < response.data.Result.length; i++) { 532 var clone = template.content.cloneNode(true); 533 if (response.data.Result[i].ImageUrl && clone.querySelector("img")) { 534 clone.querySelector("img").setAttribute("data-src", response.data.Result[i].ImageUrl + "?anch
534or=center&mode=crop&width=500&height=350&rnd=132154250515800000"); 535 } 536 clone.querySelectorAll("a").forEach(function (e) { return e.setAttribute("href", response.data.Result[i].Url); }); 537 clone.querySelector("h3 a").textContent = response.data.Result[i].Title; 538 clone.querySelector("p").textContent = response.data.Result[i].Description; 539 template.parentElement.appendChild(clone); 540 } 541 if (document.querySelectorAll(".search-result, .search-result-container").length < response.data.ResultCount) { 542 pager.style.display = 'block'; 543 } 544 else { 545 pager.style.display = 'none'; 546 } 547 } 548 resultLabelCount.innerHTML = response.data.ResultCount; 549 })["catch"](function () { 550 }); 551 } 552 /*====================================== 553 #Cookie Consent 554 ======================================*/ 555 (function () { 556 var cookieConsent = document.querySelector(".cookie-consent"); 557 if (cookieConsent) { 558 var cookieConsentButton = cookieConsent.querySelector(".button"); 559 if (cookieConsentButton) { 560 // Add a cookie for 365days when clicking dismiss button 561 cookieConsentButton.addEventListener("click", function (e) { 562 e.preventDefault(); 563 cookieConsent.remove(); 564 setCookie("cookie-consent", "true", 365); 565 }); 566 } 567 // Show cookie modal if there is no cookie 568 if (getCookie("cookie-consent") == "") { 569 cookieConsent.classList.remove("hide--important"); 570 } 571 } 572 })(); 573 /*====================================== 574 #Tabs 575 ======================================*/ 576 (function () { 577 function setTab(hash, scroll) { 578 // Get the current tab nav that matches hash 579 var item = document.querySelector(".tabs__nav a[href='" + hash + "']"); 580 if (item) { 581 // Hit the road if current tab is already active 582 if (item.classList.contains("acitve")) { 583 return; 584 } 585 // Get widget scope 586 var widget_1 = item.closest(".tabs"); 587 // Remove active class from all nav items 588 var navs = item.closest("ul").querySelectorAll("a"); 589 navs.forEach(function (nav) { 590 nav.classList.remove("active"); 591 }); 592 // Set active class to selected nav item 593 item.classList.add("active"); 594 // Hide all tabs 595 var tabs = widget_1.querySelectorAll(".tab");
596 tabs.forEach(function (tab) { 597 tab.classList.remove("tab--active"); 598 }); 599 // Show selected tab 600 var target = item.getAttribute("href"); 601 var targetTab = widget_1.querySelector(target); 602 targetTab.classList.add("tab--active"); 603 //Scroll to widget 604 if (scroll) { 605 var header_1 = document.querySelector(".top"); 606 setTimeout(function () { 607 window.scrollTo({ 'behavior': 'smooth', 'left': 0, 'top': (widget_1.offsetTop - header_1.offsetHeight) }); 608 }, 100); 609 } 610 } 611 } 612 //Change tab on tab-nav click 613 var tabNavigationItems = document.querySelectorAll(".tabs__nav a"); 614 tabNavigationItems.forEach(function (item) { 615 item.addEventListener("click", function (e) { 616 e.preventDefault(); 617 history.pushState("", "", item.getAttribute("href")); 618 setTab(item.getAttribute("href"), false); 619 }); 620 }); 621 //Check if hash exist and contains "tab--" 622 if (window.location.hash && window.location.hash.indexOf("tab--") !== -1) { 623 //Set active tab and enable scroll 624 setTab(window.location.hash, true); 625 } 626 //Check onpopstate contains "tab--" 627 window.onpopstate = function (e) { 628 if (window.location.hash.indexOf("tab--") !== -1) { 629 setTab(window.location.hash, false); 630 } 631 }; 632 })(); 633 /*====================================== 634 #Scroll Animate Observer 635 ======================================*/ 636 var scrollSections = document.querySelectorAll('section, .grid:not(.grid--nav)'); 637 var scrollObserverSettings = { 638 threshold: 0, 639 rootMargin: '5% 0% -25% 0%' 640 }; 641 var scrollObserver = new IntersectionObserver(function (entries) { 642 entries.forEach(function (entry) { 643 if (entry.isIntersecting) { 644 entry.target.classList.add('in-view'); 645 setTimeout(function () { 646 entry.target.classList.remove("animate"); 647 scrollObserver.unobserve(entry.target); 648 }, 1500); 649 } 650 }); 651 }, scrollObserverSettings); 652 scrollSections.forEach(function (section) { 653 scrollObserver.observe(section); 654 }); 655 /*====================================== 656 #Navigation Toggle 657 ======================================*/ 658 (function () { 659 var navigationButtons = document.querySelectorAll(".navigation button"); 660 if (navigationButtons) { 661 navigationButtons.forEach(function (item) { 662 item.addEventListener("click", function (e) { 663 e.preventDefault(); 664 // Toggle open class to button and li 665 item.classList.toggle("open"); 666 item.closest("li").classList.toggle("open"); 667 // Toggle aria-expanded on button 668 if (item.classList.contains("open")) { 669 item.setAttribute("aria-expanded", "true"); 670 } 671 else { 672 item.setAttribute("aria-expanded", "false"); 673 } 674 }); 675 }); 676 } 677 var selectedNavigationItems = document.querySelectorAll(".navigation[data-expand='true'] .selected"); 678 selectedNavigationItems.forEach(function (item) { 679 var parentsLi = getParents(item, "li"); 680 parentsLi.forEach(function (li) { 681 // Expand all parents to selected item 682 li.classList.add("open"); 683 var btn = li.querySelector("button"); 684 if (btn) { 685 btn.classList.add("open"); 686 btn.setAttribute("aria-expanded", "true"); 687 } 688 }); 689 // Open child to selected item 690 item.classList.add("open"); 691 var btn = item.querySelector("button"); 692 if (btn) { 693 btn.classList.add("open"); 694 btn.setAttribute("aria-expanded", "true"); 695 } 696 }); 697 })(); 698 /*====================================== 699 #Page loaded 700 ======================================*/ 701 window.addEventListener('load', function () { 702 document.body.classList.remove("page-loading"); 703 document.body.classList.add("page-loaded"); 704 });
705 /*====================================== 706 #Helpers 707 ======================================*/ 708 //Creates cookie 709 function setCookie(cname, cvalue, exdays) { 710 var d = new Date(); 711 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 712 var expires = "expires=" + d.toUTCString(); 713 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 714 } 715 ; 716 //Returns cookie 717 function getCookie(cname) { 718 var name = cname + "="; 719 var decodedCookie = decodeURIComponent(document.cookie); 720 var ca = decodedCookie.split(';'); 721 for (var i = 0; i < ca.length; i++) { 722 var c = ca[i]; 723 while (c.charAt(0) == ' ') { 724 c = c.substring(1); 725 } 726 if (c.indexOf(name) == 0) { 727 return c.substring(name.length, c.length); 728 } 729 } 730 return ""; 731 } 732 ; 733 // Returns all matching parents to elm by selector 734 function getParents(elem, selector) { 735 // Element.matches() polyfill 736 if (!Element.prototype.matches) { 737 Element.prototype.matches = 738 Element.prototype.matchesSelector || 739 Element.prototype.mozMatchesSelector || 740 Element.prototype.msMatchesSelector || 741 Element.prototype.oMatchesSelector || 742 Element.prototype.webkitMatchesSelector || 743 function (s) { 744 var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length; 745 while (--i >= 0 && matches.item(i) !== this) { } 746 return i > -1; 747 }; 748 } 749 // Set up a parent array 750 var parents = []; 751 // Push each parent element to the array 752 for (; elem && elem !== document; elem = elem.parentNode) { 753 if (selector) { 754 if (elem.matches(selector)) { 755 parents.push(elem); 756 } 757 continue; 758 } 759 parents.push(elem); 760 } 761 // Return our parent array 762 return parents; 763 } 764 ; 765}; 766IglooApp();
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.