Skip to content

Commit

Permalink
Fixed wiki links in configurable inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonymousRandomPerson committed Jul 19, 2024
1 parent d527a2f commit 412a2ca
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
14 changes: 12 additions & 2 deletions web/_js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 19 additions & 12 deletions web/_js/main/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta name="author" content="Place Atlas Initiative and contributors (original by Roland Rytz)">
<meta name="application-name" content="The 2023 r/place Atlas">
<meta name="robots" content="index, follow">

<meta property="og:title" content="The 2023 r/place Atlas">
<meta property="og:type" content="website">
<meta property="og:url" content="https://2023.place-atlas.stefanocoding.me/">
Expand All @@ -33,17 +33,17 @@
<meta name="twitter:image:alt" content="The 2023 r/place Atlas logo">

<!-- <meta name="google-site-verification" content="gZGHpBSMzffAbIn0qB8b00We6EwSGkDTfDoQVv-NWss"/> -->

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, shrink-to-fit=no, viewport-fit=cover"> <!-- user-scalable=no -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#222">

<link rel="apple-touch-icon" href="_img/apple-touch-icon.png" sizes="180x180">
<link rel="icon alternate" href="_img/favicon.png" type="image/png" class="js-site-favicon">
<link rel="icon" href="_img/favicon.svg" type="image/svg+xml" class="js-site-favicon">

<link rel="stylesheet" href="./_css/style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-dark.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
Expand Down Expand Up @@ -117,7 +117,7 @@
<div class="d-flex w-100 py-2 align-items-center">
<i class="bi bi-info-circle-fill fs-5"></i>
<p class="mb-0 flex-grow-1 px-2">The Atlas has been updated. Few quality of life updates, and The Final Clean canvas is now <a class="alert-link" href="#/T">viewable</a>.</p>
<a class="fs-5" data-bs-toggle="collapse" href="#headerNotice" role="button" aria-expanded="false" aria-controls="headerNotice"><i class="bi bi-x-lg"></i></a>
<a class="fs-5" data-bs-toggle="collapse" href="#headerNotice" role="button" aria-expanded="false" aria-controls="headerNotice"><i class="bi bi-x-lg"></i></a>
</div>
</aside>
<nav id="main-navbar" class="navbar navbar-expand-lg bg-body border-bottom">
Expand Down Expand Up @@ -341,13 +341,13 @@ <h6>Need Help?</h6>
<div id="subredditGroup" class="mb-3 d-flex flex-column gap-2"></div>
<label id="discordLabel" class="form-label">Discord</label>
<div id="discordGroup" class="mb-3 d-flex flex-column gap-2"></div>
<!-- <label id="wikiLabel" class="form-label">
<label id="wikiLabel" class="form-label" style="display:none">
<a class="text-decoration-none" href="https://place-wiki.stefanocoding.me/" target="_blank">
<span class="text-body">r/place Wiki</span>
<i class="bi bi-box-arrow-up-right" aria-hidden="true"></i>
</a>
</label>
<div id="wikiGroup" class="mb-3 d-flex flex-column gap-2"></div> -->
<div id="wikiGroup" class="mb-3 d-flex flex-column gap-2" style="display:none"></div>
<div id="infoButtons" class="d-flex flex-wrap flex-row-reverse gap-2">
<input type="submit" class="btn btn-primary flex-fill" id="exportButton" value="Export">
<input type="submit" class="btn btn-secondary flex-fill" id="previewButton" value="Preview">
Expand Down

0 comments on commit 412a2ca

Please sign in to comment.