-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcity.html
executable file
·1 lines (1 loc) · 2.68 KB
/
city.html
1
<!DOCTYPE html><html><meta charset="UTF-8"><head><link rel="stylesheet" href="sidereal_min.css"><script src="cities.js"></script><style>input.accordion{display:none}label.accordion{display:block;margin:0 0 1em 0;cursor:pointer;background:#f5f5f5;padding:10px;width:100%;border:none;text-align:left;outline:0;font-size:16px;font-weight:700}label.accordion:before{content:'\2795';font-size:20px;color:#777;font-weight:700;margin-left:.5em;float:right}label.accordion:hover{background:#e0e0e0}.content{background:#fff;padding:10px 25px;border:1px solid #e0e0e0;margin:0 0 1px 0}input.accordion+label.accordion+.content{display:none}input.accordion:checked+label.accordion+.content{display:block}input.accordion:checked+label.accordion:before{content:'\2796'}input.accordion:checked+label.accordion{background:#e0e0e0}</style><title>Major Cities</title></head><body><div id="wrapper"><br><h1>Major Cities Around the World</h1><p>The city data are taken from <a href="https://www.geonames.org/" target="_blank">geonames.org</a> (data downloaded in December, 2020). Only cities with population greater than 200000 are included here. There are <span id="ncity"></span> cities in this database.</p><br><div id="cities"></div><br><br><footer><hr><p style="text-align:center">© 2018–2025 by Yuk Tung Liu</p></footer></div><script>"use strict";function new_eval(t){return Function("return "+t)()}function print_cities_in_region(t,e,n){let i="<h2>"+e+"</h2>";i+='<input type="checkbox" class="accordion" id="'+t+'" />',i+='<label for="'+t+'" class="accordion">Click here to show/hide cities in this region</label>',i+='<div class="content">';let r,o=new_eval(t+"_cities()"),a=o.length;for(r=0;r<a;r++){r%15==0&&(i+='<table style="width:80%;">',i+="<tr><th>Index</th> <th>City</th> <th>Longitude</th> <th>Latitude</th> <th>Time Zone</th></tr>"),i+="<tr><td>"+r+"</td><td>"+o[r][0]+", "+o[r][1]+"</td><td>"+o[r][3]+"°</td><td>"+o[r][2]+"°</td><td>";let t=o[r][5];t="GMT"+(t>=0?"+"+t:t),i+=t+"</td></tr>",(r+1)%15==0&&(i+="</table><br />")}r%15!=0&&(i+="</table>"),i+="</div><br />";let d=document.createElement("div");return d.innerHTML=i,n.appendChild(d),r}document.getElementById("wrapper").style.display="block";let main=document.getElementById("cities"),regionCode=["NAm","LA","EA","SEA","SA","WCA","EE","NE","WE","SE","AF","OC"],regionName=["North America","Latin America and the Caribbean","East Asia","South-East Asia","South Asia","West and Central Asia","Eastern Europe","Northern Europe","Western Europe","Southern Europe","Africa","Oceania"],n=regionCode.length,ncity=0;for(let t=0;t<n;t++)ncity+=print_cities_in_region(regionCode[t],regionName[t],main);document.getElementById("ncity").textContent=ncity</script></body></html>