Skip to content

Commit c7afce8

Browse files
committed
优化 [Discuz! - 帖子列表页图片模式]、[Discuz! - 自带翻页的帖子列表] 通用规则; 调整 脚本翻页报错信息显示内容。
1 parent abee0d5 commit c7afce8

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

Autopage.user.js

Lines changed: 20 additions & 12 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 6.6.42
6+
// @version 6.6.43
77
// @author X.I.U
88
// @description ⭐无缝加载 下一页内容 至网页底部(类似瀑布流,无限滚动,无需手动点击下一页)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、MyBB、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...) 等網站~
@@ -228,7 +228,7 @@
228228
if (new Function('fun', DBSite[now].url)(window.autoPage)) {curSite = DBSite[now];} else {if (urlC === true) {support = true;}; break;}
229229
}
230230
} catch (e) {
231-
console.error('[自动无缝翻页] - 当前网页规则 "url" 有误,请检查', e, DBSite[now].url);
231+
console.error('[自动无缝翻页] - 当前网页规则 "url" 匹配出错,请检查:\n', DBSite[now].url + '\n\n', e);
232232
}
233233
}
234234
} else {
@@ -259,7 +259,7 @@
259259

260260
}
261261
} catch (e) {
262-
console.error('[自动无缝翻页] - 当前网页规则 "url" 有误,请检查', e, DBSite[now].url);
262+
console.error('[自动无缝翻页] - 当前网页规则 "url" 匹配出错,请检查:\n', DBSite[now].url + '\n\n', e);
263263
}
264264
}
265265
} else {
@@ -731,7 +731,7 @@ function: {
731731
pager: {
732732
type: 2,
733733
nextL: '#autopbn',
734-
nextTextOf: '下一'
734+
interval: 800
735735
}
736736
}, // Discuz! 论坛 - 帖子列表(自带无缝加载下一页按钮的)
737737
discuz_guide: {
@@ -742,16 +742,17 @@ function: {
742742
replaceE: '.pg, .pages',
743743
forceHTTPS: true
744744
}
745-
}, // Discuz! 论坛 - 导读页 及 帖子列表(不带无缝加载下一页按钮的)
745+
}, // Discuz! 论坛 - 导读页 及 帖子列表(不带无缝加载下一页按钮的,或存在按钮但只是单纯跳转下一页链接的
746746
discuz_waterfall: {
747747
ignore: true,
748+
style: '.pgbtn',
748749
pager: {
749750
nextL: 'a.nxt:not([href^="javascript"]) ,a.next:not([href^="javascript"])',
750-
pageE: '#waterfall > li',
751+
pageE: '#waterfall > li, #waterfall > dl',
751752
replaceE: '.pg, .pages',
752753
forceHTTPS: true
753754
}
754-
}, // Discuz! 论坛 - 图片模式的帖子列表(不带无缝加载下一页按钮的)
755+
}, // Discuz! 论坛 - 图片模式的帖子列表(不带无缝加载下一页按钮的,或存在按钮但只是单纯跳转下一页链接的
755756
discuz_thread: {
756757
ignore: true,
757758
thread: true,
@@ -1381,8 +1382,15 @@ function: {
13811382
}
13821383
// [Discuz! 论坛] 图片模式列表样式预处理
13831384
function waterfallStyle() {
1384-
let width = getCSS('#waterfall > li:first-child').style.width;
1385-
if (width) insStyle(`#waterfall {height: auto !important; width: 100% !important;} #waterfall > li {width: ${width} !important; float: left !important; position: inherit !important; left: auto !important; top: auto !important;}`);
1385+
let waterfall_ = getCSS('#waterfall > li:first-child');
1386+
if (waterfall_ && waterfall_.style && waterfall_.style.width) {
1387+
insStyle(`#waterfall {height: auto !important; width: 100% !important;} #waterfall > li {width: ${waterfall_.style.width} !important; float: left !important; position: inherit !important; left: auto !important; top: auto !important;}`);
1388+
} else {
1389+
waterfall_ = getAllCSS('#waterfall > dl');
1390+
if (waterfall_ && waterfall_.length > 5) {
1391+
insStyle(`#waterfall > dl {display: unset !important;}`);
1392+
}
1393+
}
13861394
}
13871395

13881396

@@ -1669,7 +1677,7 @@ function: {
16691677
//console.log('URL:' + url, '最终 URL:' + xhr.responseURL, '返回内容:' + xhr.responseText)
16701678
processElems(createDocumentByString(xhr.responseText));
16711679
} catch (e) {
1672-
console.error('[自动无缝翻页] - 处理获取到的下一页内容时出现问题,请检查!', 'URL:' + url, '最终 URL:' + xhr.responseURL, '返回状态:' + xhr.statusText, '返回内容:' + xhr.responseText);
1680+
console.error('[自动无缝翻页] - 处理获取到的下一页内容时出现问题,请检查!\n', e, '\nURL:' + url, '\n最终 URL:' + xhr.responseURL, '\n返回状态:' + xhr.statusText, '\n返回内容:' + xhr.responseText);
16731681
}
16741682
};
16751683
xhr.onerror = function() {
@@ -1698,7 +1706,7 @@ function: {
16981706
//console.log('URL:' + url, '最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
16991707
processElems(createDocumentByString(response.responseText));
17001708
} catch (e) {
1701-
console.error('[自动无缝翻页] - 处理获取到的下一页内容时出现问题,请检查!', e, 'URL:' + url, '最终 URL:' + response.finalUrl, '返回状态:' + response.statusText, '返回内容:' + response.responseText);
1709+
console.error('[自动无缝翻页] - 处理获取到的下一页内容时出现问题,请检查!\n', e, '\nURL:' + url, '\n最终 URL:' + response.finalUrl, '\n返回状态:' + response.statusText, '\n返回内容:' + response.responseText);
17021710
}
17031711
},
17041712
onerror: function (response) {
@@ -2221,7 +2229,7 @@ function: {
22212229
curSite.pageUrl = tempUrl;
22222230
func(curSite.pageUrl);
22232231
} catch (e) {
2224-
console.error('[自动无缝翻页] - 当前网页规则 "nextL" 内 JS 代码有误,请检查', e, curSite.pager.nextL);
2232+
console.error('[自动无缝翻页] - 当前网页规则 "nextL" 内 JS 代码有误,请检查:\n', curSite.pager.nextL + '\n\n', e);
22252233
}
22262234
} else if (getNextE_()) {
22272235
func(curSite.pageUrl);

0 commit comments

Comments
 (0)