duzo zmian, funkcji
This commit is contained in:
@ -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');
|
||||
}
|
@ -32,7 +32,12 @@
|
||||
<button id="copyBtn" class="btn btn-success btn-sm"
|
||||
onclick="copyLink('{{ request.url_root }}share/{{ list.share_token }}')"
|
||||
{% if not list.is_public %}disabled{% endif %}>
|
||||
📋 Skopiuj link
|
||||
📋 Skopiuj / Udostępnij
|
||||
</button>
|
||||
<button id="openBtn" class="btn btn-primary btn-sm"
|
||||
onclick="openList('{{ request.url_root }}share/{{ list.share_token }}')"
|
||||
{% if not list.is_public %}disabled{% endif %}>
|
||||
✅ Otwórz do odznaczania
|
||||
</button>
|
||||
<button id="toggleVisibilityBtn" class="btn btn-outline-secondary btn-sm" onclick="toggleVisibility({{ list.id }})">
|
||||
{% if list.is_public %}
|
||||
|
Reference in New Issue
Block a user