From 46964b5c2b99c4c7c12381a9cb6ed52bc53989a4 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Tue, 18 Jul 2023 06:39:12 +0000 Subject: [PATCH] tweak how copying text works --- templates/index.tmpl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/templates/index.tmpl b/templates/index.tmpl index e846594..81bab72 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -102,7 +102,7 @@ -->

- +

ABOUT @@ -135,6 +135,18 @@ let toCopy = ""; document.querySelectorAll("#paper span").forEach(span => { let guts = span.innerHTML; + if (!span.classList.contains("black")) { + toCopy += guts.trim()+" "; + } + if (guts.includes("\n") && toCopy[toCopy.length-1] != "\n") { + toCopy += "\n" + } + + /* + // I think this method of converting to plaintext is interesting but + // it's not very practical--it's way too many characters to + // realistically put in a toot or alt text or similar. I may add a + // "copy wide text" button that re-introduces this behavior. let out = ""; if (span.classList.contains("black")) { for (let i = 0; i < guts.length; i++) { @@ -147,8 +159,8 @@ } else { out = guts; } - - toCopy += out; + toCopy += out + */ }); navigator.clipboard.writeText(toCopy).then(() => {