1(function ($) { 2 3 $(document).ready(function () { 4 $(".login_btn").click(function () { 5 // $('#Loginpopup').show(); 6 // Get the current URL 7 var currentUrl = window.location.href; 8 9 // Extract the language prefix if it exists 10 var languagePrefixMatch = currentUrl.match(/[^/]+\/([^/]+)\/sih/); 11 12 // Find the index of "sih/" 13 var sihIndex = currentUrl.indexOf("sih/"); 14 15 var redirectUrl = window.location.origin; 16 if (languagePrefixMatch && languagePrefixMatch[1]) { 17 redirectUrl += "/" + languagePrefixMatch[1] + "/"; // Append the language prefix if it exists 18 } 19 20 // Check if "sih/" is found in the URL 21 if (sihIndex !== -1) { 22 // Extract the part of the URL after "sih/" 23 var dynamicPart = currentUrl.substring(sihIndex + 4); 24 25 // Update the href attribute of the .login_btn element 26 $(".login_btn").attr( 27 "href", 28 redirectUrl + 29 "?action=drupallogin&redirectto=" + 30 encodeURIComponent(dynamicPart) 31 ); 32 } else { 33 console.error('"sih/" not found in the URL'); 34 } 35 // $('body').addClass('body-no-scroll'); 36 }); 37 $(".close").click(function () { 38 $("#Loginpopup").hide(); 39 $("body").removeClass("body-no-scroll"); 40 }); 41 42 $(".login-dropdown").hover( 43 function () { 44 $(".acc-setting-list").hide(); 45 $(".user-dropdown-popup").show(); 46 }, 47 function () { 48 $(".user-dropdown-popup").hide(); 49 } 50 ); 51 }); 52 53 $(document).ready(function () { 54 $(".settings-drop-down").on("click", function () { 55 $(".acc-setting-list").slideToggle(); 56 }); 57 58 $(".open-modal").on("click", function () { 59 $("body").addClass("modal-open1"); 60 $("body").addClass("body-no-scroll"); 61 }); 62 $(".close-modal, .close-btn").on("click", function () { 63 $("body").removeClass("modal-open1"); 64 $("body").removeClass("body-no-scroll"); 65 }); 66 }); 67 68 $(document).ready(function () { 69 function updateNavId() { 70 if ($(window).width() < 1024) { 71 $(".nav-bar").addClass("mb-nav-bar"); 72 } else { 73 $(".nav-bar").removeClass("mb-nav-bar"); 74 } 75 } 76 77 updateNavId(); 78 $(window).resize(function () { 79 updateNavId(); 80 }); 81 }); 82 83 /***** Mobile Header Starts Here *****/ 84 const mobile = document.querySelector("#mobile"); 85 const navClose = document.querySelector(".nav-close"); 86 const mbNav = document.querySelector("#mbnav"); 87 const bodyAdd = document.querySelector("body"); 88 const navOverlay = document.querySelector(".nav-overlay"); 89 90 mobile.addEventListener("click", function () { 91 mbNav.classList.add("show"); 92 bodyAdd.classList.add("body-no-scroll"); 93 navOverlay.style.display = "block"; 94 }); 95 // navClose.addEventListener("click", function () { 96 // $('.mb-nav-bar li.dropdownArrow').closest("li.dropdown").find("ul").removeClass("active-sub-nav"); 97 // $('#mbnav .mobile-nav-head .back').hide(); 98 // $('#mbnav .mobile-nav-head h3').text("Menu"); 99 // $('#mbnav .mobile-nav-head').removeClass('active-nav-head'); 100 // mbNav.classList.remove("show"); 101 // bodyAdd.classList.remove("body-no-scroll"); 102 // navOverlay.style.display = 'none'; 103 // }); 104 105 navClose.addEventListener("click", function () { 106 var dropdownArrows = document.querySelectorAll( 107 ".mb-nav-bar li.dropdownArrow" 108 ); 109 dropdownArrows.forEach(function (arrow) { 110 var closestDropdown = arrow.closest("li.dropdown"); 111 if (closestDropdown) { 112 var ul = closestDropdown.querySelector("ul"); 113 if (ul) { 114 ul.classList.remove("active-sub-nav"); 115 } 116 } 117 }); 118 119 mbNav.querySelector(".mobile-nav-head .back").style.display = "none"; 120 mbNav.querySelector(".mobile-nav-head h3").textContent = "Menu"; 121 mbNav.querySelector(".mobile-nav-head").classList.remove("active-nav-head"); 122 mbNav.classList.remove("show"); 123 bodyAdd.classList.remove("body-no-scroll"); 124 navOverlay.style.display = "none"; 125 }); 126 127 const loginDropdown = document.querySelector("#logindropdown"); 128 const loginRagitionlist = document.querySelector(".login-ragition-list"); 129 loginDropdown.addEventListener("click", function () { 130 loginRagitionlist.classList.toggle("show"); 131 }); 132 133 // Close loginRagitionlist if click elsewhere 134 document.addEventListener("click", function (event) { 135 if ( 136 !loginRagitionlist.contains(event.target) && 137 !loginDropdown.contains(event.target) 138 ) { 139 loginRagitionlist.classList.remove("show"); 140 } 141 }); 142 143 // Function to handle click events for mobile navigation 144 function handleMobileNavigationClick() {
145 $("#mbnav .mobile-nav-head .back").click(function () { 146 $(".mb-nav-bar li.dropdownArrow") 147 .closest("li.dropdown") 148 .find("ul") 149 .removeClass("active-sub-nav"); 150 $("#mbnav .mobile-nav-head .back").hide(); 151 $("#mbnav .mobile-nav-head h3").text("Menu"); 152 $("#mbnav .mobile-nav-head").removeClass("active-nav-head"); 153 }); 154 155 $(".mb-nav-bar li.dropdownArrow").click(function () { 156 $(".mb-nav-bar li.dropdownArrow") 157 .not(this) 158 .closest("li.dropdown") 159 .find("ul") 160 .removeClass("active-sub-nav"); 161 $(this).closest("li.dropdown").find("ul").addClass("active-sub-nav"); 162 $("#mbnav .mobile-nav-head .back").show(); 163 $("#mbnav .mobile-nav-head").addClass("active-nav-head"); 164 var activeNavText = $(this).find("a:first").text(); 165 $("#mbnav .mobile-nav-head h3").text(activeNavText); 166 }); 167 } 168 169 // Function to handle resizing of the window 170 function handleWindowResize() { 171 $(window).resize(function () { 172 // Call the function to handle mobile navigation click events 173 handleMobileNavigationClick(); 174 }); 175 handleMobileNavigationClick(); 176 } 177 178 // Call the function to handle resizing of the window 179 $(document).ready(function () { 180 handleWindowResize(); 181 }); 182})(jQuery); 183 184/***** Mobile Header Ends Here *****/ 185 186function scrollFunction() { 187 try { 188 if ( 189 document.body.scrollTop > 500 || 190 document.documentElement.scrollTop > 500 191 ) { 192 mybutton.style.display = "flex"; 193 } else { 194 mybutton.style.display = "none"; 195 } 196 } catch (error) { 197 console.log("Unexpected: ", error); 198 } 199} 200 201window.onscroll = function () { 202 myFunction(); 203 scrollFunction(); 204}; 205 206function myFunction() { 207 var header = document.getElementById("header-middle"); 208 var sticky = header.offsetTop; 209 if (window.scrollY > sticky && window.innerWidth > 768) { 210 header.classList.add("sticky"); 211 } else { 212 header.classList.remove("sticky"); 213 } 214} 215 216/**** Translation Start Here ****/ 217 218document.querySelectorAll("#lang_container a").forEach(function (element) { 219 element.addEventListener("click", changeLanguageFn); 220}); 221 222function getCookieLang(cname) { 223 var name = cname + "="; 224 var ca = document.cookie.split(";"); 225 for (var i = 0; i < ca.length; i++) { 226 var c = ca[i]; 227 while (c.charAt(0) == " ") { 228 c = c.substring(1); 229 } 230 if (c.indexOf(name) == 0) { 231 return c.substring(name.length, c.length); 232 } 233 } 234 return ""; 235} 236 237function setLangCookie(cname, cvalue) { 238 var newUrl = window.location.href; 239 while (newUrl.indexOf("//") >= 0) { 240 newUrl = newUrl.replace(/\/\//g, "/"); 241 } 242 newUrl = newUrl 243 .replace(/http:\//g, "http://") 244 .replace(/https:\//g, "https://"); 245 window.location.href = newUrl; 246} 247 248function changeLanguageFn() { 249 // var updatedLang = $(this).attr("value"); 250 // $(".header-language").find('span').eq(0).text($(this).text()); 251 // $(".header-language").find('span').eq(1).text($(this).text()); 252 253 var updatedLang = this.getAttribute("value"); 254 var langText = this.textContent || this.innerText; 255 var headerLanguageSpans = document.querySelectorAll(".header-language span"); 256 headerLanguageSpans[0].textContent = langText; 257 headerLanguageSpans[1].textContent = langText; 258 259 if (updatedLang === "English") setLangCookie("lang", ""); 260 else setLangCookie("lang", updatedLang); 261 262 RedirectUrl(updatedLang); 263} 264 265var langCodeList = 266 "Hindi,Marathi,Bengali,Gujarati,Punjabi,Oriya,Tamil,Telugu,Malayalam,Kannada,Assamese,Konkani,Santhali,Maithali,Sanskrit,Bodo,Sindhi,Manipuri,Nepali,Urdu,Kashmiri,Dogri,Azerbaijani,Belarusian,Persian,Kazakhstan,Kyrgyzstan,Tajikistan,Uzbekistan,Finnish,Japanese,Korean,Russian,Dutch,French,Portuguese,Spanish,Chinese_simplified,Chinese_traditional"; 267document.onreadystatechange = function () { 268 var urlName = window.location.pathname; 269 var strSegment = window.location.pathname.split("/"); 270 var langName = GetLanguage(strSegment[1]); 271}; 272 273function RedirectUrl(strLang) { 274 var newUrl = ""; 275 var pathName = window.location.pathname; 276 var strSegment = window.location.pathname.split("/"); 277 var segmentLang = strSegment[1]; 278 var origHost = window.location.host; 279 280 if ( 281 langCodeList 282 .toString() 283 .toLowerCase() 284 .indexOf(segmentLang.toString().toLowerCase()) > -1 285 ) 286 pathName = pathName.replace("/" + segmentLang, ""); 287 288 if (strLang.toString().toLowerCase() == "english") { 289 newUrl = window.location.protocol + "//" + origHost + pathName; 290 } else { 291 if (pathName == "/") pathName = ""; 292 newUrl = 293 window.location.protocol + 294 "//" + 295 origHost + 296 "/" + 297 strLang.toString().toLowerCase() + 298 "/" + 299 pathName; 300 } 301 302 while (newUrl.indexOf("//") >= 0) { 303 newUrl = newUrl.replace(/\/\//g, "/"); 304 } 305 newUrl = newUrl 306 .replace(/http:\//g, "http://") 307 .replace(/https:\//g, "https://"); 308 window.location = newUrl; 309} 310 311function GetSubDomain(hostname) { 312 var regexParse = new RegExp("[a-z-0-9]{2,63}.[a-z.]{2,5}$"); 313 if (hostname) { 314 var urlParts = regexParse.exec(hostname); 315 return hostname.replace(urlParts[0], "").slice(0, -1); 316 } 317} 318function GetLanguage(strLanguage) { 319 if (strLanguage != "sih") { 320 document.getElementById("P9LngDdl").innerText = strLanguage.toUpperCase(); 321 } else { 322 document.getElementById("P9LngDdl").innerText = "ENGLISH"; 323 } 324 if (!strLanguage) return strLanguage; 325 326 var strLang; 327 switch (strLanguage.toLowerCase()) { 328 case "hindi": 329 strLang = "Hindi"; 330 break; 331 case "marathi": 332 strLang = "Marathi"; 333 break; 334 case "bengali": 335 strLang = "Bengali"; 336 break; 337 case "gujarati": 338 strLang = "Gujarati"; 339 break; 340 case "punjabi": 341 strLang = "Punjabi"; 342 break; 343 case "oriya": 344 strLang = "Oriya"; 345 break; 346 case "tamil": 347 strLang = "Tamil"; 348 break; 349 case "telugu": 350 strLang = "Telugu";
351 break; 352 case "malayalam": 353 strLang = "Malayalam"; 354 break; 355 case "kannada": 356 strLang = "Kannada"; 357 break; 358 case "assamese": 359 strLang = "Assamese"; 360 break; 361 case "konkani": 362 strLang = "Konkani"; 363 break; 364 case "santhali": 365 strLang = "Santhali"; 366 break; 367 case "maithali": 368 strLang = "Maithali"; 369 break; 370 case "sanskrit": 371 strLang = "Sanskrit"; 372 break; 373 case "bodo": 374 strLang = "Bodo"; 375 break; 376 case "sindhi": 377 strLang = "Sindhi"; 378 break; 379 case "manipuri": 380 strLang = "Manipuri"; 381 break; 382 case "nepali": 383 strLang = "Nepali"; 384 break; 385 case "urdu": 386 strLang = "Urdu"; 387 break; 388 case "kashmiri": 389 strLang = "Kashmiri"; 390 break; 391 case "dogri": 392 strLang = "Dogri"; 393 break; 394 case "azerbaijani": 395 strLang = "Azerbaijani"; 396 break; 397 case "belarusian": 398 strLang = "Belarusian"; 399 break; 400 case "persian": 401 strLang = "Persian"; 402 break; 403 case "kazakhstan": 404 strLang = "Kazakhstan"; 405 break; 406 case "kyrgyzstan": 407 strLang = "Kyrgyzstan"; 408 break; 409 case "tajikistan": 410 strLang = "Tajikistan"; 411 break; 412 case "uzbekistan": 413 strLang = "Uzbekistan"; 414 break; 415 case "finnish": 416 strLang = "Finnish"; 417 break; 418 case "japanese": 419 strLang = "Japanese"; 420 break; 421 case "korean": 422 strLang = "Korean"; 423 break; 424 case "russian": 425 strLang = "Russian"; 426 break; 427 case "dutch": 428 strLang = "Dutch"; 429 break; 430 case "french": 431 strLang = "French"; 432 break; 433 case "portuguese": 434 strLang = "Portuguese"; 435 break; 436 case "spanish": 437 strLang = "Spanish"; 438 break; 439 case "chn-smpl": 440 strLang = "Chinese_simplified"; 441 break; 442 case "chn-tred": 443 strLang = "Chinese_traditional"; 444 break; 445 case "english": 446 strLang = "en-in"; 447 break; 448 449 default: 450 break; 451 } 452 453 return strLang; 454} 455 456/**** Translation End Here ****/
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.