Skip to content

Commit 5d3a0cb

Browse files
committed
优化 代码
1 parent d56c52d commit 5d3a0cb

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

Autopage.user.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 自动无缝翻页
3-
// @version 1.1.4
3+
// @version 1.1.5
44
// @author X.I.U
55
// @description 自动无缝翻页,目前支持:423Down、Apphot(原烈火汉化)、小众软件、PubMed、三国杀论坛
66
// @match *://www.423down.com/*
@@ -28,7 +28,10 @@
2828
// 默认 ID 为 0
2929
var curSite = {SiteTypeID: 0};
3030

31-
// 自动翻页规则,HT_insert:1 = 插入元素前面;2 = 插入元素中的最后一个子元素后面
31+
// 自动翻页规则
32+
// type:1 = 脚本实现自动无缝翻页,2 = 网站自带了自动无缝翻页功能,只需要点击下一页按钮即可,这时 nextText 为按钮文本,避免一瞬间加载太多次下一页
33+
// HT_insert:1 = 插入元素前面;2 = 插入元素中的最后一个子元素后面
34+
// scrollDelta:数值越大,滚动条触发点越靠上(越早开始翻页)
3235
let DBSite = {
3336
_423down_postslist: {
3437
SiteTypeID: 1,
@@ -68,14 +71,16 @@
6871
pager: {
6972
type: 2,
7073
nextLink: 'button.load-button.next-page',
74+
nextText: 'Show more',
7175
scrollDelta: 1500
7276
}
7377
},
7478
sanguosha_forum: {
7579
SiteTypeID: 5,
7680
pager: {
7781
type: 2,
78-
nextLink: 'a.bm_h',
82+
nextLink: '#autopbn',
83+
nextText: '下一页 »',
7984
scrollDelta: 800
8085
}
8186
},
@@ -145,7 +150,7 @@
145150
ShowPager.loadMorePage();
146151
}else{
147152
let autopbn = document.querySelector(curSite.pager.nextLink);
148-
if (autopbn){
153+
if (autopbn && autopbn.innerText == curSite.pager.nextText){ // 如果正在加载,就不再点击
149154
autopbn.click();
150155
}
151156
}

0 commit comments

Comments
 (0)