🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2025/12/27 08:45:37
🔄 下次更新时间:2025/12/27 09:45:37
手动刷新缓存

dedu

去除百度搜索结果重定向,热榜,部分百度系推广, 翻译页广告弹出层

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name        dedu
// @license     MIT
// @namespace   github.com/ojer
// @match       https://www.baidu.com/s
// @match       https://fanyi.baidu.com/*
// @grant       GM_addElement
// @runat       document-end
// @version     1.35
// @author      ojer
// @description 去除百度搜索结果重定向,热榜,部分百度系推广, 翻译页广告弹出层
// ==/UserScript==
const dataId = 'vm-ojer-dedu'
const addStyle = () => {
  let content = `
		#content_right{
			display: none !important;
		}

   	#content_left > div:not([id]) {
			display: none !important;
		}

		#content_left > div[tpl="short_video"],div[tpl="news-realtime"],div[tpl="bjh_addressing"],div[tpl="recommend_list"] {
			display: none !important;
		}

		#content_left > div[mu^="https://baijiahao.baidu.com/s"] {
			display: none !important;
		}

	`
  if (window.location.host === 'fanyi.baidu.com') {
    // display: block;
    content += `
    div[style*="background-color: rgba(0, 0, 0, 0.6);"] {
      display: none !important;
    }

    div[style*="background: rgba(0, 0, 0, 0.6);"] {
      display: none !important;
    }

    body > div:not(#root) {
			display: none !important;
		}

    `
  }

  const ele = GM_addElement(document.head, 'style', content)
  ele.setAttribute('data-id', dataId)
}

const main = (s) => {
  setTimeout(() => {
    const left = document.getElementById('content_left')
    if (left) {
      const childrenElements = left.children
      for (var i = childrenElements.length - 1; i > -1; i--) {
        const fc = childrenElements[i]
        if (fc.querySelector('a.m.c-gap-left')) {
          fc.remove()
          continue
        }
        try {
          const href = fc.getAttribute('mu')
          if (href) {
            fc.querySelectorAll('a').forEach((a) => a.setAttribute('href', href))
          }
        } catch (ignore) {}
      }
    }
    s += 500
    if (s <= 3000) {
      main(s)
    }
  }, s)
}

new MutationObserver((mutationsList, observer) => {
  if (!document.querySelector('style[data-id="' + dataId + '"]')) {
    setTimeout(addStyle())
    main(500)
  }
}).observe(document.body, {
  childList: true
})