Skip to content

Commit

Permalink
Added script another way
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersSeverinsen committed Apr 19, 2024
1 parent 514c281 commit 3ab936f
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions web/templates/secrets_admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,19 @@
</tr>
{% endfor %}
</table>
<script>
var copyButtons = document.getElementsByClassName('copyButton');
for(var index=0; index < copyButtons.length; index++){
var element = copyButtons[index];
element.addEventListener('click', function(){
var parent = element.parentElement;
var text = parent.firstElementChild.textContent;
navigator.clipboard.writeText(text).then(() => {
/* Resolved - text copied to clipboard successfully */
},() => {
/* Rejected - text failed to copy to the clipboard */
});
});
}
</script>
{% endblock %}
{% block scripts %}
<script>
var copyButtons = document.getElementsByClassName('copyButton');
for(var index=0; index < copyButtons.length; index++){
var element = copyButtons[index];
element.addEventListener('click', function(){
console.log(element);
var parent = element.parentElement;
var text = parent.firstElementChild.textContent;
navigator.clipboard.writeText(text).then(() => {
/* Resolved - text copied to clipboard successfully */
},() => {
/* Rejected - text failed to copy to the clipboard */
});
});
}
</script>
{% endblock scripts %}

0 comments on commit 3ab936f

Please sign in to comment.