Hyphenate ISBN numbers and add copy button
This commit is contained in:
parent
f39a1fd580
commit
d2c4785af1
12 changed files with 8044 additions and 12 deletions
|
@ -65,6 +65,9 @@ let BookWyrm = new (class {
|
|||
.querySelectorAll('input[type="file"]')
|
||||
.forEach(bookwyrm.disableIfTooLarge.bind(bookwyrm));
|
||||
document.querySelectorAll("[data-copytext]").forEach(bookwyrm.copyText.bind(bookwyrm));
|
||||
document
|
||||
.querySelectorAll("[data-copywithtooltip]")
|
||||
.forEach(bookwyrm.copyWithTooltip.bind(bookwyrm));
|
||||
document
|
||||
.querySelectorAll(".modal.is-active")
|
||||
.forEach(bookwyrm.handleActiveModal.bind(bookwyrm));
|
||||
|
@ -524,6 +527,20 @@ let BookWyrm = new (class {
|
|||
textareaEl.parentNode.appendChild(copyButtonEl);
|
||||
}
|
||||
|
||||
copyWithTooltip(copyButtonEl) {
|
||||
const text = document.getElementById(copyButtonEl.dataset.contentId).innerHTML;
|
||||
const tooltipEl = document.getElementById(copyButtonEl.dataset.tooltipId);
|
||||
copyButtonEl.addEventListener("click", () => {
|
||||
navigator.clipboard.writeText(text);
|
||||
tooltipEl.style.visibility = "visible";
|
||||
tooltipEl.style.opacity = 1;
|
||||
setTimeout(function() {
|
||||
tooltipEl.style.visibility = "hidden";
|
||||
tooltipEl.style.opacity = 0;
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the details dropdown component.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue