mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
get rid of jquery for don't ask box
This commit is contained in:
parent
2390c08de3
commit
e2e4f6dee2
1 changed files with 8 additions and 11 deletions
|
|
@ -30,10 +30,8 @@ toolsContent.addEventListener("click", function (event) {
|
||||||
|
|
||||||
// click on Regenerate buttons
|
// click on Regenerate buttons
|
||||||
if (event.target.parentNode.id === "regenerateFeature") {
|
if (event.target.parentNode.id === "regenerateFeature") {
|
||||||
if (sessionStorage.getItem("regenerateFeatureDontAsk")) {
|
const dontAsk = sessionStorage.getItem("regenerateFeatureDontAsk");
|
||||||
processFeatureRegeneration(event, button);
|
if (dontAsk) return processFeatureRegeneration(event, button);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
alertMessage.innerHTML = /* html */ `Regeneration will remove all the custom changes for the element.<br /><br />Are you sure you want to proceed?`;
|
alertMessage.innerHTML = /* html */ `Regeneration will remove all the custom changes for the element.<br /><br />Are you sure you want to proceed?`;
|
||||||
$("#alert").dialog({
|
$("#alert").dialog({
|
||||||
|
|
@ -49,15 +47,14 @@ toolsContent.addEventListener("click", function (event) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
open: function () {
|
open: function () {
|
||||||
const pane = $(this).dialog("widget").find(".ui-dialog-buttonpane");
|
const checkbox =
|
||||||
$(
|
'<span><input id="dontAsk" class="checkbox" type="checkbox"><label for="dontAsk" class="checkbox-label dontAsk"><i>do not ask again</i></label><span>';
|
||||||
'<span><input id="dontAsk" class="checkbox" type="checkbox"><label for="dontAsk" class="checkbox-label dontAsk"><i>do not ask again</i></label><span>'
|
const pane = this.parentElement.querySelector(".ui-dialog-buttonpane");
|
||||||
).prependTo(pane);
|
pane.insertAdjacentHTML("afterbegin", checkbox);
|
||||||
},
|
},
|
||||||
close: function () {
|
close: function () {
|
||||||
const box = $(this).dialog("widget").find(".checkbox")[0];
|
const box = this.parentElement.querySelector(".checkbox");
|
||||||
if (!box) return;
|
if (box?.checked) sessionStorage.setItem("regenerateFeatureDontAsk", true);
|
||||||
if (box.checked) sessionStorage.setItem("regenerateFeatureDontAsk", true);
|
|
||||||
$(this).dialog("destroy");
|
$(this).dialog("destroy");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue