Skip to content

Commit bd8cf3f

Browse files
committed
新增 [篱笆网论坛] 支持; 优化 [Discuz! 论坛] 识别
1 parent 64228e1 commit bd8cf3f

1 file changed

Lines changed: 64 additions & 6 deletions

File tree

Autopage.user.js

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 自动无缝翻页
3-
// @version 2.1.0
3+
// @version 2.1.1
44
// @author X.I.U
55
// @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条、360、微信、贴吧、豆瓣、微博、NGA、V2EX、起点小说、煎蛋网、超能网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、小霸王其乐无穷、CS.RIN.RU、FitGirl、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、片库、音范丝、BT之家、爱恋动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、小众软件、极简插件、异次元软件、异星软件空间、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork(以上仅一部分,更多的写不下了...
66
// @match *://*/*
@@ -143,6 +143,9 @@
143143
insertPosition: ['css;#postlist', 3],
144144
replaceE: 'css;.pg, .pages',
145145
scrollDelta: 1000
146+
},
147+
function: {
148+
before: discuz_thread_functionBefore
146149
}
147150
}, // Discuz! - 帖子内
148151
discuz_search: {
@@ -1952,7 +1955,50 @@
19521955
replaceE: 'css;ul.main_List > li.i3',
19531956
scrollDelta: 1000
19541957
}
1955-
} // 宽带山论坛
1958+
}, // 宽带山论坛
1959+
libaclub: {
1960+
SiteTypeID: 0,
1961+
host: 'www.libaclub.com',
1962+
functionStart: function() {
1963+
if (location.pathname === '/' || location.pathname.indexOf('/date_') > -1) {
1964+
curSite = DBSite.libaclub;
1965+
} else if (location.pathname.indexOf('/f_') > -1) {
1966+
curSite = DBSite.libaclub_f;
1967+
} else if (location.pathname === '/facade.php') {
1968+
curSite = DBSite.libaclub_search;
1969+
}
1970+
document.lastElementChild.appendChild(document.createElement('style')).textContent = 'li.ui-list-merchant-ad, .ui-nav-appImage {display: none !important;}';},
1971+
pager: {
1972+
type: 1,
1973+
nextLink: '//div[@class="ui-crumbs-more"]/a[@class="fn-link"][1]',
1974+
pageElement: 'css;ul.ui-list > li:not(.ui-list-item-head):not(.ui-list-merchant-ad)',
1975+
insertPosition: ['css;ul.ui-list', 3],
1976+
replaceE: 'css;div.ui-crumbs-more',
1977+
scrollDelta: 1000
1978+
}
1979+
}, // 篱笆网论坛
1980+
libaclub_f: {
1981+
SiteTypeID: 0,
1982+
pager: {
1983+
type: 1,
1984+
nextLink: '//div[@class="ui-paging"]/a[@class="ui-paging-next"]',
1985+
pageElement: 'css;ul.ui-list > li:not(.ui-list-item-head):not(.ui-list-merchant-ad)',
1986+
insertPosition: ['css;ul.ui-list', 3],
1987+
replaceE: 'css;div.ui-paging',
1988+
scrollDelta: 1000
1989+
}
1990+
}, // 篱笆网论坛 - 各版块帖子列表
1991+
libaclub_search: {
1992+
SiteTypeID: 0,
1993+
pager: {
1994+
type: 1,
1995+
nextLink: '//div[@class="ui-page"]/a[contains(text(), "下一页")]',
1996+
pageElement: 'css;.ui-box-main > ul.ui-list > li',
1997+
insertPosition: ['css;.ui-box-main > ul.ui-list', 3],
1998+
replaceE: 'css;div.ui-page',
1999+
scrollDelta: 1000
2000+
}
2001+
} // 篱笆网论坛 - 搜索页
19562002
};
19572003
// 生成 SiteTypeID
19582004
generateID();
@@ -1964,8 +2010,8 @@
19642010
}
19652011

19662012

1967-
// < 所有 Discuz!论坛 >
19682013
if (webType != 1) {
2014+
// < 所有 Discuz!论坛 >
19692015
if (webType === 2) {
19702016
if (location.pathname.indexOf('.html') > -1) { // 判断是不是静态网页(.html 结尾)
19712017
if (location.pathname.indexOf('/forum-') > -1) { // < 各版块帖子列表 >
@@ -1984,7 +2030,9 @@
19842030
} else if(location.pathname.indexOf('search') > -1) { // < 搜索结果 >
19852031
curSite = DBSite.discuz_search;
19862032
}
1987-
} else {
2033+
}
2034+
// 如果没有匹配的则继续
2035+
if (curSite.SiteTypeID === 0) {
19882036
if (location.search.indexOf('mod=forumdisplay') > -1 || location.pathname.indexOf('forumdisplay.php') > -1) { // < 各版块帖子列表 >
19892037
if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮
19902038
curSite = DBSite.discuz_forum;
@@ -2036,12 +2084,22 @@
20362084
function hidePgbtn() {
20372085
document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}';
20382086
}
2039-
20402087
// [Discuz! 论坛] 图片模式列表样式预处理
20412088
function waterfallStyle() {
20422089
let width = document.querySelector('#waterfall > li:first-child').style.width;
20432090
document.lastChild.appendChild(document.createElement('style')).textContent = `#waterfall {height: auto !important; width: 100% !important;} #waterfall > li {width: ${width} !important; float: left !important; position: inherit !important; left: auto !important; top: auto !important;}`;
20442091
}
2092+
// [Discuz! 论坛] 的插入前函数(加载图片,仅部分论坛)
2093+
function discuz_thread_functionBefore(pageElems) {
2094+
if (location.hostname === 'bbs.pcbeta.com') { // 仅部分论坛需要处理
2095+
pageElems.forEach(function (one) {
2096+
one.querySelectorAll('img[file]').forEach(function (now) {
2097+
now.src = now.getAttribute('file');
2098+
});
2099+
});
2100+
}
2101+
return pageElems
2102+
}
20452103

20462104

20472105
// 通用型插入前函数(加载图片 data-original => src)
@@ -2983,7 +3041,7 @@
29833041

29843042
if (support) {
29853043
console.info('[自动无缝翻页] - 其他网站(独立规则)'); return 1;
2986-
} else if (document.querySelector('meta[name="author"][content*="Discuz!"], meta[name="generator"][content*="Discuz!"]') || document.querySelector('a[href*="www.discuz.net"]') && document.querySelector('a[href*="www.discuz.net"]').textContent.indexOf('Discuz!') > -1) {
3044+
} else if (document.querySelector('meta[name="author"][content*="Discuz!"], meta[name="generator"][content*="Discuz!"]') || (document.querySelector('a[href*="www.discuz.net"]') && document.querySelector('a[href*="www.discuz.net"]').textContent.indexOf('Discuz!') > -1) || (document.getElementById('ft') && document.getElementById('ft').textContent.indexOf('Discuz!') > -1)) {
29873045
console.info('[自动无缝翻页] - Discuz! 论坛'); return 2;
29883046
} else if (document.getElementById('flarum-loading')) {
29893047
console.info('[自动无缝翻页] - Flarum 论坛'); return 3;

0 commit comments

Comments
 (0)