clipboard
parent
7102ca7f4c
commit
343b843790
@ -1,15 +1,18 @@
|
||||
import os
|
||||
|
||||
|
||||
class Config(object):
|
||||
DEBUG = False
|
||||
TESTING = False
|
||||
URL_PREFIX = ''
|
||||
|
||||
|
||||
|
||||
class ProductionConfig(Config):
|
||||
DEBUG = False
|
||||
URL_PREFIX = os.environ.get("URL_PREFIX")
|
||||
|
||||
|
||||
|
||||
class DevelopmentConfig(Config):
|
||||
ENV = "development"
|
||||
DEVELOPMENT = True
|
||||
DEBUG = True
|
||||
|
@ -0,0 +1,28 @@
|
||||
.share {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
|
||||
line-height: 2;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
a {
|
||||
color: currentColor;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
button.clipboard {
|
||||
background: none;
|
||||
border: none;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
button.clipboard:hover {
|
||||
color: dodgerblue;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,22 @@
|
||||
copies = document.querySelectorAll("[data-copy]");
|
||||
|
||||
Array.from(copies).forEach((copy) => {
|
||||
clipboard = document.createElement("button");
|
||||
clipboard.classList.add("clipboard");
|
||||
clipboard.innerHTML = "Copy to clipboard";
|
||||
insertAfter(clipboard, copy);
|
||||
clipboard.addEventListener("click", (e) => {
|
||||
navigator.clipboard.writeText(copy.dataset.copy).then(
|
||||
function () {
|
||||
clipboard.innerHTML = "Copied!";
|
||||
},
|
||||
function (err) {
|
||||
console.error("Async: Could not copy text: ", err);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function insertAfter(newNode, referenceNode) {
|
||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
||||
}
|
Loading…
Reference in New Issue