From 6339c681fd688501c2a2287fbcdfc457c3b3ecd6 Mon Sep 17 00:00:00 2001
From: xiu2 <54703944+XIU2@users.noreply.github.com>
Date: Fri, 6 Aug 2021 11:48:22 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E7=99=BE=E5=BA=A6?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2]=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 | 26 ++++++++++++++++++++------
README.md | 2 +-
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/Autopage.user.js b/Autopage.user.js
index e9e64ba..3cb5202 100644
--- a/Autopage.user.js
+++ b/Autopage.user.js
@@ -1,8 +1,8 @@
// ==UserScript==
// @name 自动无缝翻页
-// @version 1.4.4
+// @version 1.4.5
// @author X.I.U
-// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、豆瓣、微博、千图网、3DM、游侠网、游民星空、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、RARBG、PubMed、AfreecaTV、AlphaCoders、FitGirl Repacks...
+// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、RARBG、PubMed、AfreecaTV、AlphaCoders、FitGirl Repacks...
// @match *://*/*
// @connect www.gamersky.com
// @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png
@@ -22,7 +22,7 @@
'use strict';
var webType, curSite = {SiteTypeID: 0};
// 目前支持的网站
- const websiteList = ['movie.douban.com', 'weibo.com', 'www.58pic.com',
+ const websiteList = ['www.baidu.com', 'movie.douban.com', 'weibo.com', 'www.58pic.com',
'www.3dmgame.com', 'www.ali213.net', 'gl.ali213.net', 'www.gamersky.com',
'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',
'www.gufengmh8.com',
@@ -164,6 +164,17 @@
before: dux_beforeFunction
}
},
+ baidu: {
+ SiteTypeID: 0,
+ pager: {
+ type: 1,
+ nextLink: '//div[@id="page"]//a[contains(text(),"下一页")][@href]',
+ pageElement: 'css;#content_left > *',
+ HT_insert: ['css;#content_left', 3],
+ replaceE: 'css;#page',
+ scrollDelta: 1200
+ }
+ },
douban_subject_comments: {
SiteTypeID: 0,
pager: {
@@ -519,6 +530,9 @@
if (location.host === 'apphot.cc') curSite.pager.scrollDelta = 1600; // 对于速度慢的网站,需要增加翻页敏感度
break;
// 以上几个都是 WordPress 的 DUX 主题
+ case 'www.baidu.com': // < 百度搜索 >
+ if (location.pathname === '/s') curSite = DBSite.baidu;
+ break;
case 'movie.douban.com': // < 豆瓣评论 >
if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/comments') > -1) { // 短评
curSite = DBSite.douban_subject_comments;
@@ -945,7 +959,7 @@
timeout: 5000,
onload: function (response) {
try {
- //console.log(`${response.responseText}`)
+ //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
var newBody = ShowPager.createDocumentByString(response.responseText);
let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody);
if (pageElems.length >= 0) {
@@ -1035,7 +1049,7 @@
if (curSite.pager) {
let curPageEle = getElementByXpath(curSite.pager.nextLink);
var url = this.getFullHref(curPageEle);
- //console.log(`${url} ${curPageEle} ${curSite.pageUrl}`);
+ console.log(`${url} ${curPageEle} ${curSite.pageUrl}`);
if (url === '') return;
if (curSite.pageUrl === url) return;// 避免重复加载相同的页面
curSite.pageUrl = url;
@@ -1047,7 +1061,7 @@
timeout: 5000,
onload: function (response) {
try {
- //console.log(`${response.responseText}`)
+ //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
var newBody = ShowPager.createDocumentByString(response.responseText);
let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody);
let toElement = getAllElements(curSite.pager.HT_insert[0])[0];
diff --git a/README.md b/README.md
index a9cd7c2..43b58e0 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@
| [
](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)** |
| [
](https://www.v2ex.com/) | **V2ex 增强** | **自动签到**、链接转图片、自动无缝翻页、新标签页打开链接... | **[安装](https://greasyfork.org/zh-CN/scripts/424246)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/V2ex-Enhanced.user.js)** |
| [
](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)** |
-| [
](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)** |
+| [
](https://github.com/XIU2) | **自动无缝翻页 \*** | **所有 Discuz! / Flarum 论坛**、百度、豆瓣、微博、千图网... | **[安装](https://greasyfork.org/zh-CN/scripts/419215)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Autopage.user.js)** |
| [
](https://bbs.3dmgame.com) | **3DM论坛 美化** | 精简多余内容、样式优化 | **[安装](https://greasyfork.org/zh-CN/scripts/413593)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/3dm-Beautification.user.js)** |
| [
](https://bbs.3dmgame.com) | **3DM论坛 增强** | **自动回复**、自动无缝翻页、清理置顶帖子、自动滚动至隐藏... | **[安装](https://greasyfork.org/zh-CN/scripts/412890)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/3dm-Enhanced.user.js)** |
| [
](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)** |