Lock/unlock in one button

Unlock all burgs and lock all burgs in just one button.
Additionally to invert lock.
This commit is contained in:
Ángel Montero Lamas 2021-12-22 15:08:40 +01:00
parent 19fdc24a95
commit c12650fe9b
2 changed files with 12 additions and 4 deletions

View file

@ -3284,8 +3284,7 @@
<button id="addNewBurg" data-tip="Add a new burg. Hold Shift to add multiple" class="icon-plus"></button> <button id="addNewBurg" data-tip="Add a new burg. Hold Shift to add multiple" class="icon-plus"></button>
<button id="burgsExport" data-tip="Save burgs-related data as a text file (.csv)" class="icon-download"></button> <button id="burgsExport" data-tip="Save burgs-related data as a text file (.csv)" class="icon-download"></button>
<button id="burgNamesImport" data-tip="Rename burgs in bulk" class="icon-upload"></button> <button id="burgNamesImport" data-tip="Rename burgs in bulk" class="icon-upload"></button>
<button id="burgsLockAll" data-tip="Lock all burgs" class="icon-lock"></button> <button id="burgsonoff" data-tip="Lock / Unlock all burgs" class="icon-lock" value="Off"></button>
<button id="burgsUnlockAll" data-tip="Unlock all burgs" class="icon-lock-open-alt"></button>
<button id="burgsRemoveAll" data-tip="Remove all unlocked burgs except for capitals. To remove a capital remove its state first" class="icon-trash"></button> <button id="burgsRemoveAll" data-tip="Remove all unlocked burgs except for capitals. To remove a capital remove its state first" class="icon-trash"></button>
</div> </div>
</div> </div>

View file

@ -33,8 +33,7 @@ function overviewBurgs() {
document.getElementById("burgsListToLoad").addEventListener("change", function () { document.getElementById("burgsListToLoad").addEventListener("change", function () {
uploadFile(this, importBurgNames); uploadFile(this, importBurgNames);
}); });
document.getElementById("burgsLockAll").addEventListener("click", lockAllBurgs); document.getElementById("burgsonoff").addEventListener("click", burgsonoff);
document.getElementById("burgsUnlockAll").addEventListener("click", unlockAllBurgs);
document.getElementById("burgsRemoveAll").addEventListener("click", triggerAllBurgsRemove); document.getElementById("burgsRemoveAll").addEventListener("click", triggerAllBurgsRemove);
document.getElementById("burgsInvertLock").addEventListener("click", invertLock); document.getElementById("burgsInvertLock").addEventListener("click", invertLock);
@ -574,4 +573,14 @@ function overviewBurgs() {
burg.lock = false;}); burg.lock = false;});
burgsOverviewAddLines(); burgsOverviewAddLines();
} }
function burgsonoff(){
const currentvalue = document.getElementById('burgsonoff').value;
if(currentvalue == "Off"){
lockAllBurgs();
document.getElementById("burgsonoff").value="On";
}else{
unlockAllBurgs();
document.getElementById("burgsonoff").value="Off";
}
}
} }