From 7af47b5101428215bc229308d84f76571555a861 Mon Sep 17 00:00:00 2001 From: Nicholas Jitkoff Date: Sun, 8 Jul 2018 08:50:16 -0700 Subject: [PATCH] Better twitter sharing, added copy confirmation to copy link --- edit.css | 17 +++++++++++++++++ edit.html | 3 ++- edit.js | 8 ++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/edit.css b/edit.css index 996ce5e..2995f94 100644 --- a/edit.css +++ b/edit.css @@ -164,6 +164,23 @@ body.edited #doc-title:empty:before, cursor:pointer; } + +#copy-message { + background:#2d2d2d; + color:white; + top:0.5em; + right:0.5em; + position:absolute; + padding:0.5em 1em; + z-index:100; + font-family:monospace; + font-weight:bold; +} + +body:not(.copied) #copy-message { + display:none; +} + #menus-share-hint { content:'hello'; } diff --git a/edit.html b/edit.html index fa12261..e9e5714 100644 --- a/edit.html +++ b/edit.html @@ -2,7 +2,7 @@ - + itty.bitty @@ -19,6 +19,7 @@ itty bitty things
can be conveyed in a link.
type here – and then share!

about itty bitty
+

Link copied to clipboard.
 qr code menu diff --git a/edit.js b/edit.js index a4c5012..d726c7d 100644 --- a/edit.js +++ b/edit.js @@ -26,7 +26,7 @@ window.onload = function() { content.focus(); document.execCommand('selectAll',false,null); QS('#qrcode').onclick = makeQRCode - QS('#twitter').onclick = copyThenLink + QS('#twitter').onclick = tweetLink QS('#copy').onclick = copyLink QS('#menu').onclick = toggleMenu var hash = window.location.hash.substring(1) @@ -240,10 +240,10 @@ function copyLink() { document.execCommand("copy"); document.body.removeChild(dummy); - document.body.addClass("copied") + document.body.classList.add("copied") setTimeout(function() { - document.body.removeClass("copied") - }, 300); + document.body.classList.remove("copied") + }, 2000); } function saveLink() {