diff --git a/index.html b/index.html index 5b71e70a..851fbec9 100644 --- a/index.html +++ b/index.html @@ -1313,7 +1313,7 @@ - + @@ -1972,7 +1972,7 @@ - + @@ -3143,7 +3143,7 @@ - + diff --git a/modules/ui/burg-editor.js b/modules/ui/burg-editor.js index 5068fe1f..10d86583 100644 --- a/modules/ui/burg-editor.js +++ b/modules/ui/burg-editor.js @@ -49,6 +49,7 @@ function editBurg(id) { document.getElementById("burgRelocate").addEventListener("click", toggleRelocateBurg); document.getElementById("burglLegend").addEventListener("click", editBurgLegend); document.getElementById("burgLock").addEventListener("click", toggleBurgLockButton); + document.getElementById("burgLock").addEventListener("mouseover", showBurgELockTip); document.getElementById("burgRemove").addEventListener("click", removeSelectedBurg); function updateBurgValues() { @@ -224,12 +225,12 @@ function editBurg(id) { for (let i=0; i < group.children.length; i++) { burgsInGroup.push(+group.children[i].dataset.id); } - const burgsToRemove = burgsInGroup.filter(b => !pack.burgs[b].capital); + const burgsToRemove = burgsInGroup.filter(b => !(pack.burgs[b].capital || pack.burgs[b].lock)); const capital = burgsToRemove.length < burgsInGroup.length; alertMessage.innerHTML = `Are you sure you want to remove - ${basic || capital ? "all elements in the group" : "the entire burg group"}? -
Please note that capital burgs will not be deleted. + ${basic || capital ? "all unlocked elements in the group" : "the entire burg group"}? +
Please note that capital or locked burgs will not be deleted.

Burgs to be removed: ${burgsToRemove.length}`; $("#alert").dialog({resizable: false, title: "Remove route group", buttons: { @@ -317,6 +318,11 @@ function editBurg(id) { } + function showBurgELockTip() { + const id = +elSelected.attr("data-id"); + showBurgLockTip(id); + } + function showStyleSection() { document.querySelectorAll("#burgBottom > button").forEach(el => el.style.display = "none"); document.getElementById("burgStyleSection").style.display = "inline-block"; diff --git a/modules/ui/burgs-overview.js b/modules/ui/burgs-overview.js index b153c87f..18bc79ce 100644 --- a/modules/ui/burgs-overview.js +++ b/modules/ui/burgs-overview.js @@ -86,7 +86,7 @@ function overviewBurgs() { - + `; } @@ -106,6 +106,7 @@ function overviewBurgs() { body.querySelectorAll("div > span.icon-star-empty").forEach(el => el.addEventListener("click", toggleCapitalStatus)); body.querySelectorAll("div > span.icon-anchor").forEach(el => el.addEventListener("click", togglePortStatus)); body.querySelectorAll("div > span.locks").forEach(el => el.addEventListener("click", toggleBurgLockStatus)); + body.querySelectorAll("div > span.locks").forEach(el => el.addEventListener("mouseover", showBurgOLockTip)); body.querySelectorAll("div > span.icon-pencil").forEach(el => el.addEventListener("click", openBurgEditor)); body.querySelectorAll("div > span.icon-trash-empty").forEach(el => el.addEventListener("click", triggerBurgRemove)); @@ -187,6 +188,11 @@ function overviewBurgs() { else {this.classList.remove("icon-lock-open"); this.classList.add("icon-lock"); this.classList.remove("inactive");} } + function showBurgOLockTip() { + const burg = +this.parentNode.dataset.id; + showBurgLockTip(burg); + } + function openBurgEditor() { const burg = +this.parentNode.dataset.id; editBurg(burg); @@ -467,7 +473,7 @@ function overviewBurgs() { } function triggerAllBurgsRemove() { - alertMessage.innerHTML = `Are you sure you want to remove all burgs except of capitals? + alertMessage.innerHTML = `Are you sure you want to remove all unlocked burgs except for capitals?
To remove a capital you have to remove a state first`; $("#alert").dialog({resizable: false, title: "Remove all burgs", buttons: { diff --git a/modules/ui/cultures-editor.js b/modules/ui/cultures-editor.js index 70eb0857..67e4618c 100644 --- a/modules/ui/cultures-editor.js +++ b/modules/ui/cultures-editor.js @@ -335,7 +335,7 @@ function editCultures() { function cultureRegenerateBurgs() { if (customization === 4) return; const culture = +this.parentNode.dataset.id; - const cBurgs = pack.burgs.filter(b => b.culture === culture); + const cBurgs = pack.burgs.filter(b => b.culture === culture && !b.lock); cBurgs.forEach(b => { b.name = Names.getCulture(culture); labels.select("[data-id='" + b.i +"']").text(b.name); diff --git a/modules/ui/editors.js b/modules/ui/editors.js index f2a848d8..cac16d4c 100644 --- a/modules/ui/editors.js +++ b/modules/ui/editors.js @@ -226,6 +226,15 @@ function toggleBurgLock(burg) { b.lock = b.lock ? 0 : 1; } +function showBurgLockTip(burg) { + const b = pack.burgs[burg]; + if (b.lock) { + tip("Click to Unlock burg and allow it to be change by regeneration tools"); + } else { + tip("Click to Lock burg and prevent changes by regeneration tools"); + } +} + // draw legend box function drawLegend(name, data) { legend.selectAll("*").remove(); // fully redraw every time