1var $ = jQuery.noConflict(); 2/********************* 3ANONYMOUS FUNCTIONS 4*********************/ 5$(window).bind("load", function() { 6 console.log("JMJ"); 7 popUps(".pop-up-link"); 8 openInNewTabs(); 9 mobileMenu(); 10 GSAPanimations(); 11 lb_tabs(".tab-nav .tab-nav-inner .nav-item"); 12 tabsWithHash( 13 ".page-id-36 .tab-nav-inner .nav-item", 14 ".page-id-36 .tabs .tab-body" 15 ); 16 // userSliderHome(".home .authors-wrapper"); 17 userSliderHomeNew('[data-homepage-voices-slider]'); 18 photoGallery(".image-gallery a"); 19 accessibility(); 20 stickyMenu(); 21 youtubeAPI("article.video"); 22 youtubeAPI(".special-books .video"); 23 youtubeAPI(".special-event-full .video"); 24 if ($("body").hasClass("home")) { 25 videoPopUps(); 26 } 27 if ($("body").hasClass("page-id-75929")) { 28 $('body').addClass('special-event-full'); 29 } 30 31 // Add class to body tag for special events templates 32 specialEventsClassAdd(); 33 34 // getYTAPI(); 35 $("#lightgallery").lightGallery(); 36 37 copyToClipboard(); 38}); 39window.almComplete = function(alm) { 40 youtubeAPI("article.video"); 41 videoPopUps(); 42}; 43 44/********************* 45DECLARED FUNCTIONS 46*********************/ 47 48function getYTAPI() { 49 var youtubeAPIReady = false; 50 var tag = document.createElement("script"); 51 tag.src = "https://www.youtube.com/iframe_api"; 52 var firstScriptTag = document.getElementsByTagName("script")[0]; 53 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 54 55 function onYouTubeIframeAPIReady() { 56 youtubeAPIReady = true; 57 } 58 return youtubeAPIReady; 59} 60 61function initYT(playerFrame, videoId) { 62 function onPlayerStateChange(event) { 63 if (event.data == YT.PlayerState.ENDED) { 64 playerWrap.classList.add("ended"); 65 player.seekTo(0); 66 } else if (event.data == YT.PlayerState.PAUSED) { 67 playerWrap.classList.add("paused"); 68 } else if (event.data == YT.PlayerState.PLAYING) { 69 playerWrap.classList.remove("ended"); 70 playerWrap.classList.remove("paused"); 71 } 72 } 73 74 function onPlayerReady(event) { 75 event.target.playVideo(); 76 } 77 var player; 78 player = new YT.Player(playerFrame, { 79 height: "390", 80 width: "640", 81 videoId: "M7lc1UVf-VE", 82 events: { 83 onReady: onPlayerReady, 84 onStateChange: onPlayerStateChange 85 } 86 }); 87} 88function videoPopUps() { 89 if (!$("#video-pop-up").length) { 90 $("body").append( 91 '<div id="video-pop-up" class="lity-hide"><div class="video-pop-up-inner"><div class="video"><div class="video-inner"><iframe src="" frameborder="0"></iframe></div></div><div class="info"><h3 class="title">Title</h3><h6 class="extras"><span class="date">Date</span><span class="time">Time</span></h6><div class="description">Excerpt</div></div></div></div>' 92 ); 93 } 94 if ($("article.video").length) { 95 $(document).on("lity:open", function(e, instance) { 96 e.stopPropagation(); 97 var opener = instance.opener(); 98 var xhttp = new XMLHttpRequest(); 99 var videoID = $(opener).attr("data-video-post-id"); 100 var videoDate = $(opener) 101 .find(".extra .date") 102 .text(); 103 var videoDuration = $(opener) 104 .find(".extra .read-time") 105 .text(); 106 var websiteRoot = window.location.origin; 107 xhttp.open( 108 "GET", 109 websiteRoot + "/wp-json/wp/v2/photos_videos/" + videoID, 110 true 111 ); 112 xhttp.send(); 113 xhttp.onreadystatechange = function(e) { 114 e.stopPropagation(); 115 if (this.readyState == 4 && this.status == 200) { 116 var json = JSON.parse(this.responseText); 117 videoTitle = json.title["rendered"]; 118 youtubeID = json.acf["video_id"]; 119 acfDescription = json.acf["video_description"]; 120 var videoArray = [ 121 videoID, 122 youtubeID, 123 videoDate, 124 videoDuration, 125 videoTitle, 126 acfDescription 127 ]; 128 var videoObj = {}; 129 130 function objConstructor() { 131 for (var i = videoArray.length - 1; i >= 0; i--) { 132 if (videoArray[i]) { 133 var num = "prop_" + String(i); 134 videoObj[num] = videoArray[i]; 135 } 136 } 137 return videoObj; 138 } 139 140 function populateVideo() { 141 objConstructor(); 142 // initYT("#video-pop-up .video-inner", videoObj["prop_1"]); 143 $("#video-pop-up iframe").attr( 144 "src", 145 "https://www.youtube.com/embed/" + 146 videoObj["prop_1"] + 147 "?autoplay=1" 148 ); 149 $("#video-pop-up .title").text(videoObj["prop_4"]); 150 $("#video-pop-up .extras .date").text(videoObj["prop_2"]); 151 $("#video-pop-up .extras .time").text(videoObj["prop_3"]); 152 if (videoObj["prop_5"]) { 153 $("#video-pop-up .description").html(videoObj["prop_5"]); 154 } else { 155 $("#video-pop-up .description").html(""); 156 } 157 $("#video-pop-up .video-pop-up-inner").addClass("loaded"); 158 } 159 populateVideo(); 160 } 161 }; 162 }); 163 $(document).on("lity:close", function(event, instance) { 164 $("#video-pop-up .video-pop-up-inner").removeClass("loaded"); 165 $("#video-pop-up .video-pop-up-inner iframe").attr("src", ""); 166 }); 167 } 168} 169 170function lb_smooth_scroll() { 171 $('a[href*="#"]') 172 .not('[href="#"]') 173 .not('[href="#0"]') 174 .not(".tab-body") 175 .click(function(event) { 176 if ( 177 location.pathname.replace(/^\//, "") == 178 this.pathname.replace(/^\//, "") && 179 location.hostname == this.hostname 180 ) { 181 var target = $(this.hash); 182 target = target.length 183 ? target 184 : $("[name=" + this.hash.slice(1) + "]"); 185 if (target.length) { 186 event.preventDefault(); 187 hashID = 188 "#" + 189 $(this) 190 .attr("href") 191 .replace(/^.*?(#|$)/, ""); 192 $("html, body").animate( 193 { 194 scrollTop: $(hashID).offset().top 195 }, 196 1000, 197 function() { 198 var $target = $(target);
199 $target.focus(); 200 if ($target.is(":focus")) { 201 return false; 202 } else { 203 $target.attr("tabindex", "-1"); // Adding tabindex for elements not focusable 204 $target.focus(); // Set focus again 205 } 206 } 207 ); 208 } 209 } 210 }); 211} 212$(window).on("load resize orientationchange", function() { 213 function sliderInit(slidersEle, breakNum, settingsObj) { 214 $(slidersEle).each(function() { 215 var $carousel = $(this); 216 /* Initializes a slick carousel only on mobile screens */ 217 // slick on mobile 218 if ($(window).width() > breakNum) { 219 if ($carousel.hasClass("slick-initialized")) { 220 $carousel.slick("unslick"); 221 } 222 } else { 223 if (!$carousel.hasClass("slick-initialized")) { 224 $carousel.slick(settingsObj); 225 } 226 } 227 }); 228 } 229 sliderInit("#code_block-7-12 ul", 1025, { 230 infinite: false, 231 speed: 400, 232 autoplay: false, 233 dots: false, 234 slidesToShow: 3, 235 slidesToScroll: 1, 236 prevArrow: 237 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/08/left-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 238 nextArrow: 239 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/08/right-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 240 responsive: [ 241 { 242 breakpoint: 601,
243 settings: { 244 slidesToShow: 2 245 } 246 } 247 ] 248 }); 249 sliderInit(" .article-wrapper-inner", 601, { 250 infinite: false, 251 speed: 400, 252 autoplay: false, 253 dots: false, 254 slidesToShow: 2, 255 slidesToScroll: 1, 256 prevArrow: 257 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/08/left-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 258 nextArrow: 259 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/08/right-chev-arrow.svg" alt="Slider Previous Arrow" /></div>' //replace arrows 260 }); 261 sliderInit(".home .blog-articles .article-wrapper-inner", 1025, { 262 infinite: false, 263 speed: 400, 264 autoplay: false, 265 dots: false, 266 slidesToShow: 3, 267 slidesToScroll: 1, 268 prevArrow: 269 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/08/left-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 270 nextArrow: 271 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/08/right-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 272 responsive: [ 273 { 274 breakpoint: 601,
275 settings: { 276 slidesToShow: 2 277 } 278 } 279 ] 280 }); 281 sliderInit(".article-wrapper.tablet .article-wrapper-inner", 1025, { 282 infinite: false, 283 speed: 400, 284 autoplay: false, 285 dots: false, 286 slidesToShow: 3, 287 slidesToScroll: 1, 288 prevArrow: 289 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/08/left-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 290 nextArrow: 291 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/08/right-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 292 responsive: [ 293 { 294 breakpoint: 601, 295 settings: { 296 slidesToShow: 2 297 } 298 } 299 ] 300 }); 301 var amountOfVideos = $(".special-event-full .videos-wrapper").children(); 302 if (amountOfVideos) { 303 console.log(amountOfVideos); 304 } 305 sliderInit(".special-event-full .videos-wrapper", 1025, { 306 infinite: false, 307 speed: 400, 308 autoplay: false, 309 dots: false, 310 slidesToShow: 3, 311 slidesToScroll: 1, 312 prevArrow: 313 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/08/left-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 314 nextArrow: 315 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/08/right-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 316 responsive: [ 317 { 318 breakpoint: 601,
319 settings: { 320 slidesToShow: 2 321 } 322 } 323 ] 324 }); 325 var amountOfVideos = $(".special-event-olla .videos-wrapper").children(); 326 if (amountOfVideos) { 327 console.log(amountOfVideos); 328 } 329 sliderInit(".special-event-olla .videos-wrapper", 1025, { 330 infinite: false, 331 speed: 400, 332 autoplay: false, 333 dots: false, 334 slidesToShow: 3, 335 slidesToScroll: 1, 336 prevArrow: 337 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/08/left-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 338 nextArrow: 339 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/08/right-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 340 responsive: [ 341 { 342 breakpoint: 601, 343 settings: { 344 slidesToShow: 2 345 } 346 } 347 ] 348 }); 349 sliderInit(".special-event-olla .related-articles-wrapper", 1025, { 350 infinite: false, 351 speed: 400, 352 autoplay: false, 353 dots: false, 354 slidesToShow: 3, 355 slidesToScroll: 1, 356 prevArrow: 357 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/08/left-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 358 nextArrow: 359 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/08/right-chev-arrow.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 360 responsive: [ 361 { 362 breakpoint: 601,
363 settings: { 364 slidesToShow: 2 365 } 366 } 367 ] 368 }); 369}); 370function millisToMinutesAndSeconds(millis) { 371 var minutes = Math.floor(millis / 60000); 372 var seconds = ((millis % 60000) / 1000).toFixed(0); 373 return minutes + ":" + (seconds < 10 ? "0" : "") + seconds; 374} 375 376function setWatchTime(time, ele) { 377 var timeToShow = 378 moment.duration(time).minutes() <= 0 ? 1 : moment.duration(time).minutes(); 379 $(ele) 380 .find(".read-time") 381 .html(timeToShow + " Min"); 382} 383 384function setPlayTime(time, ele) { 385 var playTime = millisToMinutesAndSeconds(moment.duration(time)); 386 $(ele) 387 .find(".playtime") 388 .html(playTime); 389} 390 391function youtubeAPI(ele) { 392 var APIKEY = "AIzaSyCVRHHTViM20hUYQ3zC2GXoLba8YLTEXYY"; 393 $(ele).each(function() { 394 var article = $(this); 395 var video_url = $(article) 396 .find("a") 397 .attr("data-video-url"); 398 var video_id = video_url.split("v=")[1]; 399 var ampersandPosition = video_id.indexOf("&"); 400 if (ampersandPosition != -1) { 401 video_id = video_id.substring(0, ampersandPosition); 402 } 403 var xhttp = new XMLHttpRequest(); 404 xhttp.onreadystatechange = function() { 405 if (this.readyState == 4 && this.status == 200) { 406 var json = JSON.parse(this.responseText); 407 var vTime = json.items[0]["contentDetails"]["duration"]; 408 409 setWatchTime(vTime, article); 410 setPlayTime(vTime, article); 411 } 412 }; 413 xhttp.open( 414 "GET", 415 "https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=" + 416 video_id + 417 "&key=" + 418 APIKEY, 419 true 420 ); 421 xhttp.send(); 422 }); 423} 424 425function stickyMenu() { 426 var controller = new ScrollMagic.Controller(); 427 new ScrollMagic.Scene({ 428 duration: 0, 429 offset: 50 430 }) 431 .setPin("#new_columns-7-9") 432 .setClassToggle("#new_columns-7-9, .mobile-menu, body", "scroll-active") 433 .addTo(controller); 434} 435 436function openInNewTabs() { 437 var outSideLinks = [ 438 $("#menu-item-460 > a"), 439 $("#menu-item-458 > a"), 440 $("#menu-item-459 > a"), 441 $("#menu-item-73 > a"), 442 $("#menu-item-2138 > a"), 443 $("#menu-item-2153 > a"), 444 $("#menu-item-2139 > a"), 445 $("#menu-item-2137 > a"), 446 $("#menu-item-2141 > a"), 447 $("#menu-item-436 > a"), 448 $("#menu-item-2152 > a"), 449 $("#menu-item-76 > a") 450 ]; 451 $(outSideLinks).each(function() { 452 $(this).attr("target", "_blank"); 453 }); 454} 455// simple tabs 456function lb_tabs(ele) { 457 var lbButton = $(ele); 458 $(lbButton).click(function(e) { 459 e.preventDefault(); 460 var lbHref = $(this).attr("href"); 461 $(lbButton).each(function() { 462 $(this).removeClass("active"); 463 }); 464 $(this).addClass("active"); 465 $(".tab-body").each(function() { 466 $(this).removeClass("active"); 467 }); 468 $(".tab-body" + lbHref).addClass("active"); 469 }); 470 $(lbButton) 471 .first() 472 .click(); 473} 474 475function tabsWithHash(nav, body) { 476 function bodyArrayConstructor(ele) { 477 var bodyArray = []; 478 $(ele).each(function() { 479 bodyArray.push($(this).attr("id")); 480 }); 481 return bodyArray; 482 } 483 var avalibleBodies = bodyArrayConstructor(body); 484 485 function classCycle(ele) { 486 var hrefNeeded = $(ele).attr("href"); 487 $(nav).each(function() { 488 $(this).removeClass("active"); 489 }); 490 $(ele).addClass("active"); 491 $(body).each(function() { 492 $(this).removeClass("active"); 493 }); 494 if (history.pushState) { 495 history.pushState(null, null, hrefNeeded); 496 } else { 497 location.hash = hrefNeeded; 498 } 499 $(body + hrefNeeded).addClass("active"); 500 } 501 $(nav).click(function(e) { 502 e.preventDefault(); 503 classCycle($(this)); 504 }); 505 506 function tabInit() { 507 if (window.location.hash) { 508 var hash = window.location.hash.substring(1); 509 var bodyResult = avalibleBodies.find(function(ele) { 510 return ele == hash; 511 }); 512 $(nav + '[href="#' + bodyResult + '"]').click(); 513 } else { 514 $(nav) 515 .first() 516 .click(); 517 } 518 } 519 tabInit(); 520} 521// pop ups 522function popUps(btn) { 523 $("body").click(function() { 524 $(".pop-up").removeClass("active"); 525 $("body").removeClass("pop-up-active"); 526 }); 527 $(".pop-up-inner").click(function(e) { 528 e.stopPropagation(); 529 }); 530 $(btn).click(function(e) { 531 e.preventDefault(); 532 e.stopPropagation(); 533 var href = $(this).attr("href"); 534 $(href + ".pop-up").addClass("active"); 535 $("body").addClass("pop-up-active"); 536 }); 537 $(".close-pop-up").click(function() { 538 $(this) 539 .parent() 540 .parent() 541 .removeClass("active"); 542 $("body").removeClass("pop-up-active"); 543 }); 544} 545 546 547function mobileMenu() { 548 const closeMobileMenu = () => { 549 document.querySelector('header').classList.remove('active'); 550 document.querySelector('.mobile-button').classList.remove('active'); 551 document.querySelector('.mobile-menu').classList.remove('active'); 552 document.body.classList.remove('menu-active'); 553 document.documentElement.classList.remove('menu-active'); 554 } 555 556 const handleDocumentClick = (e) => { 557 const mobileButton = document.querySelector('.mobile-button'); 558 if (!document.querySelector('.mobile-menu').contains(e.target) && !mobileButton.contains(e.target)) { 559 closeMobileMenu(); 560 } 561 } 562 563 $(".mobile-button").click(function(e) { 564 $("header").toggleClass("active"); 565 $(this).toggleClass("active"); 566 $(".mobile-menu").toggleClass("active"); 567 $("html, body").toggleClass("menu-active"); 568 569 if ($(".mobile-menu").hasClass("active")) { 570 document.addEventListener('click', handleDocumentClick); 571 } else { 572 document.removeEventListener('click', handleDocumentClick); 573 } 574 if (!$(".mobile-menu").hasClass("active")) { 575 $(".mobile-menu li.menu-item-has-children").each(function() { 576 $(this) 577 .removeClass("active") 578 .find(".sub-menu") 579 .slideUp(); 580 }); 581 } 582 }); 583 584 $(".mobile-menu li.menu-item-has-children > a").click(function(e) { 585 e.preventDefault(); 586 587 $(this) 588 .parent() 589 .toggleClass("active") 590 .children(".sub-menu") 591 .slideToggle(); 592 593 $(this) 594 .parent() 595 .toggleClass("active"); 596 597 }); 598} 599 600function tabletSearch() { 601 $(window).on("load resize orientationchange", function() { 602 if ($(window).width() < 1025 || $(window).width() > 601) { 603 $("#s").animate( 604 { 605 width: "toggle" 606 }, 607 350 608 ); 609 $(".search-button").click(function(e) { 610 e.preventDefault(); 611 $("#s").animate( 612 { 613 width: "toggle" 614 }, 615 350 616 ); 617 }); 618 } 619 }); 620} 621 622function GSAPanimations() { 623 function blogImageHover(ele) { 624 $(document).on("mouseenter", ele, function() { 625 TweenLite.to($(this), 0.5, { 626 ease: Cubic.easeInOut, 627 scale: 1.035 628 }); 629 }); 630 $(document).on("mouseout", ele, function() { 631 TweenLite.to($(this), 0.5, { 632 ease: Cubic.easeInOut, 633 scale: 1 634 }); 635 }); 636 } 637 638 function blogTextImageHover(ele) { 639 $(document).on("mouseenter", ele, function() { 640 var bgImage = $(this) 641 .closest(".article-inner")
642 .find(".image-bg"); 643 TweenLite.to($(bgImage), 0.5, { 644 ease: Cubic.easeInOut, 645 scale: 1.035 646 }); 647 }); 648 $(document).on("mouseout", ele, function() { 649 var bgImage = $(this) 650 .closest(".article-inner") 651 .find(".image-bg"); 652 TweenLite.to($(bgImage), 0.5, { 653 ease: Cubic.easeInOut, 654 scale: 1 655 }); 656 }); 657 } 658 blogTextImageHover(".alm-reveal .article .info .title a"); 659 blogTextImageHover(".blog-articles .article .info .title a"); 660 blogTextImageHover(".special-books .article .info .title a"); 661 blogTextImageHover(".special-books .article .info .fancy-links a"); 662 blogImageHover(".special-books .article .image-bg"); 663 blogImageHover(".alm-reveal .article .image .image-bg"); 664 blogImageHover(".blog-articles .article .image .image-bg"); 665 blogImageHover(".single-photos_videos #lightgallery a img"); 666} 667 668function photoGallery(ele) { 669 $(document).on("click", ele, function(e) { 670 e.preventDefault(); 671 var EleItems = $(this).find(".gallery-items"); 672 jsonObj = []; 673 $(EleItems).each(function() { 674 var src = $(this).attr("data-src"); 675 var thumb = $(this).attr("data-thumb"); 676 var subHtml = $(this).attr("data-subhtml"); 677 var download = $(this).attr("data-download-url"); 678 item = { 679 src: src, 680 subHtml: subHtml, 681 thumb: thumb 682 }; 683 if (download == "false") { 684 item["downloadUrl"] = false; 685 } else { 686 item["downloadUrl"] = download; 687 } 688 jsonObj.push(item); 689 }); 690 $(this).lightGallery({ 691 dynamic: true, 692 dynamicEl: jsonObj 693 }); 694 }); 695} 696 697function archiveSearch(post_type) { 698 $(".post-type-archive-" + post_type + " form #searchinput").keypress(function( 699 e 700 ) { 701 if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { 702 var searchterm = $( 703 ".post-type-archive-" + post_type + " form #searchinput" 704 ).val(); 705 window.location = "/?s=" + searchterm + "&post_type=" + post_type; 706 return false; 707 } else { 708 return true; 709 } 710 }); 711} 712 713function userSliderHome(slider) { 714 $(slider).slick({ 715 infinite: false, 716 speed: 400, 717 autoplay: false, 718 dots: false, 719 slidesToShow: 3, 720 slidesToScroll: 1, 721 prevArrow: 722 '<div class="slick-arrow slick-prev"><img src="/wp-content/uploads/2019/06/blue-slider-arrow-left.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 723 nextArrow: 724 '<div class="slick-arrow slick-next"><img src="/wp-content/uploads/2019/06/blue-slider-arrow-right.svg" alt="Slider Previous Arrow" /></div>', //replace arrows 725 responsive: [ 726 { 727 breakpoint: 1441, 728 settings: { 729 slidesToShow: 3 730 } 731 }, 732 { 733 breakpoint: 1025, 734 settings: { 735 slidesToShow: 2 736 } 737 }, 738 { 739 breakpoint: 601,
740 settings: { 741 slidesToShow: 1, 742 centerMode: true, 743 centerPadding: "0px" 744 } 745 } 746 ] 747 }); 748} 749 750function userSliderHomeNew(slider) { 751 const sliders = document.querySelectorAll(slider); 752 sliders.forEach((el) => { 753 $(el).slick({ 754 infinite: false, 755 speed: 400, 756 autoplay: false, 757 dots: false, 758 slidesToShow: 1, 759 slidesToScroll: 1, 760 // appendArrows: '[data-homepage-voices-slider-arrows]', 761 prevArrow: el.parentNode.querySelector('[data-homepage-voices-slider-arrow-prev]'), 762 nextArrow: el.parentNode.querySelector('[data-homepage-voices-slider-arrow-next]') 763 }); 764 }) 765} 766 767function accessibility() { 768 $("body").addClass("no-focus-outline"); 769 document.body.addEventListener("keyup", function(e) { 770 if (e.which === 9) { 771 document.body.classList.remove("no-focus-outline"); 772 } 773 }); 774 function RandCB(ele) { 775 $(ele).attr("tabindex", "0"); 776 $(ele).on("keypress", function(e) { 777 if (e.which == 13) { 778 $(this).click(); 779 } 780 }); 781 } 782 var linkTitles = ["facebook", "instagram", "twitter", "rss", "youtube"]; 783 for (i = 0; i < linkTitles.length; ++i) { 784 $(".oxy-social-icons") 785 .find("a") 786 .each(function() { 787 if ( 788 $(this) 789 .attr("class") 790 .indexOf(linkTitles[i]) >= 0 791 ) { 792 $(this).attr("title", linkTitles[i] + " link"); 793 $(this).attr("aria-label", linkTitles[i] + " link"); 794 } 795 }); 796 } 797} 798 799function scrollAds() { 800 $(window).scroll(function(e) { 801 var $el = $(".fixed-ad"); 802 var isPositionFixed = $el.css("position") == "fixed"; 803 if ($(this).scrollTop() > 1000 && !isPositionFixed) { 804 $el.css({ 805 position: "fixed", 806 top: "0px" 807 }); 808 } 809 if ($(this).scrollTop() < 1000 && isPositionFixed) { 810 $el.css({ 811 position: "static", 812 top: "0px" 813 }); 814 } 815 }); 816} 817 818function specialEventsClassAdd() { 819 if( $('#section-4-2989').hasClass('special-events-short-wrapper') ) { 820 $('body').addClass('special-event-short'); 821 } 822 if ($("#section-4-2989").hasClass("special-event-full-wrapper")) { 823 $("body").addClass("special-event-full"); 824 } 825 if ($("#section-4-2990").hasClass("special-event-book-wrapper")) { 826 $("body").addClass("special-books"); 827 } 828} 829 830function copyToClipboard() { 831 document.querySelectorAll('[data-copy-to-clipboard]')?.forEach((button) => { 832 button.addEventListener('click', async function(e) { 833 const el = e.currentTarget; 834 835 const text = el.getAttribute('data-copy-text'); 836 const textWrapper = el.querySelector('[data-copy-text-wrapper]') || el; 837 const currentText = textWrapper.textContent; 838 839 try { 840 await navigator.clipboard.writeText(text); 841 textWrapper.textContent = 'Copied to clipboard!' 842 el.setAttribute('disabled', true); 843 844 setTimeout(() => { 845 textWrapper.textContent = currentText; 846 el.removeAttribute('disabled'); 847 }, 3000); 848 } catch (err) { 849 textWrapper.textContent = currentText; 850 el.removeAttribute('disabled'); 851 } 852 }) 853 }) 854} 855/********************* 856HELPER FUNCTIONS 857*********************/
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.