diff --git a/bookwyrm/static/css/bookwyrm/components/_copy.scss b/bookwyrm/static/css/bookwyrm/components/_copy.scss
index e0c4246e6..7a47c1dba 100644
--- a/bookwyrm/static/css/bookwyrm/components/_copy.scss
+++ b/bookwyrm/static/css/bookwyrm/components/_copy.scss
@@ -28,3 +28,31 @@
.vertical-copy button {
width: 100%;
}
+
+.copy-tooltip {
+ overflow: visible;
+ visibility: hidden;
+ width: 140px;
+ background-color: #555;
+ color: #fff;
+ text-align: center;
+ border-radius: 6px;
+ padding: 5px;
+ position: absolute;
+ z-index: 1;
+ margin-left: -30px;
+ margin-top: -45px;
+ opacity: 0;
+ transition: opacity 0.3s;
+}
+
+.copy-tooltip::after {
+ content: "";
+ position: absolute;
+ top: 100%;
+ left: 50%;
+ margin-left: -60px;
+ border-width: 5px;
+ border-style: solid;
+ border-color: #555 transparent transparent transparent;
+ }
diff --git a/bookwyrm/static/css/fonts/icomoon.eot b/bookwyrm/static/css/fonts/icomoon.eot
index 69628662b..b86375a90 100644
Binary files a/bookwyrm/static/css/fonts/icomoon.eot and b/bookwyrm/static/css/fonts/icomoon.eot differ
diff --git a/bookwyrm/static/css/fonts/icomoon.svg b/bookwyrm/static/css/fonts/icomoon.svg
index c67c8b225..a3c902a07 100644
--- a/bookwyrm/static/css/fonts/icomoon.svg
+++ b/bookwyrm/static/css/fonts/icomoon.svg
@@ -39,6 +39,7 @@
+
diff --git a/bookwyrm/static/css/fonts/icomoon.ttf b/bookwyrm/static/css/fonts/icomoon.ttf
index 12c79d551..edcbd3b75 100644
Binary files a/bookwyrm/static/css/fonts/icomoon.ttf and b/bookwyrm/static/css/fonts/icomoon.ttf differ
diff --git a/bookwyrm/static/css/fonts/icomoon.woff b/bookwyrm/static/css/fonts/icomoon.woff
index 624b70f33..47d4bffb5 100644
Binary files a/bookwyrm/static/css/fonts/icomoon.woff and b/bookwyrm/static/css/fonts/icomoon.woff differ
diff --git a/bookwyrm/static/css/vendor/icons.css b/bookwyrm/static/css/vendor/icons.css
index 6477aee5c..b661ce8e7 100644
--- a/bookwyrm/static/css/vendor/icons.css
+++ b/bookwyrm/static/css/vendor/icons.css
@@ -1,10 +1,10 @@
@font-face {
font-family: 'icomoon';
- src: url('../fonts/icomoon.eot?r7jc98');
- src: url('../fonts/icomoon.eot?r7jc98#iefix') format('embedded-opentype'),
- url('../fonts/icomoon.ttf?r7jc98') format('truetype'),
- url('../fonts/icomoon.woff?r7jc98') format('woff'),
- url('../fonts/icomoon.svg?r7jc98#icomoon') format('svg');
+ src: url('../fonts/icomoon.eot?nr4nq7');
+ src: url('../fonts/icomoon.eot?nr4nq7#iefix') format('embedded-opentype'),
+ url('../fonts/icomoon.ttf?nr4nq7') format('truetype'),
+ url('../fonts/icomoon.woff?nr4nq7') format('woff'),
+ url('../fonts/icomoon.svg?nr4nq7#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
@@ -122,6 +122,9 @@
.icon-graphic-banknote:before {
content: "\e920";
}
+.icon-copy:before {
+ content: "\e92c";
+}
.icon-search:before {
content: "\e986";
}
diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js
index 0c6958f33..67d64688f 100644
--- a/bookwyrm/static/js/bookwyrm.js
+++ b/bookwyrm/static/js/bookwyrm.js
@@ -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,21 @@ 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.
*
diff --git a/bookwyrm/templates/book/book_identifiers.html b/bookwyrm/templates/book/book_identifiers.html
index ff5aad0bb..9b1ad4f3d 100644
--- a/bookwyrm/templates/book/book_identifiers.html
+++ b/bookwyrm/templates/book/book_identifiers.html
@@ -4,42 +4,50 @@
{% if book.isbn_13 or book.oclc_number or book.asin or book.aasin or book.isfdb %}
{% if book.isbn_13 %}
-
+
- {% trans "ISBN:" %}
-
- {{ book.isbn_13 }}
+
- {{ book.isbn_13 }}
+
+
+ {% trans "Copied ISBN!" %}
+
{% endif %}
{% if book.oclc_number %}
-
+
- {% trans "OCLC Number:" %}
- {{ book.oclc_number }}
{% endif %}
{% if book.asin %}
-
+
- {% trans "ASIN:" %}
- {{ book.asin }}
{% endif %}
{% if book.aasin %}
-
+
- {% trans "Audible ASIN:" %}
- {{ book.aasin }}
{% endif %}
{% if book.isfdb %}
-
+
- {% trans "ISFDB ID:" %}
- {{ book.isfdb }}
{% endif %}
{% if book.goodreads_key %}
-
+
- {% trans "Goodreads:" %}
- {{ book.goodreads_key }}