From b80d914cba0158a559162f1d019f836c004dee6b Mon Sep 17 00:00:00 2001 From: Matt Harrison Date: Mon, 7 Mar 2022 12:37:54 -0500 Subject: [PATCH 1/3] fix click to copy when there is more than one copy link on the page. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes issue reported on the mailing list here: https://lists.archlinux.org/pipermail/aur-general/2022-March/036833.html Thanks to Henry-Joseph Audéoud for diagnosing the issue https://lists.archlinux.org/pipermail/aur-general/2022-March/036836.html Also update the event variable to use the local copy instead of the deprecated global version https://stackoverflow.com/questions/58341832/event-is-deprecated-what-should-be-used-instead --- web/html/js/copy.js | 4 ++-- web/template/pkg_details.php | 4 ++-- web/template/pkgbase_details.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/web/html/js/copy.js b/web/html/js/copy.js index f46299b3..21324ccb 100644 --- a/web/html/js/copy.js +++ b/web/html/js/copy.js @@ -1,6 +1,6 @@ document.addEventListener('DOMContentLoaded', function() { - document.querySelector('.copy').addEventListener('click', function(e) { + document.querySelectorAll('.copy').addEventListener('click', function(e) { e.preventDefault(); - navigator.clipboard.writeText(event.target.text); + navigator.clipboard.writeText(e.target.text); }); }); diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 047de9a7..25d85b78 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -309,9 +309,9 @@ endif; diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index 35ad217a..bde29c1c 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -138,9 +138,9 @@ endif; From 5045f0f3e464fc0fbb3229968cb07617ec48314f Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Mon, 7 Mar 2022 23:53:57 -0800 Subject: [PATCH 2/3] fix: copy.js javascript initialization Not sure where this works, but it doesn't seem to work on my browser. Achieved the same by forEaching through the array returned by querySelectorAll instead. Signed-off-by: Kevin Morris --- templates/partials/packages/details.html | 1 - web/html/js/copy.js | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/templates/partials/packages/details.html b/templates/partials/packages/details.html index 22d519b9..e0eda54c 100644 --- a/templates/partials/packages/details.html +++ b/templates/partials/packages/details.html @@ -160,4 +160,3 @@ - diff --git a/web/html/js/copy.js b/web/html/js/copy.js index 21324ccb..3b659270 100644 --- a/web/html/js/copy.js +++ b/web/html/js/copy.js @@ -1,6 +1,9 @@ document.addEventListener('DOMContentLoaded', function() { - document.querySelectorAll('.copy').addEventListener('click', function(e) { - e.preventDefault(); - navigator.clipboard.writeText(e.target.text); - }); + let elements = document.querySelectorAll('.copy'); + elements.forEach(function(el) { + el.addEventListener('click', function(e) { + e.preventDefault(); + navigator.clipboard.writeText(e.target.text); + }); + }); }); From e2a17fef95385f0a7cae4216d28b5789b84facce Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Mon, 7 Mar 2022 23:57:54 -0800 Subject: [PATCH 3/3] upgrade: bump to v6.0.22 Signed-off-by: Kevin Morris --- aurweb/config.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aurweb/config.py b/aurweb/config.py index 9931e7d2..d0b095f0 100644 --- a/aurweb/config.py +++ b/aurweb/config.py @@ -6,7 +6,7 @@ from typing import Any # Publicly visible version of aurweb. This is used to display # aurweb versioning in the footer and must be maintained. # Todo: Make this dynamic/automated. -AURWEB_VERSION = "v6.0.21" +AURWEB_VERSION = "v6.0.22" _parser = None diff --git a/pyproject.toml b/pyproject.toml index ce081ce6..f2401b88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ # [tool.poetry] name = "aurweb" -version = "v6.0.21" +version = "v6.0.22" license = "GPL-2.0-only" description = "Source code for the Arch User Repository's website" homepage = "https://aur.archlinux.org"