1// This file is used by 1) GNZ and 2) EG 2 3// IE 11 fix for syntax compile 4if (!String.prototype.startsWith) { 5 String.prototype.startsWith = function (searchString, position) { 6 position = position || 0; 7 return this.indexOf(searchString, position) === position; 8 }; 9} 10 11$(function () { 12 13 var $window = $(window) 14 15 headerBgUpdate() 16 headerDropdownLinks() 17 mobileDropdownLinks() 18 setupLayout() 19 headerSearch() 20 partnersCarousel() 21 22 23 //setTimeout(function () { heroCarousel(); }, 500); 24 25 //galleryCarousel() 26 //eventsCarousel() 27 //tilesCarousel() 28 videosCarousel() 29 //faq() 30 mobileMenu() 31 32 //Phase 2 33 //templateFilter() 34 leaderboardTable() 35 36 37 38 function leaderboardTable() { 39 var contentTrigger = $('.js-leaderboard') 40 var contentClose = $('.js-row-content__close') 41 var content = $('.table__row-content') 42 var contentScroll = $('.row-content__scroll') 43 44 var dataHoleButton = $('.js-hole-tab'); 45 46 contentScroll.scroll(function() { 47 var elmnt = $(this) 48 var x = elmnt.scrollLeft() 49 if ( x > 10) { 50 contentScroll.addClass('hide-mobile-gesture') 51 } 52 }); 53 54 contentTrigger.click(function() { 55 if ($(this).next(content).hasClass('content-is-active')) { 56 $(this).next(content).removeClass('content-is-active') 57 $(this).next(content).slideUp(400); 58 } else { 59 content.slideUp(400); 60 content.removeClass('content-is-active') 61 $(this).next(content).addClass('content-is-active') 62 $(this).next(content).slideDown(400); 63 if ($( window ).width() < 1311) { 64 content.addClass('remove-swipe'); 65 } 66 } 67 }) 68 69 contentClose.click(function() { 70 content.slideUp(400); 71 content.removeClass('content-is-active') 72 }) 73 74 // For triggering hole tabs on mobile. 75 dataHoleButton.click(function() { 76 var dataHole = $(this).data("holes") 77 var thisContainer = $(this).closest('.table__row-content') 78 var tabs = thisContainer.find('.js-hole-tab') 79 var dataClass = 'data-holes-is-' + dataHole + '' 80 81 if (!thisContainer.hasClass(dataClass)) { 82 thisContainer.removeClass('data-holes-is-out') 83 thisContainer.removeClass('data-holes-is-in') 84 thisContainer.addClass(dataClass) 85 tabs.removeClass('is-active') 86 $(this).addClass('is-active') 87 } 88 }) 89 } 90 91 92 93 // Scroll to top page 94 function scrollToTopDoc() { 95 $('body').addClass('scroll-to-top-init') 96 97 function showTop(){ 98 $('html,body').animate({ scrollTop: 0 }, 0); 99 $('body').removeClass('scroll-to-top-init') 100 return false; 101 } 102 setTimeout(showTop, 500); 103 } 104 $('.js-backToTop').click(function() { 105 scrollToTopDoc() 106 }) 107 // ---------------- 108 109 // Dropdown links for desktop navigation 110 function headerDropdownLinks() { 111 var lgDropdownNav = $('.js-dropdown-navigation') 112 //var lgDropdownTrigger = lgDropdownNav.find('.navigation__li') 113 var dropdownOverlay = $('.dropdown-menu__overlay') 114 //var lgDSection = $('.dropdown-menu__section') 115 116 dropdownOverlay.click(function() { 117 $('body').removeClass('dropdown-is-open') 118 $('.navigation__li').removeClass('is-active') 119 $(`.dropdown-menu__section`).removeClass('is-active') 120 }) 121 122 lgDropdownNav.on('click', '.navigation__li', function () { 123 $('body').addClass('dropdown-is-open') 124 lgMagicNumber = $(this).data('menu-link'); 125 126 if ($(`.dropdown-menu__section[data-menu-section=${lgMagicNumber}]`).hasClass('is-active')) { 127 $(`.dropdown-menu__section[data-menu-section=${lgMagicNumber}]`).removeClass('is-active') 128 $('body').removeClass('dropdown-is-open') 129 $('.navigation__li').removeClass('is-active') 130 } else { 131 $(`.dropdown-menu__section`).removeClass('is-active') 132 $('.navigation__li').removeClass('is-active') 133 $(`.dropdown-menu__section[data-menu-section=${lgMagicNumber}]`).addClass('is-active') 134 $(this).addClass('is-active') 135 } 136 }) 137 } 138 139 // Dropdown links for mobile navigation (accordion type functionality) 140 function mobileDropdownLinks() { 141 var dropdownNav = $('.js-mobile-dropdown') 142 143 dropdownNav.on('click', '.navigation__li', function() { 144 var dSection = dropdownNav.find('.menu-dropdown__section') 145 146 magicNumber = $(this).data('menu-link') 147 148 if ($(`.navigation__li[data-menu-link=${magicNumber}]`).hasClass('is-active')) { 149 $(`.navigation__li[data-menu-link=${magicNumber}]`).removeClass('is-active') 150 dSection.eq(magicNumber).hide(400) 151 } else { 152 dSection.hide(400) 153 $(`.navigation__li`).removeClass('is-active') 154 $(`.navigation__li[data-menu-link=${magicNumber}]`).addClass('is-active') 155 dSection.eq(magicNumber).show(400) 156 $(this).addClass('is-active') 157 } 158 }) 159 } 160 161 // Scroll reveal functions 162 // see : https://scrollrevealjs.org/api/reveal.html 163 164 // Used for scrollReveal when triggered 165 function animatingClass(el) { 166 el.classList.add('is-animating') 167 } 168 // Generic scroll reveal functions 169 ScrollReveal().reveal('.js-image-scale', { 170 delay: 300, 171 scale: 1.2, 172 interval: 100, 173 duration: 1400, 174 distance: '0', 175 origin: 'bottom', 176 viewFactor: 0.25, 177 opacity: 1, 178 // container: '#container', 179 beforeReveal: animatingClass 180 }) 181 182 ScrollReveal().reveal('.js-custom-reveal', { 183 delay: 300, 184 duration: 0, 185 distance: '0', 186 origin: 'top', 187 viewFactor: 0.3, 188 opacity: 1, 189 // container: '#container', 190 beforeReveal: animatingClass 191 }) 192 193 ScrollReveal().reveal('.js-fade-up', { 194 delay: 250, 195 duration: 600, 196 distance: '16px', 197 origin: 'bottom', 198 viewFactor: 0.2, 199 // container: '#container', 200 beforeReveal: animatingClass 201 }) 202 203 ScrollReveal().reveal('.js-fade-up-interval', { 204 delay: 250, 205 interval: 100, 206 duration: 600, 207 distance: '16px', 208 origin: 'bottom', 209 viewFactor: 0.2, 210 // container: '#container', 211 beforeReveal: animatingClass 212 }) 213 214 ScrollReveal().reveal('.js-fade-up-interval2', { 215 delay: 250, 216 interval: 100, 217 duration: 600, 218 distance: '16px', 219 origin: 'bottom', 220 viewFactor: 0.2, 221 // container: '#container', 222 beforeReveal: animatingClass 223 }) 224 ScrollReveal().reveal('.js-fade-up-interval3', { 225 delay: 250, 226 interval: 100, 227 duration: 600, 228 distance: '16px', 229 origin: 'bottom', 230 viewFactor: 0.2, 231 // container: '#container', 232 beforeReveal: animatingClass 233 }) 234 235 ScrollReveal().reveal('.js-fade-up-rte', { 236 delay: 250, 237 duration: 600, 238 distance: '16px', 239 origin: 'bottom', 240 // container: '#container', 241 beforeReveal: animatingClass 242 }) 243 ///////////////////////////////////////// 244 245 246 // Handle the header style updates once scrolled from top 247 function headerBgUpdate() { 248 if ($window.scrollTop() < 10) 249 $('.site-header').removeClass('has-bg').addClass('is-top') 250 else if ($window.scrollTop() >= 10) { 251 $('.site-header').addClass('has-bg').removeClass('is-top') 252 } 253 } 254 255 $window.scroll(_.throttle(function () { 256 headerBgUpdate() 257 }, 50)) 258 259 260 // General page layout when page loads 261 function setupLayout() { 262 // footer size that updates as it is fixed at bottom of page 263 function footerSize() { 264 var footer = $('.site-footer') 265 var header = $('.site-header') 266 var siteContentContainer = $('.l_content-spacer') 267 var footerHeight = footer.outerHeight() 268 269 if ($(window).width() <= 767) { 270 siteContentContainer.css('paddingBottom', "0") 271 footer.css('position', "relative") 272 footer.css('zIndex', "12") 273 } else { 274 siteContentContainer.css('paddingBottom', "" + footerHeight + "px") 275 footer.css('position', "fixed") 276 footer.css('zIndex', "0") 277 } 278 } 279 280 // For making hero actually 100 vh on some mobiles. 281 function resizeViewport() {
282 let vh = window.innerHeight * 0.01; 283 document.documentElement.style.setProperty('--vh', vh + 'px'); 284 } 285 286 $(window).resize(function () { 287 footerSize() 288 resizeViewport() 289 }) 290 footerSize() 291 resizeViewport() 292 } 293 294 // Show and hide header search 295 function headerSearch() { 296 var openSearch = $('.js-open-search') 297 var closeSearch = $('.js-close-search') 298 var searchInput = $('#headerSearchInput') 299 var doc = $('body') 300 var lgDSection = $('.dropdown-menu__section') 301 302 openSearch.click(function (event) { 303 event.preventDefault(); 304 doc.addClass('search-is-open') 305 doc.removeClass('dropdown-is-open') 306 $('.navigation__li').removeClass('is-active') 307 lgDSection.removeClass('is-active') 308 searchInput.focus() 309 }) 310 311 closeSearch.click(function () { 312 event.preventDefault(); 313 doc.removeClass('search-is-open') 314 searchInput.blur() 315 }) 316 } 317 318 // Mobile menu toggle 319 function mobileMenu() { 320 var doc = $('body') 321 var sb = 0; 322 $('.js-mobile-menu').click(function (){ 323 if (doc.hasClass('menu-is-open')) { 324 doc.removeClass('menu-is-open') 325 $(document).scrollTop(SB); 326 327 } else { 328 SB = $(document).scrollTop(); 329 doc.addClass('menu-is-open') 330 } 331 }) 332 } 333 334 // Have commented out custom slide transition as it breaks when using autoplay. 335 // Have also commented slidesPerGroup option with speed these can be uncommented if scroll all in view is required. 336 function partnersCarousel() { 337 $('.partners__carousel').each(function (index, elem) { 338 var currentTranslate = 0; 339 new Swiper(elem, { 340 // virtualTranslate: 'true', 341 slidesPerView: 2, 342 spaceBetween: 16, 343 // slidesPerGroup: 2, 344 // speed: 600, 345 lazy: { 346 loadPrevNext: true, 347 }, 348 autoplay: { 349 delay: 4000, 350 disableOnInteraction: false, 351 }, 352 353 breakpoints: { 354 640: { 355 slidesPerView: 3, 356 spaceBetween: 16, 357 // slidesPerGroup: 3, 358 // speed: 800, 359 lazy: { 360 loadPrevNext: true, 361 }, 362 }, 363 768: { 364 slidesPerView: 4, 365 spaceBetween: 16, 366 // slidesPerGroup: 4, 367 // speed: 1000, 368 lazy: { 369 loadPrevNext: true, 370 }, 371 }, 372 1100: { 373 slidesPerView: 5, 374 spaceBetween: 16, 375 // slidesPerGroup: 5, 376 // speed: 1200, 377 lazy: { 378 loadPrevNext: true, 379 }, 380 }, 381 1520: { 382 slidesPerView: 6, 383 spaceBetween: 16, 384 // slidesPerGroup: 6, 385 // speed: 1400, 386 lazy: { 387 loadPrevNext: true, 388 }, 389 } 390 }, 391 navigation: { 392 nextEl: jQuery(elem).siblings('.block-header').find('.sw-r'), 393 prevEl: jQuery(elem).siblings('.block-header').find('.sw-l') 394 }, 395 // on: { 396 397 // setTranslate: function (translate) { 398 399 // var swiper = this 400 // var delay = 0 401 // var delayAmount = 0.025 402 403 // if (currentTranslate > translate) { 404 // delay = 0 405 // for (var i = 0; i < swiper.slides.length; i++) { 406 // swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 407 // swiper.slides[i].style.transitionDelay = '' + delay + 's'
408 // delay = delay + delayAmount; 409 // } 410 411 // } else { 412 // delay = swiper.slides.length * delayAmount 413 // for (var i = 0; i < swiper.slides.length; i++) { 414 // swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 415 // swiper.slides[i].style.transitionDelay = '' + delay + 's' 416 // delay = delay - delayAmount; 417 // } 418 // } 419 // currentTranslate = translate 420 // return currentTranslate; 421 // } 422 // } 423 }) 424 }) 425 } 426 427 // Accordion Filter 428 filterAccordion() 429 function filterAccordion() { 430 431 var $filterAccordion = $('.js-filter-accordion') 432 var $filterAccordionTrigger = $filterAccordion.find('.filter-accordion__title') 433 var $filterAccordionActiveClass = 'is-active' 434 var $filterAccordionSpeed = 400 435 436 $filterAccordionTrigger.click(function (e) { 437 if ($(this).parent().hasClass($filterAccordionActiveClass)) { 438 $(this).parent().removeClass($filterAccordionActiveClass) 439 $(this).next('.filter-accordion__content').slideUp($filterAccordionSpeed) 440 } else { 441 // $(this).closest($filterAccordion).find('.filter-accordion__content').slideUp($filterAccordionSpeed) 442 // $(this).closest($filterAccordion).find('.filter-accordion__item').removeClass($filterAccordionActiveClass) 443 $(this).parent().addClass($filterAccordionActiveClass) 444 $(this).next('.filter-accordion__content').slideDown($filterAccordionSpeed) 445 } 446 }) 447 } 448 449 $(document).ready(function () { 450 var stickyrightpanelhtml = $('.sticky-right-panel__inner').html(); 451 if ($(window).width() > 1440 && stickyrightpanelhtml != undefined) { 452 let stickyHtml = stickyrightpanelhtml.trim(); 453 if (stickyHtml) { 454 let stickySidebar = new StickySidebar('.sticky-right-panel', { 455 topSpacing: 20, 456 bottomSpacing: -27, 457 containerSelector: '.main--two-column', 458 innerWrapperSelector: '.sticky-right-panel__inner' 459 }) 460 } 461 } 462 }); 463 464 ///////////////////////////////////////// 465}) 466 467function videoModal() { 468 // Video modal 469 470 var SB = 0; 471 var videoBtn = $('[data-video]'); 472 function videoPlay($that) { 473 if (!$('.video-modal').length) { 474 $('body').prepend( 475 '<div class="video-modal">' + 476 '<div class="video-modal__overlay"></div>' + 477 '<span class="video-modal__close large-screens button">' + 478 '<svg class="icon-close">' + 479 '<use xlink:href="#icon-close"></use>' + 480 '</svg>' + 481 '</span>' + 482 '<div class="container">' + 483 '<div class="video-modal__overlay no-bg"></div>' + 484 '<div class="row u_justify-center">' + 485 '<div class="col-10">' + 486 '<div class="video-modal__inner">' + 487 '<div class="video-modal__close-container">' + 488 '<span class="video-modal__close small-screens button">' + 489 '<svg class="icon-close">' + 490 '<use xlink:href="#icon-close"></use>' + 491 '</svg>' + 492 '</span>' + 493 '</div>' + 494 '<div class="video-modal__video-container">' + 495 496 '<div class="embed-responsive ratio-16by9">' + 497 '<iframe class="video-modal__video embed-responsive-item" src="' + $that.attr('data-video') + '" allow="autoplay; fullscreen" allowfullscreen="true"></iframe>' + 498 '</div>' + 499 500 '</div>' + 501 '</div>' + 502 '</div>' + 503 '</div>' + 504 '</div>' + 505 '</div>' 506 ) 507 } 508 } 509 510 $(document).on('click', '.video-modal__overlay', function () { 511 closeVideo() 512 }); 513 $(document).on('click', '.video-modal__close', function () { 514 closeVideo() 515 }); 516 517 videoBtn.click(function (e) { 518 e.preventDefault(); 519 SB = $(document).scrollTop(); 520 $('body').addClass('video-modal-is-active') 521 var that = $(this); 522 videoPlay(that) 523 }) 524 525 function closeVideo() { 526 $('body').removeClass('video-modal-is-active') 527 $('.video-modal').remove(); 528 $(document).scrollTop(SB); 529 } 530} 531 532function templateFilter() { 533 var filterTriger = $('.js-filter-open') 534 var parent = filterTriger.parent() 535 var filterContent = parent.next('.filter-content-mobile') 536 537 filterTriger.click(function (e) { 538 e.preventDefault(); 539 540 if (parent.hasClass('is-active')) { 541 parent.removeClass('is-active') 542 filterContent.slideUp(400); 543 } else { 544 parent.addClass('is-active') 545 filterContent.slideDown(400); 546 } 547 }) 548} 549 550function videosCarousel() { 551 $('.videos__carousel').each(function (index, elem) { 552 var currentTranslate = 0; 553 new Swiper(elem, { 554 virtualTranslate: 'true', 555 slidesPerView: 'auto', 556 spaceBetween: 16, 557 558 breakpoints: { 559 640: { 560 slidesPerView: 'auto', 561 spaceBetween: 16 562 } 563 }, 564 pagination: { 565 el: '.videos__carousel .swiper-pagination', 566 type: 'progressbar', 567 }, 568 navigation: { 569 nextEl: jQuery(elem).siblings('.block-header').find('.sw-r'), 570 prevEl: jQuery(elem).siblings('.block-header').find('.sw-l') 571 }, 572 on: { 573 init: function () { 574 var swiper = this 575 var slideCount = swiper.slides.length; 576 577 if (slideCount < 10) { 578 slideTotal = '0' + slideCount 579 } else { 580 slideTotal = slideCount 581 } 582 583 var swiperSlideLength = document.createTextNode("" + slideTotal + ""); 584 swiper.el.querySelector('.carousel__count--total').innerHTML = ''; 585 swiper.el.querySelector('.carousel__count--total').appendChild(swiperSlideLength); 586 }, 587 setTranslate: function (translate) { 588 589 var swiper = this
590 var delay = 0 591 var delayAmount = 0.025 592 593 if (currentTranslate > translate) { 594 delay = 0 595 for (var i = 0; i < swiper.slides.length; i++) { 596 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 597 swiper.slides[i].style.transitionDelay = '' + delay + 's' 598 delay = delay + delayAmount; 599 } 600 601 } else { 602 delay = swiper.slides.length * delayAmount 603 for (var i = 0; i < swiper.slides.length; i++) { 604 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 605 swiper.slides[i].style.transitionDelay = '' + delay + 's' 606 delay = delay - delayAmount; 607 } 608 } 609 currentTranslate = translate 610 return currentTranslate; 611 } 612 } 613 }) 614 }) 615} 616 617function revealGeneric() { 618 // Used for scrollReveal when triggered 619 function animatingClass(el) { 620 el.classList.add('is-animating') 621 } 622 623 // Generic scroll reveal functions 624 ScrollReveal().reveal('.js-image-scale', { 625 delay: 300, 626 scale: 1.2, 627 interval: 100, 628 duration: 1400, 629 distance: '0', 630 origin: 'bottom', 631 viewFactor: 0.25, 632 opacity: 1, 633 // container: '#container', 634 beforeReveal: animatingClass 635 }) 636 637 ScrollReveal().reveal('.js-fade-up', { 638 delay: 250, 639 duration: 600, 640 distance: '16px', 641 origin: 'bottom', 642 viewFactor: 0.2, 643 // container: '#container', 644 beforeReveal: animatingClass 645 }) 646 647 ScrollReveal().reveal('.js-custom-reveal', { 648 delay: 300, 649 duration: 0, 650 distance: '0', 651 origin: 'top', 652 viewFactor: 0.3, 653 opacity: 1, 654 // container: '#container', 655 beforeReveal: animatingClass 656 }) 657} 658 659function revealText() { 660 // Used for scrollReveal when triggered 661 function animatingClass(el) { 662 el.classList.add('is-animating') 663 } 664 665 ScrollReveal().reveal('.js-fade-up-interval', { 666 delay: 250, 667 interval: 100, 668 duration: 600, 669 distance: '16px', 670 origin: 'bottom', 671 viewFactor: 0.2, 672 // container: '#container', 673 beforeReveal: animatingClass 674 }) 675 676 ScrollReveal().reveal('.js-fade-up-interval2', { 677 delay: 250, 678 interval: 100, 679 duration: 600, 680 distance: '16px', 681 origin: 'bottom', 682 viewFactor: 0.2, 683 // container: '#container', 684 beforeReveal: animatingClass 685 }) 686 687 ScrollReveal().reveal('.js-fade-up-interval3', { 688 delay: 250, 689 interval: 100, 690 duration: 600, 691 distance: '16px', 692 origin: 'bottom', 693 viewFactor: 0.2, 694 // container: '#container', 695 beforeReveal: animatingClass 696 }) 697 698 ScrollReveal().reveal('.js-fade-up', { 699 delay: 250, 700 duration: 600, 701 distance: '16px', 702 origin: 'bottom', 703 viewFactor: 0.2, 704 // container: '#container', 705 beforeReveal: animatingClass 706 }) 707 708 ScrollReveal().reveal('.js-fade-up-rte', { 709 delay: 250, 710 duration: 600, 711 distance: '16px', 712 origin: 'bottom', 713 // container: '#container', 714 beforeReveal: animatingClass 715 }) 716} 717 718function revealArticles() { 719 720 // Scroll reveal functions 721 // see : https://scrollrevealjs.org/api/reveal.html 722 723 // Used for scrollReveal when triggered 724 function animatingClass(el) { 725 el.classList.add('is-animating') 726 } 727 728 ScrollReveal().reveal('.js-image-scale-news', { 729 delay: 300, 730 scale: 1.2, 731 interval: 100, 732 duration: 1400, 733 distance: '0', 734 origin: 'bottom', 735 viewFactor: 0.25, 736 opacity: 1, 737 // container: '#container', 738 beforeReveal: animatingClass 739 }) 740 741 ScrollReveal().reveal('.js-fade-up-interval-news', { 742 delay: 250, 743 interval: 100, 744 duration: 600, 745 distance: '16px', 746 origin: 'bottom', 747 viewFactor: 0.2, 748 // container: '#container', 749 beforeReveal: animatingClass 750 }) 751 752 ScrollReveal().reveal('.js-fade-up-interval', { 753 delay: 250, 754 interval: 100, 755 duration: 600, 756 distance: '16px', 757 origin: 'bottom', 758 viewFactor: 0.2, 759 // container: '#container', 760 beforeReveal: animatingClass 761 }) 762} 763 764function faq(pcid) { 765 var $faq = $('div[pc-id=' + pcid + '] .faq'); 766 var $faqActiveClass = 'is-active' 767 var $faqSpeed = 400 768 $('.faq__title', $faq).each(function (i) { 769 $(this).on("click", function () { 770 if ($(this).parent().hasClass($faqActiveClass)) { 771 $(this).parent().removeClass($faqActiveClass) 772 $(this).next('.faq__content').slideUp($faqSpeed) 773 } else { 774 $(this).closest($faq).find('.faq__content').slideUp($faqSpeed) 775 $(this).closest($faq).find('.faq__item').removeClass($faqActiveClass) 776 $(this).parent().addClass($faqActiveClass) 777 $(this).next('.faq__content').slideDown($faqSpeed) 778 } 779 }) 780 }); 781} 782 783function loadBgVideo() { 784 // for background video fit and resizing 785 $('.jquery-background-video').bgVideo({ 786 fadeIn: 500, 787 pauseAfter: 0 788 }) 789} 790 791 792var swiperTransitionInterleaveOffset = 0.9; // Used for custom hero transition. 793var vWidth = 1007; 794
795////////////////// 796function heroCarousel() { 797 $('.hero__carousel').each(function (index, el) { 798 var newClass = 'hero__carousel_' + index 799 $(this).addClass(newClass) 800 var slides = $(this).find('.swiper-slide') 801 802 if (slides.length > 1) { 803 new Swiper('.' + newClass, { 804 loop: true, 805 speed: 600, 806 grabCursor: true, 807 watchSlidesProgress: true, 808 mousewheelControl: true, 809 keyboardControl: true, 810 loopedSlides: 1, 811 autoplay: { 812 delay: 5000, 813 disableOnInteraction: false, 814 }, 815 pagination: { 816 el: '.hero__carousel .swiper-pagination', 817 clickable: true, 818 renderBullet: function (index, className) { 819 return '<span class="' + className + '"> <svg class="pagination-circle" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2"><circle class="path circle" fill="none" stroke="#00E6A1" stroke-width="3" stroke-miterlimit="10" cx="65.1" cy="65.1" r="62.1" /></svg></span>'; 820 }, 821 }, 822 breakpoints: { 823 1025: { 824 direction: 'vertical', 825 } 826 }, 827 on: { 828 progress: function () { 829 if (window.navigator.userAgent.indexOf('Trident/') === -1) { 830 var swiper = this 831 var currentWindowWidth = $(document).width() 832 if (currentWindowWidth > vWidth) { 833 var innerOffset = swiper.height * swiperTransitionInterleaveOffset 834 } else { 835 var innerOffset = swiper.width * swiperTransitionInterleaveOffset 836 } 837 838 for (var i = 0; i < swiper.slides.length; i++) { 839 var slideProgress = swiper.slides[i].progress 840 var innerTranslate = slideProgress * innerOffset 841 842 if (currentWindowWidth > vWidth) { 843 swiper.slides[i].querySelector('.slide-inner').style.transform = 'translate3d(0,' + innerTranslate + 'px, 0)' 844 } else { 845 swiper.slides[i].querySelector('.slide-inner').style.transform = 'translate3d(' + innerTranslate + 'px,0, 0)' 846 } 847 } 848 } 849 }, 850 touchStart: function () { 851 if (window.navigator.userAgent.indexOf('Trident/') === -1) { 852 var swiper = this 853 for (var i = 0; i < swiper.slides.length; i++) { 854 swiper.slides[i].style.transition = '' 855 } 856 } 857 }, 858 setTransition: function (speed) { 859 860 if (window.navigator.userAgent.indexOf('Trident/') === -1) { 861 var swiper = this 862 for (var i = 0; i < swiper.slides.length; i++) { 863 swiper.slides[i].style.transition = speed + 'ms' 864 swiper.slides[i].querySelector(".slide-inner").style.transition = speed + "ms" 865 } 866 } 867 } 868 } 869 }) 870 } 871 else if (slides.length === 1) { 872 slides.addClass('swiper-slide-active'); 873 } 874 }) 875} 876 877function GetParameterValues(param) { 878 let reg = new RegExp("[?&]" + param + "=([^&#]*)", "i") 879 let queryString = reg.exec(window.location.href) 880 return queryString ? queryString[1] : null 881} 882 883function convertNewsArticleImages(htmlString) { 884 var htmlObject = $('<div>' + htmlString + '<div>'); // jquery call 885 var imgObject = htmlObject.find('img'); 886 887 for (i = 0; i < imgObject.length; i++) { 888 var wrapper = $(`<div class="rte__image"><div class="image-reveal-container"></div><div class="rte__image__pattern"> 889<svg width="120" class="pattern" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg"> 890 <path d="M4.29294 0H5.70715L0 5.70715L0 4.29294L4.29294 0Z" class="fill"/> 891 <path d="M0 14.2929V15.7072L15.7072 0H14.2929L0 14.2929Z" class="fill"/> 892 <path d="M24.2929 0L0 24.2929L0 25.7072L25.7072 0H24.2929Z" class="fill"/> 893 <path d="M34.2929 0L0 34.2929V35.7072L35.7072 0H34.2929Z" class="fill"/> 894 <path d="M44.2929 0L0 44.2929L0 45.7072L45.7072 0H44.2929Z" class="fill"/> 895 <path d="M54.2929 0L0 54.2929V55.7072L55.7072 0H54.2929Z" class="fill"/> 896 <path d="M64.2929 0L0 64.2929L0 65.7072L65.7072 0H64.2929Z" class="fill"/> 897 <path d="M74.2929 0L0 74.2929V75.7072L75.7072 0H74.2929Z" class="fill"/> 898 <path d="M84.2929 0L0 84.2929L0 85.7072L85.7072 0H84.2929Z" class="fill"/> 899 <path d="M94.2929 0L0 94.2929V95.7072L95.7072 0H94.2929Z" class="fill"/> 900 <path d="M104.293 0L0 104.293L0 105.707L105.707 0H104.293Z" class="fill"/> 901 <path d="M114.293 0L0 114.293V115.707L115.707 0H114.293Z" class="fill"/> 902 <path d="M120 4.29294L4.29294 120H5.70715L120 5.70715V4.29294Z" class="fill"/> 903 <path d="M120 14.2929L14.2929 120H15.7072L120 15.7072V14.2929Z" class="fill"/> 904 <path d="M120 24.2929L24.2929 120H25.7072L120 25.7072V24.2929Z" class="fill"/> 905 <path d="M120 34.2929L34.2929 120H35.7072L120 35.7072V34.2929Z" class="fill"/> 906 <path d="M120 44.2929L44.2929 120H45.7071L120 45.7072V44.2929Z" class="fill"/> 907 <path d="M120 54.2929L54.2929 120H55.7071L120 55.7072V54.2929Z" class="fill"/> 908 <path d="M120 64.2929L64.2929 120H65.7071L120 65.7072V64.2929Z" class="fill"/> 909 <path d="M120 74.2929L74.2929 120H75.7071L120 75.7072V74.2929Z" class="fill"/> 910 <path d="M120 84.2929L84.2929 120H85.7071L120 85.7072V84.2929Z" class="fill"/> 911 <path d="M120 94.2929L94.2929 120H95.7072L120 95.7072V94.2929Z" class="fill"/>
912 <path d="M120 104.293L104.293 120H105.707L120 105.707V104.293Z" class="fill"/> 913 <path d="M120 114.293L114.293 120H115.707L120 115.707V114.293Z" class="fill"/> 914</svg> 915 </div></div>`); 916 wrapper.find('.image-reveal-container').prepend(imgObject[i].outerHTML); 917 //$(htmlObject).find('img').replaceWith($(wrapper[0])); 918 $(imgObject[i]).replaceWith($(wrapper[0])); 919 } 920 921 return $(htmlObject)[0].outerHTML; 922} 923 924function convertNewsArticleImagesSg(htmlString) { 925 var htmlObject = $('<div>' + htmlString + '<div>'); // jquery call 926 var imgObject = htmlObject.find('img'); 927 928 for (i = 0; i < imgObject.length; i++) { 929 var wrapper = $(`<div class="rte__image"><div class="image-reveal-container"></div><div class="rte__image__pattern"> 930<svg width="64" height="192" viewBox="0 0 64 192" fill="none" xmlns="http://www.w3.org/2000/svg"> 931<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0369 18.6211C7.31581 23.3885 4.28353 28.0852 4.91213 33.823C5.35085 37.9106 8.67275 41.8804 10.7924 45.2493C18.7094 57.7938 17.8338 57.3267 32.89 57.0619C47.8486 56.8344 46.9932 57.3243 53.874 44.6051C55.2623 42.0343 56.7637 39.4892 57.8883 36.7691C58.9589 34.1557 59.356 30.3178 58.3473 27.5587C57.1278 24.1565 54.7328 21.082 52.797 18.0823C44.8747 5.9533 45.7221 6.41391 31.0002 6.51669C16.1677 6.71335 17.0166 6.25176 10.015 18.5864L10.0369 18.6211Z" fill="#8AC2E6" fill-opacity="0.35"/> 932<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0369 82.6211C7.31581 87.3885 4.28353 92.0852 4.91213 97.823C5.35085 101.911 8.67275 105.88 10.7924 109.249C18.7094 121.794 17.8338 121.327 32.89 121.062C47.8486 120.834 46.9932 121.324 53.874 108.605C55.2623 106.034 56.7637 103.489 57.8883 100.769C58.9589 98.1557 59.356 94.3178 58.3473 91.5587C57.1278 88.1565 54.7328 85.082 52.797 82.0823C44.8747 69.9533 45.7221 70.4139 31.0002 70.5167C16.1677 70.7133 17.0166 70.2518 10.015 82.5864L10.0369 82.6211Z" fill="#8AC2E6" fill-opacity="0.35"/> 933<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0369 146.621C7.31581 151.389 4.28353 156.085 4.91213 161.823C5.35085 165.911 8.67275 169.88 10.7924 173.249C18.7094 185.794 17.8338 185.327 32.89 185.062C47.8486 184.834 46.9932 185.324 53.874 172.605C55.2623 170.034 56.7637 167.489 57.8883 164.769C58.9589 162.156 59.356 158.318 58.3473 155.559C57.1278 152.156 54.7328 149.082 52.797 146.082C44.8747 133.953 45.7221 134.414 31.0002 134.517C16.1677 134.713 17.0166 134.252 10.
933015 146.586L10.0369 146.621Z" fill="#8AC2E6" fill-opacity="0.35"/> 934</svg> 935 </div></div>`); 936 wrapper.find('.image-reveal-container').prepend(imgObject[i].outerHTML); 937 //$(htmlObject).find('img').replaceWith($(wrapper[0])); 938 $(imgObject[i]).replaceWith($(wrapper[0])); 939 } 940 941 return $(htmlObject)[0].outerHTML; 942} 943 944function convertNewsArticleImagesEg(htmlString) { 945 var htmlObject = $('<div>' + htmlString + '<div>'); 946 var imgObject = htmlObject.find('img'); 947 for (i = 0; i < imgObject.length; i++) { 948 var wrapper = $(`<div class="rte__image"><div class="image-reveal-container"></div></div>`); 949 wrapper.find('.image-reveal-container').prepend(imgObject[i].outerHTML); 950 $(imgObject[i]).replaceWith($(wrapper[0])); 951 } 952 return $(htmlObject)[0].outerHTML; 953} 954 955function convertNewsiFramesEg(htmlString) { 956 var htmlObject = $('<div>' + htmlString + '<div>'); 957 var imgObject = htmlObject.find('iframe'); 958 for (i = 0; i < imgObject.length; i++) { 959 var wrapper = $(`<div class="rte__iframe"><div class="video__container"></div></div>`); 960 wrapper.find('.video__container').prepend(imgObject[i].outerHTML); 961 $(imgObject[i]).replaceWith($(wrapper[0])); 962 } 963 return $(htmlObject)[0].outerHTML; 964} 965 966function convertLinkButtons(htmlString) { 967 var htmlObject = $('<div>' + htmlString + '<div>'); 968 var linkButtonObject = htmlObject.find('.btn-link'); 969 for (i = 0; i < linkButtonObject.length; i++) { 970 var linkText = linkButtonObject[i].innerHTML; 971 var linkHref = linkButtonObject[i].href; 972 var linkTarget = linkButtonObject[i].target; 973 var wrapper = $(`<div class="button-container"><a class="button button--primary" href="` + linkHref + `" target="` + linkTarget + `"></a></div>`); 974 wrapper.find('.button--primary').prepend('<span class="button__text">' + linkText + '</span><span class="button__icon"><svg class="icon-arrow"><use xlink:href="#icon-arrow"></use></svg></span>'); 975 $(linkButtonObject[i]).replaceWith($(wrapper[0])); 976 } 977 return $(htmlObject)[0].outerHTML; 978} 979 980// Events 981var eventsCarouselObj = {}; 982function eventsCarousel() { 983 $('.events__carousel').each(function (index, elem) { 984 var currentTranslate = 0; 985 var controlId = $(this).parents('.pc-root-container').attr('pc-id'); 986 if (!!eventsCarouselObj['events__carousel-' + controlId]) { 987 var swiper = eventsCarouselObj['events__carousel-' + controlId]; 988 swiper.update(); 989 } else { 990 eventsCarouselObj['events__carousel-' + controlId] = new Swiper(elem, { 991 virtualTranslate: 'true', 992 slidesPerView: 'auto', 993 watchSlidesProgress: true, 994 spaceBetween: 16, 995 pagination: { 996 el: '.swiper-pagination', 997 type: 'progressbar', 998 }, 999 navigation: { 1000 nextEl: '.swiper-button-next', 1001 prevEl: '.swiper-button-prev' 1002 }, 1003 on: { 1004 init: function () { 1005 var swiper = this 1006 var slideCount = swiper.slides.length; 1007 1008 if (slideCount < 10) { 1009 slideTotal = '0' + slideCount 1010 } else { 1011 slideTotal = slideCount 1012 } 1013 1014 var swiperSlideLength = document.createTextNode("" + slideTotal + ""); 1015 swiper.el.querySelector('.carousel__count--total').innerHTML = ''; 1016 if (swiper.el.querySelector('.carousel__count--total')) { 1017 swiper.el.querySelector('.carousel__count--total').appendChild(swiperSlideLength); 1018 } 1019 }, 1020 update: function () { 1021 var swiper = this 1022 var slideCount = swiper.slides.length; 1023 1024 if (slideCount < 10) { 1025 slideTotal = '0' + slideCount 1026 } else { 1027 slideTotal = slideCount 1028 } 1029 1030 var swiperSlideLength = document.createTextNode("" + slideTotal + ""); 1031 swiper.el.querySelector('.carousel__count--total').innerHTML = ''; 1032 if (swiper.el.querySelector('.carousel__count--total')) { 1033 swiper.el.querySelector('.carousel__count--total').appendChild(swiperSlideLength); 1034 } 1035 }, 1036 setTranslate: function (translate) { 1037 1038 var swiper = this 1039 var delay = 0 1040 var delayAmount = 0.025 1041 1042 if (currentTranslate > translate) {
1043 delay = 0 1044 for (var i = 0; i < swiper.slides.length; i++) { 1045 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 1046 swiper.slides[i].style.transitionDelay = '' + delay + 's' 1047 delay = delay + delayAmount; 1048 } 1049 1050 } else { 1051 delay = swiper.slides.length * delayAmount 1052 for (var i = 0; i < swiper.slides.length; i++) { 1053 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 1054 swiper.slides[i].style.transitionDelay = '' + delay + 's' 1055 delay = delay - delayAmount; 1056 } 1057 } 1058 currentTranslate = translate 1059 return currentTranslate; 1060 } 1061 } 1062 }); 1063 } 1064 }) 1065} 1066 1067// Tiles 1068function tilesCarousel() { 1069 $('.tiles__carousel').each(function (index, elem) { 1070 var currentTranslate = 0; 1071 new Swiper(elem, { 1072 virtualTranslate: 'true', 1073 slidesPerView: 'auto', 1074 watchSlidesProgress: true, 1075 spaceBetween: 16, 1076 breakpoints: { 1077 640: { 1078 slidesPerView: 'auto', 1079 spaceBetween: 16 1080 }, 1081 768: { 1082 slidesPerView: 'auto', 1083 spaceBetween: 16 1084 }, 1085 1100: { 1086 slidesPerView: 'auto', 1087 spaceBetween: 32 1088 } 1089 }, 1090 pagination: { 1091 el: '.swiper-pagination', 1092 type: 'progressbar', 1093 }, 1094 navigation: { 1095 nextEl: jQuery(elem).siblings('.block-header').find('.sw-r'), 1096 prevEl: jQuery(elem).siblings('.block-header').find('.sw-l') 1097 }, 1098 on: { 1099 init: function () { 1100 var swiper = this 1101 var slideCount = swiper.slides.length; 1102 1103 if (slideCount < 10) { 1104 slideTotal = '0' + slideCount 1105 } else { 1106 slideTotal = slideCount 1107 } 1108 1109 var swiperSlideLength = document.createTextNode("" + slideTotal + ""); 1110 const count = swiper.el.querySelector('.carousel__count--total'); 1111 if (count) { 1112 count.innerHTML = ''; 1113 count.appendChild(swiperSlideLength); 1114 } 1115 }, 1116 setTranslate: function (translate) { 1117 1118 var swiper = this 1119 var delay = 0 1120 var delayAmount = 0.025 1121 1122 if (currentTranslate > translate) { 1123 delay = 0 1124 for (var i = 0; i < swiper.slides.length; i++) { 1125 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 1126 swiper.slides[i].style.transitionDelay = '' + delay + 's' 1127 delay = delay + delayAmount; 1128 } 1129 1130 } else { 1131 delay = swiper.slides.length * delayAmount 1132 for (var i = 0; i < swiper.slides.length; i++) { 1133 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 1134 swiper.slides[i].style.transitionDelay = '' + delay + 's' 1135 delay = delay - delayAmount; 1136 } 1137 } 1138 currentTranslate = translate 1139 return currentTranslate; 1140 } 1141 } 1142 }) 1143 }) 1144} 1145 1146 1147function tableScrollReveal() { 1148 1149 // Used for scrollReveal when triggered 1150 function animatingClass(el) { 1151 el.classList.add('is-animating') 1152 } 1153 1154 ScrollReveal().reveal('.js-fade-up-interval', { 1155 delay: 250, 1156 interval: 100, 1157 duration: 600, 1158 distance: '16px', 1159 origin: 'bottom', 1160 viewFactor: 0.2, 1161 // container: '#container', 1162 beforeReveal: animatingClass 1163 }) 1164} 1165 1166function galleryCarousel(spaceBetweenValue = 140, spaceBetweenValueSmallerView = 64, spaceBetweenValueMobile = 16) { 1167 $('.gallery__carousel').each(function (index, elem) { 1168 new Swiper(elem, { 1169 speed: 500, 1170 slidesPerView: 1, 1171 spaceBetween: spaceBetweenValueMobile, 1172 centeredSlides: true, 1173 watchSlidesProgress: true, 1174 loopedSlides: 3, 1175 loop: true, 1176 breakpoints: { 1177 768: { 1178 slidesPerView: 1, 1179 spaceBetween: spaceBetweenValueSmallerView, 1180 centeredSlides: true 1181 }, 1182 980: { 1183 slidesPerView: 1, 1184 spaceBetween: spaceBetweenValue, 1185 centeredSlides: true 1186 }, 1187 }, 1188 pagination: { 1189 el: '.gallery__carousel .swiper-pagination', 1190 type: 'progressbar', 1191 }, 1192 navigation: { 1193 nextEl: '.swiper-button-next', 1194 prevEl: '.swiper-button-prev' 1195 }, 1196 on: { 1197 init: function () { 1198 var swiper = this 1199 var slideCount = swiper.slides.length - 6; 1200 1201 if (slideCount < 10) { 1202 slideTotal = '0' + slideCount 1203 } else { 1204 slideTotal = slideCount 1205 } 1206 1207 var swiperSlideLength = document.createTextNode("" + slideTotal + ""); 1208 if (swiper.el.querySelector('.carousel__count--total')) { 1209 swiper.el.querySelector('.carousel__count--total').innerHTML = ''; 1210 swiper.el.querySelector('.carousel__count--total').appendChild(swiperSlideLength); 1211 } 1212 } 1213 } 1214 }) 1215 }) 1216} 1217 1218function newsFeatured() { 1219 $('.news-featured-swiper').each(function (index, elem) { 1220 var currentTranslate = 0; 1221 new Swiper(elem, { 1222 virtualTranslate: 'true', 1223 slidesPerView: 'auto', 1224 watchSlidesProgress: true, 1225 breakpoints: { 1226 640: { 1227 slidesPerView: 'auto', 1228 }, 1229 768: { 1230 slidesPerView: 'auto', 1231 } 1232 }, 1233 pagination: { 1234 el: '.news-featured-swiper .swiper-pagination', 1235 type: 'progressbar', 1236 }, 1237 navigation: { 1238 nextEl: jQuery(elem).siblings('.block-header').find('.sw-r'), 1239 prevEl: jQuery(elem).siblings('.block-header').find('.sw-l') 1240 }, 1241 on: { 1242 setTranslate: function (translate) { 1243 1244 var swiper = this
1245 var delay = 0 1246 var delayAmount = 0.025 1247 1248 if (currentTranslate > translate) { 1249 delay = 0 1250 for (var i = 0; i < swiper.slides.length; i++) { 1251 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 1252 swiper.slides[i].style.transitionDelay = '' + delay + 's' 1253 delay = delay + delayAmount; 1254 } 1255 1256 } else { 1257 delay = swiper.slides.length * delayAmount 1258 for (var i = 0; i < swiper.slides.length; i++) { 1259 swiper.slides[i].style.transform = 'translate(' + translate + 'px' + ', 0px)' 1260 swiper.slides[i].style.transitionDelay = '' + delay + 's' 1261 delay = delay - delayAmount; 1262 } 1263 } 1264 currentTranslate = translate 1265 return currentTranslate; 1266 } 1267 } 1268 }) 1269 }) 1270} 1271 1272function initResourceHubBlockSlider(className) { 1273 $('.' + className + ' .resources__swiper').each(function (index, elem) { 1274 new Swiper(elem, { 1275 slidesPerView: 1.1, 1276 slidesPerGroup: 1, 1277 spaceBetween: 8, 1278 breakpoints: { 1279 1024: { 1280 slidesPerView: 3, 1281 slidesPerGroup: 3, 1282 spaceBetween: 30, 1283 navigation: { 1284 nextEl: jQuery(elem).parent('.resources__block--tiles').find('.swiper-button-next'), 1285 prevEl: jQuery(elem).parent('.resources__block--tiles').find('.swiper-button-prev') 1286 } 1287 } 1288 }, 1289 pagination: { 1290 el: '.resources__swiper swiper-pagination', 1291 clickable: true 1292 }, 1293 navigation: { 1294 nextEl: '.swiper-button-next', 1295 prevEl: '.swiper-button-prev' 1296 }, 1297 on: { 1298 init: function () { 1299 jQuery(elem).parent('.resources__block--tiles').find('.swiper-button-prev').removeClass('hide'); 1300 jQuery(elem).parent('.resources__block--tiles').find('.swiper-button-next').removeClass('hide'); 1301 } 1302 } 1303 }) 1304 }) 1305} 1306 1307//function viewAllRealatedNews(tags) { 1308// window.open(`/news?tags=${tags}`); 1309//} 1310 1311 1312function preventBackgroundScroll() { 1313 // When DIV overlay is shown, prevent background scroll. 1314 document.body.style.position = 'fixed'; 1315 document.body.style.top = `-${window.scrollY}px`; 1316} 1317 1318function normaliseBackgroundScroll(element) { 1319 // When DIV overlay is hidden (or closed), normalise page scroll. 1320 document.body.style.position = ''; 1321 document.body.style.top = ''; 1322 1323 var rec = document.getElementById(element).getBoundingClientRect(); 1324 var pos = { top: rec.top + window.scrollY - 100, left: rec.left + window.scrollX }; 1325 window.scrollTo(pos.left, pos.top); 1326} 1327 1328 1329 1330 1331/** 1332* ============================== 1333* BoF: Reusable modal dialogs 1334* ============================== 1335* @param message Message to be displayed on the modal. 1336* @param yesButtonText [Optional] text to be displayed on the yes button. Pass undefined to have it use the default button text. 1337* @param cancelButtonText [Optional] text to be displayed on the cancel button. Pass undefined to have it use the default button text. 1338*/ 1339async function userConfirmationModal(htmlMessage, yesButtonText, cancelButtonText) { 1340 let modal = new Promise(function (resolve, reject) { 1341 if (!$('.user-custom__confirmation-modal').length) { 1342 $('body').prepend( 1343 '<div id="userCustomConfirmModal" class="modal admin-view user-custom__confirmation-modal" tabindex="-1" role="dialog" aria-labelledby="customUserConfirmModalLabel" aria-hidden="true" data-backdrop="static" keyboard="false">' + 1344 ' <div class="modal-dialog modal-dialog-centered" role="document">' + 1345 ' <div class="modal-content">' + 1346 ' <div class="modal-body">' + 1347 ' <div id="confirm-dialog-text" class="text-align-center">' + 1348 ' <span>New confirmation message must be appended here.</span>' + 1349 ' </div>' + 1350 ' </div>' + 1351 ' <div class="modal-footer">' + 1352 ' <button id="btnConfirmCancel" type="button" class="btn btn-secondary btn-lg" data-dismiss="modal" aria-label="Close">No</button>' + 1353 ' <button id="btnConfirmYes" type="button" class="btn btn-primary btn-lg">Yes</button>' + 1354 ' </div>' + 1355 ' </div>' + 1356 ' </div>' + 1357 '</div>' 1358 ) 1359 } 1360 1361 let modalId = '#userCustomConfirmModal'; 1362 let confirmButton = `${modalId} #btnConfirmYes`; 1363 let cancelButton = `${modalId} #btnConfirmCancel`; 1364 1365 $(modalId).on('show.bs.modal', function (e) {
1366 $(modalId).find('.modal-body > div#confirm-dialog-text').empty().append(htmlMessage); 1367 1368 if (yesButtonText) { 1369 $(confirmButton).html(yesButtonText); 1370 } 1371 if (cancelButtonText) { 1372 $(cancelButton).html(cancelButtonText); 1373 } 1374 }); 1375 1376 $(modalId).modal('show'); 1377 1378 $(confirmButton).off('click').click(function () { 1379 $(modalId).modal('hide'); 1380 $('.user-custom__confirmation-modal').remove(); 1381 resolve(true); 1382 }); 1383 1384 $(cancelButton).off('click').click(function () { 1385 $(modalId).modal('hide'); 1386 $('.user-custom__confirmation-modal').remove(); 1387 reject(false); 1388 }); 1389 }); 1390 1391 await modal; 1392} 1393 1394 1395/** 1396* @param message Message to be displayed on the modal. 1397* @param buttonText [Optional] text to be displayed on the close button. Pass undefined to have it use the default button text. 1398*/ 1399function userMessageModal(htmlMessage, buttonText) { 1400 if (!$('.user-custom__message-modal').length) { 1401 $('body').prepend( 1402 '<div id="userCustomMessageModal" class="modal admin-view user-custom__message-modal" tabindex="-1" role="dialog" aria-labelledby="userCustomMessageModalLabel" aria-hidden="true" data-backdrop="static" keyboard="false">' + 1403 ' <div class="modal-dialog modal-dialog-centered" role="document">' + 1404 ' <div class="modal-content">' + 1405 ' <div class="modal-body">' + 1406 ' <div id="message-dialog-text" class="text-align-center">' + 1407 ' <span>New message must be appended here.</span>' + 1408 ' </div>' + 1409 ' </div>' + 1410 ' <div class="modal-footer">' + 1411 ' <button id="btnMessageClose" type="button" class="btn btn-secondary btn-lg" data-dismiss="modal" aria-label="Close">Close</button>' + 1412 ' </div>' + 1413 ' </div>' + 1414 ' </div>' + 1415 '</div>' 1416 ) 1417 } 1418 1419 1420 let modalId = '#userCustomMessageModal'; 1421 let closeButton = `${modalId} #btnMessageClose`; 1422 1423 $(modalId).on('show.bs.modal', function (e) { 1424 $(modalId).find('.modal-body > div#message-dialog-text').empty().append(htmlMessage); 1425 1426 if (buttonText) { 1427 $(closeButton).html(buttonText); 1428 } 1429 }); 1430 1431 $(modalId).modal('show'); 1432 1433 $(closeButton).off('click').click(function () { 1434 $(modalId).modal('hide'); 1435 }); 1436} 1437/** 1438 * EoF: Reusable modal dialogs 1439 * */ 1440 1441 1442 1443function portraitVideoModal() { 1444 let scrollValue = 0; 1445 1446 function playPortraitVideo() { 1447 if (!$('.video-modal').length) { 1448 $('body').prepend( 1449 '<div class="video-modal">' + 1450 ' <div class="video-modal__overlay">' + 1451 ' <span class="video-modal__close large-screens button">' + 1452 ' <svg class="icon-close">' + 1453 ' <use xlink:href="#icon-close"></use>' + 1454 ' </svg>' + 1455 ' </span>' + 1456 ' <div class="container">' + 1457 ' <div class="video-modal__overlay no-bg">' + 1458 ' <div class="row u_justify-center">' + 1459 ' <div class="col-12 p-0">' + 1460 ' <div class="video-modal__inner">' + 1461 ' <div class="video-modal__close-container">' + 1462 ' <span class="video-modal__close small-screens button">' + 1463 ' <svg class="icon-close">' + 1464 ' <use xlink:href="#icon-close"></use>' + 1465 ' </svg>' + 1466 ' </span>' + 1467 ' </div>' + 1468 ' <div class="video-modal__portrait">' + 1469 ' <iframe width="425" height="755" src="' + $(this).attr('data-video') + '" frameborder="0" allow="autoplay; fullscreen" allowfullscreen"true"></iframe>' + 1470 ' </div>' + 1471 ' </div>' + 1472 ' </div>' + 1473 ' </div>' + 1474 ' </div>' + 1475 ' </div>' + 1476 ' </div>' + 1477 '</div>' 1478 ) 1479 } 1480 1481 scrollValue = $(document).scrollTop(); 1482 $('body').addClass('video-modal-is-active'); 1483 } 1484 1485 function closePortraitVideo() { 1486 $('body').removeClass('video-modal-is-active') 1487 $('.video-modal').remove(); 1488 $(document).scrollTop(scrollValue); 1489 } 1490 1491 $(document).off('click', '.video-modal__overlay', closePortraitVideo).on('click', '.video-modal__overlay', closePortraitVideo); 1492 $(document).off('click', '.video-modal__close', closePortraitVideo).on('click', '.video-modal__close', closePortraitVideo); 1493 $(document).off('click', '.vbg__btn-play', playPortraitVideo).on('click', '.vbg__btn-play', playPortraitVideo); 1494 1495}
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.