|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 自动无缝翻页 |
3 | | -// @version 1.4.4 |
| 3 | +// @version 1.4.5 |
4 | 4 | // @author X.I.U |
5 | | -// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、豆瓣、微博、千图网、3DM、游侠网、游民星空、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、RARBG、PubMed、AfreecaTV、AlphaCoders、FitGirl Repacks... |
| 5 | +// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、RARBG、PubMed、AfreecaTV、AlphaCoders、FitGirl Repacks... |
6 | 6 | // @match *://*/* |
7 | 7 | // @connect www.gamersky.com |
8 | 8 | // @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png |
|
22 | 22 | 'use strict'; |
23 | 23 | var webType, curSite = {SiteTypeID: 0}; |
24 | 24 | // 目前支持的网站 |
25 | | - const websiteList = ['movie.douban.com', 'weibo.com', 'www.58pic.com', |
| 25 | + const websiteList = ['www.baidu.com', 'movie.douban.com', 'weibo.com', 'www.58pic.com', |
26 | 26 | 'www.3dmgame.com', 'www.ali213.net', 'gl.ali213.net', 'www.gamersky.com', |
27 | 27 | 'www.423down.com', 'apphot.cc', 'iao.su', 'www.ypojie.com', 'www.appinn.com', 'www.weidown.com', 'www.luochenzhimu.com', 'www.iplaysoft.com', 'www.mpyit.com', 'www.yxssp.com', |
28 | 28 | 'www.gufengmh8.com', |
|
164 | 164 | before: dux_beforeFunction |
165 | 165 | } |
166 | 166 | }, |
| 167 | + baidu: { |
| 168 | + SiteTypeID: 0, |
| 169 | + pager: { |
| 170 | + type: 1, |
| 171 | + nextLink: '//div[@id="page"]//a[contains(text(),"下一页")][@href]', |
| 172 | + pageElement: 'css;#content_left > *', |
| 173 | + HT_insert: ['css;#content_left', 3], |
| 174 | + replaceE: 'css;#page', |
| 175 | + scrollDelta: 1200 |
| 176 | + } |
| 177 | + }, |
167 | 178 | douban_subject_comments: { |
168 | 179 | SiteTypeID: 0, |
169 | 180 | pager: { |
|
519 | 530 | if (location.host === 'apphot.cc') curSite.pager.scrollDelta = 1600; // 对于速度慢的网站,需要增加翻页敏感度 |
520 | 531 | break; |
521 | 532 | // 以上几个都是 WordPress 的 DUX 主题 |
| 533 | + case 'www.baidu.com': // < 百度搜索 > |
| 534 | + if (location.pathname === '/s') curSite = DBSite.baidu; |
| 535 | + break; |
522 | 536 | case 'movie.douban.com': // < 豆瓣评论 > |
523 | 537 | if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/comments') > -1) { // 短评 |
524 | 538 | curSite = DBSite.douban_subject_comments; |
|
945 | 959 | timeout: 5000, |
946 | 960 | onload: function (response) { |
947 | 961 | try { |
948 | | - //console.log(`${response.responseText}`) |
| 962 | + //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText) |
949 | 963 | var newBody = ShowPager.createDocumentByString(response.responseText); |
950 | 964 | let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody); |
951 | 965 | if (pageElems.length >= 0) { |
|
1035 | 1049 | if (curSite.pager) { |
1036 | 1050 | let curPageEle = getElementByXpath(curSite.pager.nextLink); |
1037 | 1051 | var url = this.getFullHref(curPageEle); |
1038 | | - //console.log(`${url} ${curPageEle} ${curSite.pageUrl}`); |
| 1052 | + console.log(`${url} ${curPageEle} ${curSite.pageUrl}`); |
1039 | 1053 | if (url === '') return; |
1040 | 1054 | if (curSite.pageUrl === url) return;// 避免重复加载相同的页面 |
1041 | 1055 | curSite.pageUrl = url; |
|
1047 | 1061 | timeout: 5000, |
1048 | 1062 | onload: function (response) { |
1049 | 1063 | try { |
1050 | | - //console.log(`${response.responseText}`) |
| 1064 | + //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText) |
1051 | 1065 | var newBody = ShowPager.createDocumentByString(response.responseText); |
1052 | 1066 | let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody); |
1053 | 1067 | let toElement = getAllElements(curSite.pager.HT_insert[0])[0]; |
|
0 commit comments