Commit 324b077b authored by marius david's avatar marius david
Browse files

customise submission menu

parent cd959b2e
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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"
+28 −23
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ function slugify(text) {
		.normalize('NFKD')
		.toLowerCase()
		.trim()
		.replace(' ', '_')
		.replace(/\s+/g, '-')
		.replace(/[^\w\-]+/g, '')
		.replace(/\-+/g, '-');
@@ -342,6 +343,7 @@ function initDraw() {

		// Reddit

		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)}`
@@ -368,11 +370,14 @@ function initDraw() {

			if (exportObject.id === -1) document.getElementById("redditFlair").textContent = "New Entry"
			else document.getElementById("redditFlair").textContent = "Edit Entry"
		} else {
			redditPostButton.classList.add("collapse")
		}

		// 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
+3 −3
Original line number Diff line number Diff line
@@ -372,10 +372,10 @@ <h5 class="modal-title" id="exportModalLabel">Export Entry</h5>
				</div>
				<div class="modal-body d-flex flex-column">
					<p>
						If you want to use Reddit, use the <span class="badge bg-primary">Post Direct to Reddit</span> button or manually copy the text below and submit it as a new text post to <a href="https://www.reddit.com/r/placeAtlas2023/" target="_blank" rel="noreferrer">r/placeAtlas2023</a> on Reddit.
						Don't forget to flair it with the <span class="badge rounded-pill bg-primary"><i class="bi bi-tag" aria-hidden="true"></i> <span id="redditFlair">New Entry</span></span> flair.</p>
						If you want to use Lemmy, post the text below as-is on the <a href="https://toast.ooo/c/2024lemmycanvasatlas">!2024lemmycanvasatlas@toast.ooo</a> Lemmy community, either via the linked instance, your own, or another Activity-Pub compatible clien.
					</p>
					<p>
						If you want to use GitHub, use the <span class="badge bg-primary">Submit Direct to GitHub</span> button, or read <a href="https://github.com/placeAtlas/atlas-2023/blob/master/CONTRIBUTING.md#through-github" target="_blank">the contributing guide</a> to submit a patch.
						If you want to use GitHub, use the <span class="badge bg-primary">Submit Direct to GitHub</span> button and check <a href="https://github.com/marius851000/lemmy-canvas-2024-atlas/blob/master/CONTRIBUTING.md#through-github" target="_blank">the contributing guide</a> to submit a patch.
					</p>
					<p>We will then check it and add it to the Atlas.</p>
					<textarea class="form-control flex-grow-1" cols="40" rows="20" id="exportString" title="Raw JSON string" readonly></textarea>