Skip to content

Commit b210942

Browse files
committed
优化 自动无缝翻页
1 parent 509fa6c commit b210942

3 files changed

Lines changed: 87 additions & 53 deletions

File tree

3dm-Enhanced.user.js

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 3DM论坛增强
3-
// @version 1.0.9
3+
// @version 1.1.0
44
// @author X.I.U
55
// @description 自动回复、自动无缝翻页、清理置顶帖子、自动滚动至隐藏内容
66
// @match *://bbs.3dmgame.com/*
@@ -105,19 +105,37 @@
105105
thread: {
106106
SiteTypeID: 2,
107107
pager: {
108-
nextLink: '//div[@id="pgt"]//a[contains(text(),"下一页")][@href]',
108+
nextLink: '//a[@class="nxt"][@href]',
109109
pageElement: 'css;div#postlist > div[id^="post_"]',
110110
HT_insert: ['css;div#postlist', 2],
111-
replaceE: '//div[@class="pg"] | //div[@class="pgbtn"]',
111+
replaceE: 'css;div.pg'
112112
}
113113
},
114-
guide: {
114+
search: {
115115
SiteTypeID: 3,
116116
pager: {
117-
nextLink: '//div[@id="pgt"]//a[contains(text(),"下一页")][@href]',
118-
pageElement: 'css;div#threadlist div.bm_c table > tbody[id^="normalthread_"]',
117+
nextLink: '//a[@class="nxt"][@href]',
118+
pageElement: 'css;div#threadlist > ul',
119+
HT_insert: ['css;div#threadlist', 2],
120+
replaceE: 'css;div.pg'
121+
}
122+
},
123+
guide: {
124+
SiteTypeID: 4,
125+
pager: {
126+
nextLink: '//a[@class="nxt"][@href]',
127+
pageElement: 'css;div#threadlist div.bm_c table > tbody',
119128
HT_insert: ['css;div#threadlist div.bm_c table', 2],
120-
replaceE: 'css;div.pg',
129+
replaceE: 'css;div.pg'
130+
}
131+
},
132+
youspace: {
133+
SiteTypeID: 5,
134+
pager: {
135+
nextLink: '//a[@class="nxt"][@href]',
136+
pageElement: 'css;tbody > tr:not(.th)',
137+
HT_insert: ['css;tbody', 2],
138+
replaceE: 'css;div.pg'
121139
}
122140
}
123141
};
@@ -134,22 +152,30 @@
134152

135153
// URL 匹配正则表达式
136154
let patt_thread = /\/thread-\d+-\d+\-\d+.html/,
137-
patt_forum = /\/forum-\d+-\d+\.html/,
138-
patt_guide = /mod\=guide\&view\=(hot|digest)/
155+
patt_forum = /\/forum-\d+-\d+\.html/
139156

140157
// URL 判断
141158
if (patt_thread.test(location.pathname) || location.search.indexOf('mod=viewthread') > -1){
142159
// 帖子内
160+
hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮
143161
if(menu_value('menu_thread_pageLoading'))curSite = DBSite.thread;
144162
if(menu_value('menu_autoReply'))autoReply(); // 如果有隐藏内容,则自动回复
145163
if(menu_value('menu_scrollToShowhide'))setTimeout(function(){window.scrollTo(0,document.querySelector('.showhide').offsetTop)}, 500); // 滚动至隐藏内容
146-
}else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){
164+
} else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){
147165
// 各板块帖子列表
148166
curSite = DBSite.forum;
149167
if(menu_value('menu_cleanTopPost'))cleanTopPost(); // 清理置顶帖子
150-
}else if (patt_guide.test(location.search)){
168+
} else if (location.search.indexOf('mod=guide') > -1){
151169
// 导读帖子列表
152170
curSite = DBSite.guide;
171+
} else if (location.pathname === '/search.php') {
172+
// 搜索结果列表
173+
curSite = DBSite.search;
174+
} else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) {
175+
// 别人的主题/回复
176+
curSite = DBSite.youspace;
177+
} else {
178+
curSite = DBSite.forum;
153179
}
154180

155181
pageLoading(); // 自动翻页
@@ -237,6 +263,14 @@
237263
}
238264

239265

266+
// 隐藏帖子内的 [下一页] 按钮
267+
function hidePgbtn() {
268+
let style_hidePgbtn = document.createElement('style');
269+
style_hidePgbtn.innerHTML = `.pgbtn {display: none;}`;
270+
document.head.appendChild(style_hidePgbtn);
271+
}
272+
273+
240274
// 滚动条事件
241275
function windowScroll(fn1) {
242276
var beforeScrollTop = document.documentElement.scrollTop,

52pojie-Enhanced.user.js

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 吾爱破解论坛增强 - 自动签到、翻页
3-
// @version 1.3.0
3+
// @version 1.3.1
44
// @author X.I.U
55
// @description 自动签到、自动无缝翻页、屏蔽导读悬赏贴(最新发表页)
66
// @match *://www.52pojie.cn/*
@@ -90,63 +90,73 @@
9090
SiteTypeID: 2,
9191
pager: {
9292
type: 1,
93-
nextLink: '//div[@id="pgt"]//a[contains(text(),"下一页")][@href]',
93+
nextLink: '//a[@class="nxt"][@href]',
9494
pageElement: 'css;div#postlist > div[id^="post_"]',
9595
HT_insert: ['css;div#postlist', 2],
9696
replaceE: 'css;div.pg',
9797
scrollDelta: 766
9898
}
9999
},
100-
guide: {
100+
search: {
101101
SiteTypeID: 3,
102102
pager: {
103103
type: 1,
104-
nextLink: '//div[@id="pgt"]//a[contains(text(),"下一页")][@href]',
105-
pageElement: 'css;div#threadlist div.bm_c table > tbody[id^="normalthread_"]',
106-
HT_insert: ['css;div#threadlist div.bm_c table', 2],
104+
nextLink: '//a[@class="nxt"][@href]',
105+
pageElement: 'css;div#threadlist > ul',
106+
HT_insert: ['css;div#threadlist', 2],
107107
replaceE: 'css;div.pg',
108108
scrollDelta: 766
109109
}
110110
},
111-
collection: {
111+
guide: {
112112
SiteTypeID: 4,
113113
pager: {
114114
type: 1,
115-
nextLink: '//div[@class="pg"]//a[contains(text(),"下一页")][@href]',
116-
pageElement: 'css;div#ct div.bm_c table > tbody',
117-
HT_insert: ['css;div#ct div.bm_c table', 2],
115+
nextLink: '//a[@class="nxt"][@href]',
116+
pageElement: 'css;div#threadlist div.bm_c table > tbody',
117+
HT_insert: ['css;div#threadlist div.bm_c table', 2],
118118
replaceE: 'css;div.pg',
119-
scrollDelta: 899
119+
scrollDelta: 766
120120
}
121121
},
122-
favorite: {
122+
youspace: {
123123
SiteTypeID: 5,
124124
pager: {
125125
type: 1,
126126
nextLink: '//a[@class="nxt"][@href]',
127-
pageElement: 'css;ul#favorite_ul > li',
128-
HT_insert: ['css;ul#favorite_ul', 2],
127+
pageElement: 'css;tbody > tr:not(.th)',
128+
HT_insert: ['css;tbody', 2],
129129
replaceE: 'css;div.pg',
130-
scrollDelta: 899
130+
scrollDelta: 1000
131131
}
132132
},
133-
search: {
133+
collection: {
134134
SiteTypeID: 6,
135135
pager: {
136136
type: 1,
137137
nextLink: '//a[@class="nxt"][@href]',
138-
pageElement: 'css;div#threadlist > ul',
139-
HT_insert: ['css;div#threadlist', 2],
138+
pageElement: 'css;div#ct div.bm_c table > tbody',
139+
HT_insert: ['css;div#ct div.bm_c table', 2],
140140
replaceE: 'css;div.pg',
141-
scrollDelta: 766
141+
scrollDelta: 899
142+
}
143+
},
144+
favorite: {
145+
SiteTypeID: 7,
146+
pager: {
147+
type: 1,
148+
nextLink: '//a[@class="nxt"][@href]',
149+
pageElement: 'css;ul#favorite_ul > li',
150+
HT_insert: ['css;ul#favorite_ul', 2],
151+
replaceE: 'css;div.pg',
152+
scrollDelta: 899
142153
}
143154
}
144155
};
145156

146157
// URL 匹配正则表达式
147158
let patt_thread = /\/thread-\d+-\d+\-\d+.html/,
148-
patt_forum = /\/forum-\d+-\d+\.html/,
149-
patt_guide = /mod\=guide\&view\=(hot|digest|new|newthread|my|tech|help)/
159+
patt_forum = /\/forum-\d+-\d+\.html/
150160

151161
// URL 判断
152162
if (patt_thread.test(location.pathname) || location.search.indexOf('mod=viewthread') > -1) {
@@ -156,7 +166,7 @@
156166
}
157167
} else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1) {
158168
curSite = DBSite.forum; // 各板块帖子列表
159-
} else if (patt_guide.test(location.search)) {
169+
} else if (location.search.indexOf('mod=guide') > -1) {
160170
curSite = DBSite.guide; // 导读帖子列表
161171
delateReward(); // 屏蔽导读悬赏贴(最新发表)
162172
} else if (location.search.indexOf('mod=collection') > -1) {
@@ -165,6 +175,8 @@
165175
curSite = DBSite.favorite; // 收藏列表
166176
} else if (location.pathname === '/search.php') {
167177
curSite = DBSite.search; // 搜索结果列表
178+
} else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复
179+
curSite = DBSite.youspace;
168180
}
169181
curSite.pageUrl = ""; // 下一页URL
170182

Hostloc-Enhanced.user.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 全球主机交流论坛增强
3-
// @version 1.3.2
3+
// @version 1.3.3
44
// @author X.I.U
55
// @description 自动签到(访问空间)、屏蔽用户(黑名单)、屏蔽关键词(帖子标题)、回帖小尾巴、自动无缝翻页、快捷回到顶部(右键点击两侧空白处)、收起预览帖子(左键点击两侧空白处)、预览帖子快速回复带签名、显示是否在线、显示帖子内隐藏回复、屏蔽阅读权限 255 帖子
66
// @match *://hostloc.com/*
@@ -113,28 +113,19 @@
113113
replaceE: 'css;div.pg',
114114
}
115115
},
116-
guide: {
117-
SiteTypeID: 3,
118-
pager: {
119-
nextLink: '//a[@class="nxt"][@href]',
120-
pageElement: 'css;div#threadlist div.bm_c table > tbody[id^="normalthread_"]',
121-
HT_insert: ['css;div#threadlist div.bm_c table', 2],
122-
replaceE: 'css;div.pg',
123-
}
124-
},
125116
search: {
126-
SiteTypeID: 4,
117+
SiteTypeID: 3,
127118
pager: {
128119
nextLink: '//a[@class="nxt"][@href]',
129120
pageElement: 'css;div#threadlist > ul',
130121
HT_insert: ['css;div#threadlist', 2],
131122
replaceE: 'css;div.pg'
132123
}
133124
},
134-
myreply: {
125+
guide: {
135126
SiteTypeID: 4,
136127
pager: {
137-
nextLink: '(//a[@class="nxt"])[1][@href]',
128+
nextLink: '//a[@class="nxt"][@href]',
138129
pageElement: 'css;div#threadlist div.bm_c table > tbody',
139130
HT_insert: ['css;div#threadlist div.bm_c table', 2],
140131
replaceE: 'css;div.pg',
@@ -144,7 +135,7 @@
144135
SiteTypeID: 5,
145136
pager: {
146137
nextLink: '//a[@class="nxt"][@href]',
147-
pageElement: 'css;tbody > tr',
138+
pageElement: 'css;tbody > tr:not(.th)',
148139
HT_insert: ['css;tbody', 2],
149140
replaceE: 'css;div.pg',
150141
}
@@ -161,8 +152,7 @@
161152

162153
// URL 匹配正则表达式
163154
let patt_thread = /\/thread-\d+-\d+\-\d+.html/,
164-
patt_forum = /\/forum-\d+-\d+\.html/,
165-
patt_guide = /mod\=guide\&view\=(hot|digest)/
155+
patt_forum = /\/forum-\d+-\d+\.html/
166156

167157
// URL 判断
168158
if (patt_thread.test(location.pathname) || location.search.indexOf('mod=viewthread') > -1) { // 帖子内
@@ -183,7 +173,7 @@
183173
vfastpostDOMNodeInserted(); // 监听插入事件(预览快速回复带签名)
184174
littleTail('forum'); // 小尾巴
185175
if (patt_forum.test(location.pathname)) blockDOMNodeInserted(); //监听插入事件(有新的回复主题,点击查看)
186-
}else if (patt_guide.test(location.search)) { // 导读帖子列表
176+
}else if (location.search.indexOf('mod=guide') > -1) { // 导读帖子列表
187177
curSite = DBSite.guide;
188178
} else if(location.pathname === '/search.php') { // 搜索结果列表
189179
curSite = DBSite.search;
@@ -192,9 +182,7 @@
192182
blockUsers('notice'); // 屏蔽用户(黑名单)
193183
} else if(location.pathname === '/home.php' && location.search.indexOf('mod=space&do=pm') > -1) { // 消息(私人聊天)
194184
blockUsers('pm'); // 屏蔽用户(黑名单)
195-
} else if(location.pathname === '/forum.php' && location.search.indexOf('mod=guide&view=my&type=reply') > -1) { // 我的帖子:回复
196-
curSite = DBSite.myreply;
197-
} else if(location.pathname === '/home.php' && location.search.indexOf('&do=thread&view=me') > -1) { // 别人的帖子:回复
185+
} else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复
198186
curSite = DBSite.youreply;
199187
} else if(location.pathname === '/forum.php' && location.search.indexOf('mod=post&action=reply') > -1 || location.pathname === '/forum.php' && location.search.indexOf('mod=post&action=newthread') > -1) { // 回复:高级回复
200188
littleTail('reply'); // 小尾巴

0 commit comments

Comments
 (0)