+
This URL is very large and may not work in all browsers or sharing platforms. Consider exporting as a .md file instead.
diff --git a/script.js b/script.js
index 81eecd2..48f3e83 100644
--- a/script.js
+++ b/script.js
@@ -1553,13 +1553,15 @@ This is a fully client-side application. Your content never leaves your browser
}
const shareModal = document.getElementById("share-modal");
+ const shareModalWarning = document.getElementById("share-modal-warning");
const shareModalCopy = document.getElementById("share-modal-copy");
const shareModalClose = document.getElementById("share-modal-close");
const shareModalCloseBtn = document.getElementById("share-modal-close-btn");
- let pendingShareUrl = '';
+ let currentShareUrl = '';
- function openShareModal(shareUrl) {
- pendingShareUrl = shareUrl;
+ function openShareModal(shareUrl, tooLarge) {
+ currentShareUrl = shareUrl;
+ shareModalWarning.style.display = tooLarge ? "" : "none";
shareModal.classList.add("active");
document.addEventListener("keydown", handleShareModalKeydown);
}
@@ -1582,15 +1584,24 @@ This is a fully client-side application. Your content never leaves your browser
shareModalCopy.addEventListener("click", function () {
const originalText = shareModalCopy.innerHTML;
if (navigator.clipboard && window.isSecureContext) {
- navigator.clipboard.writeText(pendingShareUrl).then(() => {
+ navigator.clipboard.writeText(currentShareUrl).then(() => {
shareModalCopy.innerHTML = '
Copied!';
setTimeout(() => { shareModalCopy.innerHTML = originalText; }, 2000);
}).catch(() => {
- shareModalCopy.innerHTML = '
Copy failed';
- setTimeout(() => { shareModalCopy.innerHTML = originalText; }, 2000);
+ // clipboard.writeText failed; nothing further to do in secure context
});
} else {
- shareModalCopy.innerHTML = '
Copy failed';
+ try {
+ const tempInput = document.createElement("textarea");
+ tempInput.value = currentShareUrl;
+ document.body.appendChild(tempInput);
+ tempInput.select();
+ document.execCommand("copy");
+ document.body.removeChild(tempInput);
+ shareModalCopy.innerHTML = '
Copied!';
+ } catch (_) {
+ shareModalCopy.innerHTML = '
Copy failed';
+ }
setTimeout(() => { shareModalCopy.innerHTML = originalText; }, 2000);
}
});
@@ -1609,26 +1620,11 @@ This is a fully client-side application. Your content never leaves your browser
const shareUrl = window.location.origin + window.location.pathname + '#share=' + encoded;
const tooLarge = shareUrl.length > MAX_SHARE_URL_LENGTH;
- if (tooLarge) {
- openShareModal(shareUrl);
- return;
+ if (!tooLarge) {
+ window.location.hash = 'share=' + encoded;
}
- window.location.hash = 'share=' + encoded;
-
- const originalText = shareButton.innerHTML;
- if (navigator.clipboard && window.isSecureContext) {
- navigator.clipboard.writeText(shareUrl).then(() => {
- shareButton.innerHTML = '
Copied!';
- setTimeout(() => { shareButton.innerHTML = originalText; }, 2000);
- }).catch(() => {
- shareButton.innerHTML = '
Linked!';
- setTimeout(() => { shareButton.innerHTML = originalText; }, 2000);
- });
- } else {
- shareButton.innerHTML = '
Linked!';
- setTimeout(() => { shareButton.innerHTML = originalText; }, 2000);
- }
+ openShareModal(shareUrl, tooLarge);
});
function loadFromShareHash() {
From e5fb3aeec59eca9cab897ea34dbd4c2eb555bc03 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 4 Mar 2026 13:33:40 +0000
Subject: [PATCH 6/6] Remove Share via URL modal; copy URL directly on share
button click
Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
---
index.html | 24 ---------------
script.js | 85 ++++++++++++++++++------------------------------------
styles.css | 80 --------------------------------------------------
3 files changed, 28 insertions(+), 161 deletions(-)
diff --git a/index.html b/index.html
index f82a8d5..f2d98ee 100644
--- a/index.html
+++ b/index.html
@@ -232,30 +232,6 @@
Menu