Greasy Fork

来自缓存

Greasy Fork is available in English.

去除有道在线翻译页面样式

去除有道在线翻译最基础翻译功能外其他样式,保留最简洁的样式

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         去除有道在线翻译页面样式
// @namespace    小冰鸡
// @version      0.1
// @description  去除有道在线翻译最基础翻译功能外其他样式,保留最简洁的样式
// @author       小冰鸡
// @match        *://fanyi.youdao.com/*
// @match        *://*/*
// @grant        none
// @license MIT
// ==/UserScript==

;(function () {
  'use strict'
  function customFun() {
    let timer = setInterval(function () {
      let dom = document.querySelector('.tab-header')
      if (dom) {
        clearInterval(timer)

        dom.style.display = 'none'

        // 获取头部按钮列表,并且点击第一个
        let buttons = document.querySelectorAll('.tab-header .tab-item')
        buttons[0].click()

        // 要移除的dom类名列表
        let removeList = [
          '.ai-guide',
          '.sidebar-inner-container',
          '.header-content',
          '.top-banner-outer-container',
          '.banner-outer-container',
          '.document-upload-entrance-container',
          '.sidebar-container',
          '.dict-website-footer'
        ]
        removeList.forEach((domName) => {
          let dom = document.querySelector(domName)
          if (dom) dom.style.display = 'none'
        })
      }
      let dialog = document.querySelector('.pop-up-comp')
      if (dialog) {
        let ad = document.querySelector('.pop-up-comp .inner-content .ad')
        dialog.style.display = 'none'
      }
    }, 20)
  }
  customFun()
})()