1//----------------------------------------------------------------------------------------- 2// 3// 4// Variables 5// 6// 7//----------------------------------------------------------------------------------------- 8// 9//----------------------------------------------------------- 10// 11// SVG 12// 13//----------------------------------------------------------- 14// 15var SVG = { 16 'arrow-left-mobile': '<svg class="svg-arrow-mobile" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 37.414"><path class="svg-colored" fill="none" stroke="#000" stroke-width="3" d="m27.5 36.707-18-18 18-18"/></svg>', 17 'arrow-right-mobile': '<svg class="svg-arrow-mobile" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 37.414"><path class="svg-colored" fill="none" stroke="#000" stroke-width="3" d="m9.5 36.707 18-18-18-18"/></svg>', 18 'arrow-left-chevron': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 37.414"><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="m27.5 36.707-18-18 18-18"/></svg>', 19 'arrow-right-chevron': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 37.414"><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="m9.5 36.707 18-18-18-18"/></svg>', 20 'arrow-left-chevron-square': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 38"><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="M37 37H1V1h36Z"/><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="m24.539 28.693-11.077-9.734 11.077-9.651"/></svg>', 21 'arrow-right-chevron-square': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 38"><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="M37 37H1V1h36Z"/><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="m13.462 28.693 11.077-9.734-11.077-9.651"/></svg>', 22 'arrow-left-arrow-square': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 38"><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="M1 1h36v36H1zm36 18H10.551"/><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="m16.408 24.896-5.857-5.939L16.408 13"/></svg>', 23 'arrow-right-arrow-square': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 38"><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="M1 1h36v36H1zm0 18h26.45"/><path class="svg-colored" fill="none" stroke="#000" stroke-width="2" d="m21.594 13 5.86 5.943-5.86 5.96"/></svg>', 24 'arrow-left-chevron-curve': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 38.828"><path class="svg-colored" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" d="m26.408 37.414-14.22-14.22a5.762 5.762 0 0 1 0-8.149l6.174-6.174 7.456-7.457"/></svg>', 25 'arrow-right-chevron-curve': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 38.828"><path class="svg-colored" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" d="m10.5 1.414 14.22 14.22a5.762 5.762 0 0 1 0 8.149l-6.174 6.174-7.46 7.457"/></svg>', 26 'arrow-left-arrow': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 36"><path class="svg-colored" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" d="M37 18.407H1"/><path class="svg-colored" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" stroke-linejoin="round" d="M13.217 30.814 1 18.426 13.217 6"/></svg>', 27 'arrow-right-arrow': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 36"><path class="svg-colored" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" d="M1 18.407h36"/><path class="svg-colored" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" stroke-linejoin="round" d="M24.787 6 37 18.386 24.787 30.814"/></svg>', 28 'arrow-left-chevron-circle': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 38"><g class="svg-colored" fill="none" stroke="#000" stroke-width="2" transform="translate(-753 -326)"><circle cx="18" cy="18" r="18" transform="translate(754 327)"/><path d="m774.302 339.488-5.6 5.6 5.6 5.6"/></g></svg>', 29 'arrow-right-chevron-circle': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 38"><g class="svg-colored" fill="none" stroke="#000" stroke-width="2" transform="translate(-816 -328)"><circle cx="18" cy="18" r="18" transform="translate(817 329)"/><path d="m832.698 352.512 5.6-5.6-5.6-5.6"/></g></svg>' 30}; 31//----------------------------------------------------------------------------------------- 32// 33// 34// Helper Functions 35// 36// 37//----------------------------------------------------------------------------------------- 38// 39//----------------------------------------------------------- 40// 41// Debounce 42// 43//----------------------------------------------------------- 44// 45function _debounce(func, wait, immediate) { 46 var timeout; 47 return function () { 48 var context = this, args = arguments; 49 var later = function () { 50 timeout = null;
51 if (!immediate) func.apply(context, args); 52 }; 53 var callNow = immediate && !timeout; 54 clearTimeout(timeout); 55 timeout = setTimeout(later, wait); 56 if (callNow) func.apply(context, args); 57 }; 58} 59 60//----------------------------------------------------------- 61// 62// Is IE Version 63// 64//----------------------------------------------------------- 65// 66function _isIEVersion() { 67 var ua = window.navigator.userAgent; 68 var msie = ua.indexOf('MSIE '); 69 var trident = ua.indexOf('Trident/'); 70 71 if (msie > 0) { 72 // IE 10 or older => return version number 73 return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 74 } 75 76 if (trident > 0) { 77 // IE 11 => return version number 78 var rv = ua.indexOf('rv:'); 79 return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 80 } 81 82 return false; 83} 84 85//----------------------------------------------------------- 86// 87// Is Mobile Devices 88// 89//----------------------------------------------------------- 90// 91function _isMobileDevices() { 92 if (is.mobile() || is.tablet()) { 93 return true; 94 } else { 95 return false; 96 } 97} 98 99//----------------------------------------------------------- 100// 101// Is Minimum Browser Width 102// 103//----------------------------------------------------------- 104// 105function _isMinBrowserWidth(width) { 106 107 // Return Boolean 108 // 109 return window.matchMedia("(min-width: " + width + "px)").matches; 110} 111 112//----------------------------------------------------------- 113// 114// Is Maximum Browser Width 115// 116//----------------------------------------------------------- 117// 118function _isMaxBrowserWidth(width) { 119 120 // Return Boolean 121 // 122 return window.matchMedia("(max-width: " + width + "px)").matches; 123} 124 125//----------------------------------------------------------- 126// 127// Has URL Query 128// 129//----------------------------------------------------------- 130// 131function _hasUrlQuery(uri) { 132 return uri.indexOf("?") > 0; 133} 134 135//----------------------------------------------------------- 136// 137// Remove URL Query 138// 139//----------------------------------------------------------- 140// 141function _removeUrlQuery(uri) { 142 return uri.substring(0, uri.indexOf("?")); 143} 144 145//----------------------------------------------------------- 146// 147// Get URL Query 148// 149//----------------------------------------------------------- 150// 151function _getUrlQuery() { 152 var vars = [], hash; 153 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 154 for (var i = 0; i < hashes.length; i++) { 155 hash = hashes[i].split('='); 156 vars.push(hash[0]); 157 vars[hash[0]] = hash[1]; 158 } 159 return vars; 160} 161 162//----------------------------------------------------------- 163// 164// Get File Extension from String 165// 166//----------------------------------------------------------- 167// 168function _getFileExtension(file) { 169 return file.substr((file.lastIndexOf('.') + 1)); 170} 171 172//----------------------------------------------------------- 173// 174// Convert Extension to File Type
175// 176//----------------------------------------------------------- 177// 178function _convertFileExtensionToFileType(extension) { 179 if (typeof extension !== 'string') { 180 return console.log('The parameter for _convertFileExtensionToFileType() function is not a string'); 181 } 182 183 var ext = extension.toLowerCase(); 184 185 switch (ext) { 186 case 'png': 187 case 'jpg': 188 case 'jpeg': 189 case 'gif': 190 case 'webp': 191 case 'heic': 192 case 'heif': 193 return 'image'; 194 case 'txt': 195 return 'txt'; 196 case 'pdf': 197 return 'pdf'; 198 case 'xls': 199 case 'xlsx': 200 return 'excel'; 201 case 'doc': 202 case 'docx': 203 return 'word'; 204 case 'ppt': 205 case 'pptx': 206 return 'powerpoint'; 207 case 'mp4': 208 case 'mov': 209 case 'wmv': 210 case 'flv': 211 case 'avi': 212 case 'avchd': 213 return 'video'; 214 default: 215 return 'unknown'; 216 } 217} 218 219//----------------------------------------------------------------------------------------- 220// 221// 222// Init 223// 224// 225//----------------------------------------------------------------------------------------- 226// 227//----------------------------------------------------------- 228// 229// Init ScrollMagic Controller 230// 231//----------------------------------------------------------- 232// 233var SMController = new ScrollMagic.Controller(); 234 235 236//----------------------------------------------------------------------------------------- 237// 238// 239// Morweb Modifications 240// 241// 242//----------------------------------------------------------------------------------------- 243// 244//----------------------------------------------------------- 245// 246// Fix "._overflow-hidden" class ajax issue on <body> 247// 248//----------------------------------------------------------- 249// 250$(document).ajaxComplete(function(event, request, settings) { 251 $('body').removeClass('_overflow-hidden'); 252}); 253 254 255//----------------------------------------------------------------------------------------- 256// 257// 258// Theme Functions 259// 260// 261//----------------------------------------------------------------------------------------- 262// 263// ----------------------------------------------------------- 264// 265// Root CSS 266// 267//----------------------------------------------------------- 268// 269function handleRootCSS() { 270 271 setRootCSS(); 272 273 $(window).on('resize', _debounce(function () { 274 setRootCSS(); 275 }, 250)); 276 277 $(document).on('click', '._js-reset-root-css', function () { 278 setRootCSS(); 279 }); 280 281 $(document).ajaxComplete(function (event, request, settings) { 282 setRootCSS(); 283 }); 284 285 function setRootCSS() { 286 $('html').attr('style', 287 '--vh:' + ($(window).innerHeight() * 0.01).toFixed(2) + 'px;' + 288 '--header-height:' + $('.header-wrap').outerHeight() + 'px;' + 289 '--header-main-height:' + $('.header-main').outerHeight() + 'px;' 290 ); 291 } 292} 293 294//----------------------------------------------------------- 295// 296// Browser Version 297// 298//----------------------------------------------------------- 299// 300function handleBrowserVersion() { 301 302 // Check browser compatibility 303 // 304 if (_isIEVersion() !== false && _isIEVersion() < 10) { 305 $('html').addClass('_outdated-browser'); 306 } 307 308 if (is.ie()) { 309 $('html').addClass('is-ie'); 310 } 311 312 if (is.edge()) { 313 $('html').addClass('is-edge'); 314 } 315 316 if (is.desktop()) { 317 $('html').addClass('is-desktop'); 318 } 319 320 if (is.mobile()) { 321 $('html').addClass('is-mobile'); 322 } 323 324 if (is.tablet()) { 325 $('html').addClass('is-tablet'); 326 } 327 328 if (is.touchDevice()) { 329 $('html').addClass('is-touch-device'); 330 } 331} 332 333//----------------------------------------------------------- 334// 335// Scroll To Top 336// 337//----------------------------------------------------------- 338// 339function handleScrollTop() { 340 $("._js-scroll-top").on('click', function (e) { 341 e.preventDefault(); 342 $('html, body').animate({scrollTop: 0}, 'slow'); 343 }); 344} 345 346//----------------------------------------------------------- 347// 348// Image Popup 349// 350//----------------------------------------------------------- 351// 352function handleImagePopup() { 353 init(); 354 355 $(document).ajaxComplete(function () { 356 init(); 357 }); 358
359 function init() { 360 $('._js-img-popup').magnificPopup({ 361 type: 'image', 362 closeBtnInside: false, 363 closeOnContentClick: false, 364 image: { 365 verticalFit: true, 366 titleSrc: 'title' 367 }, 368 gallery: { 369 enabled: true 370 } 371 }); 372 } 373} 374 375//----------------------------------------------------------- 376// 377// Video Popup 378// 379//----------------------------------------------------------- 380// 381function handleVideoPopup() { 382 init(); 383 384 $(document).ajaxComplete(function () { 385 init(); 386 }); 387 388 function init() { 389 $('._js-video-popup').magnificPopup({ 390 type: 'iframe', 391 preloader: false, 392 closeBtnInside: false, 393 fixedContentPos: false, 394 closeOnContentClick: false, 395 disableOn: 700, 396 removalDelay: 160 397 }); 398 } 399} 400 401//----------------------------------------------------------- 402// 403// Handle Form 404// 405//----------------------------------------------------------- 406// 407function handleForm() { 408 409 convertAsterisk(); 410 411 $(document).ajaxComplete(function (event, request, settings) { 412 convertAsterisk(); 413 }); 414 415 function convertAsterisk() { 416 if ($("table.Dialog tr th .asterisk").length || $("table.Dialog tr td label .asterisk").length || $("table.Dialog tr td .icon .asterisk").length) { 417 return; 418 } 419 420 $("table.Dialog tr th:contains('*'), table.Dialog tr td label:contains('*'), table.Dialog tr td .icon:contains('*')").html(function (index, html) { 421 return html.replace(/(\*)/g, '<span class="asterisk">$1</span>'); 422 }); 423 } 424} 425 426//----------------------------------------------------------- 427// 428// Toggle Form todo 429// 430// Usage Case: 431// <input type='radio' data-toggle-form='#target-id'/> 432// 433//----------------------------------------------------------- 434// 435function handleToggleForm() { 436 437 $('[data-toggle-form-hidden]').hide(); 438 $('[data-toggle-form-hidden-reverse]').show(); 439 440 //-------------------------------- 441 // Toggle Forms 442 //-------------------------------- 443 // 444 $(document).on('change', '[data-toggle-form]', function() { 445 if ($(this).is('input:radio')) { 446 $($(this).attr('data-toggle-form')).toggle(!!$(this).is(':checked')); 447 return false; 448 } else if ($(this).is('input:checkbox')) { 449 $($(this).attr('data-toggle-form')).toggle(!!$(this).is(':checked')); 450 return false; 451 } else if ($(this).is('select:not([multiple])')) { 452 var val = $(this).val().toLowerCase(); 453 var valTarget = $(this).attr('data-toggle-form-val').toLowerCase(); 454 $($(this).attr('data-toggle-form')).toggle(val === valTarget); 455 return false; 456 } 457 }); 458 459 //-------------------------------- 460 // Toggle Forms Reverse 461 //-------------------------------- 462 // 463 $(document).on('change', '[data-toggle-form-reverse]', function() { 464 if ($(this).is('input:radio')) { 465 $($(this).attr('data-toggle-form-reverse')).toggle(!$(this).is(':checked')); 466 return false; 467 } else if ($(this).is('input:checkbox')) { 468 $($(this).attr('data-toggle-form-reverse')).toggle(!$(this).is(':checked')); 469 return false; 470 } else if ($(this).is('select:not([multiple])')) { 471 var val = $(this).val().toLowerCase(); 472 var valTarget = $(this).attr('data-toggle-form-val').toLowerCase(); 473 $($(this).attr('data-toggle-form-reverse')).toggle(val !== valTarget); 474 return false; 475 } 476 }); 477 478 //-------------------------------- 479 // Multiselect 480 //-------------------------------- 481 // 482 $(document).on('click', '[data-toggle-form][multiple] option', function() { 483 var $this = $(this); 484 var $parent = $this.closest('select'); 485 var $target = $($parent.attr('data-toggle-form')); 486 var val = $this.val().toLowerCase(); 487 var valTarget = $parent.attr('data-toggle-form-val').toLowerCase(); 488 489 if (val === valTarget) { 490 $target.toggle($this.is(':selected')); 491 } 492 }); 493} 494 495//----------------------------------------------------------- 496// 497// Input Mask 498// 499//----------------------------------------------------------- 500// 501function handleInputMask() { 502 503 // via data-inputmask attribute 504 // 505 $(":input").inputmask(); 506 507 // Options 508 // 509 var phoneOption = {"mask": "(999) 999-9999"}; 510 var dateOption = {"alias": "datetime", "inputFormat": "mm/dd/yyyy"}; 511 var emailOption = {"alias": "email"}; 512 513 // Selectors 514 // 515 var phoneSelectors = [ 516 'input[placeholder="(999) 999-9999"]' 517 ].join(', '); 518 519 var dateSelectors = [ 520 'input[placeholder="mm/dd/yyyy"]' 521 ].join(', '); 522 523 // Phone 524 // 525 $(phoneSelectors).inputmask(phoneOption); 526 527 // Date 528 // 529 $(dateSelectors).inputmask(dateOption); 530} 531 532//----------------------------------------------------------- 533// 534// Accordion 535// 536//----------------------------------------------------------- 537// 538function handleAccordion() { 539 $('._js-accordion').each(function () { 540 var $this = $(this); 541 var $content = $('.accordion-content', $this); 542 543 if ($this.hasClass('active')) { 544 $content.show(); 545 } 546 }); 547 548 $(document).on('click', '._js-accordion .accordion-btn', function () { 549 var $btn = $(this); 550 var $parent = $btn.closest('.accordion'); 551 var $content = $('.accordion-content', $parent); 552 553 if ($parent.hasClass('active')) { 554 $content.slideUp(500); 555 $parent.removeClass('active'); 556 } else { 557 $parent.addClass('active'); 558 $content.slideDown(500); 559 } 560 561 // Fix for Slick Slider 562 // $(".slider .sliderWrap").slick("refresh"); 563 }); 564} 565 566//----------------------------------------------------------- 567// 568// Tabs 569// 570//----------------------------------------------------------- 571// 572function handleTabs() { 573 $('._js-tabs').each(function () { 574 var $tabs = $(this); 575 var $navs = $('.tabs-nav', $tabs); 576 var $panes = $('.tabs-pane', $tabs); 577 578 $navs.first().addClass('active'); 579 $panes.first().addClass('active'); 580 }); 581 582 $(document).on('click', '._js-tabs .tabs-nav', function () { 583 var $nav = $(this); 584 var $parent = $nav.closest('.tabs'); 585 var $navs = $('.tabs-nav', $parent); 586 var $panes = $('.tabs-pane', $parent); 587 var INDEX = $navs.index(this); 588 589 $navs.removeClass('active'); 590 $panes.hide().removeClass('active'); 591 592 $nav.addClass('active'); 593 $panes.eq(INDEX).show().addClass('active'); 594 }); 595} 596 597 598 599 600//----------------------------------------------------------- 601// 602// Sidebar Mobile 603// 604//----------------------------------------------------------- 605// 606function handleSidebarMobile() { 607 608 $('._js-sidebar').each(function () { 609 610 //-------------------------------- 611 // Selectors 612 //-------------------------------- 613 // 614 var $el = $(this); 615 var $body = $('body'); 616 var $openBtn = $('.sidebar-open-btn', $el); 617 var $closeBtn = $('.sidebar-close-btn', $el); 618 var $sidebarInner = $('.sidebar-side .sidebar-inner', $el); 619 var $sidebarInnerAnchor = $('.sidebar-side .sidebar-inner a', $el); 620 621 //-------------------------------- 622 // Open Sidebar 623 //-------------------------------- 624 // 625 $openBtn.on('click', function (e) { 626 e.preventDefault(); 627 628 $el.addClass('_active'); 629 $sidebarInner.fadeIn(400); 630 $body.addClass('_overflow-hidden'); 631 632 // Accessibility 633 // 634 $openBtn.attr('aria-disabled', true); 635 $closeBtn.attr('aria-disabled', false); 636 }); 637 638 //-------------------------------- 639 // Close Sidebar 640 //-------------------------------- 641 // 642 $closeBtn.on('click', function (e) { 643 e.preventDefault(); 644 $body.removeClass('_overflow-hidden'); 645 $sidebarInner.fadeOut(400, function () { 646 $el.removeClass('_active'); 647 }); 648 649 // Accessibility 650 // 651 $openBtn.attr('aria-disabled', false); 652 $closeBtn.attr('aria-disabled', true); 653 }); 654 655 $sidebarInnerAnchor.on('click', function () { 656 if (!$el.hasClass('_active')) return; 657 658 $body.removeClass('_overflow-hidden'); 659 $sidebarInner.fadeOut(400, function () { 660 $el.removeClass('_active'); 661 }); 662 663 // Accessibility 664 // 665 $openBtn.attr('aria-disabled', false); 666 $closeBtn.attr('aria-disabled', true); 667 }); 668 669 //-------------------------------- 670 // Resize 671 //-------------------------------- 672 // 673 $(window).on('resize', _debounce(function () { 674 if (_isMinBrowserWidth(992)) { 675 $el.removeClass('_active'); 676 $sidebarInner.css({'display': ''}); 677 $body.removeClass('_overflow-hidden'); 678 } 679 }, 250)); 680 }); 681} 682//----------------------------------------------------------- 683// 684// Sticky Sidebar 685// 686//----------------------------------------------------------- 687// 688function handleStickySidebar() { 689 var $stickySidebar = $('._js-sticky-sidebar'); 690 691 //-------------------------------- 692 // Exit if no sticky sidebar 693 //-------------------------------- 694 // 695 if (!$stickySidebar.length) return false; 696 697 //-------------------------------- 698 // Sticky Sidebar 699 //-------------------------------- 700 // 701 $stickySidebar.each(function () { 702 703 // Parameters 704 // 705 var OFFSET = 35; 706 707 // Selectors 708 // 709 var $header = $('.header-wrap'); 710 var $el = $(this);
711 var $main = $('.sidebar-main-wrap', $el); 712 var $sidebar = $('.sidebar-side-wrap', $el); 713 714 // Init scroll scene 715 // 716 var scene = new ScrollMagic.Scene({ 717 triggerElement: $sidebar, 718 triggerHook: 0 719 }) 720 .setPin($sidebar, {pushFollowers: false}) 721 .setClassToggle($el, "_stuck") 722 .addTo(SMController); 723 724 // Set scroll scene offset and duration 725 // 726 scene.offset(getOffset()); 727 scene.duration(getDuration()); 728 729 // Resize 730 // 731 $(window).on('resize', _debounce(function () { 732 733 // Re-calculate scroll scene offset and duration 734 // 735 scene.offset(getOffset()); 736 scene.duration(getDuration()); 737 }, 250)); 738 739 // Get Offset Function 740 // 741 function getOffset() { 742 return -($header.height() + OFFSET); 743 } 744 745 // Get Duration Function 746 // 747 function getDuration() { 748 return $main.height() - $sidebar.height(); 749 } 750 }); 751} 752 753//----------------------------------------------------------- 754// 755// Multiple Select Input 756// 757//----------------------------------------------------------- 758// 759function handleMultipleSelect() { 760 761 //-------------------------------- 762 // Disable preselect 763 //-------------------------------- 764 // 765 $("select[multiple] option").prop("selected", false); 766} 767 768//----------------------------------------------------------- 769// 770// Handle Modal 771// 772//----------------------------------------------------------- 773// 774function handleModal() { 775 $(document).on('click', '._js-modal .modal-btn', function () { 776 var $body = $('body'); 777 var $btn = $(this); 778 var $parent = $btn.closest('._js-modal'); 779 var $container = $('.modal-container', $parent); 780 var $dialog = $('.modal-dialog', $parent); 781 782 $body.addClass('_overflow-hidden'); 783 $container.fadeIn(400); 784 $dialog.fadeIn(400, function () { 785 $parent.addClass('active'); 786 }); 787 }); 788 789 $(document).on('click', '._js-modal .modal-close-btn', function () { 790 var $body = $('body'); 791 var $closeBtn = $(this); 792 var $parent = $closeBtn.closest('._js-modal'); 793 var $container = $('.modal-container', $parent); 794 var $dialog = $('.modal-dialog', $parent); 795 796 $body.removeClass('_overflow-hidden'); 797 $parent.removeClass('active'); 798 $container.fadeOut(400); 799 $dialog.fadeOut(400); 800 }); 801 802 $(document).on('click', '._js-modal .modal-container', function (e) { 803 804 if (e.target !== this) { 805 return; 806 } 807 808 var $body = $('body'); 809 var $container = $(this); 810 var $parent = $container.closest('._js-modal'); 811 var $dialog = $('.modal-dialog', $parent); 812 813 if ($parent.hasClass('is-fullscreen')) { 814 return; 815 } 816 817 $body.removeClass('_overflow-hidden'); 818 $parent.removeClass('active'); 819 $container.fadeOut(400); 820 $dialog.fadeOut(400); 821 }); 822} 823 824//----------------------------------------------------------- 825// 826// Video Player 827// 828//----------------------------------------------------------- 829// 830function handleVideoPlayer() { 831 $(document).on('click', '._js-video-player', function () { 832 const $this = $(this); 833 const $video = $('video', $this); 834 835 $this.addClass('active'); 836 $video[0].play(); 837 }); 838} 839 840//----------------------------------------------------------- 841// 842// Count Up 843// 844//----------------------------------------------------------- 845// 846function handleCountUp() { 847 $('._js-count-up').each(function () { 848 849 //-------------------------------- 850 // Selectors 851 //-------------------------------- 852 // 853 var $this = $(this); 854 var $num = $('.count-up-num', $this); 855 var count = {val: 0}; 856 var originalNum = $num.text(); 857 var newNum = parseFloat(originalNum.replaceAll(',', '')); 858 859 //-------------------------------- 860 // Check if the "newNum" 861 // is a number 862 //-------------------------------- 863 // 864 if (is.not.number(newNum)) { 865 console.log('the counter is not a number, please make sure you are using a number.'); 866 return; 867 } 868 869 //-------------------------------- 870 // Set the number to 0 871 //-------------------------------- 872 // 873 $num.text(0); 874 875 //-------------------------------- 876 // Animation 877 //-------------------------------- 878 // 879 var tl = gsap.to(count, 2, { 880 val: newNum, roundProps: "val", onUpdate: function () { 881 $num.text(function () { 882 if (originalNum.indexOf(",") >= 0) {
883 return count.val.toLocaleString(); 884 } else { 885 return count.val; 886 } 887 }); 888 } 889 }); 890 891 //-------------------------------- 892 // Scrolling 893 //-------------------------------- 894 // 895 new ScrollMagic.Scene({ 896 triggerElement: $this, 897 triggerHook: 0.8 898 }) 899 .setTween(tl) 900 .addTo(SMController); 901 }); 902} 903 904//----------------------------------------------------------- 905// 906// Count Up New 907// 908//----------------------------------------------------------- 909// 910/*function handleCountUp() { 911 912 var $countUp = $('._js-video-player'); 913 var ANIME_DURATION = 2000; 914 var options = { 915 root: null, 916 rootMargin: '0px', 917 threshold: 0.3 918 }; 919 920 function initNumberAnimation() { 921 $($countUp).find(".number").each(function() { 922 $(this).prop('CounterOriginalValue', $(this).text().replace(",", "")); 923 }); 924 925 $($countUp).find(".year").each(function() { 926 $(this).prop('CounterOriginalValue', $(this).text().replace(",", "")); 927 }); 928 } 929 930 function commaSeparateNumber(val){ 931 while (/(\d+)(\d{3})/.test(val.toString())){ 932 val = val.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); 933 } 934 return val; 935 } 936 937 function applyAnimationStep(el, now) { 938 if($(el).prop('CounterOriginalValue').indexOf(".") === -1) { 939 $(el).text(commaSeparateNumber(Math.round(now))); 940 } else { 941 $(el).text(now.toFixed(1)); 942 } 943 } 944 945 function applyYearAnimationStep(el, now) { 946 $(el).text(Math.round(now)); 947 } 948 949 function callback(entries, observer) { 950 entries.forEach(entry => { 951 if (entry.isIntersecting) { 952 $countUp.find(".count-up-num").each(function() { 953 $(this).prop('Counter',0).animate({ 954 Counter: $(this).prop('CounterOriginalValue') 955 }, { 956 duration: ANIME_DURATION, 957 easing: 'linear', 958 step: function (now) { 959 applyAnimationStep(this, now); 960 }, 961 complete:function(){ 962 applyAnimationStep(this, $(this).prop('CounterOriginalValue')); 963 } 964 }); 965 }); 966 967 $countUp.find(".year").each(function() { 968 $(this).prop('Counter',0).animate({ 969 Counter: $(this).prop('CounterOriginalValue') 970 }, { 971 duration: ANIME_DURATION, 972 easing: 'linear', 973 step: function (now) { 974 applyYearAnimationStep(this, now); 975 }, 976 complete:function(){ 977 applyYearAnimationStep(this, $(this).prop('CounterOriginalValue')); 978 } 979 }); 980 }); 981 } else { 982 $countUp.find(".count-up-num").each(function() { 983 $(this).prop('Counter',0); 984 $(this).stop(); 985 }); 986 987 $countUp.find(".year").each(function() { 988 $(this).prop('Counter',0); 989 $(this).stop(); 990 }); 991 } 992 }); 993 } 994 995 initNumberAnimation(); 996 const observer = new IntersectionObserver(callback, options); 997 observer.observe(document.getElementsByClassName('_js-count-up')); 998}*/ 999 1000//----------------------------------------------------------- 1001// 1002// Anchor Link 1003// 1004//----------------------------------------------------------- 1005// 1006function handleAnchorLink() { 1007 $(document).on('click','._js-anchor-link', function (e) { 1008 var $this = $(this); 1009 var $target = $this.attr('href'); 1010 1011 if ($target.length > 1 && $target.charAt(0) === '#') { 1012 e.preventDefault(); 1013 1014 $('html, body').animate({ 1015 scrollTop: $($target).offset().top - $('.headerWrap').height() 1016 }); 1017 } 1018 }); 1019} 1020 1021//----------------------------------------------------------- 1022// 1023// External URL 1024// 1025//----------------------------------------------------------- 1026// 1027function handleExternalURL() { 1028 replaceWithExternalLink(); 1029 1030 $(document).ajaxComplete(function(event, request, settings) { 1031 replaceWithExternalLink(); 1032 }); 1033 1034 function replaceWithExternalLink() { 1035 $('._js-external-link').each(function () { 1036 var $this = $(this); 1037 var EXT_LINK = $this.attr('data-external-link'); 1038 1039 if (EXT_LINK .length) { 1040 $this.attr('href', EXT_LINK ); 1041 $this.attr('target', '_blank'); 1042 } 1043 }); 1044 } 1045} 1046 1047//----------------------------------------------------------- 1048// 1049// Detect if a string has a file extension and 1050// replace it with "Please Add a Title" 1051// 1052//----------------------------------------------------------- 1053// 1054function handleReplaceFileTitle() { 1055 replaceFileTitle(); 1056 1057 $(document).ajaxComplete(function(event, request, settings) { 1058 replaceFileTitle(); 1059 }); 1060 1061 function replaceFileTitle() { 1062 $('._js-replace-file-title').each(function () { 1063 var $this = $(this); 1064 var STR = $this.text(); 1065 var EXTS = [".txt", ".jpg", ".jpeg", ".png", ".gif", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx"]; 1066 var EXT = STR.substr(STR.lastIndexOf(".")).toLowerCase(); 1067 if (EXTS.indexOf(EXT) !== -1) { 1068 $this.text('Please Add a Title'); 1069 } 1070 }); 1071 } 1072} 1073 1074 1075 1076 1077 1078 1079 1080//----------------------------------------------------------- 1081// 1082// Collapse Sidebar 1083// 1084//----------------------------------------------------------- 1085// 1086function handleCollapseSidebar() { 1087 var $body = $('body'); 1088 var focusableElementsSelector = 'a, button, :input, [tabindex]:not
1088([tabindex="-1"])'; 1089 1090 // Function to handle opening and closing of sidebar 1091 function toggleSidebar($sidebar, isOpen) { 1092 var $dialog = $sidebar.find('.sidebar-side .sidebar-inner'); 1093 var $openBtn = $sidebar.find('.sidebar-open-btn'); 1094 var $closeBtn = $sidebar.find('.sidebar-close-btn'); 1095 1096 if (isOpen) { 1097 $body.addClass('_overflow-hidden'); 1098 $sidebar.addClass('active'); 1099 $openBtn.attr('aria-expanded', 'true'); 1100 $dialog.fadeIn(200); 1101 $closeBtn.focus(); 1102 } else { 1103 $body.removeClass('_overflow-hidden'); 1104 $sidebar.removeClass('active'); 1105 $dialog.hide(); 1106 $openBtn.attr('aria-expanded', 'false').focus(); 1107 } 1108 } 1109 1110 // Event delegation for opening and closing buttons 1111 $(window).on('click', '._js-coll-sidebar .sidebar-open-btn', function() { 1112 var $sidebar = $(this).closest('._js-coll-sidebar'); 1113 toggleSidebar($sidebar, true); 1114 }); 1115 1116 $(window).on('click', '._js-coll-sidebar .sidebar-close-btn', function() { 1117 var $sidebar = $(this).closest('._js-coll-sidebar'); 1118 toggleSidebar($sidebar, false); 1119 }); 1120 1121 // Resize event with debounce 1122 $(window).on('resize', _debounce(function () { 1123 if (_isMinBrowserWidth(992)) { 1124 $body.removeClass('_overflow-hidden'); 1125 $('._js-coll-sidebar').removeClass('active'); 1126 $('._js-coll-sidebar').find('.sidebar-open-btn').attr('aria-expanded', 'false'); 1127 $('._js-coll-sidebar').find('.sidebar-side .sidebar-inner').css({'display': ''}); 1128 } 1129 }, 250)); 1130 1131 // Keyboard trap and handling 1132 $(window).on('keydown', '._js-coll-sidebar .sidebar-side .sidebar-inner', function(e) { 1133 var $sidebar = $(this).closest('._js-coll-sidebar'); 1134 1135 if (!$sidebar.hasClass('active')) return; 1136 1137 var $focusableEls = $(this).find(focusableElementsSelector); 1138 var $firstFocusable = $focusableEls.first(); 1139 var $lastFocusable = $focusableEls.last(); 1140 1141 switch (e.key) { 1142 case 'Tab': 1143 if (e.shiftKey && document.activeElement === $firstFocusable[0]) { 1144 e.preventDefault(); 1145 $lastFocusable.focus(); 1146 } else if (!e.shiftKey && document.activeElement === $lastFocusable[0]) { 1147 e.preventDefault(); 1148 $firstFocusable.focus(); 1149 } 1150 break; 1151 case 'Escape': 1152 e.preventDefault(); 1153 toggleSidebar($sidebar, false); 1154 break; 1155 } 1156 }); 1157} 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170//----------------------------------------------------------------------------------------- 1171// 1172// 1173// Execute JS 1174// 1175// 1176//----------------------------------------------------------------------------------------- 1177// 1178handleBrowserVersion(); 1179 1180$(document).ready(function () { 1181 handleRootCSS(); 1182 handleScrollTop(); 1183 handleImagePopup(); 1184 handleVideoPopup(); 1185 handleForm(); 1186 handleToggleForm(); 1187 handleInputMask(); 1188 handleAccordion(); 1189 handleTabs(); 1190 handleSidebarMobile(); 1191 handleStickySidebar(); 1192 handleMultipleSelect(); 1193 handleModal(); 1194 handleVideoPlayer(); 1195 handleCountUp(); 1196 handleAnchorLink(); 1197 handleExternalURL(); 1198 handleReplaceFileTitle(); 1199 handleCollapseSidebar(); 1200});
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.