fixed many bugs

edit of cl templates
setform button display
changed footer
changed overall layout a bit
This commit is contained in:
maru21 2023-10-15 22:46:20 +02:00
parent 63c072f4f2
commit 57d5fcceb4
7 changed files with 54 additions and 31 deletions

View File

@ -145,7 +145,7 @@ hr{border:0;border-top:1px solid #eee;margin:20px 0}
.w3-padding-top-64{padding-top:64px!important}.w3-padding-top-48{padding-top:48px!important}
.w3-padding-top-32{padding-top:32px!important}.w3-padding-top-24{padding-top:24px!important}
.w3-left{float:left!important}.w3-right{float:right!important}
.w3-button:hover{color:#000;background-color:#ccc}
.w3-button:hover{color:#000!important;background-color:#ccc!important}
.w3-transparent,.w3-hover-none:hover{background-color:transparent!important}
.w3-hover-none:hover{box-shadow:none!important}
/* Colors */

View File

@ -16,7 +16,7 @@
localOnly: true,
lineBreak: 150,
font: "Arial",
fontSize: 9,
fontSize: "10px",
};
@ -40,7 +40,7 @@
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<body class="w3-flat-clouds">
<div
class="w3-sidebar w3-bar-block w3-collapse w3-large w3-flat-clouds"
style="width: 300px; margin-top: 51px; padding-top: 12px"
@ -283,7 +283,7 @@
<div
id="output"
class="w3-row-padding w3-padding-64 w3-container w3-flat-clouds"
style="margin-bottom: 0px"
style="margin-bottom: 0px; display: none"
></div>
</div>
@ -359,13 +359,8 @@
</div>
</div>
<div class="w3-container w3-flat-clouds" style="height: 15em">
<br />
</div>
<!-- Footer -->
<footer
class="w3-container w3-padding-64 w3-center w3-opacity w3-flat-asbestos"
class="w3-container w3-padding w3-flat-clouds w3-center w3-margin-top"
>
<br />
<br />
@ -375,13 +370,13 @@
style="display: none"
>
<button
class="w3-button w3-border w3-flat-wet-asphalt"
class="w3-button w3-border w3-flat-clouds"
id="setFormBtn"
>
Set Form as Template
Set input as default
</button>
</div>
<div class="w3-container w3-margin-top" id="currentVersion">
<div class="w3-container w3-margin-top w3-right-align w3-small" id="currentVersion">
<span></span>
</div>
</footer>

View File

@ -66,6 +66,7 @@ function loadFileDiv(fileName, template) {
storeData("userInputForce", retrieveData(fileName, template));
loadTemplate(template, false, true);
}
function loadFileDivCallBack() {
@ -130,10 +131,14 @@ function loadFileDivCallBack() {
fileDisplay.appendChild(title);
let div = document.createElement("div");
div.appendChild(parseFormOnSubmit(false, true));
let parsedTemplate = parseFormOnSubmit(false, true);
div.appendChild(parsedTemplate);
fileDisplay.appendChild(div);
document.getElementById("mainForm").appendChild(fileDisplay);
//fix fontsize for display
document.getElementById("fileDisplay").firstChild.style.fontSize = "1em";
//add events
formEvts(storageName);
}
@ -193,9 +198,9 @@ function loadFileSidebar(tF) {
if (c > sidebarItemsAmount) {
sidebarListItem.setAttribute("data-template", "_overflow");
sidebarListItem.setAttribute("data-file", "_overflow");
sidebarListItem.classList.add("w3-flat-clouds");
sidebarListItem.style.backgroundColor = "#e3e7e8";
sidebarListItem.classList.remove("w3-button");
sidebarListItem.style.borderRight = "1px solid rgb(221, 221, 221)";
sidebarListItem.style.borderTop = "1px solid rgb(221, 221, 221)";
sidebarListItem.innerHTML =
tF.length - sidebarItemsAmount + " files not shown";
sidebarList.appendChild(sidebarListItem);
@ -211,11 +216,10 @@ function loadFileSidebar(tF) {
//clear all files button
sidebarListItem = document.createElement("li");
sidebarListItem.classList.add("w3-bar-item", "w3-padding-large", "w3-button");
sidebarListItem.style.borderBottom = "1px solid #ddd";
sidebarListItem.setAttribute("data-template", "_clearAll");
sidebarListItem.setAttribute("data-file", "_clearAll");
sidebarListItem.classList.add("w3-hover-flat-pomegranate", "w3-bottom");
sidebarListItem.style.borderRight = "1px solid rgb(221, 221, 221)";
sidebarListItem.style.borderTop = "1px solid rgb(221, 221, 221)";
sidebarListItem.style.width = "300px";
sidebarListItem.innerHTML = "Clear all files";
sidebarList.appendChild(sidebarListItem);
@ -299,6 +303,7 @@ function formEvts(storageName) {
);
e.target.style.pointerEvents = "auto";
}, 250);
modalNotifier(activeState.fileName + " copied to clipboard", 2);
break;
case "Delete":
let previousFile = getPreviousFile(storageName);

View File

@ -9,7 +9,7 @@ function buildForm(templateInput, loadOnly = false) {
var wordArray = [];
//display set Form button
document.getElementById("setFormButton").style.display = "block";
if (!loadOnly) document.getElementById("setFormButton").style.display = "block";
//check for presets in "-form.txt" file; indicated by !JSON_placeholder
if (templateInput.indexOf("!JSON_placeholder:") !== -1) {

View File

@ -66,7 +66,6 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
return;
}
//iterate through templateObjects and look for according formdata
for (let obj of objects) {
//compaire each obj with elements from mainFormObj
@ -130,15 +129,15 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
bHtml = bHtml.replace(/!ls /g, " ○ ");
bHtml = bHtml.replace(/ /g, "&nbsp;");
bHtml =
"<div style='font-family: " + activeState.font + ", Helvetica, sans-serif; font-size: " + activeState.fontSize + "px;'>" +
bHtml +
"</div>";
let divContent = document.createElement("div");
divContent.style.fontFamily = activeState.font + ", Helvetica, sans-serif";
divContent.style.fontSize = activeState.fontSize;
divContent.innerHTML = bHtml;
let div = document.createElement("div");
div.classList.add("w3-code", "notranslate", "w3-border-white");
div.id = "fileDisplay";
div.innerHTML = bHtml;
div.appendChild(divContent);
if (parseOnly) {
return div;
@ -216,6 +215,7 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
}
}
}
return ""
}
export function parseTextMarkups(data) {

View File

@ -264,13 +264,36 @@ function delStoredDataOnServer() {
function retrieveForm(arr) {
for (let i = 0; i < arr.length; i++) {
let e = document.getElementById(arr[i].name);
if (e === null) {
e = document.getElementById(arr[i].name.split("cl-")[1]);
if (e === null) continue;
}
//parse connected list
let id = arr[i].name.split("cl-")[1];
//escape cl-text:!ls
if (id != undefined) id = id.split(":")[0];
e = document.getElementById(id);
if (e === null) {
//parse connected list main
let id = arr[i].name.split("clM-")[1];
e = document.getElementById(id);
if (e === null) continue;
}
if (e.name.substr(0, 4) == "clM-") continue;
}
//handle connected list Main item button or list
if (e.name.substr(0, 4) == "clM-") {
if (arr[i].value != "!none") {
let clElement = document.getElementById(e.dataset.word);
if (clElement === null) {
clElement = document.getElementById(arr[i].value.replace(/ /g, "_"));
}
//make shure it is visible if selected before
if (clElement != undefined) clElement.parentElement.parentElement.classList.remove("hidden");
e.value = arr[i].value;
}
continue;
}
switch (e.nodeName) {
case "TEXTAREA":

View File

@ -1 +1 @@
[{"value":"!none","name":"Con_List_Selection"},{"value":"","name":"cl-Die_Patientin_ist_erwerbstätig","placeholder":"!ls"},{"value":"Firma: \nFunktion: \nPensum: \nAngestellt seit: \n","name":"cl-Der_Patient_ist_erwerbstätig_auf_dem_2._AM","placeholder":"!ls"},{"value":"AUF seit: \nAktueller Stand IV: ","name":"cl-_Der_Patient_ist_nicht_erwerbstätig","placeholder":"!ls"},{"value":"","name":"cl-Andere","placeholder":"!ls"},{"value":"Lebensmittelpunkt","name":"Con_List_Button"},{"value":"!ls\n!kbs","name":"cl-Lebensmittelpunkt","placeholder":"!ls"}]
[{"value":"!none","name":"Con_List_Selection"},{"value":"","name":"cl-Die_Patientin_ist_erwerbstätig","placeholder":"!ls"},{"value":"Firma: \nFunktion: \nPensum: \nAngestellt seit: \n","name":"cl-Der_Patient_ist_erwerbstätig_auf_dem_2._AM","placeholder":"!ls"},{"value":"AUF seit: \nAktueller Stand IV: ","name":"cl-_Der_Patient_ist_nicht_erwerbstätig","placeholder":"!ls"},{"value":"","name":"cl-Andere","placeholder":"!ls"},{"value":"Lebensmittelpunkt","name":"Con_List_Button"},{"value":"!ls\n!ls\n!kbs","name":"cl-Lebensmittelpunkt","placeholder":"!ls"}]