First Commit

This commit is contained in:
Esteban
2026-07-03 16:27:34 +02:00
commit 7a7440daab
8955 changed files with 1117958 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
(function () {
function csrfToken() {
var meta = document.querySelector('meta[name="csrf-token"]');
return meta ? meta.getAttribute('content') : '';
}
function post(url) {
return fetch(url, {
method: 'POST',
headers: {
'X-CSRF-TOKEN': csrfToken(),
'Accept': 'application/json',
},
});
}
document.addEventListener('click', function (event) {
var favoriteBtn = event.target.closest('[data-favorite-url]');
if (favoriteBtn) {
event.preventDefault();
post(favoriteBtn.getAttribute('data-favorite-url')).then(function (res) {
return res.json();
}).then(function (data) {
favoriteBtn.classList.toggle('is-favorite', !!data.is_favorite);
});
return;
}
var deleteForm = event.target.closest('[data-confirm]');
if (deleteForm && !confirm(deleteForm.getAttribute('data-confirm'))) {
event.preventDefault();
}
});
})();