diff --git a/templates/assets/css/main.css b/templates/assets/css/main.css index 56c8ee7..9e4a6cf 100644 --- a/templates/assets/css/main.css +++ b/templates/assets/css/main.css @@ -5977,7 +5977,7 @@ a.change i.ri-refresh-line { display: none; position: fixed; z-index: 999; - top: 485px; + top: 50%; left: 0; background-color: var(--toc-color); color: #fff; diff --git a/templates/assets/js/app.js b/templates/assets/js/app.js index 89c9fa3..4d08b48 100644 --- a/templates/assets/js/app.js +++ b/templates/assets/js/app.js @@ -1052,8 +1052,6 @@ $(document).on('click', '#t_pagination a', function () { const currentPage = parseInt(href.match(/\d+/)[0]); const $pagingArea = $('#t_pagination .post-paging'); const originalPagingHtml = $pagingArea.html(); - const isauto_loading = window.isAutoLoading - if (window.isAutoLoading) window.isAutoLoading = false; $.ajax({ type: "GET", @@ -1075,13 +1073,9 @@ $(document).on('click', '#t_pagination a', function () { } else { $("#t_pagination a").hide(); } - if (isauto_loading) { - if (window.scroll_param > result.offset().top - 58) { - $body.animate({ scrollTop: result.offset().top - 58 }, 500); - } else { - window.forceStopLoading = true; - } - } else $body.animate({ scrollTop: result.offset().top - 58 }, 500); + if (!window.scroll_param || (!window.loadMoreTimeout && window.scroll_param > result.offset().top - 58)) { + $body.animate({ scrollTop: result.offset().top - 58 }, 500); + } else window.forceStopLoading = true; getMomentAudio(); initAgree(); lazyLoadInstance.update(); @@ -1214,8 +1208,6 @@ $(document).on('click', '#p_pagination a', function () { const $pagingArea = $('#p_pagination .post-paging'); const originalPagingHtml = $pagingArea.html(); const targetOffsetTop = $('#p_pagination a').offset().top; - const isauto_loading = window.isAutoLoading - if (window.isAutoLoading) window.isAutoLoading = false; $.ajax({ type: "GET", url: href, @@ -1234,13 +1226,9 @@ $(document).on('click', '#p_pagination a', function () { } else { $("#p_pagination a").hide(); //如果没有下一页了,隐藏 } - if (isauto_loading) { - if (window.scroll_param > targetOffsetTop - 358) { - $body.animate({ scrollTop: targetOffsetTop - 358 }, 500); - } else { - window.forceStopLoading = true; - } - } else $body.animate({ scrollTop: targetOffsetTop - 358 }, 500); + if (!window.scroll_param || (!window.loadMoreTimeout && window.scroll_param > targetOffsetTop - 358)) { + $body.animate({ scrollTop: targetOffsetTop - 358 }, 500); + } else window.forceStopLoading = true; pix.initGalleryPhotos(); $.cookie('page', currentPage, { path: '/', domain: 'anian.cc' }); } else { @@ -1492,8 +1480,6 @@ $('body').on('click', '#pagination a', function () { const originalPagingHtml = $pagingArea.html(); var href = $(this).attr('data'); const currentPage = parseInt(href.match(/\d+/)[0]); - const isauto_loading = window.isAutoLoading - if (window.isAutoLoading) window.isAutoLoading = false; $.ajax({ type: "GET", url: href, @@ -1519,13 +1505,9 @@ $('body').on('click', '#pagination a', function () { } else { $("#pagination a").hide(); //如果没有下一页了,隐藏 } - if (isauto_loading) { - if (window.scroll_param > result.offset().top - 58) { - $body.animate({ scrollTop: result.offset().top - 58 }, 500); - } else { - window.forceStopLoading = true; - } - } else $body.animate({ scrollTop: result.offset().top - 58 }, 500); + if (!window.scroll_param || (!window.loadMoreTimeout && window.scroll_param > result.offset().top - 58)) { + $body.animate({ scrollTop: result.offset().top - 58 }, 500); + } else window.forceStopLoading = true; initAgree() lazyLoadInstance.update(); $.cookie('page', currentPage, { path: '/', domain: 'anian.cc' }); @@ -1548,8 +1530,6 @@ $('body').on('click', '.arc_pagenav a', function () { const $pagingArea = $('.arc_pagenav'); const originalPagingHtml = $pagingArea.html(); const postListElement = document.getElementById("post_item"); - const isauto_loading = window.isAutoLoading - if (window.isAutoLoading) window.isAutoLoading = false; var href = $(this).attr('data'); const currentPage = parseInt(href.match(/\d+/)[0]); @@ -1579,15 +1559,10 @@ $('body').on('click', '.arc_pagenav a', function () { } else { $(".arc_pagenav a").hide(); //如果没有下一页了,隐藏 } - $('.arc_pagenav .uk-spinner').remove(); - if (isauto_loading) { - if (window.scroll_param > post.offset().top - 58) { - $body.animate({ scrollTop: post.offset().top - 58 }, 500); - } else { - window.forceStopLoading = true; - } - } else $body.animate({ scrollTop: post.offset().top - 58 }, 500); + if (!window.scroll_param || (!window.loadMoreTimeout && window.scroll_param > post.offset().top - 58)) { + $body.animate({ scrollTop: post.offset().top - 58 }, 500); + } else window.forceStopLoading = true; initAgree() lazyLoadInstance.update(); $.cookie('page', currentPage, { path: '/', domain: 'anian.cc' }); @@ -2744,7 +2719,7 @@ function initTagSwitch() { // 1. 定义一个全局标志位,用于外部强制终止 window.forceStopLoading = false; -window.isAutoLoading = false; +window.loadMoreTimeout = false; function loadMultiplePages(pageCount) { return new Promise((resolve) => { let loadedCount = 0; @@ -2772,9 +2747,6 @@ function loadMultiplePages(pageCount) { const $pager = $btn.closest('.post-paging'); const oldHref = $btn.attr('data'); - - window.isAutoLoading = true; - const pageStartTime = Date.now(); $btn.trigger('click'); // 加载更多 @@ -2786,8 +2758,9 @@ function loadMultiplePages(pageCount) { resolve(); return; } - if (now - pageStartTime > 2000) { + if (now - pageStartTime > 3000) { clearInterval(waitInterval); + window.loadMoreTimeout = true; resolve(); // 解决 Promise,触发后续滚动 return; } @@ -2844,9 +2817,9 @@ function initjump() { closeLoading(); cocoMessage.success(`已成功切换至${msg}`); } - }); + }).catch(() => closeLoading?.()); } - }); + }).catch(() => closeLoading?.()); }