summaryrefslogtreecommitdiffstats
path: root/web/template/pkg_details.php
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@archlinux.org>2021-05-11 00:01:13 +0200
committerEli Schwartz <eschwartz@archlinux.org>2021-05-11 01:10:00 +0200
commita665b89ba3d71f0ca5ff18fc4211f2fa608be8fc (patch)
treebf90cc5757a331467cec275c90901babe9814d52 /web/template/pkg_details.php
parent0e426f9594d673df46add21ffd86d305df274c2d (diff)
downloadaur-origin/pu.tar.gz
aur-origin/pu.tar.xz
Use the clipboard API for copy pasteorigin/pu
The Document.execCommand API is deprecated and no longer recommended to be used. It's replacement is the much simpler navigator.clipboard API which is supported in all browsers except internet explorer. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Diffstat (limited to 'web/template/pkg_details.php')
-rw-r--r--web/template/pkg_details.php10
1 files changed, 3 insertions, 7 deletions
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index c6bb32d8..047de9a7 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -308,14 +308,10 @@ endif;
</div>
<script>
-$(document).ready(function() {
- $('.copy').click(function(e) {
- var tmp = $("<input>");
- $("body").append(tmp);
- tmp.val($(this).text()).select();
- document.execCommand("copy");
- tmp.remove();
+document.addEventListener('DOMContentLoaded', function() {
+ document.querySelector('.copy').addEventListener('click', function(e) {
e.preventDefault();
+ navigator.clipboard.writeText(event.target.text);
});
});
</script>