1(function ($, Drupal, window, document, drupalSettings) { 2 "use strict"; 3 var executedOnce = false; 4 5 Drupal.behaviors.common = { 6 attach: function (context, settings) { 7 const cartList = JSON.parse(sessionStorage.getItem("cartList")); 8 localStorage.removeItem("investorKyaData"); 9 // Function calls. 10 if (!executedOnce) { 11 loader(); 12 lazyLoadImages(); 13 clock(); 14 addNofollowBlank(); 15 addActiveClass(); 16 confirmationPopup(); 17 loginTokenExists(); 18 searchAllApprovals(); 19 slickAboutUs(); 20 headerResponse(); 21 faqsAccordian(); 22 myPopupFunction(); 23 attachChatWidgetListeners(); 24 executedOnce = true; 25 } 26 27 //Wow Animation 28 // new WOW().init(); 29 30 // Show NSWS loader. 31 function loader() { 32 jQuery(".loader-wrapper").hide(); 33 } 34 35 // Lazyload background images. 36 function lazyLoadImages() { 37 var lazyBackgrounds = [].slice.call( 38 document.querySelectorAll(".lazy-background") 39 ); 40 if ("IntersectionObserver" in window) { 41 // IntersectionObserver initialization code 42 const images = document.querySelectorAll("[data-src]"); 43 function preloadImage(img) { 44 const src = img.getAttribute("data-src"); 45 if (!src) { 46 return; 47 } 48 img.src = src; 49 } 50 const imagOptions = { 51 root: null, 52 threshold: 0.5, 53 effect: "fadeIn", 54 }; 55 const imgObserver = new IntersectionObserver( 56 (entries, imgObserver) => { 57 entries.forEach((entry) => { 58 if (!entry.isIntersecting) { 59 return; 60 } else { 61 preloadImage(entry.target); 62 imgObserver.unobserve(entry.target); 63 } 64 }); 65 }, 66 imagOptions 67 ); 68 images.forEach((image) => { 69 var b = imgObserver.observe(image); 70 }); 71 72 let lazyBackgroundObserver = new IntersectionObserver(function ( 73 entries, 74 observer 75 ) { 76 entries.forEach(function (entry) { 77 if (entry.isIntersecting) { 78 entry.target.classList.add("visible"); 79 lazyBackgroundObserver.unobserve(entry.target); 80 } 81 }); 82 }); 83 84 lazyBackgrounds.forEach(function (lazyBackground) { 85 lazyBackgroundObserver.observe(lazyBackground); 86 }); 87 } else { 88 // make lazy loading elements to be loaded right away 89 const images = document.querySelectorAll("[data-src]"); 90 91 Object.keys(images).forEach((key) => { 92 jQuery(images[key]).attr( 93 "src", 94 jQuery(images[key]).attr("data-src") 95 ); 96 }); 97 98 Object.keys(lazyBackgrounds).forEach((key) => { 99 jQuery(lazyBackgrounds[key]).addClass("visible"); 100 }); 101 } 102 } 103 104 // Background image Lazy Load for banner 105 if (jQuery('.banner-home .banner-img-video.lazy-background').length) { 106 var imageUrls = jQuery('.bg-lazyLoading').text(); 107 108 // Changes in css class 109 function callback(mutationList, observer) { 110 mutationList.forEach(function (mutation) { 111 jQuery('.banner-home .banner-img-video.lazy-background.visible video source').attr('src', imageUrls); 112 }) 113 } 114 const contact = document.querySelector('.banner-home .banner-img-video.lazy-background'); 115 const options = { attributes: true }; 116 const observer = new MutationObserver(callback); 117 observer.observe(contact, options); 118 } 119 120 // Background image Lazy Load for schemes and explore 121 if (jQuery('.govt-scheme .left_side.lazy-background,.explore.lazy-background').length) { 122 var imageUrls = jQuery('.bg-lazyLoading-img').text(); 123 var imageUrl2 = jQuery('.bg-lazyLoading2').text(); 124 125 // Changes in css class 126 function callback(mutationList, observer) { 127 mutationList.forEach(function (mutation) { 128 jQuery('.govt-scheme .left_side.lazy-background.visible .chakra img').attr('src', imageUrls); 129 jQuery('.explore.lazy-background.visible .img-bg').attr('src', imageUrl2); 130 }) 131 } 132 const govtScheme = document.querySelector('.govt-scheme .left_side.lazy-background'); 133 const explorebg = document.querySelector('.explore.lazy-background'); 134 const options = { attributes: true }; 135 const observer = new MutationObserver(callback); 136 observer.observe(govtScheme, options); 137 observer.observe(explorebg, options); 138 139 } 140 // Show live Clock. 141 function clock() { 142 if (document.querySelector("div.clock-right")) { 143 setInterval(() => { 144 let monthNames = [ 145 "January", 146 "February", 147 "March", 148 "April", 149 "May", 150 "June", 151 "July", 152 "August", 153 "September", 154 "October", 155 "November", 156 "December", 157 ]; 158 let dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; 159 let date = new Date(); 160 let place = String(date).split(/[{()}]/g); 161 let month = monthNames[date.getMonth()]; 162 let day = date.getDate(); 163 let year = date.getFullYear(); 164 let days = dayNames[date.getDay()]; 165 let hours = date.getHours(); 166 if (place[1] == "India Standard Time") { 167 place[1] = "IST"; 168 } 169 let minutes = 170 date.getMinutes() >= 10 171 ? date.getMinutes() 172 : "0" + date.getMinutes(); 173 let seconds = 174 date.getSeconds() >= 10 175 ? date.getSeconds() 176 : "0" + date.getSeconds(); 177 document.querySelector("div.clock-right").innerHTML = 178 '<p class="time-wrap sensex-box-cont"><span class="date">' + 179 days + 180 ", " + 181 day + 182 " " + 183 month + 184 " " + 185 year + 186 '</span><span class="time"><span class="current-time">' + 187 hours + 188 ":" + 189 minutes + 190 ":" + 191 seconds + 192 "</span><span class='ist'>" + 193 place[1] + 194 "</span></span></span></p>"; 195 }, 1000); 196 } 197 } 198 199 // No Follow And Target Blank To External Links. 200 function addNofollowBlank() { 201 jQuery("body a").each(function (index, value) { 202 var aLink = jQuery(this).attr("href"); 203 if (aLink) { 204 var hasHTTP = aLink.match(/^http:/); 205 var hasHTTPS = aLink.match(/^https/); 206 var hasSwsLink = aLink.match( 207 /^http(s)?:\/\/(dev-nsws\.investindia|qa-nsws\.investindia|www\.ppe\.nsws|www\.nsws)(\.)?(gov)?(\.)?(in)/ 208 ); 209 var hasNoFollow = jQuery(this).attr("rel"); 210 var hasTarget = jQuery(this).attr("target"); 211 if (hasHTTP || hasHTTPS) { 212 if (!hasSwsLink) { 213 if (!hasNoFollow) { 214 jQuery(this).attr("rel", "nofollow"); 215 } 216 if (!hasTarget) { 217 jQuery(this).attr("target", "_blank"); 218 } 219 } 220 } 221 } 222 }); 223 } 224 225 // Add active class to main navigation by checking current url. 226 function addActiveClass() { 227 var anchors = jQuery(".navbar ul").find("a"); 228 jQuery.each(anchors, function (key, value) { 229 var url = jQuery(value).attr("href"); 230 if (window.location.pathname == url) { 231 jQuery(value).addClass("is-active"); 232 } 233 }); 234 } 235 236 // Show disclaimer before redirecting to external links. 237 var googleanalytics = { 238 239 } 240 function confirmationPopup() { 241 // Open disclaimer box for external links 242 var gethref; 243 jQuery("body a").on("click", function (e) { 244 if (jQuery(this).hasClass('no-ex-link')) { 245 jQuery(".ui-widget.ui-widget-content.ui-front.ui-dialog-buttons").css("display", "none", "important"); 246 } 247 var datalayer_obj; 248 if (jQuery(this).parents(".ministry-slick").length) { 249 datalayer_obj = { 250 event: "Footer - Ministry First Click", 251 "Ministry Name": jQuery(this).children().attr("title"), 252 } 253 dataLayer.push(datalayer_obj); 254 googleanalytics = datalayer_obj; 255 googleanalytics.event = googleanalytics.event.replace('First', 'Confirm'); 256 } else if (jQuery(this).parents(".state-slick").length) { 257 datalayer_obj = { 258 event: "Footer - State First Click", 259 "State Name": jQuery(this).children().attr("title"), 260 } 261 dataLayer.push(datalayer_obj); 262 googleanalytics = datalayer_obj; 263 googleanalytics.event = googleanalytics.event.replace('First', 'Confirm'); 264 } 265 266 document 267 .getElementById("confirmation-dialog") 268 .style.setProperty("display", "block", "important"); 269 var aLink = jQuery(this).attr("href"); 270 if (aLink) { 271 var hasHTTP = aLink.match(/^http:/); 272 var hasHTTPS = aLink.match(/^https/); 273 var hasSwsLink = aLink.match( 274 /^http(s)?:\/\/(dev-nsws\.investindia|qa-nsws\.investindia|www\.ppe\.nsws|www\.nsws)(\.)?(gov)?(\.)?(in)/ 275 ); 276 gethref = jQuery(this).attr("href"); 277 if ( 278 hasHTTP ||
279 (hasHTTPS && !aLink.match(/(nodal-authority|nsws-mnstrportal)/gm)) 280 ) { 281 if (!hasSwsLink) { 282 e.preventDefault(); 283 jQuery("#confirmation-dialog").dialog("open"); 284 jQuery('body').css('overflow', 'hidden'); 285 } 286 } 287 } else { 288 e.preventDefault(); 289 } 290 }); 291 292 // Redirect to external links 293 jQuery("#confirmation-dialog").dialog({ 294 autoOpen: false, 295 modal: true, 296 buttons: [ 297 { 298 class: "butt-2", 299 text: "Cancel", 300 click: function () { 301 jQuery(this).dialog('close'); 302 jQuery('body').css('overflow', 'auto'); 303 } 304 }, 305 { 306 text: "Confirm", 307 click: function () { 308 window.open(gethref, "_blank"); 309 console.log(jQuery(this).parent()) 310 dataLayer.push(googleanalytics); 311 jQuery(this).dialog("close"); 312 jQuery('body').css('overflow', 'auto'); 313 }, 314 }, 315 ], 316 }); 317 jQuery('.ui-dialog .ui-dialog-titlebar-close').click(function () { 318 jQuery('body').css('overflow', 'auto'); 319 }); 320 } 321 322 // Add MyProfile/Signout block if login token exists. 323 function loginTokenExists() { 324 if (localStorage.getItem("userDTO")) { 325 const user = JSON.parse(localStorage.getItem("userDTO")); 326 // jQuery.ajax({ 327 // type: 'POST', 328 // url: 'https://uat-nsws.investindia.gov.in/gateway/form-builder/marketplace/user-cart', 329 // contentType: 'application/json', 330 // data: JSON.stringify({ "username": user.email }), 331 // dataType: "json", 332 // success: function (responce) { 333 // if (responce.data.approvalCount !== 0) { 334 // jQuery('.header_main_section .header_section .cart-icon a, .header_main_section .header_section .mobile-icon a.cart').prepend(`<span class="count">${responce.data.approvalCount}</span>`); 335 // } 336 // }, 337 // error: function (err) { 338 // console.log(err); 339 // } 340 // }); 341 jQuery(".header_main_section .dashboard-btn").show(); 342 jQuery(".user-info-header").show(); 343 jQuery(".header_main_section #login-block").hide(); 344 jQuery(".login-mobile").hide(); 345 // jQuery('.login-bottom-mobile strong').text("Dashboard"); 346 // jQuery('.login-bottom-mobile a').attr('href', '/portal/investor-dashboard/dashboard'); 347 // jQuery('.login-bottom-mobile a').prepend("<span class='cart-count'>0</span>"); 348 // jQuery('.login-bottom-mobile .header-login-dropdown').remove(); 349 jQuery(".header_main_section .mobile-icon .login-icon ").hide(); 350 jQuery(".header_main_section .mobile-icon .register-icon ").hide(); 351 jQuery(".header_main_section .login-section .login-btn .name").text( 352 user.name 353 ); 354 jQuery(".header_main_section .cart-icon").show(); 355 let isAdmin = user.permission.includes("Admin_Dashboard_FE_View"); 356 if (isAdmin) { 357 jQuery(".btn-dashboard a").attr("href", "/portal/admin-dashboard"); 358 jQuery( 359 ".header_main_section .header_section .cart-icon a, .header_main_section .header_section .mobile-icon a.cart" 360 ).hide(); 361 } 362 getMinistryNotification(user.swsId); 363 } else { 364 jQuery(".header_main_section .dashboard-btn").hide(); 365 //jQuery('.dashboard-mobile-menu').hide(); 366 // jQuery('.login-mobile').show(); 367 jQuery(".user-info-header").hide(); 368 jQuery(".header_main_section .login-section ").hide(); 369 jQuery(".header_main_section .mobile-icon .login-icon ").show(); 370 jQuery(".header_main_section .mobile-icon .register-icon ").show(); 371 jQuery(".header_main_section .mobile-icon .notify ").hide(); 372 //tabindex 373 if (cartList && cartList.length !== 0) { 374 jQuery( 375 ".header_main_section .header_section .cart-icon a, .header_main_section .header_section .mobile-icon a.cart" 376 ).prepend(`<span class="count">${cartList.length}</span>`); 377 } 378 } 379 } 380 381 // Show ministry notifications. 382 function getMinistryNotification(swsId) { 383 var refinedData = {}; 384 var htmlObject = ""; 385 jQuery.ajax({ 386 url: "/gateway/admin/conversation/unread/" + swsId, 387 method: "GET", 388 async: false, 389 success: function (result) { 390 if (result.status) { 391 var notificationList = result.data; 392 console.log(notificationList); 393 if (!result.data.length) { 394 htmlObject = 395 '<div class="no-notification"> No Notification, You Are All Caught Up.</div>'; 396 } else { 397 var element = document.getElementById("myDiv"); 398 element.classList.add("count"); 399 jQuery(".approvals-count").append(notificationList.length); 400 jQuery.each(notificationList, function (key, val) { 401 if (!refinedData[val.projectName]) { 402 refinedData[val.projectName] = []; 403 } 404 let fullMessageObject; 405 try{ 406 fullMessageObject = JSON.parse(val.fullMessage) 407 } 408 catch(e){ 409 fullMessageObject = {}; 410 console.log(e) 411 } 412 var tempList = { 413 subject: val.subject, 414 fullMessage: fullMessageObject, 415 }; 416 refinedData[val.projectName].push(tempList); 417 418 }); 419 htmlObject += '<div class="notifications-box">'; 420 jQuery.each(refinedData, function (key, value) { 421 htmlObject += 422 '<div class="notification"><h2>' + 423 key + 424 "</h2><h4>You have received a clarification request on your application for:</h4><ul class='notification-list'>"; 425 jQuery.each(value, function (subkey, content) { 426 htmlObject += 427 "<li>" + 428 content.subject + 429 ":" + 430 content.fullMessage.message + 431 "</li>"; 432 }); 433 htmlObject += "</ul></div>"; 434 }); 435 htmlObject += "</div>"; 436 } 437 } else { 438 htmlObject = "NO NOTIFICATION. YOU ARE ALL CAUGHT UP."; 439 } 440 jQuery(".popuptext").append(htmlObject); 441 }, 442 error: function (request) { 443 console.log("Error Occured with status: " + request.status); 444 }, 445 }); 446 } 447 448 449 450 451 var maxLength = 300; 452 $(".notification-list li").each(function () { 453 var myStr = $(this).text(); 454 if (myStr.length > maxLength) { 455 var newStr = myStr.substring(0, maxLength); 456 var removedStr = myStr.substring(maxLength, myStr.length); 457 $(this).empty().html(newStr); 458 $(this).append( 459 ' <a href="javascript:void(0);" class="read-more">Show more</a>' 460 ); 461 $(this).append('<span class="more-text">' + removedStr + "</span>"); 462 } 463 }); 464 $(".read-more").on("click", function () { 465 readMore($(this)) 466 }); 467 function readMore($this){ 468 $($this).siblings(".more-text").contents().unwrap(); 469 470 $($this).parent('li').append( 471 ' <a href="javascript:void(0);" class="read-less">Show less</a>' 472 ); 473 $(".read-less").on("click", function () { 474 readLess($(this)) 475 }); 476 $($this).remove(); 477 } 478 function readLess($this){ 479 // let updatedContent = $($this).parent('li').text() 480 var myStr = $($this).parent("li").text(); 481 if (myStr.length > maxLength) { 482 var newStr = myStr.substring(0, maxLength); 483 var removedStr = myStr.substring(maxLength, myStr.length).toString().replaceAll(/Show less/g,''); 484 console.log(removedStr) 485 $($this).parent("li").empty().html(newStr).append( 486 ' <a href="javascript:void(0);" class="read-more">Show more</a>' 487 ).append('<span class="more-text">' + removedStr.toString().replaceAll(/Show less/g,'') + "</span>"); 488 } 489 $(".read-more").on("click", function () { 490 readMore($(this)) 491 }); 492 } 493 494 495 496 497 // Show notification popup. 498 function myPopupFunction() { 499 jQuery(".popup").on("click", function (e) { 500 var popup = document.getElementById("myPopup"); 501 popup.classList.toggle("show"); 502 jQuery(document).on("click", function (event) { 503 if ( 504 jQuery(event.target).parents(".popuptext") 505 .length === 0 && jQuery(event.target).parents(".anticon-bell").length === 0 506 ) { 507 jQuery(".popuptext").removeClass("show"); 508 } 509 }); 510 }); 511 jQuery(".popuptext").on("click", function (e) { 512 e.preventDefault() 513 e.stopPropagation() 514 }); 515 jQuery(".close-icon").on("click", function (e) { 516 jQuery(".popup").trigger("click"); 517 }); 518 519 } 520 521 // Search all approvals. 522 function searchAllApprovals() { 523 jQuery("#approval-search, #approval-search-mobile").on( 524 "input", 525 function (e) { 526 jQuery("#approval-search, #approval-search-mobile").autocomplete({ 527 source: function (request, response) { 528 jQuery.ajax({ 529 type: "POST", 530 url: "/gateway/form-builder/marketplace/license-summary-list", 531 contentType: "application/json", 532 data: JSON.stringify({ 533 start: 0, 534 length: 20, 535 searchTag: e.target.value, 536 sortBy: "name", 537 filters: { ministry_id: [], department_id: [] }, 538 }), 539 dataType: "json", 540 success: function (data) { 541 jQuery("input.suggest-user").removeClass( 542 "ui-autocomplete-loading" 543 ); 544 response( 545 jQuery.map(data.data, function (item) { 546 return { 547 label: item.licenseName, 548 value: item.licenseName, 549 id: item.licenseId, 550 }; 551 }) 552 ); 553 }, 554 error: function (data) { 555 jQuery("input.suggest-user").removeClass( 556 "ui-autocomplete-loading" 557 ); 558 }, 559 }); 560 }, 561 select: function (event, ui) { 562 dataLayer.push({ 563 event: "searchSuggestedApprovals", 564 approvalName: ui.item.value, 565 }); 566 var approvalId = ui.item ? ui.item.id : 0; 567 const url = "/portal/approvaldetails/" + approvalId; 568 window.open(url, "_blank"); 569 }, 570 appendTo: jQuery(this).parent(".autocomplete")[0], 571 }); 572 } 573 ); 574 575 jQuery( 576 ".header_main_section .header_section .search-icon, .header_main_section .header_section .mobile-icon .search,.header-menu-sticky li a.search-icon" 577 ).on("click", function (e) { 578 jQuery("#approval-search").val(""); 579 jQuery("#approval-search-mobile").val(""); 580 }); 581 } 582 583 //Slick in about us section 584 function slickAboutUs() { 585 jQuery("#central-department, #state-department") 586 .not(".slick-initialized") 587 .slick({ 588 infinite: false, 589 slidesToShow: 4, 590 slidesToScroll: 1, 591 responsive: [ 592 { 593 breakpoint: 1200, 594 settings: { 595 slidesToShow: 3, 596 }, 597 }, 598 { 599 breakpoint: 991, 600 settings: { 601 slidesToShow: 4, 602 }, 603 }, 604 { 605 breakpoint: 767, 606 settings: { 607 slidesToShow: 3, 608 }, 609 }, 610 { 611 breakpoint: 550, 612 settings: { 613 slidesToShow: 2, 614 }, 615 }, 616 ], 617 }); 618 619 jQuery("#ministry-association") 620 .not(".slick-initialized") 621 .slick({ 622 infinite: false, 623 slidesToShow: 4, 624 slidesToScroll: 1, 625 responsive: [ 626 { 627 breakpoint: 991, 628 settings: { 629 slidesToShow: 3, 630 }, 631 }, 632 { 633 breakpoint: 767, 634 settings: { 635 slidesToShow: 2, 636 }, 637 }, 638 { 639 breakpoint: 555, 640 settings: { 641 slidesToShow: 1, 642 }, 643 }, 644 ], 645 }); 646 647 jQuery("#state-association") 648 .not(".slick-initialized") 649 .slick({ 650 infinite: false, 651 slidesToShow: 4, 652 slidesToScroll: 1, 653 responsive: [ 654 { 655 breakpoint: 991, 656 settings: { 657 slidesToShow: 4, 658 }, 659 }, 660 { 661 breakpoint: 767, 662 settings: { 663 slidesToShow: 3, 664 }, 665 }, 666 { 667 breakpoint: 555, 668 settings: { 669 slidesToShow: 2, 670 }, 671 }, 672 ], 673 }); 674 jQuery("#ministry-slick").slick({ 675 infinite: false, 676 slidesToShow: 3, 677 slidesToScroll: 1, 678 rows: 2, 679 responsive: [ 680 { 681 breakpoint: 991, 682 settings: { 683 slidesToShow: 2, 684 }, 685 }, 686 { 687 breakpoint: 767, 688 settings: "unslick", 689 }, 690 ], 691 }); 692 jQuery("#state-slick").slick({ 693 infinite: false, 694 slidesToShow: 3, 695 slidesToScroll: 1, 696 rows: 2, 697 responsive: [ 698 { 699 breakpoint: 991, 700 settings: { 701 slidesToShow: 2, 702 }, 703 }, 704 { 705 breakpoint: 767, 706 settings: "unslick", 707 }, 708 ], 709 }); 710 } 711 712 // Responsive header. 713 function headerResponse() { 714 var animation = "rubberBand"; 715 jQuery( 716 ".header_main_section .header_section .approvals-count:empty" 717 ).hide(); 718 jQuery(".header_main_section .header_section .mobile-icon .icon").on( 719 "click", 720 function (e) { 721 e.stopPropagation(); 722 e.preventDefault(); 723 jQuery( 724 ".header_main_section .header_section .mobile-icon .icon" 725 ).toggleClass("icon--active"); 726 jQuery(".header_top_section .right_panel .navbar").toggleClass( 727 "open" 728 ); 729 jQuery(".icon").attr("tabindex", "2"); 730 jQuery(".navbar.open .list-item.menu-dropdown").attr( 731 "tabindex", 732 "1" 733 ); 734 jQuery(".icon--active").attr("tabindex", "3"); 735 jQuery("li").attr("tabindex", "0"); 736 jQuery("body").toggleClass("body-overflow-hidden"); 737 jQuery(this) 738 .addClass("animated " + animation) 739 .one( 740
740 "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", 741 function () { 742 jQuery(this).removeClass("animated " + animation); 743 } 744 ); 745 } 746 ); 747 748 jQuery( 749 ".header_main_section .header_section .search-icon, .header_main_section .header_section .mobile-icon .search,.header-menu-sticky li a.search-icon" 750 ).on("click", function (e) { 751 jQuery(".header_main_section .header_section .search-box").toggle(); 752 jQuery(".header-menu-sticky li .st-dropdown").hide(); 753 jQuery(".search-box .search-input").focus(); 754 755 jQuery(".header_main_section .header_section .navbar").toggleClass( 756 "nav-search" 757 ); 758 jQuery( 759 ".header_main_section .header_section .search-icon" 760 ).toggleClass("search-close"); 761 jQuery( 762 ".header_main_section .header_section .mobile-icon" 763 ).toggleClass("search-open"); 764 return false; 765 }); 766 jQuery(".header-menu-sticky li .st-close").on("click", function (e) { 767 jQuery(".header-menu-sticky li .st-dropdown").hide(); 768 }); 769 //Mob St Menu 770 jQuery(".header-menu-sticky li .st-scheme").on("click", function (e) { 771 jQuery(this).next().toggle(); 772 jQuery(this).parent().siblings().children(".st-dropdown").hide(); 773 jQuery(".search-box").hide(); 774 jQuery( 775 ".header_main_section .header_section .search-icon" 776 ).removeClass("search-close"); 777 }); 778 //approvals tabs 779 jQuery("li").on("keydown", function (event) { 780 if (event.which == 13) { 781 jQuery(this).toggleClass("first-dropdown"); 782 if (jQuery("li").hasClass("first-dropdown")) { 783 jQuery(".first-dropdown > .st-dropdown").css({ 784 visibility: "visible", 785 transition: "max-height 0.2s ease-in", 786 "max-height": "200px", 787 opacity: "1", 788 }); 789 } else { 790 jQuery(".first-dropdown > .st-dropdown").attr("style", ""); 791 } 792 jQuery( 793 ".first-dropdown > .st-dropdown > .st-dropdown-menu > li:last-child" 794 ).on("keydown", function () { 795 jQuery("li").removeClass("first-dropdown"); 796 jQuery(".st-dropdown").attr("style", ""); 797 }); 798 } 799 }); 800 //login tab before user-login 801 jQuery(".custom-dropmenu").on("keydown", function (event) { 802 if (event.which == 13) { 803 jQuery(".custom-dropmenu").toggleClass("login-info"); 804 if (jQuery(".custom-dropmenu").hasClass("login-info")) { 805 jQuery(".login-info > .header-login-dropdown").css({ 806 visibility: "visible", 807 transition: "max-height 0.2s ease-in", 808 "max-height": "200px", 809 opacity: "1", 810 "z-index": "2", 811 top: "42px", 812 }); 813 } else { 814 jQuery(".custom-dropmenu > .header-login-dropdown").attr( 815 "style", 816 "" 817 ); 818 } 819 jQuery("li:last-child").on("keydown", function () { 820 jQuery(".custom-dropmenu > .header-login-dropdown").attr( 821 "style", 822 "" 823 ); 824 }); 825 } 826 }); 827 //login tab after user login 828 jQuery(".dashboard-btn").on("keydown", function (event) { 829 if (event.which == 13) { 830 jQuery(".dashboard-btn").toggleClass("profile-details"); 831 if (jQuery(".dashboard-btn").hasClass("profile-details")) { 832 jQuery(".profile-details > .header-dashboard-dropdown").css({ 833 display: "block", 834 visibility: "visible", 835 transition: "max-height 0.2s ease-in", 836 "max-height": "200px", 837 opacity: "1", 838 }); 839 } else { 840 jQuery(".dashboard-btn > .header-dashboard-dropdown").attr( 841 "style", 842 "" 843 ); 844 } 845 jQuery("li").attr("tabindex", "0"); 846 jQuery( 847 ".header-dashboard-dropdown >.header-dashboard-inner > ul > li:last-child" 848 ).on("keydown", function () { 849 jQuery(".dashboard-btn > .header-dashboard-dropdown").attr( 850 "style", 851 "" 852 ); 853 }); 854 } 855 }); 856 //search bar close and open 857 jQuery(".search-container").on("keydown", function (event) { 858 jQuery(".button-green").attr("tabindex", "0"); 859 if (event.which == 13) { 860 jQuery(".button-green ").on("keydown", function (event) { 861 if (event.which == 9) { 862 jQuery(".search-close").click(); 863 } 864 }); 865 } 866 }); 867 //notification 868 jQuery(".profile-list > .list-content").attr("tabindex", "0"); 869 jQuery(".user-info-header").on("keydown", function (event) { 870 if (event.which == 13) { 871 if (jQuery(".notification").hasClass("notification")) { 872 jQuery(".popuptext").css({ 873 animation: "fadeIn 1s", 874 visibility: "visible", 875 top: "44px", 876 "z-index": "1", 877 opacity: "1", 878 "min-height": "50px", 879 }); 880 } 881 jQuery(".notification").on("keydown", function (event) { 882 if (event.which == 9) { 883 jQuery(".close-icon").click(); 884 jQuery(".popuptext").attr("style", ""); 885 } 886 }); 887 } 888 }); 889 jQuery(".language").on('keydown', function (event) { 890 if (event.which === 13) { 891 jQuery(".lang-hover").css({ display: "block" }) 892 jQuery(".lang-arrow").css({ display: "block" }) 893 jQuery(".language").on('keydown', function (event) { 894 if (event.which === 9) { 895 jQuery(".lang-hover").attr('style', ""); 896 jQuery(".lang-arrow").attr('style', ""); 897 jQuery(".icon--active").click(); 898 jQuery(".icon").attr("tabindex", "0"); 899 } 900 901 }) 902 } 903 }) 904 905 //side nav close after tab comes to notification icon 906 jQuery(".mobile-icon > button").on("keydown", function (event) { 907 if (event.which == 13) { 908 if (localStorage.getItem("userDTO")) { 909 jQuery(".user-profile").on("keydown", function (event) { 910 jQuery(".icon--active").click(); 911 jQuery(".icon").attr("tabindex", "0"); 912 }); 913 // } else { 914 // jQuery(".language").on("keydown", function (event) { 915 // jQuery(".icon--active").click(); 916 // jQuery(".icon").attr("tabindex", "0"); 917 // }); 918 } 919 } 920 }); 921 // Header & Banner 922 if ($(".banner-offset").length) { 923 var bannerOffset = $(".banner-offset").offset().top; 924 } 925 // var headerTop = $('.header_top_section').outerHeight(); 926 $(window).scroll(function () { 927 //Header sticky 928 if ($(window).scrollTop() >= 42) { 929 $(".header_main_section").addClass("sticky"); 930 $("body").css("padding-top", "76px"); 931 } else { 932 $(".header_main_section").removeClass("sticky"); 933 $("body").css("padding-top", ""); 934 } 935 }); 936 if (jQuery(window).width() > 1199) { 937 jQuery(window).scroll(function () { 938 //OffSet Banner for Header Search Icon 939 if (jQuery(window).scrollTop() >= bannerOffset + 1) { 940 jQuery("body.path-frontpage").addClass("search-display"); 941 } else { 942 jQuery("body.path-frontpage").removeClass("search-display"); 943 jQuery(".path-frontpage .navbar").removeClass("nav-search"); 944 jQuery(".path-frontpage .search-icon").removeClass( 945 "search-close" 946 ); 947 jQuery(".path-frontpage .search-box").hide(); 948 } 949 }); 950 } 951 952 // resize by AA+ 953 // jQuery('.header_top_section .right_panel .navbar >ul >li:nth-last-child(2)').html("<div class='font-action'><img src='themes/sws/assets/images/font-incdec.svg' width='18px' alt/><div>"); 954 // jQuery('.header_top_section .right_panel .navbar >ul >li span.decrease-font').hide(); 955 jQuery(".font-action").attr("tabindex", "0"); 956 let baseFontSize = 16; 957 if (!sessionStorage.getItem("currentFontSize")) { 958 sessionStorage.setItem("currentFontSize", baseFontSize.toString()); 959 jQuery("html").css({ "font-size": baseFontSize }); 960 } else { 961 let currentFontSize = parseInt( 962 sessionStorage.getItem("currentFontSize") 963 ); 964 jQuery("html").css({ "font-size": currentFontSize }); 965 966 if ( 967 currentFontSize === 16 || 968 currentFontSize === 17 || 969 currentFontSize === 18 970 ) { 971 jQuery( 972 ".header_top_section .right_panel .navbar >ul >li span.increase-font" 973 ).show(); 974 jQuery( 975 ".header_top_section .right_panel .navbar >ul >li span.decrease-font" 976 ).hide(); 977 } else if (currentFontSize === 19) { 978 jQuery( 979 ".header_top_section .right_panel .navbar >ul >li span.increase-font" 980 ).hide(); 981 jQuery( 982 ".header_top_section .right_panel .navbar >ul >li span.decrease-font" 983 ).show(); 984 } 985 } 986 987 //font size dec/inc by tabs 988 jQuery(".font-action").on("keydown", function (event) { 989 //for increment 990 var currentFontSize = parseInt( 991 jQuery(this).parents("html").css("font-size") 992 ); 993 if ( 994 currentFontSize === 16 || 995 currentFontSize === 17 || 996 currentFontSize === 18 997 ) { 998 jQuery("html").css({ "font-size": currentFontSize + 1 }); 999 sessionStorage.setItem("currentFontSize", currentFontSize + 1); 1000 } 1001 //for decrease 1002 else if (currentFontSize === 19) { 1003 jQuery("html").css({ "font-size": baseFontSize }); 1004 sessionStorage.setItem("currentFontSize", baseFontSize.toString()); 1005 } 1006 }); 1007 jQuery( 1008 ".header_top_section .right_panel .navbar >ul >li:nth-last-child(2)" 1009 ).on("click", function () { 1010 let currentFontSize = parseInt( 1011 jQuery(this).parents("html").css("font-size") 1012 ); 1013 if (currentFontSize === 16 || currentFontSize === 17) { 1014 jQuery("html").css({ "font-size": currentFontSize + 1 }); 1015 sessionStorage.setItem("currentFontSize", currentFontSize + 1); 1016 } else if (currentFontSize === 18) { 1017 jQuery("html").css({ "font-size": currentFontSize + 1 }); 1018 sessionStorage.setItem("currentFontSize", currentFontSize + 1); 1019 } 1020 }); 1021 1022 jQuery( 1023 ".header_top_section .right_panel .navbar >ul >li:nth-last-child(2)" 1024 ).on("click", function () { 1025 const currentFontSize = parseInt( 1026 jQuery(this).parents("html").css("font-size") 1027 ); 1028 if (currentFontSize === 19) { 1029 jQuery("html").css({ "font-size": baseFontSize }); 1030 sessionStorage.setItem("currentFontSize", baseFontSize.toString()); 1031 } 1032 }); 1033 } 1034 1035 // Faqs Accordian. 1036 function faqsAccordian() { 1037 jQuery("#faqaccordian, .faq-lists").accordion({ 1038 collapsible: true, 1039 animate: { duration: 50 }, 1040 }); 1041 const scrollDiv = document.querySelectorAll(".ui-accordion-content"); 1042 var ps; 1043 for (var i = 0; i < scrollDiv.length; i++) { 1044 ps = new PerfectScrollbar(scrollDiv[i]); 1045 } 1046 } 1047 1048 // Scroll to top. 1049 jQuery("#to-top").on("click", function () { 1050 window.scrollTo(0, 0); 1051 }); 1052 1053 //Search common 1054 if (document.getElementById("submitSearchForm")) { 1055 document 1056 .getElementById("submitSearchForm") 1057 .addEventListener("submit", submitSearch); 1058 } 1059 function submitSearch() { 1060 var serchQuery = jQuery(".search-box .search-input").val(); 1061 localStorage.setItem("searchValue", serchQuery); 1062 window.open("/portal/approvalsandregistrations?q=" + serchQuery); 1063 } 1064 if (document.getElementById("submitSearchForm")) { 1065 document 1066 .getElementById("submitSearchMobileForm") 1067 .addEventListener("submit", submitSearchMobile); 1068 } 1069 function submitSearchMobile() { 1070 var serchQueryMobile = jQuery(".search-box .search-input").val(); 1071 localStorage.setItem("searchValue", serchQueryMobile); 1072 window.open("/portal/approvalsandregistrations?q=" + serchQueryMobile); 1073 } 1074 if (jQuery(".readmore-sec,.content-about").length) { 1075 jQuery(".readmore-sec,.content-about").showMore({ 1076 speedDown: 300, 1077 speedUp: 300, 1078 height: 260, 1079 showText: "Read More", 1080 hideText: "Read Less", 1081 }); 1082 } 1083 1084 //selectbox 1085 jQuery("#edit-country").selectBox({ 1086 mobile: true, 1087 menuSpeed: "fast", 1088 keepInViewport: false, 1089 menuTransition: "fade", 1090 }).change(function () { 1091 jQuery(document).ajaxComplete(function (event, xhr, settings) { 1092 if (settings.url.indexOf("/contact-us") > -1 || settings.url.indexOf("/query-feedback") > -1) { 1093 if (jQuery("#edit-country").val() !== "IN") { 1094 jQuery("#state").hide(); 1095 jQuery('.state-selectBox-dropdown-menu.selectBox-options-bottom').css("display", "none"); 1096 } 1097 else { 1098 jQuery("#state").show(); 1099 jQuery('.state-selectBox-dropdown-menu.selectBox-options-bottom').css("display", "block"); 1100 } 1101 } 1102 }); 1103 }); 1104 1105 jQuery("select:not(#edit-country)").selectBox({ 1106 mobile: true, 1107 menuSpeed: "fast", 1108 keepInViewport: false, 1109 menuTransition: "fade", 1110 }); 1111 1112 //hide empty div 1113 //$('.inner-s-box:empty').remove(); 1114 1115 jQuery('.adv-close').on('click', function () { 1116 jQuery('.adv-popup-outer').hide(); 1117 sessionStorage.setItem("popup-banner", "true") 1118 }); 1119 if (window.performance.getEntriesByType("navigation")[0].type === 'reload' || window.performance.getEntriesByType("navigation")[0].type === 'navigate' && sessionStorage.getItem("popup-banner") === 'true') { 1120 jQuery('.adv-popup-outer').hide(); 1121 } 1122 1123 1124 jQuery('.stateList-header li a').on('click', function () { 1125 var link = jQuery(this).attr("href"); 1126 localStorage.setItem('stateLink', link); 1127 }); 1128 // widget 1129 1130 FreshworksWidget('hide', 'launcher'); 1131 1132 jQuery( ".widget" ).on( "click", function() { 1133 jQuery('.widget-icons').toggleClass('active'); 1134 jQuery(".widget").toggleClass("active-widget"); 1135 FreshworksWidget('hide'); 1136 }); 1137 1138 jQuery('.call-option').hover(function(){ 1139 jQuery('.call-text').show(400); 1140 }, function(){ 1141 $('.call-text').hide(); 1142 }); 1143 jQuery('.email-option').hover(function(){ 1144 jQuery('.email-text').show(400); 1145 }, function(){ 1146 $('.email-text').hide(); 1147 } 1148 ); 1149 1150 function attachChatWidgetListeners(){ 1151 jQuery('.chat-option').on('click' , function(){ 1152 FreshworksWidget('open'); 1153 setTimeout(() => { 1154 const iframe = $('#widget-frame'); 1155 const iframeWindow = iframe[0].contentWindow; 1156 const iframeDocument = iframeWindow.document; 1157 const elementInsideIframe = $('[data-testid="header-close"]', iframeDocument); 1158 elementInsideIframe.on('click', () =>{ 1159 jQuery( ".widget" ).trigger( "click"); 1160 }); 1161 }, 1000); 1162 1163 }) 1164 1165 jQuery('#widget-chat-option').on('click' , function(){ 1166 FreshworksWidget('open');
1167 }) 1168 1169 jQuery('.chck-call').on('click' , function(){ 1170 jQuery(".widget").trigger('click'); 1171 }) 1172 1173 jQuery('.chck-email').on('click' , function(){ 1174 jQuery(".widget").trigger('click'); 1175 }) 1176 } 1177 1178 }, 1179 1180 }; 1181})(jQuery, Drupal, this, this.document, drupalSettings);
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.