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();
}
});
})();
+21
View File
@@ -0,0 +1,21 @@
(function () {
var STORAGE_KEY = 'bloomfeed-theme';
function applyTheme(theme) {
document.documentElement.setAttribute('data-theme', theme);
}
document.addEventListener('DOMContentLoaded', function () {
var toggle = document.querySelector('[data-theme-toggle]');
if (!toggle) {
return;
}
toggle.addEventListener('click', function () {
var current = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light';
var next = current === 'dark' ? 'light' : 'dark';
applyTheme(next);
localStorage.setItem(STORAGE_KEY, next);
});
});
})();