From 412a2ca0c5351a29ba47eb039d1354f774d11aae Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Thu, 18 Jul 2024 21:32:58 -0400 Subject: [PATCH] Fixed wiki links in configurable inputs --- web/_js/config.js | 14 ++++++++++++-- web/_js/main/draw.js | 31 +++++++++++++++++++------------ web/index.html | 14 +++++++------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/web/_js/config.js b/web/_js/config.js index 791f1eae..ad326e47 100644 --- a/web/_js/config.js +++ b/web/_js/config.js @@ -414,8 +414,18 @@ const externalLinksConfig = [ } return ""; } - - } + }, + { + name: "Wiki", + id: "wiki", + generateLink: (link) => "https://place-wiki.stefanocoding.me/wiki/" + link, + listingClass: "bi-wiki", + generateListingName: () => "r/place Wiki Article", + displayHTML: "{urlid}", + placeholder: "r/place Wiki Article", + configureInputField: () => {}, + hideInput: true + }, ]; console.info(`%cThe 2023 r/place Atlas diff --git a/web/_js/main/draw.js b/web/_js/main/draw.js index bd4fb1d4..79920485 100644 --- a/web/_js/main/draw.js +++ b/web/_js/main/draw.js @@ -632,6 +632,11 @@ function initDraw() { inputButton.type = "button" inputGroup.appendChild(inputButton) + if (linkConfig.hideInput) { + inputField.setAttribute("style", "display:none") + inputButton.setAttribute("style", "display:none") + } + refreshLinkGroupButtons(linkTypeId) } @@ -673,18 +678,20 @@ function initDraw() { entry = getEntry(entryId) const linkContainer = document.getElementById("linkContainer"); - linkContainer.replaceChildren(); - for (const linkConfig of externalLinksConfig) { - linkLabel = document.createElement("label"); - linkLabel.id = linkConfig.id + "Label"; - linkLabel.className = "form-label"; - linkLabel.textContent = linkConfig.name; - linkContainer.appendChild(linkLabel); - - linkGroup = document.createElement("div"); - linkGroup.id = linkConfig.id + "Group"; - linkGroup.className = "mb-3 d-flex flex-column gap-2"; - linkContainer.appendChild(linkGroup); + if (linkContainer) { + linkContainer.replaceChildren(); + for (const linkConfig of externalLinksConfig) { + linkLabel = document.createElement("label"); + linkLabel.id = linkConfig.id + "Label"; + linkLabel.className = "form-label"; + linkLabel.textContent = linkConfig.name; + linkContainer.appendChild(linkLabel); + + linkGroup = document.createElement("div"); + linkGroup.id = linkConfig.id + "Group"; + linkGroup.className = "mb-3 d-flex flex-column gap-2"; + linkContainer.appendChild(linkGroup); + } } if (entry) { diff --git a/web/index.html b/web/index.html index a687fbc8..b21b9051 100644 --- a/web/index.html +++ b/web/index.html @@ -14,7 +14,7 @@ - + @@ -33,17 +33,17 @@ - + - + - + @@ -117,7 +117,7 @@

The Atlas has been updated. Few quality of life updates, and The Final Clean canvas is now viewable.

- +