diff options
| author | Simon <vesspa0330@gmail.com> | 2025-08-06 23:17:40 -0400 |
|---|---|---|
| committer | Simon <vesspa0330@gmail.com> | 2025-08-06 23:17:40 -0400 |
| commit | bf660799fe6da9e6c72d053cf4a7b560023ae965 (patch) | |
| tree | eef4f23b0209e538ceb2538cb4e719a1e0f45683 | |
| parent | bf597be39e665c2e9ee340d34ada7f9b2309b356 (diff) | |
working on hyperlinked images
| -rw-r--r-- | startpage.html | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/startpage.html b/startpage.html index 5963fc1..3cffafc 100644 --- a/startpage.html +++ b/startpage.html @@ -443,6 +443,12 @@ style="width: 100%;" type="text" /> + <input + id="newImageContainerHyperlinkInput" + placeholder="(optional) URL to hyperlink image" + style="width: 100%;" + type="text" + /> <button id="newImageContainerCreateButton" onclick="createNewImageContainer(this)"> place image </button> @@ -551,6 +557,7 @@ </div> </div> todo: + <br />add check for youtube container in border functions <br />rename stuff | better function names | imageUrl -> mediaUrl | etc. </body> @@ -642,6 +649,7 @@ sections; clockIntervalId; youtubeId; + imageHyperlink; constructor( id, @@ -653,7 +661,8 @@ imageUrl, settings, sections, - youtubeId + youtubeId, + imageHyperlink ) { /* check if id is already used if (containerDataMap.has(name.replace(" ", "-").toLowerCase())) { @@ -683,6 +692,7 @@ this.settings = settings; this.imageUrl = imageUrl; this.youtubeId = youtubeId; + this.imageHyperlink = imageHyperlink; } else { @@ -713,6 +723,7 @@ this.id = findLowestAvailableId(); this.imageUrl = imageUrl; + this.imageHyperlink = imageHyperlink.length == 0 ? undefined : imageHyperlink ; // deep copy default settings this.settings = JSON.parse(JSON.stringify(defaultImageContainerSettings)); @@ -775,6 +786,9 @@ document.body.insertAdjacentHTML( "beforeend", ` + ${this.imageHyperlink ? + `<a class="imageHyperlink hidden" href="` + this.imageHyperlink + `">` + : ``} <img class="movable youtubeEmbed" id="${this.id}" @@ -782,6 +796,7 @@ src="${this.imageUrl}" draggable=false /> + ${this.imageHyperlink ? `</a>` : ``} ` ); } @@ -2179,6 +2194,12 @@ movableElements[i].style.cursor = cursors.grab ? 'url("' + cursors.grab + '"), grab' : "grab"; } + // disable any hyperlinks on images to enable movement + let hyperlinkedImages = document.getElementsByClassName("imageHyperlink"); + + // TODO todo : finish this / re-enable hyperlinks + + // cover any youtube iframes to enable moving/resizing let embeddedVideos = document.getElementsByClassName("youtubeEmbedCover"); for (let i = 0; i < embeddedVideos.length; i++) { @@ -2275,8 +2296,12 @@ let imageUrl = document.getElementById( "newImageContainerUrlInput" ).value; + let imageHyperlink = document.getElementById( + "newImageContainerHyperlinkInput" + ).value; document.getElementById("newImageContainerNameInput").value = ""; document.getElementById("newImageContainerUrlInput").value = ""; + document.getElementById("newImageContainerHyperlinkInput").value = ""; let container = new Container( undefined, @@ -2289,6 +2314,7 @@ undefined, undefined, undefined, + imageHyperlink ); container.createImageContainerMenuListing(); |
