有没有什么办法能每次进入某个网页就执行对应脚本的,想把百度搜索页的热搜隐藏了

35 天前
 cookie0402
725 次点击
所在节点    问与答
11 条回复
cookie0402
35 天前
写了脚本,但是每次都得手动去控制台运行
fengci
35 天前
你说的不就是 油猴子 嘛
chuhades
35 天前
油猴。
flysp
35 天前
我自己的百度屏蔽规则

baidu.com##div[class="result-op xpath-log"]
baidu.com##div[id="content_right"]
baidu.com###content_right
baidu.com##.cr-offset
baidu.com##.title-content.c-link.c-font-medium.c-line-clamp1
baidu.com##.title-text.c-font-medium.c-color-t
baidu.com##.s-hotsearch-title
baidu.com##.tieba-custom-pass-login
baidu.com##div[class="result-op xpath-log"]
baidu.com##div[id="content_right"]
baidu.com###content_right
baidu.com##.cr-offset
baidu.com##.title-content.c-link.c-font-medium.c-line-clamp1
baidu.com##.title-text.c-font-medium.c-color-t
baidu.com##.s-hotsearch-title
baidu.com##.tieba-custom-pass-login
baidu.com##div[class="s-isindex-wrap"]
cookie0402
35 天前
@flysp 也是用的油猴吗,我刚刚下载了油猴,发现添加的脚本一直没运行,是啥原因
cookie0402
35 天前
@flysp 这个是我的代码(function() {
'use strict';

// Your code here...
var doe = document.getElementById("content_right")
doe.style.display = 'none'
console.log("qidong")
})();
pipaseqin
35 天前
这是隐藏知乎标题的,供参考下。

```
// ==UserScript==
// @name ZhiHu
// @namespace http://tampermonkey.net/
// @version 2024-08-14
// @description try to take over the world!
// @author You
// @match https://www.zhihu.com/question/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @require https://code.jquery.com/jquery-3.7.1.min.js
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements */

(function() {
'use strict';
$(window).scroll(function() {
if($('.QuestionHeader-title').length) {
$('.QuestionHeader-title').css('display', 'none');
}
});
})();
```
Mechanical
35 天前
用 adblock 插件更容易实现,针对性屏蔽页面元素
yhxx
35 天前
这个需求甚至可以直接用 stylebot 之类的改一下 css 就行了
cookie0402
35 天前
@Mechanical 这个好像要收费
flysp
35 天前
@cookie0402 用的 Adblock 插件,配置 F12 查看页面元素,可以自定义屏蔽很多广告

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1064934

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX