improved delete all files
fixed some modal timing issues changed modal position testing: disabled copy and text to output field
This commit is contained in:
parent
b7868bc4e5
commit
387d043afd
@ -301,8 +301,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modalNotifier" style="display: none" class="w3-modal">
|
||||
<div class="w3-card-4 w3-modal-content w3-margin-top w3-animate-opacity" style="max-width:600px">
|
||||
<div id="modalNotifier" style="display: none; padding-top: 200px !important;" class="w3-modal">
|
||||
<div class="w3-card-4 w3-modal-content w3-margin-top" style="max-width:600px;">
|
||||
<span
|
||||
onclick="this.parentElement.parentElement.style.display='none'"
|
||||
class="w3-button w3-display-topright w3-flat-clouds"
|
||||
|
||||
@ -155,7 +155,7 @@ function createTemplate(template = false) {
|
||||
}
|
||||
let data = document.getElementById("templateInput").value;
|
||||
setNewTemplate(fileName, data);
|
||||
modalNotifier(fileName+" saved!", 1);
|
||||
modalNotifier(fileName+" saved!", 2);
|
||||
e.target.className = e.target.className.replace(" w3-grey", " w3-flat-nephritis");
|
||||
e.target.style.pointerEvents = "none";
|
||||
const timeoutSave = setTimeout(() => {
|
||||
|
||||
@ -145,7 +145,7 @@ function clickLoadFileDiv(fileName, template) {
|
||||
if (fileName == "_overflow") return;
|
||||
|
||||
if (fileName == "_clearAll") {
|
||||
clearAllFiles();
|
||||
clickClearAllFiles();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -346,10 +346,33 @@ function getPreviousFile(storageName) {
|
||||
return (previousFile != undefined) ? previousFile : false;
|
||||
}
|
||||
|
||||
function clickClearAllFiles() {
|
||||
let modal = document.getElementById("modalMsg");
|
||||
modal.replaceWith(modal.cloneNode(true));
|
||||
document.getElementById("modalMsg").addEventListener("click", (e) => {
|
||||
if (e.target && e.target.tagName === "BUTTON") {
|
||||
let modal = document.getElementById("modalNotifier");
|
||||
switch (e.target.innerHTML) {
|
||||
case "Delete":
|
||||
clearAllFiles();
|
||||
modal.replaceWith(modal.cloneNode(true));
|
||||
modalNotifier("All files deleted!", 2);
|
||||
break;
|
||||
default:
|
||||
e.preventDefault;
|
||||
}
|
||||
}
|
||||
})
|
||||
modalNotifier(
|
||||
"<div class='w3-container'> \
|
||||
<p>Would you really like to delete all stored files?</p> \
|
||||
<button class='w3-button w3-border w3-flat-pomegranate' >Delete</button>",
|
||||
0);
|
||||
}
|
||||
function clearAllFiles() {
|
||||
let tF = JSON.parse(retrieveData("templateFiles"));
|
||||
if (tF == null || tF.length == 0) {
|
||||
modalNotifier("there are no saved texts yet");
|
||||
modalNotifier("there are no saved texts yet",2);
|
||||
return;
|
||||
}
|
||||
for (let storageName of tF) {
|
||||
|
||||
@ -225,6 +225,7 @@ function formEvts() {
|
||||
parseFormOnSubmit();
|
||||
e.target.className = e.target.className.replace(" w3-grey", " w3-flat-carrot");
|
||||
e.target.style.pointerEvents = "none";
|
||||
modalNotifier(activeState.fileName + " copied to clipboard", 2);
|
||||
const timeoutCopy = setTimeout(() => {
|
||||
e.target.className = e.target.className.replace(" w3-flat-carrot"," w3-grey");
|
||||
e.target.style.pointerEvents = "auto";
|
||||
|
||||
@ -144,11 +144,11 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
|
||||
return div;
|
||||
}
|
||||
|
||||
let p = document.createElement("p");
|
||||
p.innerHTML = "Copied to Clipboard:";
|
||||
document.getElementById("output").innerHTML = "";
|
||||
document.getElementById("output").appendChild(p);
|
||||
document.getElementById("output").appendChild(div);
|
||||
// let p = document.createElement("p");
|
||||
// p.innerHTML = "Copied to Clipboard:";
|
||||
// document.getElementById("output").innerHTML = "";
|
||||
// document.getElementById("output").appendChild(p);
|
||||
// document.getElementById("output").appendChild(div);
|
||||
|
||||
storeData("userInput", JSON.stringify(dataArray));
|
||||
clearData("userInput");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user