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