Verified Commit 5045f0f3 authored by Kevin Morris's avatar Kevin Morris
Browse files

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's avatarKevin Morris <kevr@0cost.org>
parent b80d914c
...@@ -160,4 +160,3 @@ ...@@ -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>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.copy').addEventListener('click', function(e) { let elements = document.querySelectorAll('.copy');
e.preventDefault(); elements.forEach(function(el) {
navigator.clipboard.writeText(e.target.text); el.addEventListener('click', function(e) {
}); e.preventDefault();
navigator.clipboard.writeText(e.target.text);
});
});
}); });
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment