|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 自动无缝翻页 |
3 | | -// @version 2.1.5 |
| 3 | +// @version 2.1.6 |
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 *://*/* |
|
329 | 329 | baidu_tieba: { |
330 | 330 | SiteTypeID: 0, |
331 | 331 | host: 'tieba.baidu.com', |
332 | | - functionStart: function() {if (location.pathname === '/f') { // 帖子列表 |
| 332 | + functionStart: function() {if (location.pathname === '/f') { |
333 | 333 | baidu_tieba_1(); // 右侧悬浮发帖按钮点击事件(解决自动翻页导致无法发帖的问题) |
334 | 334 | curSite = DBSite.baidu_tieba; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'img.j_retract {margin-top: 0 !important;margin-bottom: 0 !important;}'; // 修复帖子列表中预览图片,在切换下一个/上一个图片时,多出来的图片上下边距 |
335 | | - } else if (location.pathname === '/f/search/res') { // 吧内搜索/全吧搜索 |
| 335 | + //} else if (location.pathname.indexOf('/p/') > -1) { |
| 336 | + //curSite = DBSite.baidu_tieba_post; |
| 337 | + } else if (location.pathname === '/f/search/res') { |
336 | 338 | curSite = DBSite.baidu_tieba_search; |
337 | 339 | }}, |
338 | 340 | pager: { |
|
365 | 367 | pager: { |
366 | 368 | type: 1, |
367 | 369 | nextLink: '//a[@class="next"][@href]', |
368 | | - pageElement: 'css;.s_post_list > .s_post', |
369 | | - insertPosition: ['css;.s_post_list', 3], |
| 370 | + pageElement: 'css;#j_p_postlist > *', |
| 371 | + insertPosition: ['css;#j_p_postlist', 3], |
370 | 372 | replaceE: 'css;.pager.pager-search', |
| 373 | + scriptType: 1, |
371 | 374 | scrollDelta: 1000 |
372 | 375 | } |
373 | 376 | }, // 百度贴吧 - 搜索页 |
|
1648 | 1651 | before: lrepacks_functionBefore |
1649 | 1652 | } |
1650 | 1653 | }, |
| 1654 | + windowslatest: { |
| 1655 | + SiteTypeID: 0, |
| 1656 | + host: 'www.windowslatest.com', |
| 1657 | + pager: { |
| 1658 | + type: 1, |
| 1659 | + nextLink: '//div[contains(@class, "page-nav")]/a/i[@class="td-icon-menu-right"]/parent::a', |
| 1660 | + pageElement: 'css;.td-ss-main-content > div:not(.td-block-title-wrap):not(.page-nav)', |
| 1661 | + insertPosition: ['css;.page-nav', 1], |
| 1662 | + replaceE: 'css;.page-nav', |
| 1663 | + scrollDelta: 2000 |
| 1664 | + } |
| 1665 | + }, |
| 1666 | + winhelponline: { |
| 1667 | + SiteTypeID: 0, |
| 1668 | + host: 'www.winhelponline.com', |
| 1669 | + functionStart: function() {if (location.pathname === '/blog/') {curSite = DBSite.winhelponline;}}, |
| 1670 | + pager: { |
| 1671 | + type: 1, |
| 1672 | + nextLink: 'css;span.prev > a[href]', |
| 1673 | + pageElement: 'css;#main > article', |
| 1674 | + insertPosition: ['css;nav.paging-navigation', 1], |
| 1675 | + replaceE: 'css;nav.paging-navigation', |
| 1676 | + scrollDelta: 2000 |
| 1677 | + } |
| 1678 | + }, |
1651 | 1679 | thewindowsclub: { |
1652 | 1680 | SiteTypeID: 0, |
1653 | 1681 | host: 'www.thewindowsclub.com', |
|
3275 | 3303 | var newBody = ShowPager.createDocumentByString(response.responseText); |
3276 | 3304 | let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody), |
3277 | 3305 | toElement = getAllElements(curSite.pager.insertPosition[0])[0]; |
3278 | | - //console.log(curSite.pager.pageElement, pageElems) |
| 3306 | + //console.log(curSite.pager.pageElement, pageElems, curSite.pager.insertPosition, toElement) |
3279 | 3307 |
|
3280 | 3308 | if (pageElems.length >= 0) { |
3281 | 3309 | // 如果有插入前函数就执行函数 |
|
3301 | 3329 | let scriptText = ''; |
3302 | 3330 | if (curSite.pager.scriptType === 1) { // 下一页的所有 <script> 标签 |
3303 | 3331 | const scriptElems = getAllElements('//script', newBody, newBody); |
3304 | | - scriptElems.forEach(function (one) {scriptText += ';' + one.textContent;}); |
| 3332 | + scriptElems.forEach(function (one) { |
| 3333 | + if (one.src) { |
| 3334 | + toElement.appendChild(document.createElement('script')).src = one.src; |
| 3335 | + } else { |
| 3336 | + scriptText += ';' + one.textContent; |
| 3337 | + } |
| 3338 | + }); |
3305 | 3339 | toElement.appendChild(document.createElement('script')).textContent = scriptText; |
3306 | 3340 | } else if (curSite.pager.scriptType === 2) { // 下一页主体元素同级 <script> 标签 |
3307 | 3341 | pageElems.forEach(function (one) {if (one.tagName === 'SCRIPT') {scriptText += ';' + one.textContent;}}); |
|
0 commit comments