Skip to content

Commit 6339c68

Browse files
committed
新增 [百度搜索] 支持
1 parent ea524a9 commit 6339c68

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

Autopage.user.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// ==UserScript==
22
// @name 自动无缝翻页
3-
// @version 1.4.4
3+
// @version 1.4.5
44
// @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...
66
// @match *://*/*
77
// @connect www.gamersky.com
88
// @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png
@@ -22,7 +22,7 @@
2222
'use strict';
2323
var webType, curSite = {SiteTypeID: 0};
2424
// 目前支持的网站
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',
2626
'www.3dmgame.com', 'www.ali213.net', 'gl.ali213.net', 'www.gamersky.com',
2727
'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',
2828
'www.gufengmh8.com',
@@ -164,6 +164,17 @@
164164
before: dux_beforeFunction
165165
}
166166
},
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+
},
167178
douban_subject_comments: {
168179
SiteTypeID: 0,
169180
pager: {
@@ -519,6 +530,9 @@
519530
if (location.host === 'apphot.cc') curSite.pager.scrollDelta = 1600; // 对于速度慢的网站,需要增加翻页敏感度
520531
break;
521532
// 以上几个都是 WordPress 的 DUX 主题
533+
case 'www.baidu.com': // < 百度搜索 >
534+
if (location.pathname === '/s') curSite = DBSite.baidu;
535+
break;
522536
case 'movie.douban.com': // < 豆瓣评论 >
523537
if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/comments') > -1) { // 短评
524538
curSite = DBSite.douban_subject_comments;
@@ -945,7 +959,7 @@
945959
timeout: 5000,
946960
onload: function (response) {
947961
try {
948-
//console.log(`${response.responseText}`)
962+
//console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
949963
var newBody = ShowPager.createDocumentByString(response.responseText);
950964
let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody);
951965
if (pageElems.length >= 0) {
@@ -1035,7 +1049,7 @@
10351049
if (curSite.pager) {
10361050
let curPageEle = getElementByXpath(curSite.pager.nextLink);
10371051
var url = this.getFullHref(curPageEle);
1038-
//console.log(`${url} ${curPageEle} ${curSite.pageUrl}`);
1052+
console.log(`${url} ${curPageEle} ${curSite.pageUrl}`);
10391053
if (url === '') return;
10401054
if (curSite.pageUrl === url) return;// 避免重复加载相同的页面
10411055
curSite.pageUrl = url;
@@ -1047,7 +1061,7 @@
10471061
timeout: 5000,
10481062
onload: function (response) {
10491063
try {
1050-
//console.log(`${response.responseText}`)
1064+
//console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
10511065
var newBody = ShowPager.createDocumentByString(response.responseText);
10521066
let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody);
10531067
let toElement = getAllElements(curSite.pager.HT_insert[0])[0];

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
| [<img src="https://static.zhihu.com/heifetz/favicon.ico" height="16px" />](https://www.zhihu.com/people/xiu2) | **知乎 增强** | **移除登录弹窗**、一键收起回答、屏蔽用户、屏蔽关键词、快... | **[安装](https://greasyfork.org/zh-CN/scripts/419081)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhihu-Enhanced.user.js)** |
2323
| [<img src="https://www.v2ex.com/static/favicon.ico" height="16px" />](https://www.v2ex.com/) | **V2ex 增强** | **自动签到**、链接转图片、自动无缝翻页、新标签页打开链接... | **[安装](https://greasyfork.org/zh-CN/scripts/424246)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/V2ex-Enhanced.user.js)** |
2424
| [<img src="https://i.loli.net/2021/03/30/ULV9XunaHesqGIR.png" height="16px" />](https://github.com/XIU2) | **Github 增强** | **高速下载** Git Clone/SSH、Release、Raw、Code(ZIP) 文件... | **[安装](https://greasyfork.org/zh-CN/scripts/412245)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/GithubEnhanced-High-Speed-Download.user.js)** |
25-
| [<img src="https://user-images.githubusercontent.com/54703944/118383905-b5d32380-b634-11eb-8914-dcea8e628ed3.png" height="16px" />](https://github.com/XIU2) | **自动无缝翻页 \*** | **所有 Discuz! / Flarum 论坛**、豆瓣、微博、千图网、423Do... | **[安装](https://greasyfork.org/zh-CN/scripts/419215)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Autopage.user.js)** |
25+
| [<img src="https://user-images.githubusercontent.com/54703944/118383905-b5d32380-b634-11eb-8914-dcea8e628ed3.png" height="16px" />](https://github.com/XIU2) | **自动无缝翻页 \*** | **所有 Discuz! / Flarum 论坛**百度、豆瓣、微博、千图网... | **[安装](https://greasyfork.org/zh-CN/scripts/419215)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Autopage.user.js)** |
2626
| [<img src="https://www.3dmgame.com/favicon.ico" height="16px" />](https://bbs.3dmgame.com) | **3DM论坛 美化** | 精简多余内容、样式优化 | **[安装](https://greasyfork.org/zh-CN/scripts/413593)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/3dm-Beautification.user.js)** |
2727
| [<img src="https://www.3dmgame.com/favicon.ico" height="16px" />](https://bbs.3dmgame.com) | **3DM论坛 增强** | **自动回复**、自动无缝翻页、清理置顶帖子、自动滚动至隐藏... | **[安装](https://greasyfork.org/zh-CN/scripts/412890)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/3dm-Enhanced.user.js)** |
2828
| [<img src="http://bbs.zhiyoo.net/favicon.ico" height="16px" />](http://bbs.zhiyoo.net/forum.php?mod=forumdisplay&fid=42&filter=author&orderby=dateline) | **智友邦论坛 美化** | 精简多余内容、样式优化、宽屏显示 | **[安装](https://greasyfork.org/zh-CN/scripts/412361)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhiyoo-Beautification.user.js)** |

0 commit comments

Comments
 (0)