fix: year and era - unlock both on lock icon click

This commit is contained in:
Azgaar 2024-09-02 12:16:51 +02:00
parent 23e2484526
commit d42fd5cf92
3 changed files with 13 additions and 9 deletions

View file

@ -1529,7 +1529,9 @@
<td></td>
</tr>
<tr data-tip="Map seed number. Seed produces the same map only if canvas size and options are the same">
<tr
data-tip="Map seed number. Press 'Enter' to apply. Seed produces the same map only if canvas size and options are the same"
>
<td>
<i
data-tip="Show seed history to apply a previous seed"
@ -1595,7 +1597,7 @@
<tr data-tip="Define current year and era name">
<td>
<i data-locked="0" id="lock_era" class="icon-lock-open"></i>
<i data-locked="0" id="lock_year" data-ids="year,era" class="icon-lock-open"></i>
</td>
<td>Year and era</td>
<td>
@ -8046,7 +8048,7 @@
<script src="modules/ui/measurers.js?v=1.99.00"></script>
<script src="modules/ui/style-presets.js?v=1.100.00"></script>
<script src="modules/ui/general.js?v=1.100.00"></script>
<script src="modules/ui/general.js?v=1.101.02"></script>
<script src="modules/ui/options.js?v=1.100.00"></script>
<script src="main.js?v=1.100.00"></script>

View file

@ -429,17 +429,19 @@ function highlightEmblemElement(type, el) {
// assign lock behavior
document.querySelectorAll("[data-locked]").forEach(function (e) {
e.addEventListener("mouseover", function (event) {
e.addEventListener("mouseover", e => {
e.stopPropagation();
if (this.className === "icon-lock")
tip("Click to unlock the option and allow it to be randomized on new map generation");
else tip("Click to lock the option and always use the current value on new map generation");
event.stopPropagation();
});
e.addEventListener("click", function () {
const id = this.id.slice(5);
if (this.className === "icon-lock") unlock(id);
else lock(id);
const fn = this.className === "icon-lock" ? unlock : lock;
const ids = this.dataset.ids.split(",");
if (ids.length) ids.forEach(fn);
else fn(this.id.slice(5));
});
});

View file

@ -12,7 +12,7 @@
*
* Example: 1.102.0 -> Major version 1, Minor version 102, Patch version 0
*/
const VERSION = "1.101.01";
const VERSION = "1.101.02";
{
document.title += " v" + VERSION;