ip2country.js 729 B

123456789101112131415
  1. /*
  2. Usage: ip2country_CountryToEmoji("TW")
  3. -> 🇹🇼
  4. *** MUST SAVE AS UTF8***
  5. *** RegionCode might not showing correctly if your computer are missing those fonts ***
  6. *** DO NOT ALTER RegionCode ***
  7. */
  8. function ip2country_CountryToEmoji(ISO3166) {
  9. if (ISO3166.length !== 2) {
  10. return ""
  11. }
  12. var RegionCode = JSON.parse('{"A":"🇦","B":"🇧","C":"🇨","D":"🇩","E":"🇪","F":"🇫","G":"🇬","H":"🇭","I":"🇮","J":"🇯","K":"🇰","L":"🇱","M":"🇲","N":"🇳","O":"🇴","P":"🇵","Q":"🇶","R":"🇷","S":"🇸","T":"🇹","U":"🇺","V":"🇻","W":"🇼","X":"🇽","Y":"🇾","Z":"🇿"}')
  13. ISO3166Arr = ISO3166.split("");
  14. return RegionCode[ISO3166Arr[0]] + RegionCode[ISO3166Arr[1]]
  15. }