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 @@
+