Skip to content

Commit 19fa993

Browse files
committed
优化 [更新外置翻页规则] 功能
1 parent 09d5a74 commit 19fa993

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

Autopage.user.js

Lines changed: 22 additions & 8 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.6.5
6+
// @version 5.6.6
77
// @author X.I.U
88
// @description ⭐无缝衔接下一页内容到网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、微博、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(以上仅一小部分,更多的写不下了...
99
// @description:zh-TW ⭐無縫銜接下一頁內容到網頁底部(類似瀑布流)⭐,支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎(Google、Bing、Yahoo...) 等網站~
@@ -1544,7 +1544,13 @@ function: {
15441544
'https://cdn.staticaly.com/gh/XIU2/UserScript/master/other/Autopage/rules.json',
15451545
//'https://cdn.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json',
15461546
'https://gcore.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json',
1547-
'https://fastly.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json']
1547+
'https://fastly.jsdelivr.net/gh/XIU2/UserScript/other/Autopage/rules.json'],
1548+
urlArr2 = [//'https://userscript.gh2233.ml/other/Autopage/rules.json',
1549+
'https://userscript.xiu2.xyz/other/Autopage/rules.json',
1550+
'https://raw.iqiq.io/XIU2/UserScript/master/other/Autopage/rules.json',
1551+
'https://hk1.monika.love/XIU2/UserScript/master/other/Autopage/rules.json',
1552+
'https://raw.fastgit.org/XIU2/UserScript/master/other/Autopage/rules.json',
1553+
'https://ghproxy.fsofso.com/https://github.com/XIU2/UserScript/blob/master/other/Autopage/rules.json']
15481554

15491555
if (update) { // 手动更新(或安装后首次更新)
15501556
GM_notification({text: '🔄 更新外置翻页规则中,请勿操作网页...', timeout: 3000});
@@ -1553,9 +1559,8 @@ function: {
15531559
getRulesUrl_();
15541560
}
15551561

1556-
function getRulesUrl_(n = false) {
1557-
let url;
1558-
if (n) {url = 'https://userscript.xiu2.xyz/other/Autopage/rules.json'} else {url = urlArr[Math.floor(Math.random()*urlArr.length)];}
1562+
function getRulesUrl_(n = false, url) {
1563+
if (n) {url = urlArr2[Math.floor(Math.random()*urlArr2.length)];} else {url = urlArr[Math.floor(Math.random()*urlArr.length)];}
15591564
GM_xmlhttpRequest({
15601565
url: url,
15611566
method: 'GET',
@@ -1588,11 +1593,11 @@ function: {
15881593
},
15891594
onerror: function (response) {
15901595
console.log('URL:' + url, response)
1591-
GM_notification({text: '❌ 错误!更新失败,请联系作者解决...', timeout: 5000});
1596+
GM_notification({text: '❌ 错误!更新失败,请几分钟后重试...', timeout: 5000});
15921597
},
15931598
ontimeout: function (response) {
15941599
console.log('URL:' + url, response)
1595-
GM_notification({text: '❌ 超时!更新失败,请联系作者解决...', timeout: 5000});
1600+
GM_notification({text: '❌ 超时!更新失败,请几分钟后重试...', timeout: 5000});
15961601
}
15971602
})
15981603
}
@@ -1616,7 +1621,9 @@ function: {
16161621
// 左键双击网页空白处暂停翻页
16171622
pausePageEvent();
16181623
// 强制新标签页打开链接
1619-
if (curSite.blank != undefined || curSite.forceTarget != undefined) forceTarget();
1624+
if (curSite.blank != undefined) forceTarget();
1625+
// 初始化事件
1626+
//if (curSite.initE != undefined) initEvent();
16201627

16211628
// 对于使用 pjax 技术的网站,需要监听 URL 变化来重新判断翻页规则
16221629
if (urlC) {
@@ -1635,6 +1642,8 @@ function: {
16351642
nowLocation = location.href; curSite = {SiteTypeID: 0}; pageNum.now = 1; // 重置规则+页码
16361643
registerMenuCommand(); // 重新判断规则
16371644
//console.log(curSite);
1645+
if (curSite.blank != undefined) forceTarget(); // 强制新标签页打开链接
1646+
//if (curSite.initE != undefined) initEvent(); // 初始化事件
16381647
if (curSite.style) {insStyle(curSite.style)} // 插入 Style CSS 样式
16391648
// 帖子内自动翻页判断
16401649
if (!GM_getValue('menu_thread')) {
@@ -3308,6 +3317,11 @@ function: {
33083317
});
33093318
}
33103319
}
3320+
// 初始化事件
3321+
/*function initEvent() {
3322+
if (curSite.initE[1] == undefined) curSite.initE[1] = 500;
3323+
setTimeout(function(){getAllCSS(curSite.initE[0]).forEach(function (o) {o.innerHTML = o.innerHTML;});}, curSite.initE[1])
3324+
}*/
33113325
// 判断元素是否隐藏(隐藏返回 true)
33123326
function isHidden(el){
33133327
return (el.offsetParent === null);

0 commit comments

Comments
 (0)