1jQuery(document).ready(function($) { 2 3 var countries = [ 4 { id: '0', text: 'Select Country' }, 5 { id: 'AF', text: 'Afghanistan'}, 6 { id: 'AX', text: 'Aland Islands'}, 7 { id: 'AL', text: 'Albania'}, 8 { id: 'DZ', text: 'Algeria'}, 9 { id: 'AS', text: 'American Samoa'}, 10 { id: 'AD', text: 'Andorra'}, 11 { id: 'AO', text: 'Angola'}, 12 { id: 'AI', text: 'Anguilla'}, 13 { id: 'AQ', text: 'Antarctica'}, 14 { id: 'AG', text: 'Antigua And Barbuda'}, 15 { id: 'AR', text: 'Argentina'}, 16 { id: 'AM', text: 'Armenia'}, 17 { id: 'AW', text: 'Aruba'}, 18 { id: 'AU', text: 'Australia'}, 19 { id: 'AT', text: 'Austria'}, 20 { id: 'AZ', text: 'Azerbaijan'}, 21 { id: 'BS', text: 'Bahamas'}, 22 { id: 'BH', text: 'Bahrain'}, 23 { id: 'BD', text: 'Bangladesh'}, 24 { id: 'BB', text: 'Barbados'}, 25 { id: 'BY', text: 'Belarus'}, 26 { id: 'BE', text: 'Belgium'}, 27 { id: 'BZ', text: 'Belize'}, 28 { id: 'BJ', text: 'Benin'}, 29 { id: 'BM', text: 'Bermuda'}, 30 { id: 'BT', text: 'Bhutan'}, 31 { id: 'BO', text: 'Bolivia'}, 32 { id: 'BA', text: 'Bosnia And Herzegovina'}, 33 { id: 'BW', text: 'Botswana'}, 34 { id: 'BV', text: 'Bouvet Island'}, 35 { id: 'BR', text: 'Brazil'}, 36 { id: 'IO', text: 'British Indian Ocean Territory'}, 37 { id: 'BN', text: 'Brunei Darussalam'}, 38 { id: 'BG', text: 'Bulgaria'}, 39 { id: 'BF', text: 'Burkina Faso'}, 40 { id: 'BI', text: 'Burundi'}, 41 { id: 'KH', text: 'Cambodia'}, 42 { id: 'CM', text: 'Cameroon'}, 43 { id: 'CA', text: 'Canada'}, 44 { id: 'CV', text: 'Cape Verde'}, 45 { id: 'KY', text: 'Cayman Islands'}, 46 { id: 'CF', text: 'Central African Republic'}, 47 { id: 'TD', text: 'Chad'}, 48 { id: 'CL', text: 'Chile'}, 49 { id: 'CN', text: 'China'}, 50 { id: 'CX', text: 'Christmas Island'}, 51 { id: 'CC', text: 'Cocos (Keeling) Islands'}, 52 { id: 'CO', text: 'Colombia'}, 53 { id: 'KM', text: 'Comoros'}, 54 { id: 'CG', text: 'Congo'}, 55 { id: 'CD', text: 'Congo}, Democratic Republic'}, 56 { id: 'CK', text: 'Cook Islands'}, 57 { id: 'CR', text: 'Costa Rica'}, 58 { id: 'CI', text: 'Cote D\'Ivoire'}, 59 { id: 'HR', text: 'Croatia'}, 60 { id: 'CU', text: 'Cuba'}, 61 { id: 'CY', text: 'Cyprus'}, 62 { id: 'CZ', text: 'Czech Republic'}, 63 { id: 'DK', text: 'Denmark'}, 64 { id: 'DJ', text: 'Djibouti'}, 65 { id: 'DM', text: 'Dominica'}, 66 { id: 'DO', text: 'Dominican Republic'}, 67 { id: 'EC', text: 'Ecuador'}, 68 { id: 'EG', text: 'Egypt'}, 69 { id: 'SV', text: 'El Salvador'}, 70 { id: 'GQ', text: 'Equatorial Guinea'}, 71 { id: 'ER', text: 'Eritrea'}, 72 { id: 'EE', text: 'Estonia'}, 73 { id: 'ET', text: 'Ethiopia'}, 74 { id: 'FK', text: 'Falkland Islands (Malvinas)'}, 75 { id: 'FO', text: 'Faroe Islands'}, 76 { id: 'FJ', text: 'Fiji'}, 77 { id: 'FI', text: 'Finland'}, 78 { id: 'FR', text: 'France'}, 79 { id: 'GF', text: 'French Guiana'}, 80 { id: 'PF', text: 'French Polynesia'}, 81 { id: 'TF', text: 'French Southern Territories'}, 82 { id: 'GA', text: 'Gabon'}, 83 { id: 'GM', text: 'Gambia'}, 84 { id: 'GE', text: 'Georgia'}, 85 { id: 'DE', text: 'Germany'}, 86 { id: 'GH', text: 'Ghana'}, 87 { id: 'GI', text: 'Gibraltar'}, 88 { id: 'GR', text: 'Greece'}, 89 { id: 'GL', text: 'Greenland'}, 90 { id: 'GD', text: 'Grenada'}, 91 { id: 'GP', text: 'Guadeloupe'}, 92 { id: 'GU', text: 'Guam'}, 93 { id: 'GT', text: 'Guatemala'}, 94 { id: 'GG', text: 'Guernsey'}, 95 { id: 'GN', text: 'Guinea'}, 96 { id: 'GW', text: 'Guinea-Bissau'}, 97 { id: 'GY', text: 'Guyana'}, 98 { id: 'HT', text: 'Haiti'}, 99 { id: 'HM', text: 'Heard Island & Mcdonald Islands'}, 100 { id: 'VA', text: 'Holy See (Vatican City State)'}, 101 { id: 'HN', text: 'Honduras'}, 102 { id: 'HK', text: 'Hong Kong'}, 103 { id: 'HU', text: 'Hungary'}, 104 { id: 'IS', text: 'Iceland'}, 105 { id: 'IN', text: 'India'}, 106 { id: 'ID', text: 'Indonesia'}, 107 { id: 'IR', text: 'Iran}, Islamic Republic Of'}, 108 { id: 'IQ', text: 'Iraq'}, 109 { id: 'IE', text: 'Ireland'}, 110 { id: 'IM', text: 'Isle Of Man'}, 111 { id: 'IL', text: 'Israel'}, 112 { id: 'IT', text: 'Italy'}, 113 { id: 'JM', text: 'Jamaica'}, 114 { id: 'JP', text: 'Japan'}, 115 { id: 'JE', text: 'Jersey'}, 116 { id: 'JO', text: 'Jordan'}, 117 { id: 'KZ', text: 'Kazakhstan'}, 118 { id: 'KE', text: 'Kenya'}, 119 { id: 'KI', text: 'Kiribati'},
120 { id: 'KR', text: 'Korea'}, 121 { id: 'KW', text: 'Kuwait'}, 122 { id: 'KG', text: 'Kyrgyzstan'}, 123 { id: 'LA', text: 'Lao People\'s Democratic Republic'}, 124 { id: 'LV', text: 'Latvia'}, 125 { id: 'LB', text: 'Lebanon'}, 126 { id: 'LS', text: 'Lesotho'}, 127 { id: 'LR', text: 'Liberia'}, 128 { id: 'LY', text: 'Libyan Arab Jamahiriya'}, 129 { id: 'LI', text: 'Liechtenstein'}, 130 { id: 'LT', text: 'Lithuania'}, 131 { id: 'LU', text: 'Luxembourg'}, 132 { id: 'MO', text: 'Macao'}, 133 { id: 'MK', text: 'Macedonia'}, 134 { id: 'MG', text: 'Madagascar'}, 135 { id: 'MW', text: 'Malawi'}, 136 { id: 'MY', text: 'Malaysia'}, 137 { id: 'MV', text: 'Maldives'}, 138 { id: 'ML', text: 'Mali'}, 139 { id: 'MT', text: 'Malta'}, 140 { id: 'MH', text: 'Marshall Islands'}, 141 { id: 'MQ', text: 'Martinique'}, 142 { id: 'MR', text: 'Mauritania'}, 143 { id: 'MU', text: 'Mauritius'}, 144 { id: 'YT', text: 'Mayotte'}, 145 { id: 'MX', text: 'Mexico'}, 146 { id: 'FM', text: 'Micronesia}, Federated States Of'}, 147 { id: 'MD', text: 'Moldova'}, 148 { id: 'MC', text: 'Monaco'}, 149 { id: 'MN', text: 'Mongolia'}, 150 { id: 'ME', text: 'Montenegro'}, 151 { id: 'MS', text: 'Montserrat'}, 152 { id: 'MA', text: 'Morocco'}, 153 { id: 'MZ', text: 'Mozambique'}, 154 { id: 'MM', text: 'Myanmar'}, 155 { id: 'NA', text: 'Namibia'}, 156 { id: 'NR', text: 'Nauru'}, 157 { id: 'NP', text: 'Nepal'}, 158 { id: 'NL', text: 'Netherlands'}, 159 { id: 'AN', text: 'Netherlands Antilles'}, 160 { id: 'NC', text: 'New Caledonia'}, 161 { id: 'NZ', text: 'New Zealand'}, 162 { id: 'NI', text: 'Nicaragua'}, 163 { id: 'NE', text: 'Niger'}, 164 { id: 'NG', text: 'Nigeria'}, 165 { id: 'NU', text: 'Niue'}, 166 { id: 'NF', text: 'Norfolk Island'}, 167 { id: 'MP', text: 'Northern Mariana Islands'}, 168 { id: 'NO', text: 'Norway'}, 169 { id: 'OM', text: 'Oman'}, 170 { id: 'PK', text: 'Pakistan'}, 171 { id: 'PW', text: 'Palau'}, 172 { id: 'PS', text: 'Palestinian Territory}, Occupied'}, 173 { id: 'PA', text: 'Panama'}, 174 { id: 'PG', text: 'Papua New Guinea'}, 175 { id: 'PY', text: 'Paraguay'}, 176 { id: 'PE', text: 'Peru'}, 177 { id: 'PH', text: 'Philippines'}, 178 { id: 'PN', text: 'Pitcairn'}, 179 { id: 'PL', text: 'Poland'}, 180 { id: 'PT', text: 'Portugal'}, 181 { id: 'PR', text: 'Puerto Rico'}, 182 { id: 'QA', text: 'Qatar'}, 183 { id: 'RE', text: 'Reunion'}, 184 { id: 'RO', text: 'Romania'}, 185 { id: 'RU', text: 'Russian Federation'}, 186 { id: 'RW', text: 'Rwanda'}, 187 { id: 'BL', text: 'Saint Barthelemy'}, 188 { id: 'SH', text: 'Saint Helena'}, 189 { id: 'KN', text: 'Saint Kitts And Nevis'}, 190 { id: 'LC', text: 'Saint Lucia'}, 191 { id: 'MF', text: 'Saint Martin'}, 192 { id: 'PM', text: 'Saint Pierre And Miquelon'}, 193 { id: 'VC', text: 'Saint Vincent And Grenadines'}, 194 { id: 'WS', text: 'Samoa'}, 195 { id: 'SM', text: 'San Marino'}, 196 { id: 'ST', text: 'Sao Tome And Principe'}, 197 { id: 'SA', text: 'Saudi Arabia'}, 198 { id: 'SN', text: 'Senegal'}, 199 { id: 'RS', text: 'Serbia'}, 200 { id: 'SC', text: 'Seychelles'}, 201 { id: 'SL', text: 'Sierra Leone'}, 202 { id: 'SG', text: 'Singapore'}, 203 { id: 'SK', text: 'Slovakia'}, 204 { id: 'SI', text: 'Slovenia'}, 205 { id: 'SB', text: 'Solomon Islands'}, 206 { id: 'SO', text: 'Somalia'}, 207 { id: 'ZA', text: 'South Africa'}, 208 { id: 'GS', text: 'South Georgia And Sandwich Isl.'}, 209 { id: 'ES', text: 'Spain'}, 210 { id: 'LK', text: 'Sri Lanka'}, 211 { id: 'SD', text: 'Sudan'}, 212 { id: 'SR', text: 'Suriname'}, 213 { id: 'SJ', text: 'Svalbard And Jan Mayen'}, 214 { id: 'SZ', text: 'Swaziland'}, 215 { id: 'SE', text: 'Sweden'}, 216 { id: 'CH', text: 'Switzerland'}, 217 { id: 'SY', text: 'Syrian Arab Republic'}, 218 { id: 'TW', text: 'Taiwan'}, 219 { id: 'TJ', text: 'Tajikistan'}, 220 { id: 'TZ', text: 'Tanzania'}, 221 { id: 'TH', text: 'Thailand'}, 222 { id: 'TL', text: 'Timor-Leste'}, 223 { id: 'TG', text: 'Togo'}, 224 { id: 'TK', text: 'Tokelau'}, 225 { id: 'TO', text: 'Tonga'}, 226 { id: 'TT', text: 'Trinidad And Tobago'}, 227 { id: 'TN', text: 'Tunisia'}, 228 { id: 'TR', text: 'Turkey'}, 229 { id: 'TM', text: 'Turkmenistan'}, 230 { id: 'TC', text: 'Turks And Caicos Islands'}, 231 { id: 'TV', text: 'Tuvalu'}, 232 { id: 'UG', text: 'Uganda'}, 233 { id: 'UA', text: 'Ukraine'}, 234 { id: 'AE', text: 'United Arab Emirates'}, 235 { id: 'GB', text: 'United Kingdom'}, 236 { id: 'US', text: 'United States'}, 237 { id: 'UM', text: 'United States Outlying Islands'}, 238 { id: 'UY', text: 'Uruguay'}, 239 { id: 'UZ', text: 'Uzbekistan'}, 240 { id: 'VU', text: 'Vanuatu'}, 241 { id: 'VE', text: 'Venezuela'}, 242 { id: 'VN', text: 'Viet Nam'}, 243 { id: 'VG', text: 'Virgin Islands}, British'}, 244 { id: 'VI', text: 'Virgin Islands}, U.S.'}, 245 { id: 'WF', text: 'Wallis And Futuna'}, 246 { id: 'EH', text: 'Western Sahara'}, 247 { id: 'YE', text: 'Yemen'}, 248 { id: 'ZM', text: 'Zambia'}, 249 { id: 'ZW', text: 'Zimbabwe'} 250 ]; 251 252 function formatCountry (country) { 253 if (!country.id) { return country.text; } 254 var $country = $( 255 '<span class="flag-text">'+ country.text+"</span>" + '<span class="flag-icon flag-icon-'+ country.id.toLowerCase() +' flag-icon-squared"></span>' 256 ); 257 return $country; 258 }; 259 260 jQuery("#country-flags").select2({ 261 placeholder: "Select a country", 262 templateResult: formatCountry, 263 data: countries 264 }); 265 266 $('.select2-selection__rendered ').attr('style', 'padding: 8px !important;'); 267 268 var country_id = $('#country_id').length ? $('#country_id').val().toUpperCase() : ''; 269 270 if(country_id && country_id !== '') { 271 272 var country_selected = countries.filter(obj => { 273 return obj.id == country_id; 274 }); 275 276 $('#country-flags').val(country_id); 277 $('#select2-country-flags-container').text(country_selected[0].text); 278 $('.select2-selection__rendered').after('<span style="position: absolute; right: 30px; top: 10px;" class="flag-icon flag-icon-' + country_selected[0].id.toLowerCase() + ' flag-icon-squared"></span>'); 279 280 // Check validate user 281 var user_id = $('#validate_user').val(); 282 if(user_id && user_id !== '') { 283 $('#country-flags').prop('disabled', true); 284 $('.select2-selection--single').attr('style', 'background-color: rgba(200,200,200, .5) !important;'); 285 } 286 287 } 288 289 $('#country-flags').on('change', function() { 290 var form = new FormData(); 291 form.append('country_id', $(this).val()); 292 $.ajax({ 293 url: window.location.origin + '/wp-content/plugins/customer-current-country/change-country.php', 294 type: 'POST', 295 data: form, 296 contentType: false, 297 cache: false, 298 processData: false, 299 success: function() { 300 location.reload(); 301 $('#country-flags').val('YE'); 302 }, 303 error: function(e) { 304 console.log('Error: ', e); 305 } 306 }); 307 }); 308 309});
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.