1$(function() { 2 const cookieValue = getCookieValueGenovaRegion(); 3 console.log("cookieValue " + cookieValue); 4 let flagFileName = "us-16.png"; 5 let flagFileNameAlt = "/html/template/bootstrap5/images/flags/icon_usa.svg"; 6 switch (cookieValue) { 7 case "us": 8 flagFileName = "us-16.png"; 9 flagFileNameAlt = "/html/template/bootstrap5/images/flags/icon_usa.svg"; 10 break; 11 case "uk": 12 flagFileName = "uk-16.png"; 13 flagFileNameAlt = "/html/uk/template/bootstrap5/images/flags/uk_flag.svg"; 14 break; 15 case "international": 16 flagFileName = "globe-16.png"; 17 $(".gdx-region-selector--header .main-link div img").hide(); 18 $("#region-flag-int").removeClass("d-none").removeClass("hidden"); 19 $(".gdx-region-selector button div img").addClass("d-none").addClass("hidden"); 20 $(".gdx-region-selector button div").append('<div class="fal fa-globe"></div>'); 21 break; 22 } 23 24 // Load up region icon. Pulled from /js/custom.js 25 // old non-useBrxmHeader 26 $('#bs-example-navbar-collapse-1 a[href="/"]') 27 .find('em.glyphicon-home') 28 .replaceWith('<img src="/images/flags/' + flagFileName + '" class="pr-10" style="display: inline; margin-top: -3px">'); 29 30 // bootrap header 31 $(".gdx-region-selector--header .main-link div img").attr("src", flagFileNameAlt); 32 // footer region selector 33 $(".gdx-region-selector button div img").attr("src", flagFileNameAlt); 34 $(".gdx-region-selector ul").find("a").each(function () { 35 if ($(this).attr("href").indexOf(cookieValue) > 0) { 36 $(this).addClass("active"); 37 $(".gdx-region-selector button span").text($(this).text()); 38 } else { 39 $(this).removeClass("active"); 40 } 41 }); 42 43 // non-session controlled region DOM hiding 44 $('*[class^="region--"]').each(function() { 45 const classNameArr = this.className.split(/\s+/); 46 if (classNameArr && !classNameArr.includes("region-" + cookieValue)) { 47 $(this).hide(); 48 } 49 }); 50}); 51 52 53$("body").on("click", "#region-dropdown-menu li", function(event) { 54 setCookieValueGenovaRegion(event); 55}); 56 57$("body").on("click", ".gdx-region-selector ul li", function(event) { 58 setCookieValueGenovaRegion(event); 59}); 60 61$("body").on("click", ".gdx-region-selector--header .sub-links a", function(event) { 62 setCookieValueGenovaRegion(event); 63}); 64 65$("body").on("click", ".region-link", function(event) { 66 setCookieValueGenovaRegion(event); 67}); 68 69function setCookieValueGenovaRegion(event) { 70 // either <a> or <li><a></a></li> 71 const hrefValue = $(this).attr("href") 72 || $(event.currentTarget).children("a").attr("href") 73 || $(event.currentTarget).attr("href"); 74 let value = "us"; 75 switch (hrefValue) { 76 case "/": 77 value = "us"; 78 break; 79 case "/uk": 80 value = "uk"; 81 break; 82 case "/international": 83 value = "international"; 84 break; 85 } 86 document.cookie = "genovaRegion=" + value + ";max-age=31536000;path=/;domain=gdx.net;Secure"; 87} 88 89function getCookieValueGenovaRegion() { 90 const allCookies = document.cookie.split(';'); 91 const namedCookie = allCookies && allCookies.find(cookie => cookie.trim().startsWith('genovaRegion=')); 92 const cookieKeyValue = namedCookie && namedCookie.split('='); 93 return cookieKeyValue && (cookieKeyValue.length == 2 ? cookieKeyValue[1] : null); 94}
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.