mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Added lock/unlock all (#713)
* Added lock/unlock all Lock All , Unlock All as separate buttons. Additionally to InvertLock. * Update burgs-overview.js Updated the syntax to the one suggested by Azgaar. * Lock/unlock in one button Unlock all burgs and lock all burgs in just one button. Additionally to invert lock. * lock unlock in burgs-overview.js Added a way to check if burgs are locked or unlocked with the lock all button, so it works in any situations about locking. * burgs-overview.js lock all Changed burgsonoff to setLockBurgs, also put setLockIcon. * index.html burgsonoff to burgsLockAll * Update burgs-overview.js spacing
This commit is contained in:
parent
44c134ebd0
commit
f3d3538ff5
2 changed files with 42 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ function overviewBurgs() {
|
|||
const body = document.getElementById("burgsBody");
|
||||
updateFilter();
|
||||
burgsOverviewAddLines();
|
||||
setLockIcon();
|
||||
$("#burgsOverview").dialog();
|
||||
|
||||
if (modules.overviewBurgs) return;
|
||||
|
|
@ -33,6 +34,8 @@ function overviewBurgs() {
|
|||
document.getElementById("burgsListToLoad").addEventListener("change", function () {
|
||||
uploadFile(this, importBurgNames);
|
||||
});
|
||||
document.getElementById("burgsLockAll").addEventListener("click", setLockBurgs);
|
||||
document.getElementById("burgsLockAll").addEventListener("click", setLockIcon);
|
||||
document.getElementById("burgsRemoveAll").addEventListener("click", triggerAllBurgsRemove);
|
||||
document.getElementById("burgsInvertLock").addEventListener("click", invertLock);
|
||||
|
||||
|
|
@ -87,7 +90,7 @@ function overviewBurgs() {
|
|||
<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>
|
||||
<select data-tip="Dominant culture. Click to change burg culture (to change cell cultrure use Cultures Editor)" class="stateCulture">${getCultureOptions(
|
||||
<select data-tip="Dominant culture. Click to change burg culture (to change cell culture use Cultures Editor)" class="stateCulture">${getCultureOptions(
|
||||
b.culture
|
||||
)}</select>
|
||||
<span data-tip="Burg population" class="icon-male"></span>
|
||||
|
|
@ -562,4 +565,41 @@ function overviewBurgs() {
|
|||
pack.burgs = pack.burgs.map(burg => ({...burg, lock: !burg.lock}));
|
||||
burgsOverviewAddLines();
|
||||
}
|
||||
|
||||
function lockAllBurgs() {
|
||||
pack.burgs.forEach(burg => {
|
||||
burg.lock = true;
|
||||
});
|
||||
burgsOverviewAddLines();
|
||||
}
|
||||
|
||||
function unlockAllBurgs() {
|
||||
pack.burgs.forEach(burg => {
|
||||
burg.lock = false;
|
||||
});
|
||||
burgsOverviewAddLines();
|
||||
}
|
||||
|
||||
function setLockBurgs() {
|
||||
const allLocked = pack.burgs.every(({lock, i, removed}) => lock || !i || removed);
|
||||
|
||||
if (allLocked) {
|
||||
unlockAllBurgs();
|
||||
} else {
|
||||
lockAllBurgs();
|
||||
}
|
||||
setLockIcon();
|
||||
}
|
||||
|
||||
function setLockIcon() {
|
||||
const allLocked = pack.burgs.every(({lock, i, removed}) => lock || !i || removed);
|
||||
|
||||
if (allLocked) {
|
||||
burgsLockAll.classList.remove("icon-lock");
|
||||
burgsLockAll.classList.add("icon-lock-open");
|
||||
} else {
|
||||
burgsLockAll.classList.add("icon-lock");
|
||||
burgsLockAll.classList.remove("icon-lock-open");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue