Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AC-Baidu-SoGou-Google-NoRedirect.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@
if (document.querySelector("#myuser") === null) {
MyApi.safeWaitFunc("#u, #gb, #b_header>#id_h, #header_wrapper .js-hl-butto, .header--aside, #header .inner .menu", parent => {

parent.style = "width: auto;";
parent.style.width = "auto";
let userAdiv = document.createElement("div");
userAdiv.id = "myuser";
userAdiv.innerHTML = `<input type='submit' class='myuserconfig' value='自定义'/><span class='ac-newversionDisplay' style='background-color: red;float: left;height: 8px;width: 8px;border-radius: 4px;display: none'>&nbsp;</span>`;
Expand Down Expand Up @@ -1971,7 +1971,7 @@
pointer-events: none;
}
`)
CONST.cssAutoInsert.add("menuBtn", ".achide{display:none;} .newFuncHighLight{color:red;font-weight: 100;background-color: yellow;font-weight: 600;}#sp-ac-container label{display:inline;}#u{width:319px}#u #myuser{display:inline-block;margin: 13px -10px 0 24px;}.site-wrapper #myuser,.sogou-set-box #myuser,#gbw #myuser{margin-right:15px;} #gb #myuser{margin-top:7px;} #myuser,#myuser .myuserconfig{padding:0;margin:0}#myuser{display:inline-block;}#myuser .myuserconfig{display:inline-block;line-height:1.5;background:#4e6ef2;color:#fff;font-weight:700;text-align:center;padding:6px;border:2px solid #E5E5E5;}#myuser .myuserconfig{box-shadow:0 0 10px 3px rgba(0,0,0,.1);border-radius: 6px}#myuser .myuserconfig:hover{background:#4662d9 !important;color:#fff;cursor:pointer;border:2px solid #73A6F8;} body[haosou] #myuser{margin-top:-10px}")
CONST.cssAutoInsert.add("menuBtn", ".achide{display:none;} .newFuncHighLight{color:red;font-weight: 100;background-color: yellow;font-weight: 600;}#sp-ac-container label{display:inline;}body:not(.baidu) #u{width:319px}#u #myuser{display:inline-block;margin: 13px -10px 0 24px;}body.baidu #u{position:absolute!important;right:0!important;left:auto!important;top:0!important;width:auto!important;display:flex!important;align-items:flex-start!important;justify-content:flex-end!important;margin:0 9px 0 0!important;padding:0 24px 0 0!important;pointer-events:none!important;}body.baidu #u>*{pointer-events:auto!important;}body.baidu #u .message-center-wrapper{display:none!important;}body.baidu #u #myuser{position:fixed!important;top:54px!important;right:220px!important;flex:0 0 auto!important;margin:0!important;z-index:100000!important;pointer-events:none!important;}body.baidu #u #myuser .myuserconfig,body.baidu #u #myuser .ac-newversionDisplay{pointer-events:auto!important;}body.baidu #u #myuser .myuserconfig{padding:5px 7px!important;line-height:18px!important;}@media (max-width:1400px){body.baidu #u #myuser{top:50px!important;right:156px!important;}}@media (max-width:1050px){body.baidu #u #myuser{top:96px!important;right:16px!important;}}.site-wrapper #myuser,.sogou-set-box #myuser,#gbw #myuser{margin-right:15px;} #gb #myuser{margin-top:7px;} #myuser,#myuser .myuserconfig{padding:0;margin:0}#myuser{display:inline-block;}#myuser .myuserconfig{display:inline-block;line-height:1.5;background:#4e6ef2;color:#fff;font-weight:700;text-align:center;padding:6px;border:2px solid #E5E5E5;}#myuser .myuserconfig{box-shadow:0 0 10px 3px rgba(0,0,0,.1);border-radius: 6px}#myuser .myuserconfig:hover{background:#4662d9 !important;color:#fff;cursor:pointer;border:2px solid #73A6F8;} body[haosou] #myuser{margin-top:-10px}")

if (CONST.curConfig.baiduLiteEnable) {
CONST.cssAutoInsert.add("baiduLiteStyle", CONST.adsCSSList.baiduLiteStyle)
Expand Down
231 changes: 97 additions & 134 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,134 +1,97 @@
### 资源推荐
1、推荐一个VPN加速的一元机场,感兴趣的冲,年付24.00元,邀请别人还能送更多:
**VPN加速地址-一元机场 - [https://V.一元机场.PLUS/b/?code=g4WEkq4j](https://v.xn--4gq62f52gdss.plus/b/?code=g4WEkq4j)**

# AC-baidu:重定向优化百度搜狗谷歌搜索_去广告_favicon_双列
![TamperMonkey v4.5](https://img.shields.io/badge/TamperMonkey-v4.18-brightgreen.svg) ![Chrome x64 v60.4](https://img.shields.io/badge/Chrome%20x64-v73.0-brightgreen.svg) ![Safari v11.0.3](https://img.shields.io/badge/Safari%20-v12.0-brightgreen.svg)

QQ群-加群链接:[AC脚本交流群](https://joinqq.90dao.com)

## 当前版本

> V27.18 优化谷歌页面,预期下一个版本将内置快速修改配置,避免全都去网站上修改

### 使用必读

[脚本使用说明](https://github.com/langren1353/GM_script/blob/master/help.md)

### 安装地址
[安装地址1](https://greasyfork.org/zh-CN/scripts/14178)

[安装地址2](https://openuserjs.org/scripts/inDarkness/AC-baidu-%E9%87%8D%E5%AE%9A%E5%90%91%E4%BC%98%E5%8C%96%E7%99%BE%E5%BA%A6%E6%90%9C%E7%8B%97%E8%B0%B7%E6%AD%8C%E5%BF%85%E5%BA%94%E6%90%9C%E7%B4%A2_favicon_%E5%8F%8C%E5%88%97)

### 插件功能

- 去掉百度、搜狗、谷歌搜索结果的重定向,回归为网站的原始网址---附带有去除百度的广告 包括百度顶部和底部的垃圾广告-百家号
- 默认移除百度百家号的内容--应广大群众的需求
- 提供护眼模式,颜色自定义,夜晚不伤眼
- 支持自定义页面效果,如果你会css样式表的话,你可以自己优化整体的页面效果
- 添加百度、搜狗、谷歌搜索结果中Favicon显示效果,页面效果更加美观和实用
- 添加标记数量,标记当前的id,界面更好看
- 百度和谷歌、必应和搜狗搜索页面都可以设置为单列、双列模式以及多列模式,视野更大
- 请求是异步请求,并不会出现一个链接没有反馈回来,其余等待的情况,每个链接的请求都是独立的,互不影响,对于网络的影响几乎没有

### 更新日志

***2025.07-12*** : V27.16 修复谷歌单双列样式表问题、优化百度样式表

***2025.06-04*** : V27.15 修复谷歌单列、双列显示问题;修复谷歌使用百度Icon问题

***2025.04-11*** : V27.14 修复百度灰度测试导致的重定向判定规则失效问题

***2025.03-22*** : V27.13 修复google更新导致多列问题、修复百度翻页问题

***2025.03-10*** : V27.12 修复duckduckGO 样式表问题;新增好搜页面双列支持

***2025.03-07*** : V27.11 fix for less.js issue at high version browser, read html without head tag

***2025.03-04*** : V27.10 fix:谷歌百度模式显示效果;Less.js被Q的问题;谷歌第二页脚本问题;

***2025.01-14*** : V27.09 fix:谷歌样式生效问题、谷歌显示字体问题、必应去广告失效导致的所有数据丢失问题

***2024.11-17*** : V27.07 fix:谷歌排版问题、谷歌翻页后图片无效问题

***2024.08-26*** : V27.06 fix:暗黑模式

***2023.12-16*** : V26.07 日常维护~

***2023.06-19*** : V26.06 修复谷歌显示效果的错位问题等,修复谷歌异常白屏问题

***2022.12-07*** : V26.04 修复必应错位问题;优化谷歌双列动画问题

***2022.08-23*** : V26.03 修复因背景图引起的看不清字的问题;修复百度单列错位问题;修复google自定义按钮不可见

***2022.08-23*** : V26.02 加快代码执行速度;减少动画撕裂;替换CDN的md5库

***2022.08-22*** : V26.01 因甲癌手术和公司事务停更了2个月,目前补上,推荐更新。 1.修复百度加载缓慢的问题;2.修复谷歌样式加载顺序异常的问题;3.整体优化样式加载时间,更流畅了

***2022.06.1*** : V25.09 更新使用less方案来对样式表进行精简

省略部分

***2019.02.15*** : V23.11 修复和Google Search Extra Button的兼容问题。修复地址有时候不能访问的问题。修复旧ff上的forEach和innerText不能用的问题。删除部分旧日志

***2019.02.13*** : V23.09 提供选项-直接删除已屏蔽的内容,避免看到一些垃圾无用信息;修复残留bug在单列时相关搜索宽度异常;优化百度图标为透明图标

***2019.01.25*** : V23.05 假装大家没发现bug,赶紧更新搜狗页面的bug

***2019.01.25*** : ....隐藏掉一些....

***2015.11.25*** : V2.0 优化,已经是真实地址的不再尝试获取

***2015.11.25*** : V1.0 完成去掉百度重定向的功能

### 展示效果-运行成功后
- 旧版本的:

![刚开始](https://img.90dao.com/images/2023/12/16/657d869b5fe80.jpg)
- Baidu搜索结果

![Baidu搜索结果](https://img.90dao.com/images/2023/12/16/657d863bcbb50.jpg)
- google搜索结果

![google搜索结果](https://img.90dao.com/images/2023/12/16/657d863c17920.jpg)

自定义设置效果
![google搜索结果](https://img.90dao.com/images/2023/12/16/657d863b31ad1.jpg)

### 如果在Opera下使用
如果脚本需要在Opera下使用的话,需要这样设置TamperMokey扩展
![Opera的特殊处理](https://img.90dao.com/images/2023/12/16/657d86ffcba3f.png)

### 关于捐赠
由于脚本属于非盈利内容,全靠用爱发电

如果有兴趣捐赠的话,可以点击一下捐赠,捐赠地址(建议加上备注):**[https://pay.acdiao.com](https://pay.acdiao.com)**

捐赠地址:支付宝、微信
![捐赠-淘宝-微信](https://img.90dao.com/images/2024/06/15/666d3f045b34c.png)

如果有任何问题的话,请提交一个issue,同时欢迎大家PR

If you have any problems on using the script, please submit an issue

### 使用声明

- 1.本脚本中提供的所有功能均免费使用,有关本软件的最新消息请前往[github](https://github.com/langren1353/GM_script/)查看
- 2.本脚本禁止使用并修改用于制作脚本集合之类的聚合性脚本

### 免责声明

本脚本中提供的所有功能均仅在浏览器中运行,所使用的源代码公开透明可见,且本脚本仅学习研究使用,不使用任何盈利方案或参与任何盈利组织,因使用本脚本引起的或与本脚本有关的任何争议,各方应友好协商解决,本脚本对使用本脚本所提供的软件时可能对用户自己或他人造成的任何形式的损失和伤害不承担任何责任。如用户下载、安装和使用本产品中所提供的软件,即表明用户信任本作者及其相关协议和免责声明。

### License

[The MIT License (MIT)](https://github.com/langren1353/GM_script/edit/master/LICENSE)

### 赞助说明
本项目大力感谢YxVM提供的服务器资源,也感谢NodeSeek论坛和社区的大力支持

YxVM服务器:[https://yxvm.com/aff.php?aff=762](https://yxvm.com/aff.php?aff=762)

NodeSeek交流论坛提供的NodeSupport项目:[https://github.com/NodeSeekDev/NodeSupport](https://github.com/NodeSeekDev/NodeSupport) 赞助了本项目

[![image](https://img.90dao.com/images/2025/04/11/67f7f3a11544c.png)](https://yxvm.com/aff.php?aff=762)
# 百度双列窄窗口布局 Bug 修复

原版项目地址:https://github.com/langren1353/GM_script

## Bug 截图

![双列窄窗口布局错位](./bug-screenshot.png)

## Bug 表现

在百度搜索结果页开启双列/多列样式后,如果浏览器窗口宽度被调窄,顶部工具区会发生错位。

具体表现:

- “自定义”按钮被挤到搜索框上方或中间。
- 百度原生“通知”入口仍在顶部工具区内占位。
- `#u`、`#myuser` 等外层容器可能覆盖搜索框,导致点击搜索框困难或无法输入。
- 窄窗口下排版混乱,搜索栏使用体验明显受影响。

## 产生原因

原脚本会把“自定义”按钮插入百度顶部工具区 `#u`:

```js
parent.insertBefore(userAdiv, parent.childNodes[0]);
```

同时原样式对 `#u` 使用了全局固定宽度:

```css
#u {
width: 319px;
}
```

百度新版搜索页的 `#u` 内还包含通知、设置、账号等元素。开启双列样式并缩窄窗口后,`#u` 内部元素空间不足,导致“自定义”和“通知”被挤到搜索框区域。

另外原代码使用:

```js
parent.style = "width: auto;";
```

这会覆盖 `#u` 可能已有的 inline style,进一步增加布局不稳定性。

## 修复内容

修改文件:

```text
AC-Baidu-SoGou-Google-NoRedirect.user.js
```

修复点:

- 只修改 `parent.style.width`,不覆盖整个 `style`。
- 将 `#u{width:319px}` 限制为非百度页。
- 百度页下让 `#u` 和 `#myuser` 外层不拦截鼠标事件,避免挡住搜索框。
- 百度页下让“自定义”按钮使用 `position: fixed`,脱离 `#u` 横向排版。
- 根据窗口宽度调整“自定义”按钮位置。
- 隐藏百度原生 `.message-center-wrapper` 通知入口,避免继续占位挤压布局。

核心修复逻辑:

```css
body.baidu #u {
pointer-events: none !important;
}

body.baidu #u > * {
pointer-events: auto !important;
}

body.baidu #u .message-center-wrapper {
display: none !important;
}

body.baidu #u #myuser {
position: fixed !important;
top: 54px !important;
right: 220px !important;
z-index: 100000 !important;
pointer-events: none !important;
}

body.baidu #u #myuser .myuserconfig {
pointer-events: auto !important;
}
```

## 验证

```bash
node --check AC-Baidu-SoGou-Google-NoRedirect.user.js
```

检查通过。
Binary file added bug-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.