diff --git a/startpage.html b/startpage.html index 654386f..ee33c23 100644 --- a/startpage.html +++ b/startpage.html @@ -210,7 +210,7 @@
+ ` ); - this.loadBookmarkListings(); } + createImageContainerMenuListing() { + document.getElementById("containers").insertAdjacentHTML( + "beforeend", + ` +(you have no layers right now)
` + ); + } + /* set at the last saved location */ settingsContainer.style.top = settingsMenuData.y; settingsContainer.style.left = settingsMenuData.x; @@ -1488,7 +1546,6 @@ settingsContainer.style.height = settingsMenuData.height + "px"; /* add event listeners */ - // moving / resizing settingsContainer.addEventListener( "mousedown", @@ -1725,33 +1782,54 @@ * DOCUMENT MANAGEMENT / MODIFICATION STUFF * ********************************************/ - function createNewContainer() { + function createNewTextContainer() { let containerName = document.getElementById( - "newContainerNameInput" + "newTextContainerNameInput" ).value; - document.getElementById("newContainerNameInput").value = ""; + document.getElementById("newTextContainerNameInput").value = ""; - // generate generic unnamed name - if (containerName == "") { - containerName = - "container-" + (containerDataMap.keys().length + 1).toString(); - } - - containerDataMap.set( + let container = new Container( + undefined, containerName, - new Container( - containerName, - undefined, - undefined, - undefined, - undefined, - undefined, - undefined, - undefined - ) + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined ); } + function createNewImageContainer() { + let containerName = document.getElementById( + "newImageContainerNameInput" + ).value; + let imageUrl = document.getElementById( + "newImageContainerUrlInput" + ).value; + document.getElementById("newImageContainerNameInput").value = ""; + document.getElementById("newImageContainerUrlInput").value = ""; + + let container = new Container( + undefined, + containerName, + undefined, + undefined, + undefined, + undefined, + imageUrl, + undefined, + undefined + ); + } + + function deleteContainer(buttonPressed) { + let containerId = buttonPressed.id.split("--")[0]; + containerDataMap.delete(containerId); + // remove element from DOM + } + /** upon click release on movable elements, store position data for when saving to localStorage when disabling edit mode */ function storeElementData() { let borderWidth = changingElement.style.borderWidth.slice(0, -2) * 2; // slice to remove "px" @@ -1943,7 +2021,7 @@ **********************/ function addLink(containerElement) { - let containerId = containerElement.id.split("-")[0]; + let containerId = containerElement.id.split("-add-link-")[0]; let container = containerDataMap.get(containerId); // collect data from inputs @@ -2014,7 +2092,7 @@ function reorderSection(buttonPressed, direction) { let temp = buttonPressed.parentElement.parentElement.id.split("--"); - let container = containerDataMap.get(temp[0].split("-")[0]); + let container = containerDataMap.get(temp[0].split("-section-listing")[0]); const sectionIndex = parseInt(temp[temp.length - 1]); let copy = container.sections[sectionIndex]; @@ -2032,7 +2110,7 @@ function deleteSection(buttonPressed) { let temp = buttonPressed.parentElement.parentElement.id.split("--"); - let container = containerDataMap.get(temp[0].split("-")[0]); + let container = containerDataMap.get(temp[0].split("-section-listing")[0]); const sectionIndex = parseInt(temp[temp.length - 1]); // delete section @@ -2050,7 +2128,7 @@ function deleteLink(buttonPressed) { let temp = buttonPressed.parentElement.parentElement.id.split("--"); - let container = containerDataMap.get(temp[0].split("-")[0]); + let container = containerDataMap.get(temp[0].split("-section-listing")[0]); const sectionIndex = parseInt(temp[temp.length - 2]); const linkIndex = parseInt(temp[temp.length - 1]); @@ -2064,7 +2142,7 @@ function reorderLink(buttonPressed, direction) { let temp = buttonPressed.parentElement.parentElement.id.split("--"); - let container = containerDataMap.get(temp[0].split("-")[0]); + let container = containerDataMap.get(temp[0].split("-section-listing")[0]); const sectionIndex = parseInt(temp[temp.length - 2]); const linkIndex = parseInt(temp[temp.length - 1]); let links = container.sections[sectionIndex].links; @@ -2187,7 +2265,7 @@ ************************************/ function changeContainerBackground(colorChange) { - let containerId = colorChange.currentTarget.id.split("-")[0]; + let containerId = colorChange.currentTarget.id.split("-settings")[0]; let container = containerDataMap.get(containerId); console.log(container); @@ -2202,7 +2280,7 @@ } function changeLinkColor(colorChange) { - let containerId = colorChange.currentTarget.id.split("-")[0]; + let containerId = colorChange.currentTarget.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.linkColor = colorChange.target.value; @@ -2213,7 +2291,7 @@ } } function changeLinkSize(sizeChange) { - let containerId = sizeChange.currentTarget.id.split("-")[0]; + let containerId = sizeChange.currentTarget.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.linkSize = @@ -2226,7 +2304,7 @@ } function changeSectionColor(colorChange) { - let containerId = colorChange.currentTarget.id.split("-")[0]; + let containerId = colorChange.currentTarget.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.sectionColor = colorChange.target.value; @@ -2236,7 +2314,7 @@ } } function changeSectionSize(sizeChange) { - let containerId = sizeChange.currentTarget.id.split("-")[0]; + let containerId = sizeChange.currentTarget.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.sectionSize = @@ -2248,7 +2326,7 @@ } } function toggleSectionBold(checkboxChanged) { - let containerId = checkboxChanged.target.id.split("-")[0]; + let containerId = checkboxChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); let sectionElements = document.getElementsByClassName(containerId + "-section"); @@ -2258,7 +2336,7 @@ container.containerSettings.sectionBold = checkboxChanged.target.checked; } function toggleSectionItalic(checkboxChanged) { - let containerId = checkboxChanged.target.id.split("-")[0]; + let containerId = checkboxChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); let sectionElements = document.getElementsByClassName(containerId + "-section"); @@ -2270,7 +2348,7 @@ // BORDER function changeContainerBorderWidth(borderChange) { - let containerId = borderChange.target.id.split("-")[0]; + let containerId = borderChange.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.borderWidth = borderChange.target.value; @@ -2278,7 +2356,7 @@ container.containerSettings.borderWidth + "px"; } function changeContainerBorderRadius(radiusChange) { - let containerId = radiusChange.target.id.split("-")[0]; + let containerId = radiusChange.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.borderRadius = radiusChange.target.value; @@ -2286,7 +2364,7 @@ container.containerSettings.borderRadius + "px"; } function changeContainerBorderColor(colorChange) { - let containerId = colorChange.target.id.split("-")[0]; + let containerId = colorChange.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.borderColor = colorChange.target.value; @@ -2295,7 +2373,7 @@ } // CLOCK function toggleDate(checkboxChanged) { - let containerId = checkboxChanged.target.id.split("-")[0]; + let containerId = checkboxChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.enableDate = checkboxChanged.target.checked; @@ -2303,7 +2381,7 @@ checkboxChanged.target.checked ? "inline" : "none"; } function toggleClock(checkboxChanged) { - let containerId = checkboxChanged.target.id.split("-")[0]; + let containerId = checkboxChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.enableClock = checkboxChanged.target.checked; @@ -2311,7 +2389,7 @@ checkboxChanged.target.checked ? "inline" : "none"; } function changeHeaderColor(colorChange) { - let containerId = colorChange.target.id.split("-")[0]; + let containerId = colorChange.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.headerColor = colorChange.target.value; @@ -2319,7 +2397,7 @@ container.containerSettings.headerColor; } function changeHeaderSize(sizeChange) { - let containerId = sizeChange.target.id.split("-")[0]; + let containerId = sizeChange.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.headerSize = @@ -2328,7 +2406,7 @@ container.containerSettings.headerSize + "px"; } function toggleHeaderBold(checkboxChanged) { - let containerId = checkboxChanged.target.id.split("-")[0]; + let containerId = checkboxChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.headerBold = checkboxChanged.target.checked; @@ -2336,7 +2414,7 @@ checkboxChanged.target.checked ? "bold" : "normal"; } function toggleHeaderItalic(checkboxChanged) { - let containerId = checkboxChanged.target.id.split("-")[0]; + let containerId = checkboxChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.headerItalic = checkboxChanged.target.checked; @@ -2346,7 +2424,7 @@ // DIVIDER function changeDividerColor(colorChange) { - let containerId = colorChange.target.id.split("-")[0]; + let containerId = colorChange.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.dividerColor = colorChange.target.value; @@ -2357,7 +2435,7 @@ divider.style.borderColor = container.containerSettings.dividerColor; } function toggleDivider(checkboxChanged) { - let containerId = checkboxChanged.target.id.split("-")[0]; + let containerId = checkboxChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.enableDivider = checkboxChanged.target.checked; @@ -2372,7 +2450,7 @@ } // TEXT function changeContainerAlignment(alignmentChanged) { - let containerId = alignmentChanged.target.id.split("-")[0]; + let containerId = alignmentChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); if (document.getElementById(containerId + "-settings-left-align").checked) { @@ -2384,7 +2462,7 @@ } } function changeFont(buttonClicked) { - let containerId = buttonClicked.target.id.split("-")[0]; + let containerId = buttonClicked.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); let input = document.getElementById(containerId + "-settings-font-input").value; @@ -2409,7 +2487,7 @@ // SHADOW function changeContainerShadow(valueChanged) { - let containerId = valueChanged.target.id.split("-")[0]; + let containerId = valueChanged.target.id.split("-settings")[0]; let container = containerDataMap.get(containerId); container.containerSettings.shadowX =