diff --git a/startpage.html b/startpage.html index e49d3bb..da525be 100644 --- a/startpage.html +++ b/startpage.html @@ -115,7 +115,7 @@ .expandableMenuToggle { cursor: pointer; - padding: 18px; + padding: 0px 18px; width: 100%; } .expandableMenuToggle.active, .expandableMenuToggle:hover { @@ -135,6 +135,10 @@ font-style: italic; } + hr { + width: 75%; + } + #editToggle { z-index: 999; position: fixed; @@ -144,19 +148,6 @@ cursor: pointer; } - .hiddenButton { - display: inline; - visibility: visible; - font-style: italic; - } - .hiddenButton.hidden { - visibility: hidden; - display: none; - } - .hiddenButton:hover { - cursor: pointer; - } - #imageRemovalWarning { color: red; size: 3rem; @@ -407,7 +398,7 @@ headerBold: false, headerItalic: false, - disableDivider: false, + enableDivider: true, dividerColor: "", centerAlign: false, shadowX: "0", @@ -439,7 +430,7 @@ clockSize: "16", clockBold: false, clockItalic: false, - disableDivider: false, + enableDivider: false, dividerColor: "", centerAlign: false, shadowX: "0", @@ -498,7 +489,7 @@ * ensure there are no brackets in the name */ this.name = name; - this.id = name.replace(" ", "-"); + this.id = name.replace(" ", "-").toLowerCase(); // if initializing saved container content, if (x !== undefined && y !== undefined) { @@ -523,13 +514,11 @@ this.initializeNewImageContainer(); } - // apply bookmarks this.loadBookmarks(); - // then create container options UI in settings menu - this.insertContainerSettingsListing(); - this.applyContainerSettings(); - // establish necessary event listeners + this.createSettingsMenuListing(); + this.applySettings(); + this.addContainerEventListeners() this.addSettingsMenuEventListeners(); @@ -541,7 +530,7 @@ /** * creates a basic container shell and lets - * loadBookmarks() and applyContainerSettings() do the rest + * loadBookmarks() and applySettings() do the rest */ loadSavedContainer() { document.body.insertAdjacentHTML( @@ -693,107 +682,197 @@ * rename settings form div ids (see "note to self") */ + loadBookmarkListings() { + if (Object.keys(this.sections).length == 0) { + return; + } - insertContainerSettingsListing() { + let sectionData = Object.values(this.sections); + let containerSettings = this.containerSettings; + + let bookmarkListings = document.getElementById(this.id + "-bookmark-listings"); + + console.log(sectionData); + + // [re]render the section listings + bookmarkListings.innerHTML = ""; + for (let i = 0; i < sectionData.length; i++) { + console.log(i); + bookmarkListings.insertAdjacentHTML( + "beforeend", + ` + ${i == 0 ? "" : `
`} +
+ + [X] + + + + ${sectionData[i].label} + + + ${i > 1 ? ` + + [up] + + ` : ``} + ${i > 0 ? ` + + [down] + + ` : ``} +
+ ` + ); + } + + // [re]render the link listings + for (let s = 0; s < sectionData.length; s++) { + for (let l = 0; l < sectionData[s].links.length; l++) { + console.log('s: ' + s); + let targetSection = document.getElementById( + this.id + "-section-listing-" + s + ); + + targetSection.insertAdjacentHTML( + "beforeend", + ` + + ` + ); + } + } + } + + createSettingsMenuListing() { document.getElementById("containers").insertAdjacentHTML( "beforeend", `
-

- ${this.name}

+

- ${this.name}

-

+ ${this.id}: bookmarks +

+ ${this.name}: bookmarks

- - - - - - - - -

- - -
- - -

+ ${this.id}: customize bookmarks

-
- - - - - - - - - - - - - - - - - - - -
- - -

+ ${this.id}: customize layer

-
- -

+ ${this.id}: header settings

-
- - -
- - - -

- - - -

- - - -
- - - - - - +

+ manage bookmarks / sections

+
+ ${Object.keys(this.sections).length == 0 ? `

(no bookmarks)

` : ``}
-

+ ${this.id}: text settings

-
- - - - - - +

+ add new bookmarks / sections

+
+ + + + + + + + +

- -
- - - - + +
-

+ ${this.id}: color + shape settings

+
+ + +

+ ${this.name}: customize

+
+ +

+ ${this.name}: header options

+
+ + + +
+ + + + +

+ + + + +
+ + + +
+ +

+ ${this.name}: text options

+
+ + + +

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +
+ + + + +
+ +

+ ${this.name}: color + shape options

- + @@ -810,13 +889,6 @@ - - - - - - - shadow settings:

@@ -835,13 +907,14 @@
` ); + this.loadBookmarkListings(); } /* * applies saved cosmetic customizations to container */ - applyContainerSettings() { + applySettings() { /** set options relevant to both image and text containers */ /** POSITION */ document.getElementById(this.id).style.top = this.y; @@ -1016,7 +1089,7 @@ /** DIVIDER */ let divider = document.getElementById(this.id + "-divider"); - if (containerSettings.disableDivider) { + if (!containerSettings.enableDivider) { document.getElementById(this.id + "-divider").hidden = true; // if there are links in this container, add room under the divider if (Object.keys(this.sections).length > 0) { @@ -1030,7 +1103,7 @@ } // fill-in settings ui document.getElementById(this.id + "-settings-divider-toggle").checked = - containerSettings.disableDivider; + containerSettings.enableDivider; document.getElementById(this.id + "-settings-divider-color").value = containerSettings.dividerColor; } @@ -1135,7 +1208,7 @@ // container divider setting listeners document .getElementById(this.id + "-settings-divider-toggle") - .addEventListener("change", disableDivider, false); + .addEventListener("change", toggleDivider, false); document .getElementById(this.id + "-settings-divider-color") .addEventListener("input", changeDividerColor, false); @@ -1158,48 +1231,45 @@ } /** - * [re]loads saved bookmark sections + links for container + * [re]renders saved bookmark sections + links for container */ loadBookmarks() { - let containerSettings = this.containerSettings; - let linkContainer = document.getElementById(this.id + "-sections"); - linkContainer.innerHTML = ""; - if (Object.keys(this.sections).length == 0) { return; } let sectionData = Object.values(this.sections); + let containerSettings = this.containerSettings; - // render the sections + let containerBookmarks = document.getElementById(this.id + "-sections"); + + containerBookmarks.innerHTML = ""; + + /* ensure uncategorized links (if any) stay at top + let noneSectionIndex; for (let i = 0; i < sectionData.length; i++) { - linkContainer.insertAdjacentHTML( + if(sectionData[i].label == "") { + noneSectionIndex = i; + break; + } + } + + if (noneSectionIndex != -1 && noneSectionIndex != 0) { + this.sections.splice(noneSectionIndex, 1); + this.sections.unshift("none"); + }*/ + + for (let i = 0; i < sectionData.length; i++) { + containerBookmarks.insertAdjacentHTML( "beforeend", ` ${i == 0 ? "" : `
`}
- - [X] - + ${sectionData[i].label} - - [up] - - - [down] -
` ); @@ -1216,12 +1286,6 @@ "beforeend", `