burgs overview - shift icon

This commit is contained in:
Azgaar 2021-05-31 23:33:21 +03:00
parent f49dd657b5
commit 3640320f3f
3 changed files with 17 additions and 14 deletions

View file

@ -1953,7 +1953,7 @@
<div data-tip="Burg mean annual temperature and real-world city for comparison">
<div class="label">Temperature:</div>
<span id="burgTemperature"></span>, like in
<span id="burgTemperatureLikeIn"></span>
<span id="burgTemperatureLike"></span>
</div>
<div data-tip="Burg height above mean sea level">

View file

@ -75,7 +75,7 @@ function editBurg(id) {
const temperature = grid.cells.temp[pack.cells.g[b.cell]];
document.getElementById('burgTemperature').innerHTML = convertTemperature(temperature);
document.getElementById('burgTemperatureLikeIn').innerHTML = getTemperatureLikeness(temperature);
document.getElementById('burgTemperatureLike').innerHTML = getTemperatureLikeness(temperature);
document.getElementById('burgElevation').innerHTML = getHeight(pack.cells.h[b.cell]);
// toggle features
@ -112,16 +112,18 @@ function editBurg(id) {
document.getElementById('burgEmblem').setAttribute('href', '#' + coaID);
}
// in °C, array from -1 °C; source: https://en.wikipedia.org/wiki/List_of_cities_by_average_temperature
// [-1; 31] °C, source: https://en.wikipedia.org/wiki/List_of_cities_by_average_temperature
function getTemperatureLikeness(temperature) {
if (temperature < -5) return 'Yakutsk';
if (temperature < -15) return 'nowhere in the real-world';
if (temperature < -5) return 'in Yakutsk';
if (temperature > 31) return 'nowhere in the real-world';
const cities = [
'Snag (Yukon)',
'Yellowknife (Canada)',
'Okhotsk (Russia)',
'Fairbanks (Alaska)',
'Nuuk (Greenland)',
'Murmansk', // -5 - 0
'Murmansk',
'Arkhangelsk',
'Anchorage',
'Tromsø',
@ -131,7 +133,7 @@ function editBurg(id) {
'Halifax',
'Prague',
'Copenhagen',
'London', // 1 - 10
'London',
'Antwerp',
'Paris',
'Milan',
@ -141,7 +143,7 @@ function editBurg(id) {
'Lisbon',
'Barcelona',
'Marrakesh',
'Alexandria', // 11 - 20
'Alexandria',
'Tegucigalpa',
'Guangzhou',
'Rio de Janeiro',
@ -151,10 +153,11 @@ function editBurg(id) {
'Mogadishu',
'Bangkok',
'Aden',
'Khartoum'
]; // 21 - 30
if (temperature > 30) return 'Mecca';
return cities[temperature + 5] || null;
'Khartoum',
'Mecca'
];
const city = cities[temperature + 5];
return city ? 'in ' + city : null;
}
function dragBurgLabel() {

View file

@ -80,7 +80,7 @@ function overviewBurgs() {
const culture = pack.cultures[b.culture].name;
lines += `<div class="states" data-id=${b.i} data-name="${b.name}" data-state="${state}" data-province="${province}" data-culture="${culture}" data-population=${population} data-type="${type}">
<span data-tip="Click to zoom into view" class="icon-dot-circled pointer"></span>
<span data-tip="Edit burg" class="icon-pencil"></span>
<input data-tip="Burg name. Click and type to change" class="burgName" value="${b.name}" autocorrect="off" spellcheck="false">
<input data-tip="Burg province" class="burgState" value="${province}" disabled>
<input data-tip="Burg state" class="burgState" value="${state}" disabled>
@ -91,8 +91,8 @@ function overviewBurgs() {
<span data-tip="${b.capital ? ' This burg is a state capital' : 'Click to assign a capital status'}" class="icon-star-empty${b.capital ? '' : ' inactive pointer'}"></span>
<span data-tip="Click to toggle port status" class="icon-anchor pointer${b.port ? '' : ' inactive'}" style="font-size:.9em"></span>
</div>
<span data-tip="Edit burg" class="icon-pencil"></span>
<span class="locks pointer ${b.lock ? 'icon-lock' : 'icon-lock-open inactive'}"></span>
<span data-tip="Click to zoom into view" class="icon-dot-circled pointer"></span>
<span data-tip="Remove burg" class="icon-trash-empty"></span>
</div>`;
}