diff options
| author | Simon <vesspa0330@gmail.com> | 2025-07-12 16:42:49 -0400 |
|---|---|---|
| committer | Simon <vesspa0330@gmail.com> | 2025-07-12 16:42:49 -0400 |
| commit | ce241ab1844cd7c2b127f0e04188d3b2e6f67e55 (patch) | |
| tree | ce79ff550a86b95e8d0e689d98dc2b4ed8ad6c88 /startpage.html | |
| parent | baeb777d2d338bed6ed627e046e25d6d7a1bd0c0 (diff) | |
link reodering works! bookmark functionality complete(?). bells and
whistles to come
Diffstat (limited to 'startpage.html')
| -rw-r--r-- | startpage.html | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/startpage.html b/startpage.html index fe4c92e..654386f 100644 --- a/startpage.html +++ b/startpage.html @@ -765,8 +765,8 @@ } // [re]render the link listings - for (let s = 0; s < sectionData.length; s++) { - for (let l = 0; l < sectionData[s].links.length; l++) { + for (let s = sectionData.length - 1; s >= 0; s--) { + for (let l = sectionData[s].links.length - 1; l >= 0; l--) { let targetSection = document.getElementById( this.id + "-section-listing--" + s ); @@ -803,8 +803,6 @@ } createSettingsMenuListing() { - console.log(this.id); - console.log(Object.keys(this.sections).length == 0 ); document.getElementById("containers").insertAdjacentHTML( "beforeend", ` @@ -1320,8 +1318,6 @@ this.id + "-section-" + s ); - console.log(s, l); - targetSection.insertAdjacentHTML( "beforeend", ` @@ -2066,6 +2062,29 @@ container.loadBookmarkListings(); } + function reorderLink(buttonPressed, direction) { + let temp = buttonPressed.parentElement.parentElement.id.split("--"); + let container = containerDataMap.get(temp[0].split("-")[0]); + const sectionIndex = parseInt(temp[temp.length - 2]); + const linkIndex = parseInt(temp[temp.length - 1]); + let links = container.sections[sectionIndex].links; + + // cut out section and re-insert into array + let link = container.sections[sectionIndex].links[linkIndex]; + container.sections[sectionIndex].links.splice(linkIndex, 1); + if (direction == "up" && linkIndex != 0) { + console.log("up: " + linkIndex); + links.splice(linkIndex - 1, 0, link); + } else if (direction == "down" && linkIndex != links.length) { + console.log("down: " + linkIndex); + links.splice(linkIndex + 1, 0, link); + } + + // refresh screen + container.loadBookmarks(); + container.loadBookmarkListings(); + } + /****************** * IMAGE HANDLERS * ******************/ |
