feat: Funktion hinzugefügt, um aktuelle URL beim Klicken auf den Button in die Zwischenablage zu kopieren

This commit is contained in:
Developer 02 2024-10-09 16:53:44 +02:00
parent 738b379fe5
commit ded3425e31

View File

@ -67,7 +67,7 @@
}
else
{
<button type="button" data-bs-toggle="modal" id="btn-download" data-bs-target="#staticBackdrop">
<button type="button" data-bs-toggle="modal" id="btn-copy" data-bs-target="#staticBackdrop">
<span class="material-symbols-outlined">
content_copy
</span>
@ -166,8 +166,13 @@
else
{
<script nonce="@nonce">
document.getElementById('btn-download').addEventListener('click', async () => {
alert("foo")
document.getElementById('btn-copy').addEventListener('click', function () {
const url = window.location.href;
navigator.clipboard.writeText(url).then(function () {
console.log('URL panoya başarıyla kopyalandı!');
}).catch(function (err) {
console.error('URL kopyalanamadı: ', err);
});
});
</script>
}