diff --git a/web/_js/config.js b/web/_js/config.js index 46be8493ad038fbb44ca41ca7d2860411f854ea5..ce2f410307522b3265dd311743683146074169fd 100644 --- a/web/_js/config.js +++ b/web/_js/config.js @@ -2,19 +2,17 @@ // Please also check code indicated with "@instanceonly" outside this file. // TODO: Avoid having instance-only code inside the main scripts to make updating easier. -//TODO:canvas adaptation const prodDomain = "canvas.mariusdavid.fr" window.prodDomain = prodDomain const instanceId = "canvas2024" window.instanceId = instanceId -//TODO:canvas adaptation -const instanceSubreddit = "none" +const instanceSubreddit = null window.instanceSubreddit = instanceSubreddit //TODO:canvas adaptation -const instanceRepo = "todo" +const instanceRepo = "https://github.com/marius851000/lemmy-canvas-2024-atlas" window.instanceRepo = instanceRepo const pageTitle = "The 2024 Fediverse canvas Atlas" diff --git a/web/_js/main/draw.js b/web/_js/main/draw.js index 9f72de722d1aa098726d5f547482b3ce011d7076..60c540121243882eb8ef2c3b7823cdd6a27bdec3 100644 --- a/web/_js/main/draw.js +++ b/web/_js/main/draw.js @@ -92,6 +92,7 @@ function slugify(text) { .normalize('NFKD') .toLowerCase() .trim() + .replace(' ', '_') .replace(/\s+/g, '-') .replace(/[^\w\-]+/g, '') .replace(/\-+/g, '-'); @@ -342,37 +343,41 @@ function initDraw() { // Reddit - let redditPostJsonString = " " + prettyJsonString.split("\n").join("\n ") - let redditPostUrl = `https://www.reddit.com/r/${instanceSubreddit}/submit?selftext=true&title=` - if (exportObject.id === -1) redditPostUrl += `✨%20${encodeURIComponent(exportObject.name ?? entry.name)}` - else redditPostUrl += `✏%20${encodeURIComponent(exportObject.name ?? entry.name)}` - redditPostUrl += "&text=" + if (instanceSubreddit != null) { + let redditPostJsonString = " " + prettyJsonString.split("\n").join("\n ") + let redditPostUrl = `https://www.reddit.com/r/${instanceSubreddit}/submit?selftext=true&title=` + if (exportObject.id === -1) redditPostUrl += `✨%20${encodeURIComponent(exportObject.name ?? entry.name)}` + else redditPostUrl += `✏%20${encodeURIComponent(exportObject.name ?? entry.name)}` + redditPostUrl += "&text=" - if (encodeURIComponent(redditPostJsonString).length > 7579 - redditPostUrl.length) { - redditPostJsonString = " " + miniJsonString - } + if (encodeURIComponent(redditPostJsonString).length > 7579 - redditPostUrl.length) { + redditPostJsonString = " " + miniJsonString + } + + redditPostUrl += encodeURIComponent(redditPostJsonString) + if (encodeURIComponent(redditPostUrl).length > 7579) { + // redditPostButton.classList.add("disabled") + // redditPostButton.ariaDisabled = true + redditPostButton.dataset.bsToggle = "tooltip" + redditPostButton.dataset.bsTitle = "This may not work due to the length of the entry. If needed, please copy manually." + if (!redditPostTooltip) redditPostTooltip = new bootstrap.Tooltip(redditPostButton) + } else { + // redditPostButton.classList.remove("disabled") + // redditPostButton.ariaDisabled = false + redditPostButton.dataset.bsTitle = "" + } + redditPostButton.href = redditPostUrl - redditPostUrl += encodeURIComponent(redditPostJsonString) - if (encodeURIComponent(redditPostUrl).length > 7579) { - // redditPostButton.classList.add("disabled") - // redditPostButton.ariaDisabled = true - redditPostButton.dataset.bsToggle = "tooltip" - redditPostButton.dataset.bsTitle = "This may not work due to the length of the entry. If needed, please copy manually." - if (!redditPostTooltip) redditPostTooltip = new bootstrap.Tooltip(redditPostButton) + if (exportObject.id === -1) document.getElementById("redditFlair").textContent = "New Entry" + else document.getElementById("redditFlair").textContent = "Edit Entry" } else { - // redditPostButton.classList.remove("disabled") - // redditPostButton.ariaDisabled = false - redditPostButton.dataset.bsTitle = "" + redditPostButton.classList.add("collapse") } - redditPostButton.href = redditPostUrl - - if (exportObject.id === -1) document.getElementById("redditFlair").textContent = "New Entry" - else document.getElementById("redditFlair").textContent = "Edit Entry" // GitHub let githubPostJsonString = prettyJsonString - let githubPostUrl = `${instanceRepo}/new/cleanup/data/patches?filename=gh-${[...Array(4)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}-${slugify(exportObject.name ?? entry.name)}.json&value=` + let githubPostUrl = `${instanceRepo}/new/main/entries?filename=${slugify(exportObject.name ?? entry.name)}.json&value=` if (encodeURIComponent(githubPostJsonString).length > 8192 - githubPostUrl.length) { githubPostJsonString = miniJsonString diff --git a/web/index.html b/web/index.html index cb8a5ffd998b02069b08fb4861c57c8adf3464db..4e08113cf5e5cd59c7f5e870ad7f14486a458b5a 100644 --- a/web/index.html +++ b/web/index.html @@ -372,10 +372,10 @@
- If you want to use Reddit, use the Post Direct to Reddit button or manually copy the text below and submit it as a new text post to r/placeAtlas2023 on Reddit. - Don't forget to flair it with the New Entry flair.
+ If you want to use Lemmy, post the text below as-is on the !2024lemmycanvasatlas@toast.ooo Lemmy community, either via the linked instance, your own, or another Activity-Pub compatible clien. +- If you want to use GitHub, use the Submit Direct to GitHub button, or read the contributing guide to submit a patch. + If you want to use GitHub, use the Submit Direct to GitHub button and check the contributing guide to submit a patch.
We will then check it and add it to the Atlas.