pattern for updating customizatoin functions established! also currently fixing bookmark form
This commit is contained in:
+32
-23
@@ -254,7 +254,7 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form id="addContainerForm" onsubmit="return false">
|
<form id="addContainerForm">
|
||||||
<div class="formTitle">add new containers / layers</div>
|
<div class="formTitle">add new containers / layers</div>
|
||||||
<input
|
<input
|
||||||
id="newContainerNameInput"
|
id="newContainerNameInput"
|
||||||
@@ -680,9 +680,7 @@
|
|||||||
document.getElementById("addContainerForm").insertAdjacentHTML(
|
document.getElementById("addContainerForm").insertAdjacentHTML(
|
||||||
"beforeend",
|
"beforeend",
|
||||||
`
|
`
|
||||||
<div id=${this.id + "-bookmark-form"}>
|
<div id=${this.id + "-bookmark-form"} class="formTitle">add bookmarks</div>
|
||||||
|
|
||||||
<div class="formTitle">add bookmarks</div>
|
|
||||||
<div>
|
<div>
|
||||||
<label> enter url: </label>
|
<label> enter url: </label>
|
||||||
<input id=${this.id + "-url-input"} type="text" name="url" />
|
<input id=${this.id + "-url-input"} type="text" name="url" />
|
||||||
@@ -2051,16 +2049,30 @@
|
|||||||
* BOOK MARK HANDLERS *
|
* BOOK MARK HANDLERS *
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
function addLink() {
|
function addLink(containerElement) {
|
||||||
|
let containerId = containerElement.id.split("-")[0];
|
||||||
|
console.log(containerId);
|
||||||
|
let container = containerDataMap.get(containerId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
change this to collect data directly from input.value
|
||||||
|
we aren't using a form anymore
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
// collect input data from form
|
// collect input data from form
|
||||||
const form = document.getElementById("bookmarkForm");
|
const form = document.getElementById(containerId + "-bookmark-form");
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
|
|
||||||
const label = formData.get("label");
|
const label = formData.get("label");
|
||||||
let url = formData.get("url");
|
let url = formData.get("url");
|
||||||
let section = formData.get("section");
|
let section = formData.get("section");
|
||||||
document.getElementById("linkInput").value = "";
|
document.getElementById(containerId + "url-input").value = "";
|
||||||
document.getElementById("labelInput").value = "";
|
document.getElementById(containerId + "label-input").value = "";
|
||||||
|
|
||||||
// sanitize input
|
// sanitize input
|
||||||
if (!url.startsWith("http")) {
|
if (!url.startsWith("http")) {
|
||||||
@@ -2075,12 +2087,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save link (and if new, the section)
|
// save link (and if new, the section)
|
||||||
links.push({
|
let tempIndex = Object.keys(container.sections).indexOf(section);
|
||||||
|
if (tempIndex =! -1) {
|
||||||
|
let tempSectionLinks = Object.values(container.sections)[tempIndex];
|
||||||
|
tempSectionLinks.push({
|
||||||
label: label,
|
label: label,
|
||||||
url: url,
|
url: url
|
||||||
section: section,
|
|
||||||
});
|
});
|
||||||
|
console.log(container.sections);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
if (sections.indexOf(section) == -1) {
|
if (sections.indexOf(section) == -1) {
|
||||||
sections.push(section);
|
sections.push(section);
|
||||||
}
|
}
|
||||||
@@ -2246,24 +2264,15 @@
|
|||||||
************************************/
|
************************************/
|
||||||
|
|
||||||
function changeContainerBackground(colorChange) {
|
function changeContainerBackground(colorChange) {
|
||||||
// DONT GET ELEMENT, GET CONTAINER FROM DATAMAP.... NEED TO FIX FOR INIT ANYWAYS
|
let containerId = colorChange.currentTarget.id.split("-")[0];
|
||||||
let container = document.getElementById(
|
let container = containerDataMap.get(containerId);
|
||||||
colorChange.currentTarget.id.split("-")[0]
|
|
||||||
);
|
|
||||||
|
|
||||||
container.containerSettings.backgroundRgba = hexToRgba(
|
container.containerSettings.backgroundRgba = hexToRgba(
|
||||||
document.getElementById(container.id + "-settings-bg-color").value,
|
document.getElementById(container.id + "-settings-bg-color").value,
|
||||||
document.getElementById(container.id + "-settings-bg-alpha").value
|
document.getElementById(container.id + "-settings-bg-alpha").value
|
||||||
);
|
);
|
||||||
|
|
||||||
/* container.containerSettings.backgroundRgba = hexToRgba(
|
document.getElementById(containerId).style.backgroundColor =
|
||||||
document.getElementById("containerColorPicker").value,
|
|
||||||
document.getElementById("containerAlpha").value
|
|
||||||
);
|
|
||||||
document.getElementById("mainContainer").style.backgroundColor =
|
|
||||||
containerSettings.backgroundRgba;
|
|
||||||
*/
|
|
||||||
container.style.backgroundColor =
|
|
||||||
container.containerSettings.backgroundRgba;
|
container.containerSettings.backgroundRgba;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user