百度首页自定义导航-> 取消默认推荐

2023/7/30 14:32:53

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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("未找到我的关注元素");
  }

};