This commit is contained in:
2026-09-26 15:23:36 +02:00
parent 990f463534
commit 27f5e3563f
18 changed files with 1226 additions and 559 deletions
+17 -7
View File
@@ -3024,9 +3024,10 @@ window.initUploadForm = (selector) => {
? redirectCheckbox.checked
: (localStorage.getItem('upload_redirect_to_item') !== 'false');
if (shouldRedirectToItem && lastData?.itemid) {
const targetUrl = lastData.slug ? `/${lastData.slug}` : `/${lastData.itemid}`;
const isMultiNonAlbumShitpost = isShitpost && (successCount > 1 || urls.length > 1);
const targetUrl = isMultiNonAlbumShitpost ? '/' : (lastData.slug ? `/${lastData.slug}` : `/${lastData.itemid}`);
if (typeof window.loadPageAjax === 'function') {
window.loadPageAjax(targetUrl, true, { bypassCache: true });
window.loadPageAjax(targetUrl, false, { bypassCache: true, skipCache: true, skipInherit: true });
} else {
window.location.href = targetUrl;
}
@@ -3148,7 +3149,7 @@ window.initUploadForm = (selector) => {
if (shouldRedirectToItem) {
const targetUrl = res.slug ? `/${res.slug}` : (res.itemid ? `/${res.itemid}` : '/');
if (typeof window.loadPageAjax === 'function') {
window.loadPageAjax(targetUrl, true, { bypassCache: true });
window.loadPageAjax(targetUrl, false, { bypassCache: true, skipCache: true, skipInherit: true });
} else {
window.location.href = targetUrl;
}
@@ -3345,12 +3346,15 @@ window.initUploadForm = (selector) => {
}
if (successCount > 0) {
const totalFilesToUpload = selectedFiles.length;
const isBgUrlUpload = lastData?.pending && selectedFiles.every(i => i.type === 'url');
if (dragModal) dragModal.classList.remove('show');
const dropModal = document.getElementById('upload-drag-modal');
if (dropModal) dropModal.classList.remove('show');
if (window.resetGlobalScrollState) window.resetGlobalScrollState();
if (window.hideAllModals) window.hideAllModals();
form._f0ckUploader.reset();
const isBgUrlUpload = lastData?.pending && selectedFiles.every(i => i.type === 'url');
if (isBgUrlUpload) {
if (typeof window.flashMessage === 'function') {
window.flashMessage((window.f0ckI18n && window.f0ckI18n.url_upload_started) || 'Background upload started', 3000, 'info');
@@ -3398,10 +3402,16 @@ window.initUploadForm = (selector) => {
}
if (shouldRedirectToItem) {
const targetItem = lastData || (uploadedResults && uploadedResults[0]);
const targetUrl = targetItem ? (targetItem.slug ? `/${targetItem.slug}` : (targetItem.itemid ? `/${targetItem.itemid}` : '/')) : '/';
const isMultiNonAlbumShitpost = isShitpost && !isAlbum && (uploadedResults.length > 1 || successCount > 1 || totalFilesToUpload > 1);
let targetUrl;
if (isMultiNonAlbumShitpost) {
targetUrl = '/';
} else {
const targetItem = lastData || (uploadedResults && uploadedResults[0]);
targetUrl = targetItem ? (targetItem.slug ? `/${targetItem.slug}` : (targetItem.itemid ? `/${targetItem.itemid}` : '/')) : '/';
}
if (typeof window.loadPageAjax === 'function') {
window.loadPageAjax(targetUrl, true, { bypassCache: true });
window.loadPageAjax(targetUrl, false, { bypassCache: true, skipCache: true, skipInherit: true });
} else {
window.location.href = targetUrl;
}