From 6154ce4a4c9ee5bb9bd0bbdce0ae9f2b00dd5b12 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Wed, 1 Sep 2021 18:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[Discuz!=20=E5=90=84?= =?UTF-8?q?=E6=9D=BF=E5=9D=97=E5=9B=BE=E7=89=87=E5=88=97=E8=A1=A8=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F]=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 5bbd95c..c573eaf 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 2.0.4 +// @version 2.0.5 // @author X.I.U // @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(更多的写不下了... // @match *://*/* @@ -108,10 +108,32 @@ pager: { type: 2, nextLink: '#autopbn', - nextText: '下一页 »', + nextTextOf: '下一页', scrollDelta: 1500 } }, // Discuz! - 各版块帖子列表(自带无缝加载下一页按钮的) + discuz_guide: { + SiteTypeID: 0, + pager: { + type: 1, + nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]', + pageElement: 'css;#threadlist table > tbody[id^="normalthread_"]', + insertPosition: ['id("threadlist")//table/tbody[starts-with(@id, "normalthread_")]/parent::table', 3], + replaceE: 'css;.pg, .pages', + scrollDelta: 1000 + } + }, // Discuz! - 导读页 及 各版块帖子列表(不带无缝加载下一页按钮的) + discuz_waterfall: { + SiteTypeID: 0, + pager: { + type: 1, + nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]', + pageElement: 'css;#waterfall > li', + insertPosition: ['css;#waterfall', 3], + replaceE: 'css;.pg, .pages', + scrollDelta: 1000 + } + }, // Discuz! - 图片模式的各版块帖子列表(不带无缝加载下一页按钮的) discuz_thread: { SiteTypeID: 0, pager: { @@ -134,17 +156,6 @@ scrollDelta: 1000 } }, // Discuz! - 搜索页 - discuz_guide: { - SiteTypeID: 0, - pager: { - type: 1, - nextLink: '//a[@class="nxt"][@href][not(contains(@href, "javascript"))] | //a[@class="next"][@href][not(contains(@href, "javascript"))]', - pageElement: 'css;#threadlist table > tbody[id^="normalthread_"]', - insertPosition: ['id("threadlist")//table/tbody[starts-with(@id, "normalthread_")]/parent::table', 3], - replaceE: 'css;.pg, .pages', - scrollDelta: 1000 - } - }, // Discuz! - 导读页 及 各版块帖子列表(不带无缝加载下一页按钮的) discuz_youspace: { SiteTypeID: 0, pager: { @@ -1847,6 +1858,8 @@ if (location.pathname.indexOf('/forum-') > -1) { // < 各版块帖子列表 > if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮 curSite = DBSite.discuz_forum; + } else if (document.getElementById('waterfall')) { // 判断是否为图片模式 + curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理 } else { curSite = DBSite.discuz_guide; } @@ -1862,6 +1875,8 @@ if (location.search.indexOf('mod=forumdisplay') > -1 || location.pathname.indexOf('forumdisplay.php') > -1) { // < 各版块帖子列表 > if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮 curSite = DBSite.discuz_forum; + } else if (document.getElementById('waterfall')) { // 判断是否为图片模式 + curSite = DBSite.discuz_waterfall; waterfallStyle(); // 图片模式列表样式预处理 } else { curSite = DBSite.discuz_guide; } @@ -1904,6 +1919,13 @@ document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}'; } + // [Discuz! 论坛] 图片模式列表样式预处理 + function waterfallStyle() { + let width = document.querySelector('#waterfall > li:first-child').style.width; + 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;}`; + } + // 通用型插入前函数(加载图片 data-original => src) function src_original_functionBefore(pageElems) {