esifawafwu
This commit is contained in:
+39
-14
@@ -1,3 +1,12 @@
|
||||
// Pages whose content depends on the rating/mime filter and must reload when it changes.
|
||||
// Profile pages count even when both previews are empty (then no .posts grid is rendered).
|
||||
// Elements whose horizontal drags belong to them (sliders, sideways-scrolling rows): swipe gestures ignore touches starting here.
|
||||
window.F0CK_NO_SWIPE_SELECTOR = 'input[type="range"], .f0ck-tuner-subtabs-nav, .f0ck-tuner-mode-bar, [data-no-swipe]';
|
||||
|
||||
window.isFilterReloadableView = function () {
|
||||
return !!document.querySelector('.posts, .tags-grid') || /^\/user\/[^/]+\/?$/.test(window.location.pathname);
|
||||
};
|
||||
|
||||
|
||||
// Normalize percent-encoded characters in the URL bar that are safe to show decoded.
|
||||
// Runs immediately so the address bar is clean before any other JS runs.
|
||||
@@ -1437,7 +1446,7 @@ window.cancelAnimFrame = (function () {
|
||||
window.flashMessage('ALL MODE ACTIVATED');
|
||||
gridCacheMap.clear();
|
||||
const isOnaraOpen = document.body.classList.contains('onara-modal-open');
|
||||
const isGridView = document.querySelector('.posts, .tags-grid');
|
||||
const isGridView = window.isFilterReloadableView();
|
||||
const isItemView = document.getElementById('prev') || document.getElementById('next') || (typeof isItemPath === 'function' ? isItemPath(window.location.pathname) : (!window.location.pathname.startsWith('/4/') && /^\/\d+(?:[?#]|$)/.test(window.location.pathname)));
|
||||
let reloadPromise = null;
|
||||
if (isOnaraOpen) {
|
||||
@@ -1501,7 +1510,7 @@ window.cancelAnimFrame = (function () {
|
||||
window.flashMessage(label);
|
||||
gridCacheMap.clear();
|
||||
const isOnaraOpen = document.body.classList.contains('onara-modal-open');
|
||||
const isGridView = document.querySelector('.posts, .tags-grid');
|
||||
const isGridView = window.isFilterReloadableView();
|
||||
const isItemView = document.getElementById('prev') || document.getElementById('next') || (typeof isItemPath === 'function' ? isItemPath(window.location.pathname) : (!window.location.pathname.startsWith('/4/') && /^\/\d+(?:[?#]|$)/.test(window.location.pathname)));
|
||||
let reloadPromise = null;
|
||||
if (isOnaraOpen) {
|
||||
@@ -13173,7 +13182,7 @@ window.cancelAnimFrame = (function () {
|
||||
|
||||
// Refresh content
|
||||
const isOnaraOpen = document.body.classList.contains('onara-modal-open');
|
||||
const isGridView = document.querySelector('.posts, .tags-grid');
|
||||
const isGridView = window.isFilterReloadableView();
|
||||
const isItemView = document.getElementById('prev') || document.getElementById('next');
|
||||
|
||||
let reloadPromise = null;
|
||||
@@ -13789,6 +13798,7 @@ window.cancelAnimFrame = (function () {
|
||||
}, 50);
|
||||
|
||||
const updateDomAfterSave = (resData) => {
|
||||
const itemPath = (resData && resData.item_path) || itemId;
|
||||
try {
|
||||
const finalRating = resData.rating || selectedRating || 'untagged';
|
||||
|
||||
@@ -13838,11 +13848,11 @@ window.cancelAnimFrame = (function () {
|
||||
sep.textContent = '→';
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = `/${itemId}`;
|
||||
a.href = `/${itemPath}`;
|
||||
a.className = 'location-link is-rehosted';
|
||||
a.title = `View rehosted post #${itemId} on f0ckm`;
|
||||
a.title = `View rehosted post /${itemPath} on f0ckm`;
|
||||
a.style.cssText = 'color: #4ade80; font-weight: 700;';
|
||||
a.innerHTML = `<i class="fa-solid fa-check"></i> #${itemId}`;
|
||||
a.innerHTML = `<i class="fa-solid fa-check"></i> /${itemPath}`;
|
||||
|
||||
locEl.appendChild(sep);
|
||||
locEl.appendChild(a);
|
||||
@@ -13860,8 +13870,8 @@ window.cancelAnimFrame = (function () {
|
||||
if (rehostBtn) {
|
||||
rehostBtn.outerHTML = `
|
||||
<span class="chan-rehost-btn-group" style="display:inline-flex;gap:4px;align-items:center;">
|
||||
<a href="/${itemId}" class="chan-rehost-action-btn rehosted" title="View Post #${itemId}" style="display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:4px 12px;border-radius:6px;font-size:0.8rem;background:rgba(74,222,128,0.2);color:#4ade80;border:1px solid rgba(74,222,128,0.4);text-decoration:none;font-weight:600;white-space:nowrap;flex-shrink:0;">
|
||||
<i class="fa-solid fa-check"></i> #${itemId}
|
||||
<a href="/${itemPath}" class="chan-rehost-action-btn rehosted" title="View /${itemPath}" style="display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:4px 12px;border-radius:6px;font-size:0.8rem;background:rgba(74,222,128,0.2);color:#4ade80;border:1px solid rgba(74,222,128,0.4);text-decoration:none;font-weight:600;white-space:nowrap;flex-shrink:0;">
|
||||
<i class="fa-solid fa-check"></i> /${itemPath}
|
||||
</a>
|
||||
<button type="button" class="chan-rehost-edit-btn" data-item-id="${itemId}" title="Edit rating" style="display:inline-flex;align-items:center;padding:3px 7px;border-radius:6px;font-size:0.8rem;background:rgba(255,255,255,0.1);color:#fff;border:1px solid rgba(255,255,255,0.2);cursor:pointer;">
|
||||
<i class="fa-solid fa-pen"></i>
|
||||
@@ -13985,8 +13995,8 @@ window.cancelAnimFrame = (function () {
|
||||
|
||||
btn.outerHTML = `
|
||||
<span class="chan-rehost-btn-group" style="display:inline-flex;gap:4px;align-items:center;">
|
||||
<a href="/${data.item_id}" class="chan-rehost-action-btn rehosted" title="View Post #${data.item_id}" style="display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:4px 12px;border-radius:6px;font-size:0.8rem;background:rgba(74,222,128,0.2);color:#4ade80;border:1px solid rgba(74,222,128,0.4);text-decoration:none;font-weight:600;white-space:nowrap;flex-shrink:0;">
|
||||
<i class="fa-solid fa-check"></i> #${data.item_id}
|
||||
<a href="/${data.item_path || data.item_id}" class="chan-rehost-action-btn rehosted" title="View /${data.item_path || data.item_id}" style="display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:4px 12px;border-radius:6px;font-size:0.8rem;background:rgba(74,222,128,0.2);color:#4ade80;border:1px solid rgba(74,222,128,0.4);text-decoration:none;font-weight:600;white-space:nowrap;flex-shrink:0;">
|
||||
<i class="fa-solid fa-check"></i> /${data.item_path || data.item_id}
|
||||
</a>
|
||||
<button type="button" class="chan-rehost-edit-btn" data-item-id="${data.item_id}" title="Edit rating" style="display:inline-flex;align-items:center;padding:3px 7px;border-radius:6px;font-size:0.8rem;background:rgba(255,255,255,0.1);color:#fff;border:1px solid rgba(255,255,255,0.2);cursor:pointer;">
|
||||
<i class="fa-solid fa-pen"></i>
|
||||
@@ -13997,7 +14007,7 @@ window.cancelAnimFrame = (function () {
|
||||
window.showToast(data.repost ? 'Already on site — linked to existing post' : 'Rehosted successfully!');
|
||||
}
|
||||
if (typeof window.openChanRehostModal === 'function') {
|
||||
const newAnchor = document.querySelector(`.chan-rehost-edit-btn[data-item-id="${data.item_id}"]`) || document.querySelector(`.chan-rehost-action-btn[href="/${data.item_id}"]`);
|
||||
const newAnchor = document.querySelector(`.chan-rehost-edit-btn[data-item-id="${data.item_id}"]`) || document.querySelector(`.chan-rehost-action-btn[href="/${data.item_path || data.item_id}"]`);
|
||||
window.openChanRehostModal({ itemId: data.item_id, anchorEl: newAnchor });
|
||||
}
|
||||
} else {
|
||||
@@ -16561,6 +16571,19 @@ window.cancelAnimFrame = (function () {
|
||||
document.addEventListener('touchstart', e => {
|
||||
if (window.f0ckSession?.disable_swiping) return;
|
||||
if (document.body.classList.contains('modal-open')) return;
|
||||
|
||||
// Sliders and horizontally scrolling rows own their horizontal drags: never start a
|
||||
// sidebar-drag or item-swipe from them (the swipe's preventDefault would freeze the slider)
|
||||
if (e.target?.closest?.(window.F0CK_NO_SWIPE_SELECTOR)) {
|
||||
swipeRT.xDown = null;
|
||||
swipeRT.yDown = null;
|
||||
swipeRT.xDiff = 0;
|
||||
swipeRT.yDiff = 0;
|
||||
swipeRT.isSidebarCandidate = false;
|
||||
swipeRT.isDraggingSidebar = false;
|
||||
swipeRT.startedInSidebarZone = true; // also blocks prev/next navigation on touchend
|
||||
return;
|
||||
}
|
||||
|
||||
const touch = e.touches[0];
|
||||
|
||||
@@ -17474,13 +17497,15 @@ window.cancelAnimFrame = (function () {
|
||||
if (document.body.classList.contains('modal-open')) return;
|
||||
if (!isLSActive()) return;
|
||||
|
||||
swipeRT.isDraggingLeftSidebar = false;
|
||||
swipeRT.isLeftSidebarCandidate = false;
|
||||
if (e.target?.closest?.(window.F0CK_NO_SWIPE_SELECTOR)) return;
|
||||
|
||||
const { sb, layout } = getLS();
|
||||
if (!sb || !layout) return;
|
||||
|
||||
const touch = e.touches[0];
|
||||
const isHidden = layout.classList.contains('sidebar-hidden');
|
||||
swipeRT.isDraggingLeftSidebar = false;
|
||||
swipeRT.isLeftSidebarCandidate = false;
|
||||
|
||||
if (isHidden) {
|
||||
if (touch.clientX < 60) {
|
||||
@@ -20145,7 +20170,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
// Trigger reload context-aware
|
||||
const fromModal = !!menu.closest('#excluded-tags-overlay');
|
||||
const postsEl = document.querySelector('.posts, .tags-grid');
|
||||
const postsEl = window.isFilterReloadableView();
|
||||
let reloadPromise = null;
|
||||
|
||||
// Set flag so hideAllModals (called inside loadPageAjax) skips the filter overlay
|
||||
|
||||
Reference in New Issue
Block a user