2023/7/30 14:32:53
// ==UserScript==
// @name 百度首页自定义导航-> 取消默认推荐
// @namespace Violentmonkey Scripts
// @match https://www.baidu.com/
// @grant none
// @version 1.3.1
// @author liuml
// @license MIT
// @description 2023/7/30 14:32:53
// ==/UserScript==
// 等待页面加载完成后执行代码
window.onload = function() {
// 获取 s_xmancard_news_new 节点
const xmancardNode = document.querySelector("#s_xmancard_news_new");
// 检查是否找到 s_xmancard_news_new 节点
if (xmancardNode) {
// 将 s_xmancard_news_new 节点的样式设置为隐藏
xmancardNode.style.display = "none";
console.log("已隐藏 s_xmancard_news_new 节点");
} else {
console.log("未找到 s_xmancard_news_new 节点");
}
const searchButton = document.querySelector("#s_menu_mine");
// 模拟点击搜索按钮
if (searchButton) {
searchButton.click();
console.log("已模拟点击我的关注");
} else {
console.log("未找到我的关注元素");
}
};