1function countrySelectionPopupStrip (pageType) { 2 if( jQuery('[data-country-popup-strip]').length > 0 ) { 3 var countryCode; 4 var formDataCountryPopup = { 5 'page_type': pageType, 6 'url_path': C_URL, 7 'place': '' 8 }; 9 10 jQuery.ajax({ 11 type: 'POST', 12 url: COUNTRY_CHECK_API, 13 data: formDataCountryPopup, 14 success: function(response) { 15 if(response.success) { 16 var htmlStringOption; 17 if(!response.data.segement) { 18 if(pageType === 'me'){ 19 showMECitiesByCountryCode(response.data.country_code); 20 } 21 if(response.data.popup) { 22 if(pageType === 'home' || pageType === 'me'){ // add popup strip before Header of India Home Page 23 jQuery('header').before(jQuery('#geo-country-selection-popup')); 24 } 25 26 // Check if country code and requested page are for same country then hide country popup strip 27 if( 28 (response.data.flag === 'IN' && ( response.data.logo =='//' || response.data.logo == '/support-center/' )) || 29 (response.data.flag === 'CA' && response.data.logo =='/ca/' ) || 30 (response.data.flag === 'US' && response.data.logo =='/us/' ) || 31 (response.data.flag === 'MX' && response.data.logo =='/mx/' ) || 32 (response.data.flag === 'AU' && response.data.logo =='/au/' ) || 33 (response.data.flag === 'UK' && response.data.logo =='/uk/' ) || 34 (response.data.flag === 'ME' && response.data.logo =='/me/' ) || 35 (response.data.flag === 'BR' && response.data.logo =='/br/' ) || 36 (response.data.flag === 'GLOBAL' && response.data.logo =='/global/' ) 37 ) { 38 jQuery('[data-country-popup-strip]').addClass('hidden'); 39 } else { 40 var path_name = document.location.pathname; 41 42 jQuery('[data-country-popup-strip]').removeClass('hidden'); 43 htmlStringOption = '<option '+ ( (response.data.flag === 'CA') ? 'selected' : '') + ' value="ca/'+response.data.segment+'"> Canada </option>'; 44 htmlStringOption += '<option '+ ( (response.data.flag === 'US') ? 'selected' : '') + ' value="us/'+response.data.segment+'"> USA </option>'; 45 htmlStringOption += '<option '+ ( (response.data.flag === 'IN') ? 'selected' : '') + ' value="'+response.data.segment+'"> India </option>'; 46 if(response.data.segment !== 'faq' && response.data.segment !== 'support-center') { 47 htmlStringOption += '<option '+ ( (response.data.flag === 'MX') ? 'selected' : '') + ' value="mx/'+response.data.segment+'"> Mexico </option>'; 48 htmlStringOption += '<option '+ ( (response.data.flag === 'AU') ? 'selected' : '') + ' value="au/'+response.data.segment+'"> Australia </option>'; 49 htmlStringOption += '<option '+ ( (response.data.flag === 'UK') ? 'selected' : '') + ' value="uk/'+response.data.segment+'"> United Kingdom </option>'; 50 htmlStringOption += '<option '+ ( (response.data.flag === 'BR') ? 'selected' : '') + ' value="br/'+response.data.segment+'"> Brazil </option>'; 51 htmlStringOption += '<option '+ ( (response.data.flag === 'ME') ? 'selected' : '') + ' value="me/'+response.data.segment+'"> Middle East </option>'; 52 htmlStringOption += '<option '+ ( (response.data.flag === 'GLOBAL') ? 'selected' : '') + ' value="global/'+response.data.segment+'"> Global </option>'; 53 } 54 jQuery('[data-country-dropdown]').append(htmlStringOption); 55 56 var IS_POPUP_CLICKED = getCookie("popUpClicked");; // Get cookie value 57 58 //todo : Need to check, what is the logic behind IF condition 59 if( !IS_POPUP_CLICKED && ( 60 ( path_name == '/' || path_name == '' && response.data.flag == 'US') || 61 ( path_name == '/' || path_name == '' && response.data.flag == 'MX') 62 ) 63 ) { 64 jQuery('head').after('<link rel="stylesheet" href="https://cdn1.byjus.com/byjusweb/css/custom-bootstrap.css" type="text/css" />'); 65 setTimeout(function() { 66 var popupHtmlString = '<div class="modal fade country-popup-for-us" id="country-popup-for-us-modal" data-backdrop="static" data-keyboard="false" role="dialog">'+ 67 '<div class="modal-dialog country-popup-dialog-for-us">'+ 68 '<div class="modal-content">'+ 69 '<div class="modal-body country-popup-body">'+ 70 '<p class="choose-region-text"><span>Choose your country or region</span> <br> to see content specific <br> to your location.</p>'+ 71 '<div class="geo-country-selection-dropdown">'+ 72 '<form>'+ 73 '<div class="form-group form-group-us-country">'+ 74 '<select class="form-control" id="country-popup-page" data-country-dropdown-us data-country-dropdown></select>'+ 75 '</div>'+ 76 '<input type="button" class="btn btn-info countinue-btn" role="button" value="Continue" onclick="continueFun(\'popup\')">'+ 77 '</form>'+ 78 '</div>'+ 79 '</div>'+ 80 '</div>'+ 81 '</div>'+ 82 '</div>'; 83 jQuery('body').after(popupHtmlString); 84 jQuery('[data-country-dropdown-us]').append(htmlStringOption); 85 jQuery('#country-popup-for-us-modal').modal('show'); 86 }, 1500); 87 } 88 jQuery('[data-country-dropdown]').after('<input type="hidden" data-country-flag="'+ response.data.flag +'">'); 89 } 90 } 91 } 92 } 93 }, 94 error: function(error){ 95 console.log('error:', error); 96 } 97 }); 98 } 99} 100 101function continueFun(continueFrom){ 102 var selCountry = jQuery('#country').val(); 103 104 if(continueFrom == 'popup') { // for us popup form 105 selCountry = jQuery('#country-popup-page').val(); 106 107 // Set to cookies 108 var expires = ""; 109 var date = new Date(); 110 date.setTime(date.getTime() + (1*24*60*60*1000)); 111 expires = "; expires=" + date.toUTCString(); 112 var popUpClickedValue = encodeURIComponent(selCountry + countryFlag); // value should have IP as well in combination 113 document.cookie = "popUpClicked" + "=" + (popUpClickedValue || "") + expires + "; path=/"; 114 } 115 var countryFlag = jQuery('.geo-country-selection-dropdown').find('[data-country-flag]').attr('data-country-flag'); 116 //Event capture when user is on Byjus home page in US and selected US from country dropdown 117 var path_name = document.location.pathname; 118 if(GA_FLAG && (path_name == '/' || path_name == '') && selCountry == 'us/' && countryFlag == 'US'){ 119 // trigger event on basis of popup 120 (continueFrom == 'popup') ? ga("send", "event", "Country Popup Continue Btn", "Country Block Popup US Selection", 'Country Block Popup US Selection'): ga("send", "event", "Country Popup Continue Btn", "Country Popup US Selection", 'Country Popup US Selection'); 121 } 122 return window.open(BASE_URL + selCountry,"_self"); 123} 124 125function closeBtn() { 126 jQuery('[data-country-popup-strip]').addClass('hidden'); 127} 128 129function getCookie(cname) { 130 let name = cname + "=";
131 let ca = document.cookie.split(';'); 132 for(let i = 0; i < ca.length; i++) { 133 let c = ca[i]; 134 while (c.charAt(0) == ' ') { 135 c = c.substring(1); 136 } 137 if (c.indexOf(name) == 0) { 138 return c.substring(name.length, c.length); 139 } 140 } 141 return ""; 142 }
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.