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> <td></td>
</tr> </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> <td>
<i <i
data-tip="Show seed history to apply a previous seed" data-tip="Show seed history to apply a previous seed"
@ -1595,7 +1597,7 @@
<tr data-tip="Define current year and era name"> <tr data-tip="Define current year and era name">
<td> <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>
<td>Year and era</td> <td>Year and era</td>
<td> <td>
@ -8046,7 +8048,7 @@
<script src="modules/ui/measurers.js?v=1.99.00"></script> <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/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="modules/ui/options.js?v=1.100.00"></script>
<script src="main.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 // assign lock behavior
document.querySelectorAll("[data-locked]").forEach(function (e) { document.querySelectorAll("[data-locked]").forEach(function (e) {
e.addEventListener("mouseover", function (event) { e.addEventListener("mouseover", e => {
e.stopPropagation();
if (this.className === "icon-lock") if (this.className === "icon-lock")
tip("Click to unlock the option and allow it to be randomized on new map generation"); 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"); else tip("Click to lock the option and always use the current value on new map generation");
event.stopPropagation();
}); });
e.addEventListener("click", function () { e.addEventListener("click", function () {
const id = this.id.slice(5); const fn = this.className === "icon-lock" ? unlock : lock;
if (this.className === "icon-lock") unlock(id); const ids = this.dataset.ids.split(",");
else lock(id);
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 * 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; document.title += " v" + VERSION;