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.removeClass('active'); 579 $panes.hide().removeClass('active'); 580 581 $navs.first().addClass('active'); 582 $panes.first().show().addClass('active'); 583 }); 584 585 $(document).on('click', '._js-tabs .tabs-nav', function () { 586 var $nav = $(this); 587 var $parent = $nav.closest('.tabs'); 588 var $navs = $('.tabs-nav', $parent); 589 var $panes = $('.tabs-pane', $parent); 590 var INDEX = $navs.index(this); 591 592 $navs.removeClass('active'); 593 $panes.hide().removeClass('active'); 594 595 $nav.addClass('active'); 596 $panes.eq(INDEX).show().addClass('active'); 597 }); 598} 599 600 601 602//----------------------------------------------------------- 603// 604// Sidebar Mobile 605// 606//----------------------------------------------------------- 607// 608function handleSidebarMobile() { 609 610 $('._js-sidebar').each(function () { 611 612 //-------------------------------- 613 // Selectors 614 //-------------------------------- 615 // 616 var $el = $(this); 617 var $body = $('body'); 618 var $openBtn = $('.sidebar-open-btn', $el); 619 var $closeBtn = $('.sidebar-close-btn', $el); 620 var $sidebarInner = $('.sidebar-side .sidebar-inner', $el); 621 622 //-------------------------------- 623 // Open Sidebar 624 //-------------------------------- 625 // 626 $openBtn.on('click', function (e) { 627 e.preventDefault(); 628 629 $el.addClass('active'); 630 $sidebarInner.fadeIn(400); 631 $body.addClass('_overflow-hidden'); 632 633 // Accessibility 634 // 635 $openBtn.attr('aria-disabled', true); 636 $closeBtn.attr('aria-disabled', false); 637 }); 638 639 //-------------------------------- 640 // Close Sidebar 641 //-------------------------------- 642 // 643 $closeBtn.on('click', function (e) { 644 e.preventDefault(); 645 $body.removeClass('_overflow-hidden'); 646 $sidebarInner.fadeOut(400, function () { 647 $el.removeClass('active'); 648 }); 649 650 // Accessibility 651 // 652 $openBtn.attr('aria-disabled', false); 653 $closeBtn.attr('aria-disabled', true); 654 }); 655 656 //-------------------------------- 657 // Resize 658 //-------------------------------- 659 // 660 $(window).on('resize', _debounce(function () { 661 if (_isMinBrowserWidth(992)) { 662 $el.removeClass('active'); 663 $sidebarInner.css({'display': ''}); 664 $body.removeClass('_overflow-hidden'); 665 } 666 }, 250)); 667 }); 668} 669 670//----------------------------------------------------------- 671// 672// Sticky Sidebar 673// 674//----------------------------------------------------------- 675// 676function handleStickySidebar() { 677 var $stickySidebar = $('._js-sticky-sidebar'); 678 679 //-------------------------------- 680 // Exit if no sticky sidebar 681 //-------------------------------- 682 // 683 if (!$stickySidebar.length) return false; 684 685 //-------------------------------- 686 // Sticky Sidebar 687 //-------------------------------- 688 // 689 $stickySidebar.each(function () { 690 691 // Parameters 692 // 693 var OFFSET = 15; 694 695 // Selectors 696 // 697 var $header = $('.header-wrap'); 698 var $el = $(this);
699 var $main = $('.sidebar-main-wrap', $el); 700 var $sidebar = $('.sidebar-side-wrap', $el); 701 702 // Init scroll scene 703 // 704 var scene = new ScrollMagic.Scene({ 705 triggerElement: $sidebar, 706 triggerHook: 0 707 }) 708 .setPin($sidebar, {pushFollowers: false}) 709 .setClassToggle($el, "_stuck") 710 .addTo(SMController); 711 712 // Set scroll scene offset and duration 713 // 714 scene.offset(getOffset()); 715 scene.duration(getDuration()); 716 717 // Resize 718 // 719 $(window).on('resize', _debounce(function () { 720 721 // Re-calculate scroll scene offset and duration 722 // 723 scene.offset(getOffset()); 724 scene.duration(getDuration()); 725 }, 250)); 726 727 // Get Offset Function 728 // 729 function getOffset() { 730 return -($header.height() + OFFSET); 731 } 732 733 // Get Duration Function 734 // 735 function getDuration() { 736 return $main.height() - $sidebar.height(); 737 } 738 }); 739} 740 741//----------------------------------------------------------- 742// 743// Multiple Select Input 744// 745//----------------------------------------------------------- 746// 747function handleMultipleSelect() { 748 749 //-------------------------------- 750 // Disable preselect 751 //-------------------------------- 752 // 753 $("select[multiple] option").prop("selected", false); 754} 755 756//----------------------------------------------------------- 757// 758// Handle Modal 759// 760//----------------------------------------------------------- 761// 762function handleModal() { 763 $(document).on('click', '._js-modal .modal-btn', function () { 764 var $body = $('body'); 765 var $btn = $(this); 766 var $parent = $btn.closest('._js-modal'); 767 var $container = $('.modal-container', $parent); 768 var $dialog = $('.modal-dialog', $parent); 769 770 $body.addClass('_overflow-hidden'); 771 $container.fadeIn(400); 772 $dialog.fadeIn(400, function () { 773 $parent.addClass('active'); 774 }); 775 }); 776 777 $(document).on('click', '._js-modal .modal-close-btn', function () { 778 var $body = $('body'); 779 var $closeBtn = $(this); 780 var $parent = $closeBtn.closest('._js-modal'); 781 var $container = $('.modal-container', $parent); 782 var $dialog = $('.modal-dialog', $parent); 783 784 $body.removeClass('_overflow-hidden'); 785 $parent.removeClass('active'); 786 $container.fadeOut(400); 787 $dialog.fadeOut(400); 788 }); 789 790 $(document).on('click', '._js-modal .modal-container', function (e) { 791 792 if (e.target !== this) { 793 return; 794 } 795 796 var $body = $('body'); 797 var $container = $(this); 798 var $parent = $container.closest('._js-modal'); 799 var $dialog = $('.modal-dialog', $parent); 800 801 if ($parent.hasClass('is-fullscreen')) { 802 return; 803 } 804 805 $body.removeClass('_overflow-hidden'); 806 $parent.removeClass('active'); 807 $container.fadeOut(400); 808 $dialog.fadeOut(400); 809 }); 810} 811 812//----------------------------------------------------------- 813// 814// Video Player 815// 816//----------------------------------------------------------- 817// 818function handleVideoPlayer() { 819 $(document).on('click', '._js-video-player', function () { 820 const $this = $(this); 821 const $video = $('video', $this); 822 823 $this.addClass('active'); 824 $video[0].play(); 825 }); 826} 827 828//----------------------------------------------------------- 829// 830// Count Up 831// 832//----------------------------------------------------------- 833// 834function handleCountUp() { 835 $('._js-count-up').each(function () { 836 837 //-------------------------------- 838 // Selectors 839 //-------------------------------- 840 // 841 var $this = $(this); 842 var $num = $('.count-up-num', $this); 843 var count = {val: 0}; 844 var originalNum = $num.text(); 845 var newNum = parseFloat(originalNum.replaceAll(',', '')); 846 847 //-------------------------------- 848 // Check if the "newNum" 849 // is a number 850 //-------------------------------- 851 // 852 if (is.not.number(newNum)) { 853 console.log('the counter is not a number, please make sure you are using a number.'); 854 return; 855 } 856 857 //-------------------------------- 858 // Set the number to 0 859 //-------------------------------- 860 // 861 $num.text(0); 862 863 //-------------------------------- 864 // Animation 865 //-------------------------------- 866 // 867 var tl = gsap.to(count, 2, { 868 val: newNum, roundProps: "val", onUpdate: function () { 869 $num.text(function () { 870 if (originalNum.indexOf(",") >= 0) {
871 return count.val.toLocaleString(); 872 } else { 873 return count.val; 874 } 875 }); 876 } 877 }); 878 879 //-------------------------------- 880 // Scrolling 881 //-------------------------------- 882 // 883 new ScrollMagic.Scene({ 884 triggerElement: $this, 885 triggerHook: 0.8 886 }) 887 .setTween(tl) 888 .addTo(SMController); 889 }); 890} 891 892//----------------------------------------------------------- 893// 894// Count Up New 895// 896//----------------------------------------------------------- 897// 898/*function handleCountUp() { 899 900 var $countUp = $('._js-video-player'); 901 var ANIME_DURATION = 2000; 902 var options = { 903 root: null, 904 rootMargin: '0px', 905 threshold: 0.3 906 }; 907 908 function initNumberAnimation() { 909 $($countUp).find(".number").each(function() { 910 $(this).prop('CounterOriginalValue', $(this).text().replace(",", "")); 911 }); 912 913 $($countUp).find(".year").each(function() { 914 $(this).prop('CounterOriginalValue', $(this).text().replace(",", "")); 915 }); 916 } 917 918 function commaSeparateNumber(val){ 919 while (/(\d+)(\d{3})/.test(val.toString())){ 920 val = val.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); 921 } 922 return val; 923 } 924 925 function applyAnimationStep(el, now) { 926 if($(el).prop('CounterOriginalValue').indexOf(".") === -1) { 927 $(el).text(commaSeparateNumber(Math.round(now))); 928 } else { 929 $(el).text(now.toFixed(1)); 930 } 931 } 932 933 function applyYearAnimationStep(el, now) { 934 $(el).text(Math.round(now)); 935 } 936 937 function callback(entries, observer) { 938 entries.forEach(entry => { 939 if (entry.isIntersecting) { 940 $countUp.find(".count-up-num").each(function() { 941 $(this).prop('Counter',0).animate({ 942 Counter: $(this).prop('CounterOriginalValue') 943 }, { 944 duration: ANIME_DURATION, 945 easing: 'linear', 946 step: function (now) { 947 applyAnimationStep(this, now); 948 }, 949 complete:function(){ 950 applyAnimationStep(this, $(this).prop('CounterOriginalValue')); 951 } 952 }); 953 }); 954 955 $countUp.find(".year").each(function() { 956 $(this).prop('Counter',0).animate({ 957 Counter: $(this).prop('CounterOriginalValue') 958 }, { 959 duration: ANIME_DURATION, 960 easing: 'linear', 961 step: function (now) { 962 applyYearAnimationStep(this, now); 963 }, 964 complete:function(){ 965 applyYearAnimationStep(this, $(this).prop('CounterOriginalValue')); 966 } 967 }); 968 }); 969 } else { 970 $countUp.find(".count-up-num").each(function() { 971 $(this).prop('Counter',0); 972 $(this).stop(); 973 }); 974 975 $countUp.find(".year").each(function() { 976 $(this).prop('Counter',0); 977 $(this).stop(); 978 }); 979 } 980 }); 981 } 982 983 initNumberAnimation(); 984 const observer = new IntersectionObserver(callback, options); 985 observer.observe(document.getElementsByClassName('_js-count-up')); 986}*/ 987 988//----------------------------------------------------------- 989// 990// Anchor Link 991// 992//----------------------------------------------------------- 993// 994function handleAnchorLink() { 995 $(document).on('click','._js-anchor-link', function (e) { 996 var $this = $(this); 997 var $target = $this.attr('href'); 998 999 if ($target.length > 1 && $target.charAt(0) === '#') { 1000 e.preventDefault(); 1001 1002 $('html, body').animate({ 1003 scrollTop: $($target).offset().top - $('.header-wrap').height() 1004 }); 1005 } 1006 }); 1007} 1008 1009//----------------------------------------------------------- 1010// 1011// External URL 1012// 1013//----------------------------------------------------------- 1014// 1015function handleExternalURL() { 1016 replaceWithExternalLink(); 1017 1018 $(document).ajaxComplete(function(event, request, settings) { 1019 replaceWithExternalLink(); 1020 }); 1021 1022 function replaceWithExternalLink() { 1023 $('._js-external-link').each(function () { 1024 var $this = $(this); 1025 var EXT_LINK = $this.attr('data-external-link'); 1026 1027 if (EXT_LINK.length) { 1028 $this.attr('href', EXT_LINK ); 1029 $this.attr('target', '_blank'); 1030 } 1031 }); 1032 } 1033} 1034 1035//----------------------------------------------------------- 1036// 1037// Detect if a string has a file extension and 1038// replace it with "Please Add a Title" 1039// 1040//----------------------------------------------------------- 1041// 1042function handleReplaceFileTitle() { 1043 replaceFileTitle(); 1044 1045 $(document).ajaxComplete(function(event, request, settings) { 1046 replaceFileTitle(); 1047 }); 1048 1049 function replaceFileTitle() { 1050 $('._js-replace-file-title').each(function () { 1051 var $this = $(this); 1052 var STR = $this.text(); 1053 var EXTS = [".txt", ".jpg", ".jpeg", ".png", ".gif", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx"]; 1054 var EXT = STR.substr(STR.lastIndexOf(".")).toLowerCase(); 1055 if (EXTS.indexOf(EXT) !== -1) { 1056 $this.text('Please Add a Title'); 1057 } 1058 }); 1059 } 1060} 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081//----------------------------------------------------------------------------------------- 1082// 1083// 1084// Execute JS 1085// 1086// 1087//----------------------------------------------------------------------------------------- 1088// 1089handleBrowserVersion(); 1090 1091$(document).ready(function () { 1092 handleRootCSS(); 1093 handleScrollTop(); 1094 handleImagePopup(); 1095 handleVideoPopup(); 1096 handleForm(); 1097 handleToggleForm(); 1098 handleInputMask(); 1099 handleAccordion(); 1100 handleTabs();
1101 handleSidebarMobile(); 1102 handleStickySidebar(); 1103 handleMultipleSelect(); 1104 handleModal(); 1105 handleVideoPlayer(); 1106 handleCountUp(); 1107 handleAnchorLink(); 1108 handleExternalURL(); 1109 handleReplaceFileTitle(); 1110});
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.