gsdf
This commit is contained in:
+12
-5
@@ -1157,6 +1157,10 @@
|
||||
if (countEl) countEl.textContent = Math.max(0, (parseInt(countEl.textContent || '0', 10)) + (nowFaved ? 1 : -1));
|
||||
if (nowFaved) flashFav(slide);
|
||||
}
|
||||
if (!window.scrollerLoggedIn && (!window.f0ckSession || !window.f0ckSession.user)) {
|
||||
showShareToast('Login to favorite posts');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const csrfToken = window.f0ckSession?.csrf_token || window.scrollerCsrf || '';
|
||||
const resp = await fetch('/api/v2/togglefav', {
|
||||
@@ -1392,11 +1396,14 @@
|
||||
const actions = document.createElement('div'); actions.className = 'scroll-actions';
|
||||
const _i = window.f0ckI18n || {};
|
||||
actions.innerHTML = `
|
||||
${window.scrollerLoggedIn ? `
|
||||
<button class="scroll-btn js-fav-btn${item.is_faved ? ' faved' : ''}" title="${_i.favourite || 'Favourite'} (double-tap)">
|
||||
<div class="scroll-btn-icon"><i class="${item.is_faved ? 'fa-solid' : 'fa-regular'} fa-heart"></i></div>
|
||||
<span class="scroll-btn-count">${item.fav_count ?? 0}</span>
|
||||
</button>` : ''}
|
||||
${(() => {
|
||||
const isFaved = !!item.is_faved;
|
||||
return `
|
||||
<button class="scroll-btn js-fav-btn${isFaved ? ' faved' : ''}" title="${_i.favourite || 'Favourite'} (double-tap)">
|
||||
<div class="scroll-btn-icon"><i class="${isFaved ? 'fa-solid' : 'fa-regular'} fa-heart"></i></div>
|
||||
<span class="scroll-btn-count">${item.fav_count ?? 0}</span>
|
||||
</button>`;
|
||||
})()}
|
||||
<button class="scroll-btn js-comments-btn" data-id="${item.id}" title="${_i.comments_label || 'Comments'} (C)">
|
||||
<div class="scroll-btn-icon"><i class="fa-regular fa-comment"></i></div>
|
||||
<span class="scroll-btn-count">${item.comment_count ?? 0}</span>
|
||||
|
||||
Reference in New Issue
Block a user