From 93f0fb0f3387be6fbfdf348750ceadbe1ea7a5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Fri, 4 Jul 2025 15:18:57 +0200 Subject: [PATCH] duzo zmian, funkcji --- static/js/hide_list.js | 37 ++++++++++++++++++++++++++++++++++++- templates/list.html | 7 ++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/static/js/hide_list.js b/static/js/hide_list.js index e806293..be3df64 100644 --- a/static/js/hide_list.js +++ b/static/js/hide_list.js @@ -23,7 +23,42 @@ function toggleVisibility(listId) { } function copyLink(link) { + if (navigator.share) { + navigator.share({ + title: 'Udostępnij moją listę', + text: 'Zobacz tę listę!', + url: link + }).catch((error) => { + console.error('Błąd podczas udostępniania', error); + fallbackCopy(link); + }); + } else { + fallbackCopy(link); + } +} + +function shareLink(link) { + if (navigator.share) { + navigator.share({ + title: 'Udostępnij moją listę', + text: 'Zobacz tę listę!', + url: link + }) + .catch((error) => { + console.error('Błąd podczas udostępniania', error); + alert('Nie udało się udostępnić linka'); + }); + } else { + copyLink(link); + } +} + +function fallbackCopy(link) { navigator.clipboard.writeText(link).then(() => { - alert('Link skopiowany!'); + alert('Link skopiowany do schowka!'); }); +} + +function openList(link) { + window.open(link, '_blank'); } \ No newline at end of file diff --git a/templates/list.html b/templates/list.html index 43f127f..266f747 100644 --- a/templates/list.html +++ b/templates/list.html @@ -32,7 +32,12 @@ +