From 57d5fcceb4b15edcee87ffcb4ea7dc19411da1df Mon Sep 17 00:00:00 2001 From: maru21 Date: Sun, 15 Oct 2023 22:46:20 +0200 Subject: [PATCH] fixed many bugs edit of cl templates setform button display changed footer changed overall layout a bit --- css/w3.css | 2 +- index.html | 21 ++++++++------------- js/9.9.9/files.js | 15 ++++++++++----- js/9.9.9/form.js | 2 +- js/9.9.9/parseForm.js | 14 +++++++------- js/9.9.9/web.js | 29 ++++++++++++++++++++++++++--- template/testing-form.txt | 2 +- 7 files changed, 54 insertions(+), 31 deletions(-) diff --git a/css/w3.css b/css/w3.css index 0125498..5eff116 100644 --- a/css/w3.css +++ b/css/w3.css @@ -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 */ diff --git a/index.html b/index.html index 4cdb341..9e89976 100644 --- a/index.html +++ b/index.html @@ -16,8 +16,8 @@ localOnly: true, lineBreak: 150, font: "Arial", - fontSize: 9, - + fontSize: "10px", + }; let script = document.createElement("script"); @@ -40,7 +40,7 @@ - +
@@ -359,13 +359,8 @@ -
-
-
- - diff --git a/js/9.9.9/files.js b/js/9.9.9/files.js index 7d7bc04..7a07d5a 100644 --- a/js/9.9.9/files.js +++ b/js/9.9.9/files.js @@ -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); diff --git a/js/9.9.9/form.js b/js/9.9.9/form.js index 492185f..5f29233 100644 --- a/js/9.9.9/form.js +++ b/js/9.9.9/form.js @@ -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) { diff --git a/js/9.9.9/parseForm.js b/js/9.9.9/parseForm.js index fb5c1e3..ded454b 100644 --- a/js/9.9.9/parseForm.js +++ b/js/9.9.9/parseForm.js @@ -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, " "); - bHtml = - "
" + - bHtml + - "
"; - + 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) { diff --git a/js/9.9.9/web.js b/js/9.9.9/web.js index 1abe774..30b84c2 100644 --- a/js/9.9.9/web.js +++ b/js/9.9.9/web.js @@ -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; + } + } + //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; + } - if (e.name.substr(0, 4) == "clM-") continue; + continue; + } switch (e.nodeName) { case "TEXTAREA": diff --git a/template/testing-form.txt b/template/testing-form.txt index 37f6be0..90eca20 100644 --- a/template/testing-form.txt +++ b/template/testing-form.txt @@ -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"}] \ No newline at end of file +[{"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"}] \ No newline at end of file