Forráskód Böngészése

auto update script executed

tobychui 1 éve
szülő
commit
13e1ce39b5
3 módosított fájl, 262 hozzáadás és 1 törlés
  1. 5 1
      web/components/status.html
  2. 1 0
      web/index.html
  3. 256 0
      web/script/countryCode.js

+ 5 - 1
web/components/status.html

@@ -212,8 +212,12 @@
             //populate the table
             $("#countryCodetable").html("");
             for (const [key, value] of Object.entries(data)) {
+                var countryName = getCountryName(key);
+                if (countryName == ""){
+                    countryName = "LAN"
+                }
                 $("#countryCodetable").append(`<tr>
-                    <td>${key}</td>
+                    <td>${key} (${countryName})</td>
                     <td>${value}</td>
                 </tr>`);
             }

+ 1 - 0
web/index.html

@@ -12,6 +12,7 @@
         <script src="../script/ao_module.js"></script>
         <script src="script/semantic/semantic.min.js"></script>
         <script src="script/tablesort.js"></script>
+        <script src="script/countryCode.js"></script>
         <link rel="stylesheet" href="main.css">
     </head>
     <body>

+ 256 - 0
web/script/countryCode.js

@@ -0,0 +1,256 @@
+/*
+    CountryCode.js
+
+    This script convert country code into 
+    country name
+*/
+
+var getCountryName = function(countryISOCode){
+    countryISOCode = countryISOCode.toLowerCase();
+    var cc = {
+        "af": "Afghanistan",
+        "ax": "Aland Islands",
+        "al": "Albania",
+        "dz": "Algeria",
+        "as": "American Samoa",
+        "ad": "Andorra",
+        "ao": "Angola",
+        "ai": "Anguilla",
+        "ag": "Antigua",
+        "ar": "Argentina",
+        "am": "Armenia",
+        "aw": "Aruba",
+        "au": "Australia",
+        "at": "Austria",
+        "az": "Azerbaijan",
+        "bs": "Bahamas",
+        "bh": "Bahrain",
+        "bd": "Bangladesh",
+        "bb": "Barbados",
+        "by": "Belarus",
+        "be": "Belgium",
+        "bz": "Belize",
+        "bj": "Benin",
+        "bm": "Bermuda",
+        "bt": "Bhutan",
+        "bo": "Bolivia",
+        "ba": "Bosnia",
+        "bw": "Botswana",
+        "bv": "Bouvet Island",
+        "br": "Brazil",
+        "vg": "British Virgin Islands",
+        "bn": "Brunei",
+        "bg": "Bulgaria",
+        "bf": "Burkina Faso",
+        "mm": "Burma",
+        "bi": "Burundi",
+        "tc": "Caicos Islands",
+        "kh": "Cambodia",
+        "cm": "Cameroon",
+        "ca": "Canada",
+        "cv": "Cape Verde",
+        "ky": "Cayman Islands",
+        "cf": "Central African Republic",
+        "td": "Chad",
+        "cl": "Chile",
+        "cn": "China",
+        "cx": "Christmas Island",
+        "cc": "Cocos Islands",
+        "co": "Colombia",
+        "km": "Comoros",
+        "cg": "Congo Brazzaville",
+        "cd": "Congo",
+        "ck": "Cook Islands",
+        "cr": "Costa Rica",
+        "ci": "Cote Divoire",
+        "hr": "Croatia",
+        "cu": "Cuba",
+        "cy": "Cyprus",
+        "cz": "Czech Republic",
+        "dk": "Denmark",
+        "dj": "Djibouti",
+        "dm": "Dominica",
+        "do": "Dominican Republic",
+        "ec": "Ecuador",
+        "eg": "Egypt",
+        "sv": "El Salvador",
+        "gb": "England",
+        "gq": "Equatorial Guinea",
+        "er": "Eritrea",
+        "ee": "Estonia",
+        "et": "Ethiopia",
+        "eu": "European Union",
+        "fk": "Falkland Islands",
+        "fo": "Faroe Islands",
+        "fj": "Fiji",
+        "fi": "Finland",
+        "fr": "France",
+        "gf": "French Guiana",
+        "pf": "French Polynesia",
+        "tf": "French Territories",
+        "ga": "Gabon",
+        "gm": "Gambia",
+        "ge": "Georgia",
+        "de": "Germany",
+        "gh": "Ghana",
+        "gi": "Gibraltar",
+        "gr": "Greece",
+        "gl": "Greenland",
+        "gd": "Grenada",
+        "gp": "Guadeloupe",
+        "gu": "Guam",
+        "gt": "Guatemala",
+        "gw": "Guinea-Bissau",
+        "gn": "Guinea",
+        "gy": "Guyana",
+        "ht": "Haiti",
+        "hm": "Heard Island",
+        "hn": "Honduras",
+        "hk": "Hong Kong",
+        "hu": "Hungary",
+        "is": "Iceland",
+        "in": "India",
+        "io": "Indian Ocean Territory",
+        "id": "Indonesia",
+        "ir": "Iran",
+        "iq": "Iraq",
+        "ie": "Ireland",
+        "il": "Israel",
+        "it": "Italy",
+        "jm": "Jamaica",
+        "jp": "Japan",
+        "jo": "Jordan",
+        "kz": "Kazakhstan",
+        "ke": "Kenya",
+        "ki": "Kiribati",
+        "kw": "Kuwait",
+        "kg": "Kyrgyzstan",
+        "la": "Laos",
+        "lv": "Latvia",
+        "lb": "Lebanon",
+        "ls": "Lesotho",
+        "lr": "Liberia",
+        "ly": "Libya",
+        "li": "Liechtenstein",
+        "lt": "Lithuania",
+        "lu": "Luxembourg",
+        "mo": "Macau",
+        "mk": "Macedonia",
+        "mg": "Madagascar",
+        "mw": "Malawi",
+        "my": "Malaysia",
+        "mv": "Maldives",
+        "ml": "Mali",
+        "mt": "Malta",
+        "mh": "Marshall Islands",
+        "mq": "Martinique",
+        "mr": "Mauritania",
+        "mu": "Mauritius",
+        "yt": "Mayotte",
+        "mx": "Mexico",
+        "fm": "Micronesia",
+        "md": "Moldova",
+        "mc": "Monaco",
+        "mn": "Mongolia",
+        "me": "Montenegro",
+        "ms": "Montserrat",
+        "ma": "Morocco",
+        "mz": "Mozambique",
+        "na": "Namibia",
+        "nr": "Nauru",
+        "np": "Nepal",
+        "an": "Netherlands Antilles",
+        "nl": "Netherlands",
+        "nc": "New Caledonia",
+        "pg": "New Guinea",
+        "nz": "New Zealand",
+        "ni": "Nicaragua",
+        "ne": "Niger",
+        "ng": "Nigeria",
+        "nu": "Niue",
+        "nf": "Norfolk Island",
+        "kp": "North Korea",
+        "mp": "Northern Mariana Islands",
+        "no": "Norway",
+        "om": "Oman",
+        "pk": "Pakistan",
+        "pw": "Palau",
+        "ps": "Palestine",
+        "pa": "Panama",
+        "py": "Paraguay",
+        "pe": "Peru",
+        "ph": "Philippines",
+        "pn": "Pitcairn Islands",
+        "pl": "Poland",
+        "pt": "Portugal",
+        "pr": "Puerto Rico",
+        "qa": "Qatar",
+        "re": "Reunion",
+        "ro": "Romania",
+        "ru": "Russia",
+        "rw": "Rwanda",
+        "sh": "Saint Helena",
+        "kn": "Saint Kitts and Nevis",
+        "lc": "Saint Lucia",
+        "pm": "Saint Pierre",
+        "vc": "Saint Vincent",
+        "ws": "Samoa",
+        "sm": "San Marino",
+        "gs": "Sandwich Islands",
+        "st": "Sao Tome",
+        "sa": "Saudi Arabia",
+        "sn": "Senegal",
+        "cs": "Serbia",
+        "rs": "Serbia",
+        "sc": "Seychelles",
+        "sl": "Sierra Leone",
+        "sg": "Singapore",
+        "sk": "Slovakia",
+        "si": "Slovenia",
+        "sb": "Solomon Islands",
+        "so": "Somalia",
+        "za": "South Africa",
+        "kr": "South Korea",
+        "es": "Spain",
+        "lk": "Sri Lanka",
+        "sd": "Sudan",
+        "sr": "Suriname",
+        "sj": "Svalbard",
+        "sz": "Swaziland",
+        "se": "Sweden",
+        "ch": "Switzerland",
+        "sy": "Syria",
+        "tw": "Taiwan",
+        "tj": "Tajikistan",
+        "tz": "Tanzania",
+        "th": "Thailand",
+        "tl": "Timorleste",
+        "tg": "Togo",
+        "tk": "Tokelau",
+        "to": "Tonga",
+        "tt": "Trinidad",
+        "tn": "Tunisia",
+        "tr": "Turkey",
+        "tm": "Turkmenistan",
+        "tv": "Tuvalu",
+        "ug": "Uganda",
+        "ua": "Ukraine",
+        "ae": "United Arab Emirates",
+        "us": "United States",
+        "uy": "Uruguay",
+        "um": "Us Minor Islands",
+        "vi": "Us Virgin Islands",
+        "uz": "Uzbekistan",
+        "vu": "Vanuatu",
+        "va": "Vatican City",
+        "ve": "Venezuela",
+        "vn": "Vietnam",
+        "wf": "Wallis and Futuna",
+        "eh": "Western Sahara",
+        "ye": "Yemen",
+        "zm": "Zambia",
+        "zw": "Zimbabwe"
+    }
+    
+    return cc[countryISOCode];
+}