Skip to content

Commit 6154ce4

Browse files
committed
新增 [Discuz! 各板块图片列表模式] 支持
1 parent 1630025 commit 6154ce4

1 file changed

Lines changed: 35 additions & 13 deletions

File tree

Autopage.user.js

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 自动无缝翻页
3-
// @version 2.0.4
3+
// @version 2.0.5
44
// @author X.I.U
55
// @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、贴吧、豆瓣、微博、NGA(玩家社区)、V2EX、看雪论坛、起点小说、煎蛋网、超能网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、小霸王其乐无穷、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、片库、音范丝、BT之家、爱恋动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、小众软件、极简插件、果核剥壳、六音软件、微当下载、th-sjy 汉化、异次元软件、老殁殁漂遥、异星软件空间、动漫狂、漫画猫、漫画DB、HiComic(嗨漫画)、动漫之家、古风漫画网、砂之船动漫家、PubMed、wikiHow、GreasyFork、CS.RIN.RU、FitGirl(更多的写不下了...
66
// @match *://*/*
@@ -108,10 +108,32 @@
108108
pager: {
109109
type: 2,
110110
nextLink: '#autopbn',
111-
nextText: '下一页 »',
111+
nextTextOf: '下一页',
112112
scrollDelta: 1500
113113
}
114114
}, // Discuz! - 各版块帖子列表(自带无缝加载下一页按钮的)
115+
discuz_guide: {
116+
SiteTypeID: 0,
117+
pager: {
118+
type: 1,
119+
nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
120+
pageElement: 'css;#threadlist table > tbody[id^="normalthread_"]',
121+
insertPosition: ['id("threadlist")//table/tbody[starts-with(@id, "normalthread_")]/parent::table', 3],
122+
replaceE: 'css;.pg, .pages',
123+
scrollDelta: 1000
124+
}
125+
}, // Discuz! - 导读页 及 各版块帖子列表(不带无缝加载下一页按钮的)
126+
discuz_waterfall: {
127+
SiteTypeID: 0,
128+
pager: {
129+
type: 1,
130+
nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
131+
pageElement: 'css;#waterfall > li',
132+
insertPosition: ['css;#waterfall', 3],
133+
replaceE: 'css;.pg, .pages',
134+
scrollDelta: 1000
135+
}
136+
}, // Discuz! - 图片模式的各版块帖子列表(不带无缝加载下一页按钮的)
115137
discuz_thread: {
116138
SiteTypeID: 0,
117139
pager: {
@@ -134,17 +156,6 @@
134156
scrollDelta: 1000
135157
}
136158
}, // Discuz! - 搜索页
137-
discuz_guide: {
138-
SiteTypeID: 0,
139-
pager: {
140-
type: 1,
141-
nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]',
142-
pageElement: 'css;#threadlist table > tbody[id^="normalthread_"]',
143-
insertPosition: ['id("threadlist")//table/tbody[starts-with(@id, "normalthread_")]/parent::table', 3],
144-
replaceE: 'css;.pg, .pages',
145-
scrollDelta: 1000
146-
}
147-
}, // Discuz! - 导读页 及 各版块帖子列表(不带无缝加载下一页按钮的)
148159
discuz_youspace: {
149160
SiteTypeID: 0,
150161
pager: {
@@ -1847,6 +1858,8 @@
18471858
if (location.pathname.indexOf('/forum-') > -1) { // < 各版块帖子列表 >
18481859
if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮
18491860
curSite = DBSite.discuz_forum;
1861+
} else if (document.getElementById('waterfall')) { // 判断是否为图片模式
1862+
curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理
18501863
} else {
18511864
curSite = DBSite.discuz_guide;
18521865
}
@@ -1862,6 +1875,8 @@
18621875
if (location.search.indexOf('mod=forumdisplay') > -1 || location.pathname.indexOf('forumdisplay.php') > -1) { // < 各版块帖子列表 >
18631876
if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮
18641877
curSite = DBSite.discuz_forum;
1878+
} else if (document.getElementById('waterfall')) { // 判断是否为图片模式
1879+
curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理
18651880
} else {
18661881
curSite = DBSite.discuz_guide;
18671882
}
@@ -1904,6 +1919,13 @@
19041919
document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}';
19051920
}
19061921

1922+
// [Discuz! 论坛] 图片模式列表样式预处理
1923+
function waterfallStyle() {
1924+
let width = document.querySelector('#waterfall > li:first-child').style.width;
1925+
document.lastChild.appendChild(document.createElement('style')).textContent = `#waterfall {height: auto !important; width: 100% !important;}
1926+
#waterfall > li {width: ${width} !important; float: left !important; position: inherit !important; left: auto !important; top: auto !important;}`;
1927+
}
1928+
19071929

19081930
// 通用型插入前函数(加载图片 data-original => src)
19091931
function src_original_functionBefore(pageElems) {

0 commit comments

Comments
 (0)