MCPcopy Create free account
hub / github.com/Forward-Future/loopy / showCopyFallback

Function showCopyFallback

loop-library/site/script.js:514–544  ·  view source on GitHub ↗
(button, text)

Source from the content-addressed store, hash-verified

512 textArea.remove();
513
514 if (!copied) {
515 throw new Error("Copy is unavailable.");
516 }
517}
518
519function showCopyFallback(button, text) {
520 const shareActions = button.closest(".share-actions");
521
522 if (!shareActions) {
523 showToast("Copy failed. Copying is unavailable in this browser.");
524 return;
525 }
526
527 let fallback = shareActions.querySelector(".copy-fallback");
528
529 if (!fallback) {
530 fallback = document.createElement("label");
531 fallback.className = "copy-fallback";
532
533 const label = document.createElement("span");
534 label.textContent = "Copy this post manually";
535
536 const textArea = document.createElement("textarea");
537 textArea.setAttribute("readonly", "");
538 textArea.rows = 4;
539
540 fallback.append(label, textArea);
541 shareActions.append(fallback);
542 }
543
544 const textArea = fallback.querySelector("textarea");
545 textArea.value = text;
546 textArea.focus();
547 textArea.select();

Callers 1

script.jsFile · 0.85

Calls 1

showToastFunction · 0.85

Tested by

no test coverage detected