Better twitter sharing, added copy confirmation to copy link

This commit is contained in:
Nicholas Jitkoff 2018-07-08 08:50:16 -07:00
parent becc28d51c
commit 7af47b5101
3 changed files with 23 additions and 5 deletions

View file

@ -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';
}

View file

@ -2,7 +2,7 @@
<html>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; connect-src https://codepen.io; style-src 'unsafe-inline' 'self'">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; connect-src https://codepen.io; style-src 'unsafe-inline' 'self'">
<title>itty.bitty</title>
<script src="lzma/lzma_worker-min.js"></script>
<script src="jquery-3.3.1.min.js"></script>
@ -19,6 +19,7 @@ itty bitty things<br>
can be conveyed in a link.<br>
type here &ndash; and then share!<p><a id="ib-info" href="http://about.bitty.site" target="_blank">about itty bitty</a><br>
</div>
<div id="copy-message">Link copied to clipboard.</div>
<div id="content"></div>
<span id="toolbar">
<a target="_blank" id="length"></a>&nbsp;<a target="_blank" id="qrcode" href="https://zxing.appspot.com/generator/">qr code</a>&nbsp;<a target="_blank" id="menu">menu</a>

View file

@ -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() {