Skip to content

Commit 3d6e1e8

Browse files
committed
优化 各个论坛通用规则识别方式
1 parent 7d32283 commit 3d6e1e8

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

Autopage.user.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN 自动无缝翻页
44
// @name:zh-TW 自動無縫翻頁
55
// @name:en AutoPager
6-
// @version 5.3.8
6+
// @version 5.3.9
77
// @author X.I.U
88
// @description ⭐无缝衔接下一页内容到网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、微博、NGA、V2EX、B 站(Bilibili)、煎蛋网、龙的天空、起点中文、千图网、千库网、Pixabay、Pixiv、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、RuTracker、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、小众软件、【动漫狂、漫画猫、漫画屋、漫画 DB、动漫之家、拷贝漫画、HiComic、Mangabz、Xmanhua 等漫画网站...】、PubMed、Z-Library、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了...
99
// @description:zh-TW ⭐無縫銜接下一頁內容到網頁底部(類似瀑布流)⭐,支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎(Google、Bing、Yahoo...) 等網站~
@@ -205,44 +205,44 @@
205205
console.info('[自动无缝翻页] - 独立规则 网站'); return 1;
206206
} else if (self != top) {
207207
return -1;
208-
} else if (typeof discuz_uid != 'undefined' || getCSS('meta[name="author" i][content*="Discuz!" i], meta[name="generator" i][content*="Discuz!" i], body[id="nv_forum" i][class^="pg_" i][onkeydown*="27"], body[id="nv_search" i][onkeydown*="27"]') || (getCSS('a[href*="www.discuz.net" i]') && getCSS('a[href*="www.discuz.net" i]').textContent.indexOf('Discuz!') > -1) || (getCSS('#ft') && getCSS('#ft').textContent.indexOf('Discuz!') > -1)) {
209-
console.info('[自动无缝翻页] - <Discuz!> 论坛'); return 2;
210-
} else if (getCSS('#flarum-loading')) {
211-
console.info('[自动无缝翻页] - <Flarum> 论坛'); return 3;
212-
} else if (getCSS('body#phpbb')) {
213-
console.info('[自动无缝翻页] - <phpBB> 论坛'); return 4;
214-
} else if (getXpath('//footer//a[contains(string(), "Xiuno")] | //link[contains(@href, "xiuno")] | //script[contains(@src, "xiuno")]')) {
215-
console.info('[自动无缝翻页] - <Xiuno> 论坛'); return 5;
208+
} else if (typeof discuz_uid != 'undefined') {
209+
console.info(`[自动无缝翻页] - <Discuz!> 论坛`); return 2;
210+
} else if (typeof flarum != 'undefined') {
211+
console.info(`[自动无缝翻页] - <Flarum> 论坛`); return 3;
212+
} else if (typeof phpbb != 'undefined') {
213+
console.info(`[自动无缝翻页] - <phpBB> 论坛`); return 4;
214+
} else if (typeof xn != 'undefined' && getXpath('//footer//a[contains(string(), "Xiuno")] | //link[contains(@href, "xiuno")] | //script[contains(@src, "xiuno")]')) {
215+
console.info(`[自动无缝翻页] - <Xiuno> 论坛`); return 5;
216216
} else if (typeof XF != 'undefined') {
217-
console.info('[自动无缝翻页] - <XenForo> 论坛'); return 6;
217+
console.info(`[自动无缝翻页] - <XenForo> 论坛`); return 6;
218218
} else if (getCSS('head meta[name="generator" i][content="nexusphp" i]') || getXpath('id("footer")[contains(string(), "NexusPHP")]')) {
219-
console.info('[自动无缝翻页] - <NexusPHP> 论坛'); return 7;
219+
console.info(`[自动无缝翻页] - <NexusPHP> 论坛`); return 7;
220220
} else if (getAllCSS('.load-more, .loadmore, #load-more, #loadmore, .show_more').length === 1) {
221-
console.info('[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 1'); return 8;
221+
console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 1`); return 8;
222222
} else if (getAllXpath('//*[@onclick][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]').length === 1) {
223-
console.info('[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 2'); return 9;
223+
console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 2`); return 9;
224224
} else if (getCSS('link[href*="themes/dux" i], script[src*="themes/dux" i]')) {
225-
console.info('[自动无缝翻页] - 使用 WordPress <DUX> 主题的网站'); return 100;
225+
console.info(`[自动无缝翻页] - 使用 WordPress <DUX> 主题的网站`); return 100;
226226
} else if (getCSS('link[href*="themes/xiu" i], script[src*="themes/xiu" i]')) {
227-
console.info('[自动无缝翻页] - 使用 WordPress <XIU> 主题的网站'); return 101;
227+
console.info(`[自动无缝翻页] - 使用 WordPress <XIU> 主题的网站`); return 101;
228228
} else if (getCSS('link[href*="themes/d8" i], script[src*="themes/d8" i]')) {
229-
console.info('[自动无缝翻页] - 使用 WordPress <D8> 主题的网站'); return 102;
229+
console.info(`[自动无缝翻页] - 使用 WordPress <D8> 主题的网站`); return 102;
230230
} else if (getCSS('link[href*="themes/begin" i], script[src*="themes/begin" i], img[src*="themes/begin" i]')) {
231-
console.info('[自动无缝翻页] - 使用 WordPress <Begin> 主题的网站'); return 103;
231+
console.info(`[自动无缝翻页] - 使用 WordPress <Begin> 主题的网站`); return 103;
232232
} else if (getCSS('link[href*="/wp-content/" i], script[src*="/wp-content/" i]')) {
233233
if (getAllCSS('article').length > 2 && getCSS('#nav-below, nav.navigation, nav.pagination, nav.paging-navigation')) {
234234
if (getCSS('a.next')) {
235-
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (a.next)'); return 104;
235+
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (a.next)`); return 104;
236236
} else if (getCSS('li.next-page > a')) {
237-
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (li.next-page > a)'); return 105;
237+
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (li.next-page > a)`); return 105;
238238
} else if (getCSS('.nav-previous a')) {
239-
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (旧文章)'); return 106;
239+
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (旧文章)`); return 106;
240240
} else if (getXpath('//nav[@id="nav-below" or contains(@class, "navigation") or contains(@class, "pagination")]//a[contains(text(), "下一页") or contains(text(), ">") or contains(text(), "next") or contains(text(), "Next") or contains(text(), "NEXT")]')) {
241-
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (下一页)'); return 107;
241+
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (下一页)`); return 107;
242242
}
243243
}
244244
} else if ((getCSS('meta[name="description" i][content*="小说"], meta[name="description" i][content*="章节"], meta[name="description" i][content*="阅读"]') || location.hostname.indexOf('biqu') > -1 || document.title.indexOf('笔趣阁') > -1) && getCSS('#content, .content, #chaptercontent, .chaptercontent, #BookText') && getXpath('//a[contains(text(), "下一章") or contains(text(), "下一页")]')) {
245-
console.info('[自动无缝翻页] - <笔趣阁> 模板的小说网站'); return 200;
245+
console.info(`[自动无缝翻页] - <笔趣阁> 模板的小说网站`); return 200;
246246
}
247247
return 0;
248248
}
@@ -263,7 +263,7 @@
263263
case 7: // < 所有 NexusPHP 论坛 >
264264
DBSite.nexusphp.url(); break;
265265
case 8: // < 部分自带 自动无缝翻页 的网站 1 >
266-
DBSite.loadmore.url(); break;
266+
DBSite.loadmore.url('.load-more, .loadmore, #load-more, #loadmore, .show_more'); break;
267267
case 9: // < 部分自带 自动无缝翻页 的网站 2 >
268268
DBSite.loadmore.url('//*[@onclick][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]'); break;
269269
case 100: // < 所有使用 WordPress DUX 主题的网站 >
@@ -275,7 +275,7 @@
275275
case 103: // < 所有使用 WordPress Begin 主题的网站 >
276276
DBSite.begin.url(); break;
277277
case 104: // < 部分使用 WordPress 的网站 (a.next) >
278-
DBSite.wp_article.url(); break;
278+
DBSite.wp_article.url('a.next'); break;
279279
case 105: // < 部分使用 WordPress 的网站 (li.next-page > a) >
280280
DBSite.wp_article.url('li.next-page > a'); break;
281281
case 106: // < 部分使用 WordPress 的网站 (旧文章) >
@@ -361,7 +361,7 @@ function: {
361361
*/ //<<< 规则简单说明 >>>
362362
DBSite = {
363363
loadmore: {
364-
url: function(nextL = '.load-more, .loadmore, #load-more, #loadmore, .show_more') {curSite = DBSite.loadmore; curSite.pager.nextL = nextL;},
364+
url: function(nextL) {curSite = DBSite.loadmore; curSite.pager.nextL = nextL;},
365365
pager: {
366366
type: 2,
367367
isHidden: true,
@@ -585,7 +585,7 @@ function: {
585585
}
586586
}, // WordPress 的 Begin 主题 - 搜索页
587587
wp_article: {
588-
url: function(nextL = 'a.next') {if (!indexOF('/post/') && !getCSS('#comments, .comments-area, #disqus_thread')) {curSite = DBSite.wp_article; curSite.pager.nextL = nextL; if (getCSS('img[data-src]')) {curSite.function = {bF: "return fun.src_bF(pageE, [0, 'img[data-src]', 'data-src'])"};} else if (getCSS('img[data-original]')) {curSite.function = {bF: "return fun.src_bF(pageE, [0, 'img[data-original]', 'data-original'])"};}}},
588+
url: function(nextL) {if (!indexOF('/post/') && !getCSS('#comments, .comments-area, #disqus_thread')) {curSite = DBSite.wp_article; curSite.pager.nextL = nextL; if (getCSS('img[data-src]')) {curSite.function = {bF: "return fun.src_bF(pageE, [0, 'img[data-src]', 'data-src'])"};} else if (getCSS('img[data-original]')) {curSite.function = {bF: "return fun.src_bF(pageE, [0, 'img[data-original]', 'data-original'])"};}}},
589589
pager: {
590590
pageE: 'article',
591591
replaceE: '#nav-below, nav.navigation, nav.pagination, nav.paging-navigation',

0 commit comments

Comments
 (0)