优化 各个论坛通用规则识别方式

This commit is contained in:
xiu2
2022-03-17 18:00:43 +08:00
parent 7d32283e14
commit 3d6e1e84a8
+26 -26
View File
@@ -3,7 +3,7 @@
// @name:zh-CN 自动无缝翻页
// @name:zh-TW 自動無縫翻頁
// @name:en AutoPager
// @version 5.3.8
// @version 5.3.9
// @author X.I.U
// @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(以上仅一小部分,更多的写不下了...
// @description:zh-TW ⭐無縫銜接下一頁內容到網頁底部(類似瀑布流)⭐,支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎(Google、Bing、Yahoo...) 等網站~
@@ -205,44 +205,44 @@
console.info('[自动无缝翻页] - 独立规则 网站'); return 1;
} else if (self != top) {
return -1;
} 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)) {
console.info('[自动无缝翻页] - <Discuz!> 论坛'); return 2;
} else if (getCSS('#flarum-loading')) {
console.info('[自动无缝翻页] - <Flarum> 论坛'); return 3;
} else if (getCSS('body#phpbb')) {
console.info('[自动无缝翻页] - <phpBB> 论坛'); return 4;
} else if (getXpath('//footer//a[contains(string(), "Xiuno")] | //link[contains(@href, "xiuno")] | //script[contains(@src, "xiuno")]')) {
console.info('[自动无缝翻页] - <Xiuno> 论坛'); return 5;
} else if (typeof discuz_uid != 'undefined') {
console.info(`[自动无缝翻页] - <Discuz!> 论坛`); return 2;
} else if (typeof flarum != 'undefined') {
console.info(`[自动无缝翻页] - <Flarum> 论坛`); return 3;
} else if (typeof phpbb != 'undefined') {
console.info(`[自动无缝翻页] - <phpBB> 论坛`); return 4;
} else if (typeof xn != 'undefined' && getXpath('//footer//a[contains(string(), "Xiuno")] | //link[contains(@href, "xiuno")] | //script[contains(@src, "xiuno")]')) {
console.info(`[自动无缝翻页] - <Xiuno> 论坛`); return 5;
} else if (typeof XF != 'undefined') {
console.info('[自动无缝翻页] - <XenForo> 论坛'); return 6;
console.info(`[自动无缝翻页] - <XenForo> 论坛`); return 6;
} else if (getCSS('head meta[name="generator" i][content="nexusphp" i]') || getXpath('id("footer")[contains(string(), "NexusPHP")]')) {
console.info('[自动无缝翻页] - <NexusPHP> 论坛'); return 7;
console.info(`[自动无缝翻页] - <NexusPHP> 论坛`); return 7;
} else if (getAllCSS('.load-more, .loadmore, #load-more, #loadmore, .show_more').length === 1) {
console.info('[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 1'); return 8;
console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 1`); return 8;
} else if (getAllXpath('//*[@onclick][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]').length === 1) {
console.info('[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 2'); return 9;
console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 2`); return 9;
} else if (getCSS('link[href*="themes/dux" i], script[src*="themes/dux" i]')) {
console.info('[自动无缝翻页] - 使用 WordPress <DUX> 主题的网站'); return 100;
console.info(`[自动无缝翻页] - 使用 WordPress <DUX> 主题的网站`); return 100;
} else if (getCSS('link[href*="themes/xiu" i], script[src*="themes/xiu" i]')) {
console.info('[自动无缝翻页] - 使用 WordPress <XIU> 主题的网站'); return 101;
console.info(`[自动无缝翻页] - 使用 WordPress <XIU> 主题的网站`); return 101;
} else if (getCSS('link[href*="themes/d8" i], script[src*="themes/d8" i]')) {
console.info('[自动无缝翻页] - 使用 WordPress <D8> 主题的网站'); return 102;
console.info(`[自动无缝翻页] - 使用 WordPress <D8> 主题的网站`); return 102;
} else if (getCSS('link[href*="themes/begin" i], script[src*="themes/begin" i], img[src*="themes/begin" i]')) {
console.info('[自动无缝翻页] - 使用 WordPress <Begin> 主题的网站'); return 103;
console.info(`[自动无缝翻页] - 使用 WordPress <Begin> 主题的网站`); return 103;
} else if (getCSS('link[href*="/wp-content/" i], script[src*="/wp-content/" i]')) {
if (getAllCSS('article').length > 2 && getCSS('#nav-below, nav.navigation, nav.pagination, nav.paging-navigation')) {
if (getCSS('a.next')) {
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (a.next)'); return 104;
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (a.next)`); return 104;
} else if (getCSS('li.next-page > a')) {
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (li.next-page > a)'); return 105;
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (li.next-page > a)`); return 105;
} else if (getCSS('.nav-previous a')) {
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (旧文章)'); return 106;
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (旧文章)`); return 106;
} 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")]')) {
console.info('[自动无缝翻页] - 部分使用 WordPress 的网站 (下一页)'); return 107;
console.info(`[自动无缝翻页] - 部分使用 WordPress 的网站 (下一页)`); return 107;
}
}
} 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(), "下一页")]')) {
console.info('[自动无缝翻页] - <笔趣阁> 模板的小说网站'); return 200;
console.info(`[自动无缝翻页] - <笔趣阁> 模板的小说网站`); return 200;
}
return 0;
}
@@ -263,7 +263,7 @@
case 7: // < 所有 NexusPHP 论坛 >
DBSite.nexusphp.url(); break;
case 8: // < 部分自带 自动无缝翻页 的网站 1 >
DBSite.loadmore.url(); break;
DBSite.loadmore.url('.load-more, .loadmore, #load-more, #loadmore, .show_more'); break;
case 9: // < 部分自带 自动无缝翻页 的网站 2 >
DBSite.loadmore.url('//*[@onclick][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]'); break;
case 100: // < 所有使用 WordPress DUX 主题的网站 >
@@ -275,7 +275,7 @@
case 103: // < 所有使用 WordPress Begin 主题的网站 >
DBSite.begin.url(); break;
case 104: // < 部分使用 WordPress 的网站 (a.next) >
DBSite.wp_article.url(); break;
DBSite.wp_article.url('a.next'); break;
case 105: // < 部分使用 WordPress 的网站 (li.next-page > a) >
DBSite.wp_article.url('li.next-page > a'); break;
case 106: // < 部分使用 WordPress 的网站 (旧文章) >
@@ -361,7 +361,7 @@ function: {
*/ //<<< 规则简单说明 >>>
DBSite = {
loadmore: {
url: function(nextL = '.load-more, .loadmore, #load-more, #loadmore, .show_more') {curSite = DBSite.loadmore; curSite.pager.nextL = nextL;},
url: function(nextL) {curSite = DBSite.loadmore; curSite.pager.nextL = nextL;},
pager: {
type: 2,
isHidden: true,
@@ -585,7 +585,7 @@ function: {
}
}, // WordPress 的 Begin 主题 - 搜索页
wp_article: {
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'])"};}}},
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'])"};}}},
pager: {
pageE: 'article',
replaceE: '#nav-below, nav.navigation, nav.pagination, nav.paging-navigation',