Compare commits
No commits in common. "57d5fcceb4b15edcee87ffcb4ea7dc19411da1df" and "43a33ed76c51216a57bca6a47ac99bc7fbd489a5" have entirely different histories.
57d5fcceb4
...
43a33ed76c
@ -33,11 +33,8 @@
|
||||
.w3-flat-pumpkin
|
||||
{color:#fff;background-color:#d35400}
|
||||
.w3-flat-pomegranate
|
||||
{color:#fff;background-color:#c0392b !important}
|
||||
{color:#fff;background-color:#c0392b}
|
||||
.w3-flat-silver
|
||||
{color:#000;background-color:#bdc3c7}
|
||||
.w3-flat-asbestos
|
||||
{color:#fff;background-color:#7f8c8d}
|
||||
|
||||
.w3-hover-flat-pomegranate:hover
|
||||
{color:#fff !important;background-color:#c0392b !important}
|
||||
22
index.html
22
index.html
@ -13,11 +13,8 @@
|
||||
|
||||
//settings
|
||||
window.settings = {
|
||||
localOnly: true,
|
||||
lineBreak: 150,
|
||||
font: "Arial",
|
||||
fontSize: "10px",
|
||||
|
||||
localOnly: true,
|
||||
};
|
||||
|
||||
let script = document.createElement("script");
|
||||
@ -40,7 +37,7 @@
|
||||
<link rel="stylesheet" href="css/styles.css" />
|
||||
</head>
|
||||
|
||||
<body class="w3-flat-clouds">
|
||||
<body>
|
||||
<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 +280,7 @@
|
||||
<div
|
||||
id="output"
|
||||
class="w3-row-padding w3-padding-64 w3-container w3-flat-clouds"
|
||||
style="margin-bottom: 0px; display: none"
|
||||
style="margin-bottom: 0px"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
@ -359,8 +356,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w3-container w3-flat-clouds" style="height: 15em">
|
||||
<br />
|
||||
</div>
|
||||
<!-- Footer -->
|
||||
|
||||
<footer
|
||||
class="w3-container w3-padding w3-flat-clouds w3-center w3-margin-top"
|
||||
class="w3-container w3-padding-64 w3-center w3-opacity w3-flat-asbestos"
|
||||
>
|
||||
<br />
|
||||
<br />
|
||||
@ -370,13 +372,13 @@
|
||||
style="display: none"
|
||||
>
|
||||
<button
|
||||
class="w3-button w3-border w3-flat-clouds"
|
||||
class="w3-button w3-border w3-flat-wet-asphalt"
|
||||
id="setFormBtn"
|
||||
>
|
||||
Set input as default
|
||||
Set Form as Template
|
||||
</button>
|
||||
</div>
|
||||
<div class="w3-container w3-margin-top w3-right-align w3-small" id="currentVersion">
|
||||
<div class="w3-container w3-margin-top" id="currentVersion">
|
||||
<span></span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@ -11,6 +11,7 @@ import { modalNotifier } from "./evts.js";
|
||||
function buildFile() {
|
||||
createStorageObj();
|
||||
|
||||
|
||||
//set current page value in activeState object
|
||||
activeState.activePage = "files";
|
||||
|
||||
@ -23,6 +24,7 @@ function buildFile() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (screen.width > 992) {
|
||||
document.getElementById("siteTitle").innerHTML = "Saved files";
|
||||
} else {
|
||||
@ -66,7 +68,6 @@ function loadFileDiv(fileName, template) {
|
||||
storeData("userInputForce", retrieveData(fileName, template));
|
||||
|
||||
loadTemplate(template, false, true);
|
||||
|
||||
}
|
||||
|
||||
function loadFileDivCallBack() {
|
||||
@ -113,7 +114,7 @@ function loadFileDivCallBack() {
|
||||
deleteButton.setAttribute("type", "submit");
|
||||
deleteButton.setAttribute("value", "Delete");
|
||||
deleteButton.classList.add("w3-button");
|
||||
deleteButton.classList.add("w3-flat-pomegranate");
|
||||
deleteButton.classList.add("w3-red");
|
||||
document.getElementById("submitContainer").appendChild(deleteButton);
|
||||
|
||||
if (screen.width > 992) {
|
||||
@ -122,6 +123,7 @@ function loadFileDivCallBack() {
|
||||
document.getElementById("siteTitle").innerHTML = "TG";
|
||||
}
|
||||
|
||||
|
||||
let title = document.createElement("div");
|
||||
title.classList.add("w3-panel");
|
||||
let titleText = document.createElement("h2");
|
||||
@ -131,14 +133,10 @@ function loadFileDivCallBack() {
|
||||
fileDisplay.appendChild(title);
|
||||
|
||||
let div = document.createElement("div");
|
||||
let parsedTemplate = parseFormOnSubmit(false, true);
|
||||
div.appendChild(parsedTemplate);
|
||||
div.appendChild(parseFormOnSubmit(false, true));
|
||||
fileDisplay.appendChild(div);
|
||||
document.getElementById("mainForm").appendChild(fileDisplay);
|
||||
|
||||
//fix fontsize for display
|
||||
document.getElementById("fileDisplay").firstChild.style.fontSize = "1em";
|
||||
|
||||
//add events
|
||||
formEvts(storageName);
|
||||
}
|
||||
@ -194,15 +192,13 @@ function loadFileSidebar(tF) {
|
||||
sidebarListItem.style.borderBottom = "1px solid #ddd";
|
||||
sidebarListItem.id = "sb-" + obj.fileName.replace(/:/g, "_");
|
||||
|
||||
//handle to many files on screen and display hidden files amount
|
||||
if (c > sidebarItemsAmount) {
|
||||
sidebarListItem.setAttribute("data-template", "_overflow");
|
||||
sidebarListItem.setAttribute("data-file", "_overflow");
|
||||
sidebarListItem.style.backgroundColor = "#e3e7e8";
|
||||
sidebarListItem.setAttribute("data-template", '_overflow');
|
||||
sidebarListItem.setAttribute("data-file", '_overflow');
|
||||
sidebarListItem.classList.add("w3-flat-clouds");
|
||||
sidebarListItem.classList.remove("w3-button");
|
||||
sidebarListItem.style.borderTop = "1px solid rgb(221, 221, 221)";
|
||||
sidebarListItem.innerHTML =
|
||||
tF.length - sidebarItemsAmount + " files not shown";
|
||||
sidebarListItem.style.borderRight = "1px solid rgb(221, 221, 221)"
|
||||
sidebarListItem.innerHTML = tF.length - sidebarItemsAmount + " files not shown";
|
||||
sidebarList.appendChild(sidebarListItem);
|
||||
break;
|
||||
}
|
||||
@ -213,13 +209,17 @@ function loadFileSidebar(tF) {
|
||||
c++;
|
||||
}
|
||||
|
||||
//clear all files button
|
||||
sidebarListItem = document.createElement("li");
|
||||
sidebarListItem.classList.add("w3-bar-item", "w3-padding-large", "w3-button");
|
||||
sidebarListItem.setAttribute("data-template", "_clearAll");
|
||||
sidebarListItem.setAttribute("data-file", "_clearAll");
|
||||
sidebarListItem.classList.add("w3-hover-flat-pomegranate", "w3-bottom");
|
||||
sidebarListItem.style.borderTop = "1px solid rgb(221, 221, 221)";
|
||||
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-flat-pomegranate", "w3-bottom");
|
||||
sidebarListItem.style.borderRight = "1px solid rgb(221, 221, 221)";
|
||||
sidebarListItem.style.width = "300px";
|
||||
sidebarListItem.innerHTML = "Clear all files";
|
||||
sidebarList.appendChild(sidebarListItem);
|
||||
@ -228,11 +228,7 @@ function loadFileSidebar(tF) {
|
||||
}
|
||||
|
||||
function mainFormPlaceholder(msg = "Select a file") {
|
||||
return (
|
||||
"<div class='w3-row-padding w3-padding-24 w3-container w3-flat-clouds'><div class='w3-code notranslate w3-border-white' style='font-family: Arial, Helvetica, sans-serif;'><p>" +
|
||||
msg +
|
||||
"</p><br><br><br><br><br><br><br><br><br><br><br></div></div>"
|
||||
);
|
||||
return "<div class='w3-row-padding w3-padding-24 w3-container w3-flat-clouds'><div class='w3-code notranslate w3-border-white' style='font-family: Arial, Helvetica, sans-serif;'><p>" + msg + "</p><br><br><br><br><br><br><br><br><br><br><br></div></div>";
|
||||
}
|
||||
|
||||
function copyFileToClipboard() {
|
||||
@ -242,6 +238,7 @@ function copyFileToClipboard() {
|
||||
} else {
|
||||
console.log("error file not found");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function copyToClipBoard(html) {
|
||||
@ -291,19 +288,12 @@ function formEvts(storageName) {
|
||||
break;
|
||||
case "Copy":
|
||||
copyFileToClipboard();
|
||||
e.target.className = e.target.className.replace(
|
||||
" w3-grey",
|
||||
" w3-flat-carrot"
|
||||
);
|
||||
e.target.className = e.target.className.replace(" w3-grey", " w3-flat-carrot");
|
||||
e.target.style.pointerEvents = "none";
|
||||
const timeoutCopy = setTimeout(() => {
|
||||
e.target.className = e.target.className.replace(
|
||||
" w3-flat-carrot",
|
||||
" w3-grey"
|
||||
);
|
||||
e.target.className = e.target.className.replace(" w3-flat-carrot"," w3-grey");
|
||||
e.target.style.pointerEvents = "auto";
|
||||
}, 250);
|
||||
modalNotifier(activeState.fileName + " copied to clipboard", 2);
|
||||
break;
|
||||
case "Delete":
|
||||
let previousFile = getPreviousFile(storageName);
|
||||
@ -312,8 +302,7 @@ function formEvts(storageName) {
|
||||
if (previousFile) {
|
||||
loadFileDiv(previousFile.fileName, previousFile.template);
|
||||
} else {
|
||||
document.getElementById("mainForm").innerHTML =
|
||||
mainFormPlaceholder("No file yet");
|
||||
document.getElementById("mainForm").innerHTML = mainFormPlaceholder("No file yet");
|
||||
}
|
||||
|
||||
break;
|
||||
@ -336,6 +325,7 @@ function loadSpecificTemplate(storageName) {
|
||||
}
|
||||
|
||||
function getPreviousFile(storageName) {
|
||||
|
||||
let orgFileName = storageName.split("_m21_")[0];
|
||||
let tF = JSON.parse(retrieveData("templateFiles"));
|
||||
let i = 0;
|
||||
@ -343,17 +333,17 @@ function getPreviousFile(storageName) {
|
||||
|
||||
for (let obj of tF) {
|
||||
if (obj.fileName == orgFileName) {
|
||||
previousFile = tF[i - 1];
|
||||
previousFile = tF[i-1];
|
||||
if (previousFile === undefined) {
|
||||
//get the next one if there is no previous one
|
||||
previousFile = tF[i + 1];
|
||||
previousFile = tF[i+1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return previousFile != undefined ? previousFile : false;
|
||||
return (previousFile != undefined) ? previousFile : false;
|
||||
}
|
||||
|
||||
function clickClearAllFiles() {
|
||||
@ -372,18 +362,17 @@ function clickClearAllFiles() {
|
||||
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
|
||||
);
|
||||
0);
|
||||
}
|
||||
function clearAllFiles() {
|
||||
let tF = JSON.parse(retrieveData("templateFiles"));
|
||||
if (tF == null || tF.length == 0) {
|
||||
modalNotifier("there are no saved texts yet", 2);
|
||||
modalNotifier("there are no saved texts yet",2);
|
||||
return;
|
||||
}
|
||||
for (let storageName of tF) {
|
||||
|
||||
@ -9,7 +9,7 @@ function buildForm(templateInput, loadOnly = false) {
|
||||
var wordArray = [];
|
||||
|
||||
//display set Form button
|
||||
if (!loadOnly) document.getElementById("setFormButton").style.display = "block";
|
||||
document.getElementById("setFormButton").style.display = "block";
|
||||
|
||||
//check for presets in "-form.txt" file; indicated by !JSON_placeholder
|
||||
if (templateInput.indexOf("!JSON_placeholder:") !== -1) {
|
||||
|
||||
@ -66,6 +66,7 @@ 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
|
||||
@ -129,15 +130,15 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
|
||||
bHtml = bHtml.replace(/!ls /g, " ○ ");
|
||||
bHtml = bHtml.replace(/ /g, " ");
|
||||
|
||||
let divContent = document.createElement("div");
|
||||
divContent.style.fontFamily = activeState.font + ", Helvetica, sans-serif";
|
||||
divContent.style.fontSize = activeState.fontSize;
|
||||
divContent.innerHTML = bHtml;
|
||||
bHtml =
|
||||
"<div style='font-family: Arial, Helvetica, sans-serif;'>" +
|
||||
bHtml +
|
||||
"</div>";
|
||||
|
||||
let div = document.createElement("div");
|
||||
div.classList.add("w3-code", "notranslate", "w3-border-white");
|
||||
div.id = "fileDisplay";
|
||||
div.appendChild(divContent);
|
||||
div.innerHTML = bHtml;
|
||||
|
||||
if (parseOnly) {
|
||||
return div;
|
||||
@ -215,7 +216,6 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
export function parseTextMarkups(data) {
|
||||
|
||||
@ -264,36 +264,13 @@ function delStoredDataOnServer() {
|
||||
|
||||
function retrieveForm(arr) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
|
||||
let e = document.getElementById(arr[i].name);
|
||||
if (e === null) {
|
||||
//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);
|
||||
e = document.getElementById(arr[i].name.split("cl-")[1]);
|
||||
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;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
if (e.name.substr(0, 4) == "clM-") continue;
|
||||
|
||||
switch (e.nodeName) {
|
||||
case "TEXTAREA":
|
||||
|
||||
@ -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!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!kbs","name":"cl-Lebensmittelpunkt","placeholder":"!ls"}]
|
||||
Loading…
Reference in New Issue
Block a user