优化 [自带自动无缝翻页网站] 通用规则

This commit is contained in:
xiu2
2022-06-24 12:21:57 +08:00
parent 7252007704
commit 7d26f25dd3
+14 -4
View File
@@ -3,7 +3,7 @@
// @name:zh-CN 自动无缝翻页
// @name:zh-TW 自動無縫翻頁
// @name:en AutoPager
// @version 6.0.12
// @version 6.0.13
// @author X.I.U
// @description ⭐无缝加载 下一页内容 至网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、B 站(bilibili)、NGA、V2EX、煎蛋网、龙的天空、起点中文、千图网、千库网、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...) 等網站~
@@ -114,7 +114,10 @@
'https://raw.xn--gzu630h.xn--kpry57d/XIU2/UserScript/master/other/Autopage/rules.json',
'https://raw.xn--p8jhe.tw/XIU2/UserScript/master/other/Autopage/rules.json'
//'https://git.yumenaka.net/https://raw.githubusercontent.com/XIU2/UserScript/master/other/Autopage/rules.json'
], menuId = [], webType = 0, curSite = {SiteTypeID: 0}, DBSite, DBSite2, pausePage = true, pageNum = {now: 1, _now: 1}, urlC = false, nowLocation = '', lp = location.pathname, scriptHandler;
],
loadMoreExclude1 = ['stackoverflow.com'],
loadMoreExclude2 = ['.smzdm.com','.steampowered.com','.zcool.com.cn'],
menuId = [], webType = 0, curSite = {SiteTypeID: 0}, DBSite, DBSite2, pausePage = true, pageNum = {now: 1, _now: 1}, urlC = false, nowLocation = '', lp = location.pathname, scriptHandler;
window.autoPage = {lp: ()=>location.pathname, indexOF: indexOF, isMobile: isMobile, isUrlC: isUrlC, blank: forceTarget, getAll: getAll, getOne: getOne, getAllXpath: getAllXpath, getXpath: getXpath, getAllCSS: getAllCSS, getCSS: getCSS, getNextE: getNextE, getNextEP: getNextEP, getNextSP: getNextSP, getNextEPN: getNextEPN, getNextUPN: getNextUPN, getNextUP: getNextUP, getNextF: getNextF, getSearch: getSearch, getCookie: getCookie, insStyle: insStyle, insScript: insScript, src_bF: src_bF, xs_bF: xs_bF}
if (typeof GM_info != 'undefined') {scriptHandler = GM_info.scriptHandler;} else if (typeof GM != 'undefined' && typeof GM.info != 'undefined') {scriptHandler = GM.info.scriptHandler;} else {scriptHandler = '';}
for (let i=0;i<menuAll.length;i++){ // 如果读取到的值为 null 就写入默认值
@@ -263,10 +266,10 @@
} else if (getCSS('head meta[name="generator" i][content="nexusphp" i]') || getXpath('id("footer")[contains(string(), "NexusPHP")]')) {
console.info(`[自动无缝翻页] - <NexusPHP> 论坛`); return 7;
} else if (location.hostname.indexOf('stackoverflow.com') == -1 && getAllCSS('.load-more, .load_more, .loadmore, #load-more, #load_more, #loadmore, .show-more, .show_more').length === 1) {
} else if (loadMoreExclude(loadMoreExclude1) && getAllCSS('.load-more, .load_more, .loadmore, #load-more, #load_more, #loadmore, .show-more, .show_more').length === 1) {
console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 1`); return 8;
} else if (location.hostname.indexOf('.smzdm.com') == -1 && location.hostname.indexOf('.steampowered.com') == -1 && getAllXpath('//*[self::a or self::span or self::button or self::div][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]').length === 1) {
} else if (loadMoreExclude(loadMoreExclude2) && getAllXpath('//*[self::a or self::span or self::button or self::div][text()="加载更多" or text()="查看更多"][not(@href) or @href="#" or starts-with(@href, "javascript")]').length === 1) {
console.info(`[自动无缝翻页] - 部分自带 自动无缝翻页 的网站 2`); return 9;
} else if (getCSS('link[href*="/wp-content/" i], script[src*="/wp-content/" i]')) {
@@ -2754,6 +2757,13 @@ function: {
DBSite[val].SiteTypeID = num = num + 1;
}
}
// 遍历 loadMoreExclude 数组,判断是否包含域名
function loadMoreExclude(l) {
for (let i=0; i<l.length; i++) {
if (location.hostname.indexOf(l[i]) != -1) return false
}
return true
}
// 获取 Cookie
function getCookie(name) {
if (!name) return ''