mirror of
https://github.com/XIU2/UserScript.git
synced 2026-09-22 15:06:57 +00:00
优化 [添加历史记录] 功能
This commit is contained in:
+24
-8
@@ -3,7 +3,7 @@
|
||||
// @name:zh-CN 自动无缝翻页
|
||||
// @name:zh-TW 自動無縫翻頁
|
||||
// @name:en AutoPager
|
||||
// @version 5.2.2
|
||||
// @version 5.2.3
|
||||
// @author X.I.U
|
||||
// @description ⭐无缝衔接下一页内容到网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、微博、NGA、V2EX、B 站(Bilibili)、煎蛋网、龙的天空、起点中文、IT之家、千图网、千库网、Pixabay、Pixiv、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、小众软件、【动漫狂、漫画猫、漫画屋、漫画 DB、动漫之家、拷贝漫画、HiComic、Mangabz、Xmanhua 等漫画网站...】、PubMed、Z-Library、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了...
|
||||
// @description:zh-TW ⭐無縫銜接下一頁內容到網頁底部(類似瀑布流)⭐,支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎(Google、Bing、Yahoo...) 等網站~
|
||||
@@ -323,6 +323,7 @@ function: {
|
||||
nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
|
||||
pageE: 'id("threadlist")//table[./tbody[contains(@id, "normalthread_")]]/tbody[not(@id="separatorline")]',
|
||||
replaceE: '.pg, .pages',
|
||||
forceHTTPS: true,
|
||||
scrollD: 1500
|
||||
}
|
||||
}, // Discuz! 论坛 - 导读页 及 帖子列表(不带无缝加载下一页按钮的)
|
||||
@@ -331,6 +332,7 @@ function: {
|
||||
nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
|
||||
pageE: '#waterfall > li',
|
||||
replaceE: '.pg, .pages',
|
||||
forceHTTPS: true,
|
||||
scrollD: 1500
|
||||
}
|
||||
}, // Discuz! 论坛 - 图片模式的帖子列表(不带无缝加载下一页按钮的)
|
||||
@@ -341,6 +343,7 @@ function: {
|
||||
nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
|
||||
pageE: '#postlist > div[id^="post_"]',
|
||||
replaceE: '//div[contains(@class,"pg") or contains(@class,"pages")][./a[contains(@class,"nxt") or contains(@class,"next") or contains(@class,"prev")][not(contains(@href,"javascript") or contains(@href,"commentmore"))]]',
|
||||
forceHTTPS: true,
|
||||
scrollD: 1500
|
||||
},
|
||||
function: {
|
||||
@@ -353,6 +356,7 @@ function: {
|
||||
nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
|
||||
pageE: '#threadlist > ul',
|
||||
replaceE: '.pg, .pages',
|
||||
forceHTTPS: true,
|
||||
scrollD: 1500
|
||||
}
|
||||
}, // Discuz! 论坛 - 搜索页
|
||||
@@ -361,6 +365,7 @@ function: {
|
||||
nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
|
||||
pageE: 'form:not([action^="search.php?"]) tbody > tr:not(.th)',
|
||||
replaceE: '.pg, .pages',
|
||||
forceHTTPS: true,
|
||||
scrollD: 1500
|
||||
}
|
||||
}, // Discuz! 论坛 - 回复页、主题页(别人的)
|
||||
@@ -369,6 +374,7 @@ function: {
|
||||
nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
|
||||
pageE: '#ct .bm_c table > tbody',
|
||||
replaceE: '.pg, .pages',
|
||||
forceHTTPS: true,
|
||||
scrollD: 1500
|
||||
}
|
||||
}, // Discuz! 论坛 - 淘帖页
|
||||
@@ -377,6 +383,7 @@ function: {
|
||||
pager: {
|
||||
nextL: '//a[@class="nxt" or @class="next"] | //div[@class="page"]/a[text()="下一页" or contains(text(), ">")]',
|
||||
replaceE: '.pg, .page',
|
||||
forceHTTPS: true,
|
||||
scrollD: 1000
|
||||
}
|
||||
}, // Discuz! 论坛 - 触屏手机版 - 帖子内
|
||||
@@ -1444,7 +1451,7 @@ function: {
|
||||
window.addEventListener('urlchange', function(){
|
||||
lp = location.pathname;
|
||||
//console.log(nowLocation, location.href)
|
||||
if (curSite.history !== false && window.top.document.xiu_nowUrl === location.href) {nowLocation = location.href; return}
|
||||
if (curSite.history !== false && window.top.document.Autopage_nowUrl === location.href) {nowLocation = location.href; return}
|
||||
if (nowLocation == location.href) return
|
||||
if (curSite.pager && curSite.pager.type == 5) {
|
||||
if (self != top) {window.top.location.href = location.href;} else {if (getCSS('iframe#Autopage_iframe')) {getCSS('iframe#Autopage_iframe').remove();}}
|
||||
@@ -2859,11 +2866,18 @@ function: {
|
||||
function getNextE(css) {
|
||||
if (!css) css = curSite.pager.nextL;
|
||||
let next = getOne(css);
|
||||
if (next && next.nodeType === 1 && next.href && next.href.slice(0,4) === 'http' && next.href != curSite.pageUrl) {
|
||||
if (curSite.pager.forceHTTPS && location.protocol === 'https:') {
|
||||
curSite.pageUrl = next.href.replace(/^http:/,'https:');
|
||||
if (next && next.nodeType === 1 && next.href && next.href.slice(0,4) === 'http') {
|
||||
if (next.href != curSite.pageUrl) {
|
||||
if (curSite.pager.forceHTTPS && location.protocol === 'https:') {
|
||||
if (next.href.replace(/^http:/,'https:') === curSite.pageUrl) {
|
||||
return false
|
||||
}
|
||||
curSite.pageUrl = next.href.replace(/^http:/,'https:');
|
||||
} else {
|
||||
curSite.pageUrl = next.href;
|
||||
}
|
||||
} else {
|
||||
curSite.pageUrl = next.href;
|
||||
return false
|
||||
}
|
||||
//console.log(curSite.pageUrl)
|
||||
return true
|
||||
@@ -3007,8 +3021,10 @@ function: {
|
||||
//console.log(pageE.querySelector('title'), curSite.pageUrl)
|
||||
title = title || pageE.querySelector('title').textContent || window.top.document.title;
|
||||
url = url || curSite.pageUrl;
|
||||
window.top.document.xiu_nowUrl = curSite.pageUrl;
|
||||
window.top.history.pushState('xiu_history', title, url);
|
||||
window.top.document.Autopage_nowUrl = curSite.pageUrl;
|
||||
// 对于下一页 URL 和当前网页 URL 的协议不同时,跳过
|
||||
if (url.indexOf(window.top.location.protocol) === -1) return
|
||||
window.top.history.pushState('Autopage_history', title, url);
|
||||
window.top.document.title = title;
|
||||
}
|
||||
// 插入 <Script>
|
||||
|
||||
Reference in New Issue
Block a user