mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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 <kevr@0cost.org>
This commit is contained in:
parent
b80d914cba
commit
5045f0f3e4
2 changed files with 7 additions and 5 deletions
|
@ -160,4 +160,3 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script type="text/javascript" src="/static/js/copy.js"></script>
|
<script type="text/javascript" src="/static/js/copy.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
document.querySelectorAll('.copy').addEventListener('click', function(e) {
|
let elements = document.querySelectorAll('.copy');
|
||||||
|
elements.forEach(function(el) {
|
||||||
|
el.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
navigator.clipboard.writeText(e.target.text);
|
navigator.clipboard.writeText(e.target.text);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue