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 data-tip="Burg mean annual temperature and real-world city for comparison">
<div class="label">Temperature:</div> <div class="label">Temperature:</div>
<span id="burgTemperature"></span>, like in <span id="burgTemperature"></span>, like in
<span id="burgTemperatureLikeIn"></span> <span id="burgTemperatureLike"></span>
</div> </div>
<div data-tip="Burg height above mean sea level"> <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]]; const temperature = grid.cells.temp[pack.cells.g[b.cell]];
document.getElementById('burgTemperature').innerHTML = convertTemperature(temperature); 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]); document.getElementById('burgElevation').innerHTML = getHeight(pack.cells.h[b.cell]);
// toggle features // toggle features
@ -112,16 +112,18 @@ function editBurg(id) {
document.getElementById('burgEmblem').setAttribute('href', '#' + coaID); 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) { 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 = [ const cities = [
'Snag (Yukon)', 'Snag (Yukon)',
'Yellowknife (Canada)', 'Yellowknife (Canada)',
'Okhotsk (Russia)', 'Okhotsk (Russia)',
'Fairbanks (Alaska)', 'Fairbanks (Alaska)',
'Nuuk (Greenland)', 'Nuuk (Greenland)',
'Murmansk', // -5 - 0 'Murmansk',
'Arkhangelsk', 'Arkhangelsk',
'Anchorage', 'Anchorage',
'Tromsø', 'Tromsø',
@ -131,7 +133,7 @@ function editBurg(id) {
'Halifax', 'Halifax',
'Prague', 'Prague',
'Copenhagen', 'Copenhagen',
'London', // 1 - 10 'London',
'Antwerp', 'Antwerp',
'Paris', 'Paris',
'Milan', 'Milan',
@ -141,7 +143,7 @@ function editBurg(id) {
'Lisbon', 'Lisbon',
'Barcelona', 'Barcelona',
'Marrakesh', 'Marrakesh',
'Alexandria', // 11 - 20 'Alexandria',
'Tegucigalpa', 'Tegucigalpa',
'Guangzhou', 'Guangzhou',
'Rio de Janeiro', 'Rio de Janeiro',
@ -151,10 +153,11 @@ function editBurg(id) {
'Mogadishu', 'Mogadishu',
'Bangkok', 'Bangkok',
'Aden', 'Aden',
'Khartoum' 'Khartoum',
]; // 21 - 30 'Mecca'
if (temperature > 30) return 'Mecca'; ];
return cities[temperature + 5] || null; const city = cities[temperature + 5];
return city ? 'in ' + city : null;
} }
function dragBurgLabel() { function dragBurgLabel() {

View file

@ -80,7 +80,7 @@ function overviewBurgs() {
const culture = pack.cultures[b.culture].name; 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}"> 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 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 province" class="burgState" value="${province}" disabled>
<input data-tip="Burg state" class="burgState" value="${state}" 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="${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> <span data-tip="Click to toggle port status" class="icon-anchor pointer${b.port ? '' : ' inactive'}" style="font-size:.9em"></span>
</div> </div>
<span data-tip="Edit burg" class="icon-pencil"></span>
<span class="locks pointer ${b.lock ? 'icon-lock' : 'icon-lock-open inactive'}"></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> <span data-tip="Remove burg" class="icon-trash-empty"></span>
</div>`; </div>`;
} }