dump1090/public_html/flags.js

215 lines
17 KiB
JavaScript
Raw Normal View History

"use strict";
// Declare ICAO registration address ranges and country
// install the flag images in flags-tiny subdirectory.
var ICAO_Codes = [
{start:0x700000, end:0x701000, country: "Afghanistan", flag_image: "Afghanistan.png"},
{start:0x501000, end:0x501400, country: "Albania", flag_image: "Albania.png"},
{start:0x0A0000, end:0x0A8000, country: "Algeria", flag_image: "Algeria.png"},
{start:0x090000, end:0x091000, country: "Angola", flag_image: "Angola.png"},
{start:0x0CA000, end:0x0CA400, country: "Antigua and Barbuda", flag_image: "Antigua_and_Barbuda.png"},
{start:0xE00000, end:0xE40000, country: "Argentina", flag_image: "Argentina.png"},
{start:0x600000, end:0x600400, country: "Armenia", flag_image: "Armenia.png"},
{start:0x7C0000, end:0x800000, country: "Australia", flag_image: "Australia.png"},
{start:0x440000, end:0x448000, country: "Austria", flag_image: "Austria.png"},
{start:0x600800, end:0x600C00, country: "Azerbaijan", flag_image: "Azerbaijan.png"},
{start:0x0A8000, end:0x0A9000, country: "Bahamas", flag_image: "Bahamas.png"},
{start:0x894000, end:0x895000, country: "Bahrain", flag_image: "Bahrain.png"},
{start:0x702000, end:0x703000, country: "Bangladesh", flag_image: "Bangladesh.png"},
{start:0x0AA000, end:0x0AA400, country: "Barbados", flag_image: "Barbados.png"},
{start:0x510000, end:0x510400, country: "Belarus", flag_image: "Belarus.png"},
{start:0x448000, end:0x450000, country: "Belgium", flag_image: "Belgium.png"},
{start:0x0AB000, end:0x0AB400, country: "Belize", flag_image: "Belize.png"},
{start:0x094000, end:0x094400, country: "Benin", flag_image: "Benin.png"},
{start:0x400080, end:0x4001C0, country: "Bermuda", flag_image: "Bermuda.png"},
{start:0x424000, end:0x424100, country: "Bermuda", flag_image: "Bermuda.png"},
{start:0x680000, end:0x680400, country: "Bhutan", flag_image: "Bhutan.png"},
{start:0xE94000, end:0xE95000, country: "Bolivia", flag_image: "Bolivia.png"},
{start:0x513000, end:0x513400, country: "Bosnia", flag_image: "Bosnia.png"},
{start:0x030000, end:0x030400, country: "Botswana", flag_image: "Botswana.png"},
{start:0xE40000, end:0xE80000, country: "Brazil", flag_image: "Brazil.png"},
{start:0x895000, end:0x895400, country: "Brunei", flag_image: "Brunei.png"},
{start:0x450000, end:0x458000, country: "Bulgaria", flag_image: "Bulgaria.png"},
{start:0x09C000, end:0x09D000, country: "Burkina Faso", flag_image: "Burkina_Faso.png"},
{start:0x032000, end:0x033000, country: "Burundi", flag_image: "Burundi.png"},
{start:0x038000, end:0x039000, country: "Cote d'Ivoire", flag_image: "Cote_d_Ivoire.png"},
{start:0x70E000, end:0x70F000, country: "Cambodia", flag_image: "Cambodia.png"},
{start:0x034000, end:0x035000, country: "Cameroon", flag_image: "Cameroon.png"},
{start:0xC00000, end:0xC40000, country: "Canada", flag_image: "Canada.png"},
{start:0x096000, end:0x096400, country: "Cape Verde", flag_image: "Cape_Verde.png"},
{start:0x06C000, end:0x06D000, country: "Central African Republic", flag_image: "Central_African_Republic.png"},
{start:0x084000, end:0x085000, country: "Chad", flag_image: "Chad.png"},
{start:0xE80000, end:0xE81000, country: "Chile", flag_image: "Chile.png"},
{start:0x780000, end:0x7C0000, country: "China", flag_image: "China.png"},
{start:0x0AC000, end:0x0AD000, country: "Colombia", flag_image: "Colombia.png"},
{start:0x035000, end:0x035400, country: "Comoros", flag_image: "Comoros.png"},
{start:0x036000, end:0x037000, country: "Democratic Republic of the Congo", flag_image: "Democratic_Republic_of_the_Congo.png"},
{start:0x901000, end:0x901400, country: "Cook Islands", flag_image: "Cook_Islands.png"},
{start:0x0AE000, end:0x0AF000, country: "Costa Rica", flag_image: "Costa_Rica.png"},
{start:0x501C00, end:0x502000, country: "Croatia", flag_image: "Croatia.png"},
{start:0x0B0000, end:0x0B1000, country: "Cuba", flag_image: "Cuba.png"},
{start:0x4C8000, end:0x4C8400, country: "Cyprus", flag_image: "Cyprus.png"},
{start:0x498000, end:0x4A0000, country: "Czech Republic", flag_image: "Czech_Republic.png"},
{start:0x720000, end:0x728000, country: "Democratic People's Republic of Korea", flag_image: "North_Korea.png"},
{start:0x08C000, end:0x08D000, country: "Democratic Republic of the Congo", flag_image: "Democratic_Republic_of_the_Congo.png"},
{start:0x458000, end:0x460000, country: "Denmark", flag_image: "Denmark.png"},
{start:0x098000, end:0x098400, country: "Djibouti", flag_image: "Djibouti.png"},
{start:0x0C4000, end:0x0C5000, country: "Dominican Republic", flag_image: "Dominican_Republic.png"},
{start:0xE84000, end:0xE85000, country: "Ecuador", flag_image: "Ecuador.png"},
{start:0x010000, end:0x018000, country: "Egypt", flag_image: "Egypt.png"},
{start:0x0B2000, end:0x0B3000, country: "El Salvador", flag_image: "El_Salvador.png"},
{start:0x042000, end:0x043000, country: "Equatorial Guinea", flag_image: "Equatorial_Guinea.png"},
{start:0x202000, end:0x202400, country: "Eritrea", flag_image: "Eritrea.png"},
{start:0x511000, end:0x511400, country: "Estonia", flag_image: "Estonia.png"},
{start:0x040000, end:0x041000, country: "Ethiopia", flag_image: "Ethiopia.png"},
{start:0xC88000, end:0xC89000, country: "Fiji", flag_image: "Fiji.png"},
{start:0x460000, end:0x468000, country: "Finland", flag_image: "Finland.png"},
{start:0x380000, end:0x3C0000, country: "France", flag_image: "France.png"},
{start:0x03E000, end:0x03F000, country: "Gabon", flag_image: "Gabon.png"},
{start:0x09A000, end:0x09B000, country: "Gambia", flag_image: "Gambia.png"},
{start:0x514000, end:0x514400, country: "Georgia", flag_image: "Georgia.png"},
{start:0x3C0000, end:0x400000, country: "Germany", flag_image: "Germany.png"},
{start:0x044000, end:0x045000, country: "Ghana", flag_image: "Ghana.png"},
{start:0x468000, end:0x470000, country: "Greece", flag_image: "Greece.png"},
{start:0x0CC000, end:0x0CC400, country: "Grenada", flag_image: "Grenada.png"},
{start:0x0B4000, end:0x0B5000, country: "Guatemala", flag_image: "Guatemala.png"},
{start:0x046000, end:0x047000, country: "Guinea", flag_image: "Guinea.png"},
{start:0x048000, end:0x048400, country: "Guinea Bissau", flag_image: "Guinea_Bissau.png"},
{start:0x0B6000, end:0x0B7000, country: "Guyana", flag_image: "Guyana.png"},
{start:0x0B8000, end:0x0B9000, country: "Haiti", flag_image: "Haiti.png"},
{start:0x0BA000, end:0x0BB000, country: "Honduras", flag_image: "Honduras.png"},
{start:0x470000, end:0x478000, country: "Hungary", flag_image: "Hungary.png"},
{start:0xF00000, end:0xF08000, country: "blank", flag_image: "blank.png"},
{start:0xF09000, end:0xF09400, country: "blank", flag_image: "blank.png"},
{start:0x4CC000, end:0x4CD000, country: "Iceland", flag_image: "Iceland.png"},
{start:0x800000, end:0x840000, country: "India", flag_image: "India.png"},
{start:0x8A0000, end:0x8A8000, country: "Indonesia", flag_image: "Indonesia.png"},
{start:0x730000, end:0x738000, country: "Iran", flag_image: "Iran.png"},
{start:0x728000, end:0x730000, country: "Iraq", flag_image: "Iraq.png"},
{start:0x4CA000, end:0x4CB000, country: "Ireland", flag_image: "Ireland.png"},
{start:0x738000, end:0x740000, country: "Israel", flag_image: "Israel.png"},
{start:0x300000, end:0x340000, country: "Italy", flag_image: "Italy.png"},
{start:0x0BE000, end:0x0BF000, country: "Jamaica", flag_image: "Jamaica.png"},
{start:0x840000, end:0x880000, country: "Japan", flag_image: "Japan.png"},
{start:0x740000, end:0x748000, country: "Jordan", flag_image: "Jordan.png"},
{start:0x683000, end:0x683400, country: "Kazakhstan", flag_image: "Kazakhstan.png"},
{start:0x04C000, end:0x04D000, country: "Kenya", flag_image: "Kenya.png"},
{start:0xC8E000, end:0xC8E400, country: "Kiribati", flag_image: "Kiribati.png"},
{start:0x706000, end:0x707000, country: "Kuwait", flag_image: "Kuwait.png"},
{start:0x601000, end:0x601400, country: "Kyrgyzstan", flag_image: "Kyrgyzstan.png"},
{start:0x708000, end:0x709000, country: "Laos", flag_image: "Laos.png"},
{start:0x502C00, end:0x503000, country: "Latvia", flag_image: "Latvia.png"},
{start:0x748000, end:0x750000, country: "Lebanon", flag_image: "Lebanon.png"},
{start:0x04A000, end:0x04A400, country: "Lesotho", flag_image: "Lesotho.png"},
{start:0x050000, end:0x051000, country: "Liberia", flag_image: "Liberia.png"},
{start:0x018000, end:0x020000, country: "Libya", flag_image: "Libya.png"},
{start:0x503C00, end:0x504000, country: "Lithuania", flag_image: "Lithuania.png"},
{start:0x4D0000, end:0x4D0400, country: "Luxembourg", flag_image: "Luxembourg.png"},
{start:0x054000, end:0x055000, country: "Madagascar", flag_image: "Madagascar.png"},
{start:0x058000, end:0x059000, country: "Malawi", flag_image: "Malawi.png"},
{start:0x750000, end:0x758000, country: "Malaysia", flag_image: "Malaysia.png"},
{start:0x05A000, end:0x05A400, country: "Maldives", flag_image: "Maldives.png"},
{start:0x05C000, end:0x05D000, country: "Mali", flag_image: "Mali.png"},
{start:0x4D2000, end:0x4D2400, country: "Malta", flag_image: "Malta.png"},
{start:0x900000, end:0x900400, country: "Marshall Islands", flag_image: "Marshall_Islands.png"},
{start:0x05E000, end:0x05E400, country: "Mauritania", flag_image: "Mauritania.png"},
{start:0x060000, end:0x060400, country: "Mauritius", flag_image: "Mauritius.png"},
{start:0x0D0000, end:0x0D8000, country: "Mexico", flag_image: "Mexico.png"},
{start:0x681000, end:0x681400, country: "Micronesia", flag_image: "Micronesia.png"},
{start:0x4D4000, end:0x4D4400, country: "Monaco", flag_image: "Monaco.png"},
{start:0x682000, end:0x682400, country: "Mongolia", flag_image: "Mongolia.png"},
{start:0x516000, end:0x516400, country: "Serbia and Montenegro", flag_image: "Serbia_and_Montenegro.png"},
{start:0x020000, end:0x028000, country: "Morocco", flag_image: "Morocco.png"},
{start:0x006000, end:0x007000, country: "Mozambique", flag_image: "Mozambique.png"},
{start:0x704000, end:0x705000, country: "Myanmar", flag_image: "Myanmar.png"},
{start:0x201000, end:0x201400, country: "Namibia", flag_image: "Namibia.png"},
{start:0xC8A000, end:0xC8A400, country: "Nauru", flag_image: "Nauru.png"},
{start:0x70A000, end:0x70B000, country: "Nepal", flag_image: "Nepal.png"},
{start:0x480000, end:0x488000, country: "Netherlands", flag_image: "Netherlands.png"},
{start:0xC80000, end:0xC88000, country: "New Zealand", flag_image: "New_Zealand.png"},
{start:0x0C0000, end:0x0C1000, country: "Nicaragua", flag_image: "Nicaragua.png"},
{start:0x062000, end:0x063000, country: "Niger", flag_image: "Niger.png"},
{start:0x064000, end:0x065000, country: "Nigeria", flag_image: "Nigeria.png"},
{start:0x478000, end:0x480000, country: "Norway", flag_image: "Norway.png"},
{start:0x70C000, end:0x70C400, country: "Oman", flag_image: "Oman.png"},
{start:0x760000, end:0x768000, country: "Pakistan", flag_image: "Pakistan.png"},
{start:0x684000, end:0x684400, country: "Palau", flag_image: "Palau.png"},
{start:0x0C2000, end:0x0C3000, country: "Panama", flag_image: "Panama.png"},
{start:0x898000, end:0x899000, country: "Papua New Guinea", flag_image: "Papua_New_Guinea.png"},
{start:0xE88000, end:0xE89000, country: "Paraguay", flag_image: "Paraguay.png"},
{start:0xE8C000, end:0xE8D000, country: "Peru", flag_image: "Peru.png"},
{start:0x758000, end:0x760000, country: "Philippines", flag_image: "Philippines.png"},
{start:0x488000, end:0x490000, country: "Poland", flag_image: "Poland.png"},
{start:0x490000, end:0x498000, country: "Portugal", flag_image: "Portugal.png"},
{start:0x06A000, end:0x06A400, country: "Qatar", flag_image: "Qatar.png"},
{start:0x718000, end:0x720000, country: "Republic of Korea", flag_image: "South_Korea.png"},
{start:0x504C00, end:0x505000, country: "Moldova", flag_image: "Moldova.png"},
{start:0x4A0000, end:0x4A8000, country: "Romania", flag_image: "Romania.png"},
{start:0x100000, end:0x200000, country: "Russian Federation", flag_image: "Russian_Federation.png"},
{start:0x06E000, end:0x06F000, country: "Rwanda", flag_image: "Rwanda.png"},
{start:0xC8C000, end:0xC8C400, country: "Saint Lucia", flag_image: "Saint_Lucia.png"},
{start:0x0BC000, end:0x0BC400, country: "Saint Vincent and the Grenadines", flag_image: "Saint_Vincent_and_the_Grenadines.png"},
{start:0x902000, end:0x902400, country: "Samoa", flag_image: "Samoa.png"},
{start:0x500000, end:0x500400, country: "San Marino", flag_image: "San_Marino.png"},
{start:0x710000, end:0x718000, country: "Saudi Arabia", flag_image: "Saudi_Arabia.png"},
{start:0x070000, end:0x071000, country: "Senegal", flag_image: "Senegal.png"},
{start:0x074000, end:0x074400, country: "Seychelles", flag_image: "Seychelles.png"},
{start:0x076000, end:0x076400, country: "Sierra Leone", flag_image: "Sierra_Leone.png"},
{start:0x768000, end:0x770000, country: "Singapore", flag_image: "Singapore.png"},
{start:0x505C00, end:0x506000, country: "Slovakia", flag_image: "Slovakia.png"},
{start:0x506C00, end:0x507000, country: "Slovenia", flag_image: "Slovenia.png"},
{start:0x078000, end:0x079000, country: "Somalia", flag_image: "Somalia.png"},
{start:0x008000, end:0x010000, country: "South Africa", flag_image: "South_Africa.png"},
{start:0x340000, end:0x380000, country: "Spain", flag_image: "Spain.png"},
{start:0x770000, end:0x778000, country: "Sri Lanka", flag_image: "Sri_Lanka.png"},
{start:0x07C000, end:0x07D000, country: "Sudan", flag_image: "Sudan.png"},
{start:0x0C8000, end:0x0C9000, country: "Suriname", flag_image: "Suriname.png"},
{start:0x07A000, end:0x07A400, country: "Swaziland", flag_image: "Swaziland.png"},
{start:0x4A8000, end:0x4B0000, country: "Sweden", flag_image: "Sweden.png"},
{start:0x4B0000, end:0x4B8000, country: "Switzerland", flag_image: "Switzerland.png"},
{start:0x778000, end:0x780000, country: "Syria", flag_image: "Syria.png"},
{start:0x899000, end:0x899400, country: "Taiwan", flag_image: "Taiwan.png"},
{start:0x515000, end:0x515400, country: "Tajikistan", flag_image: "Tajikistan.png"},
{start:0x880000, end:0x888000, country: "Thailand", flag_image: "Thailand.png"},
{start:0x088000, end:0x089000, country: "Togo", flag_image: "Togo.png"},
{start:0xC8D000, end:0xC8D400, country: "Tonga", flag_image: "Tonga.png"},
{start:0x0C6000, end:0x0C7000, country: "Trinidad and Tobago", flag_image: "Trinidad_and_Tobago.png"},
{start:0x028000, end:0x030000, country: "Tunisia", flag_image: "Tunisia.png"},
{start:0x4B8000, end:0x4C0000, country: "Turkey", flag_image: "Turkey.png"},
{start:0x601800, end:0x601C00, country: "Turkmenistan", flag_image: "Turkmenistan.png"},
{start:0x068000, end:0x069000, country: "Uganda", flag_image: "Uganda.png"},
{start:0x508000, end:0x510000, country: "Ukraine", flag_image: "Ukraine.png"},
{start:0x896000, end:0x897000, country: "UAE", flag_image: "UAE.png"},
{start:0x400000, end:0x440000, country: "United Kingdom", flag_image: "United_Kingdom.png"},
{start:0xA00000, end:0xB00000, country: "United States of America", flag_image: "United_States_of_America.png"},
{start:0xE90000, end:0xE91000, country: "Uruguay", flag_image: "Uruguay.png"},
{start:0x507C00, end:0x508000, country: "Uzbekistan", flag_image: "Uzbekistan.png"},
{start:0xC90000, end:0xC90400, country: "Vanuatu", flag_image: "Vanuatu.png"},
{start:0x0D8000, end:0x0E0000, country: "Venezuela", flag_image: "Venezuela.png"},
{start:0x888000, end:0x890000, country: "Vietnam", flag_image: "Vietnam.png"},
{start:0x890000, end:0x891000, country: "Yemen", flag_image: "Yemen.png"},
{start:0x004000, end:0x004400, country: "Zimbabwe", flag_image: "Zimbabwe.png"},
];
var unassigned_range = {
country: "Unassigned",
flag_image: null
};
// Given a (hex string) ICAO address,
// return an object describing that ICAO range.
// Always returns a non-null object.
// (todo: binary search)
function findICAORange(icao) {
var hexa = +("0x" + icao);
for (var i = 0; i < ICAO_Codes.length; ++i) {
if (hexa >= ICAO_Codes[i].start && hexa < ICAO_Codes[i].end) {
return ICAO_Codes[i];
}
}
return unassigned_range;
}