|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 自动无缝翻页 |
3 | | -// @version 2.1.0 |
| 3 | +// @version 2.1.1 |
4 | 4 | // @author X.I.U |
5 | 5 | // @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(以上仅一部分,更多的写不下了... |
6 | 6 | // @match *://*/* |
|
143 | 143 | insertPosition: ['css;#postlist', 3], |
144 | 144 | replaceE: 'css;.pg, .pages', |
145 | 145 | scrollDelta: 1000 |
| 146 | + }, |
| 147 | + function: { |
| 148 | + before: discuz_thread_functionBefore |
146 | 149 | } |
147 | 150 | }, // Discuz! - 帖子内 |
148 | 151 | discuz_search: { |
|
1952 | 1955 | replaceE: 'css;ul.main_List > li.i3', |
1953 | 1956 | scrollDelta: 1000 |
1954 | 1957 | } |
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 | + } // 篱笆网论坛 - 搜索页 |
1956 | 2002 | }; |
1957 | 2003 | // 生成 SiteTypeID |
1958 | 2004 | generateID(); |
|
1964 | 2010 | } |
1965 | 2011 |
|
1966 | 2012 |
|
1967 | | - // < 所有 Discuz!论坛 > |
1968 | 2013 | if (webType != 1) { |
| 2014 | + // < 所有 Discuz!论坛 > |
1969 | 2015 | if (webType === 2) { |
1970 | 2016 | if (location.pathname.indexOf('.html') > -1) { // 判断是不是静态网页(.html 结尾) |
1971 | 2017 | if (location.pathname.indexOf('/forum-') > -1) { // < 各版块帖子列表 > |
|
1984 | 2030 | } else if(location.pathname.indexOf('search') > -1) { // < 搜索结果 > |
1985 | 2031 | curSite = DBSite.discuz_search; |
1986 | 2032 | } |
1987 | | - } else { |
| 2033 | + } |
| 2034 | + // 如果没有匹配的则继续 |
| 2035 | + if (curSite.SiteTypeID === 0) { |
1988 | 2036 | if (location.search.indexOf('mod=forumdisplay') > -1 || location.pathname.indexOf('forumdisplay.php') > -1) { // < 各版块帖子列表 > |
1989 | 2037 | if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮 |
1990 | 2038 | curSite = DBSite.discuz_forum; |
|
2036 | 2084 | function hidePgbtn() { |
2037 | 2085 | document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}'; |
2038 | 2086 | } |
2039 | | - |
2040 | 2087 | // [Discuz! 论坛] 图片模式列表样式预处理 |
2041 | 2088 | function waterfallStyle() { |
2042 | 2089 | let width = document.querySelector('#waterfall > li:first-child').style.width; |
2043 | 2090 | 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;}`; |
2044 | 2091 | } |
| 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 | + } |
2045 | 2103 |
|
2046 | 2104 |
|
2047 | 2105 | // 通用型插入前函数(加载图片 data-original => src) |
|
2983 | 3041 |
|
2984 | 3042 | if (support) { |
2985 | 3043 | 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)) { |
2987 | 3045 | console.info('[自动无缝翻页] - Discuz! 论坛'); return 2; |
2988 | 3046 | } else if (document.getElementById('flarum-loading')) { |
2989 | 3047 | console.info('[自动无缝翻页] - Flarum 论坛'); return 3; |
|
0 commit comments