网页优化修改

对部分网页进行广告屏蔽与布局优化并使兼容 DarkReader 深色主题

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

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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       *://*/*
// @match       https://www.toutiao.com/*
// @match       https://fanyi.baidu.com/*
// @match       https://www.bimiacg*/bangumi/*
// @match       https://www.mikudm.com/index.php/vod/*
// @match       https://hanime1.me/comic/*
// @match       https://www.twmanga.com/comic/chapter/*
// @match       https://www.kuaikanmanhua.com/webs/comic-next/*
// @match       https://www.colamanga.com/manga-*/*
// @match       https://v.qq.com/*
// @match       https://www.thanju.com/detail/*
// @match       https://greasyfork.org/zh-CN/scripts*
// @match       https://sleazyfork.org/zh-CN/scripts*
// @match       https://www.taobao.com/*
// @match       https://item.jd.com/*
// @match       https://weili.ooopic.com/weili_*
// @match       https://www.yrxitong.com/*
// @match       https://www.cgfxw.com/*
// @match       https://*.chaoxing.com/ananas/modules/work/index.html
// @match       https://*.chaoxing.com/ananas/modules/video/index.html
// @match       https://copilot.microsoft.com/*
// @match       https://laowang.vip/forum.php?mod=viewthread&tid=*
// @match       https://*.justeasy.cn/*
// @match       https://fanqienovel.com/library*
// @version     0.0.84
// @author      YeSilin
// @license     GPL-3.0-or-later
// @icon        data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj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3N2Zz4=
// @grant       GM_addStyle
// @grant       GM_registerMenuCommand
// @description 对部分网页进行广告屏蔽与布局优化并使兼容 DarkReader 深色主题
// ==/UserScript==

(function () {
  "use strict";

  GM_registerMenuCommand("视频小窗口播放", () => {
    // 先暂停当前视频
    const video = document.querySelector("video");
    if (video) {
      video.pause();
    }

    // 然后新建 popup 小窗口
    open(document.URL, "", "popup, location=no");
  });

  GM_registerMenuCommand("谷歌搜索此网站", () => {
    const url = `https://www.google.com/search?q=site%3A${window.location.host}`;
    // 然后新标签打开
    open(url, "");
  });

  GM_registerMenuCommand("搜索此网站脚本", () => {
    let host = window.location.host.toLowerCase();
    host = host.replace(/^www\./, "");
    const url = `https://greasyfork.org/zh-CN/scripts?filter_locale=0&q=${host}`;
    // 然后新标签打开
    open(url, "");
  });

  // 今日头条优化
  if (window.location.host === "www.toutiao.com") {
    let css = `
        /* 屏蔽今日头条置顶文章 */
        .feed-card-wrapper.feed-card-article-wrapper.sticky-cell{
            display: none;
        }
        
        /* 优化页眉为毛玻璃效果 */
        .search-wrapper.red .search input{
            background: rgb(235, 235, 235);
            border: 0px;
        }
        .home-container .fix-header>div {
            background: unset;
        }
        .home-container.new-style .fix-header {
            border-bottom: 1px solid rgba(0,0,0,.05);
            background: rgba(245, 245, 245, .80);
            backdrop-filter: blur(10px);
        }
        `;
    GM_addStyle(css);

    // 修复今日头条个人主页兼容 DarkReader
    if (window.location.pathname.indexOf("/c/user/token/") > -1) {
      // 删掉默认的白色背景
      // document.getElementsByClassName('profile-container')[0].style.background = "none";
      document.querySelector(".profile-container").style.background = "none";
      // 修改搜索框的背景颜色,即使改了也会被 DarkReader 修改成其他值以符合他的主题
      document.querySelector(".search>input").style.backgroundColor = "#eee";
    }
    return;
  }

  // 百度翻译优化
  if (window.location.host === "fanyi.baidu.com") {
    let css = "";
    // 如果是新版
    if (window.location.pathname.indexOf("/mtpe-individual/") > -1) {
      css = `
            /* 屏蔽右侧广告 */
            .UMjeGiEI {
              display: none !important;
            }

            /* 屏蔽顶部开通会员广告 */
            .URCZyDIb {
              display: none !important;
            }
            /* 屏蔽顶部企业版广告 */
            ._U9afNhR{
              display: none !important;
            }

            /* 屏蔽页尾广告 */
            .jIoZrIPe {
              display: none !important;
            }
            
            /* 优化 AI 大模型翻译兼容 DarkReader*/
            #root {
              background-image: unset !important;
            }
            #multiContainer {
              background-image: unset !important;
            }

            /* AI大模型翻译·基础版 */          
            .sRKHr8FI{
              display: none !important;
            }
   
            /* AI翻译专家增强版 */             
            .ctchA9_F{
              display: none !important;
            }
            /* 启用AI能力 */   
            div.qJU3axmS > div:nth-child(1){
              display: none !important;
            }
            /* 屏蔽点击拖拽上传提示 */
            .LSOa73BQ.VwC7zyZq{
              display: none !important;
            }
            `;
      // 删除多余的渐变以便兼容 DarkReader
      // document.querySelector('.in7aMwxd').classList.remove('in7aMwxd');
      //document.querySelector("div.kXQpwTof > div > span > span > span:nth-child(1) > div").innerHTML = '请输入文本、网址、arXiv链接或粘贴图片秒翻'
    } else {
      css = `
            /* 屏蔽企业服务 */
            .menuItem{
                display: none !important;
            }
            /* 屏蔽左侧广告 */
            #app-read{
                display: none !important;
            }
            /* 屏蔽右侧广告 */
            #sideBannerContainer{
                display: none !important;
            }
            /* 屏蔽人工翻译按钮 */
            .manual-trans-btn{
                display: none !important;
            }
            /* 屏蔽ai翻译按钮 */
            .ai-trans-btn{
                display: none !important;
            }
            /* 屏蔽页尾联系我们 */
            .follow-wrapper {
                display: none !important;
            }
            /* 减小导航栏的最小宽度 */
            .pc-fanyi-navigation-bar {
                min-width: 950px;
            }
            @media(max-width: 1253px) {
                /* 减小顶部宽度 */
                .container {
                    width: 100%;
                }
                /* 减小左边距 */
                .container .inner {
                    margin: 0 25px;
                    transition: all 0.3s;
                }
                /* 屏蔽左侧导航 */
                #side-nav .nav-ol {
                    display: none !important;
                }
            }
            @media(min-width: 1254px)and (max-width:1506px) {
                .container .inner {
                    transition: all 0.3s;
                }
            }`;

      // 屏蔽顶部开通会员广告
      document.querySelector("#nav_bar_vip_btn").remove();

      // 屏蔽右侧意见反馈
      document.querySelector("#index-feedback-btn").style.visibility = "hidden";

      // 屏蔽右侧APP下载推荐
      document.querySelector(".sideQrContainer").style.visibility = "hidden";

      // 屏蔽页尾产品展示
      document.querySelector("#footer-products-container").remove();
    }

    GM_addStyle(css);
    return;
  }

  // 哔咪动漫优化
  if (window.location.host.indexOf(".bimiacg") > -1) {
    // 显示完整的剧情介绍
    if (window.location.pathname.indexOf("/bangumi/bi/") > -1) {
      let synopsis = document.querySelector("#synopsis_txt+p");
      let jianjie = document.querySelector(".vod-jianjie>p");
      if (synopsis.innerText != jianjie.innerText) {
        synopsis.innerText = jianjie.innerText;
      }
      return;
    }

    let css = `
        /* 屏蔽移动字幕广告 */
        body > section > div.main > marquee{
            display: none !important;
        }`;
    GM_addStyle(css);

    // 自动跳过推荐下载安卓客户端
    // document.querySelector("#video>div>div>p>a").click()
    $("#bkcl").remove();

    return;
  }

  // 异世界动漫优化
  if (window.location.host === "www.mikudm.com") {
    let css = `
        /* 屏蔽二维码广告 */
        a[href="https://www.mikudm.com/index.php/vod/detail/id/2187.html"] {
            display: none !important;
        }`;
    GM_addStyle(css);

    // 详情页
    if (location.pathname.indexOf("/index.php/vod/detail/id/") > -1) {
      let css = `
            /* 屏蔽保存到浏览器 */
            .text_muted.pull_right.hidden_xs {
                display: none !important;
            }
            /* 屏蔽分享按钮 */
            .playbtn.o_share.hidden_xs {
                display: none !important;
            }
            /* 屏蔽支援网站 */
            li[title="支援网站"] {
                display: none !important;
            }`;
      GM_addStyle(css);

      // 优化简介直接显示完整的剧情介绍
      document.querySelector(".desc.hidden_xs").innerHTML =
        '<span class="left text_muted">简介:</span>' +
        document.querySelector(".content_desc.full_text.clearfix > span").innerText;
      return;
    }
    // 播放页
    if (location.pathname.indexOf("/index.php/vod/play/id/") > -1) {
      return;
    }
    return;
  }

  // Hanime1 优化
  if (window.location.href.indexOf("https://hanime1.me/comic/") > -1) {
    let css = `
        /*删除漫画广告*/
        .comics-banner-ads {
            display: none !important;
        }
        
        /*漫画显示原始大小*/
        #current-page-image {
            max-height: 100%;
        }`;
    GM_addStyle(css);
    return;
  }

  // 包子漫画优化
  if (window.location.href.indexOf("https://www.twmanga.com/comic/chapter/") > -1) {
    // 监听方向盘上下两键增加滚动距离
    document.addEventListener("keydown", function (event) {
      // 浏览器内部界面的高度
      const innerHeight = window.innerHeight;
      if (event.key == "ArrowDown") {
        event.preventDefault();
        scrollBy({
          top: innerHeight / 2,
          left: 0,
          behavior: "smooth",
        });
      } else if (event.key == "ArrowUp") {
        event.preventDefault();
        window.scrollBy({
          top: -(innerHeight / 2),
          left: 0,
          behavior: "smooth",
        });
      } else {
        return;
      }
    });
    return;
  }

  // 快看漫画优化
  if (window.location.host === "www.kuaikanmanhua.com") {
    const css = `
      .comic-next {
          min-width: 500px !important;
      }
      .comic-next .contentBox {
          width: 100% !important;
      }
      .comic-next .contentBox .comicDetails .imgList {
        width: 100% !important;
        /* 预测原图最大宽度 */
        max-width: 1280px !important;
      } `;
    GM_addStyle(css);
    return;
  }

  // ColaManga 漫画优化
  if (window.location.host === "www.colamanga.com") {
    const css = `
    body {
      /* 去掉右侧多余的右填充 */
      overflow-y: initial;
    }
    .mh_wrap {
      /* 去掉最小宽度限制 */
      min-width: initial;
    }`;
    GM_addStyle(css);
    return;
  }

  // 腾讯视频优化
  if (window.location.host === "v.qq.com") {
    let css = `
        /* 屏蔽左侧栏 NBA */
        a[href="/channel/nba"] {
            display: none !important;
        }
        /* 屏蔽左侧栏体育 */
        a[href="/channel/sports_new"] {
            display: none !important;
        }
        /* 屏蔽左侧栏游戏中心 */
        a[href="https://iwan.video.qq.com/game-community/game-center/home?ztid=km53eytfwg&iwankey=iwan_pc_channel-10029421_rpk"] {
            display: none !important;
        }
        /* 屏蔽左侧栏游戏 */
        a[href="/channel/game_new"] {
            display: none !important;
        }
        /* 屏蔽左侧栏传奇游戏库 */
        a[href="https://iwan.video.qq.com/game-community/game-center/home?ztid=p7hq7qfq2m&iwankey=iwan_pc_channel-10086082_rpk"] {
            display: none !important;
        }
        /* 屏蔽左侧栏 F1 */
        a[href="https://v.qq.com/s/topic/v_sports/render/uX0ceyb1.html"] {
            display: none !important;
        }
        /* 屏蔽左侧栏艺术 */
        a[href="/channel/art"] {
            display: none !important;
        }
        /* 屏蔽左侧栏财经 */
        a[href="/channel/finance"] {
            display: none !important;
        }
        /* 屏蔽左侧栏棋牌游戏库 */
        a[href="https://iwan.video.qq.com/game-community/game-center/home?ztid=r9b76oy3p4&iwankey=iwan_channel-10357146_rpk"] {
            display: none !important;
        }
        `;
    GM_addStyle(css);
    return;
  }

  // 看韩剧优化
  if (window.location.href.indexOf("https://www.thanju.com/detail/") > -1) {
    // 优化简介直接显示完整的剧情介绍
    document.querySelector(".desc.hidden-xs").innerHTML =
      `\<span class="left text-muted">简介:</span>` +
      document.querySelector(".sketch.content").innerText.replace("剧情:", "");
    return;
  }

  // GreasyFork 优化
  if (
    document.URL.indexOf("https://greasyfork.org/zh-CN/scripts") > -1 ||
    document.URL.indexOf("https://sleazyfork.org/zh-CN/scripts") > -1
  ) {
    // 优化脚本列表中链接以新标签方式打开
    document.querySelectorAll("#browse-script-list > li > article > h2 > a").forEach((element) => {
      element.target = "_blank";
    });
    document
      .querySelectorAll("#browse-script-list > li > article > div > dl > dd.script-list-author > span > a")
      .forEach((element) => {
        element.target = "_blank";
      });
    return;
  }

  // 淘宝优化
  if (window.location.host === "www.taobao.com") {
    let css = `
        /* 优化首页背景兼容 DarkReader */
        body {
            background-image: none !important;
        }`;
    GM_addStyle(css);
    return;
  }

  // 京东优化
  if (location.href.indexOf("https://item.jd.com/") > -1) {
    let css = `
      /* 优化商品评价关闭按钮 兼容 DarkReader */
      ._rateListBox_1ygkr_1 ._title_1ygkr_22 ._closeIcon_1ygkr_39 {
        width: 20px !important;
        height: 20px !important;
        background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIiBmaWxsPSIjZmYwZjIzIj48bGluZSB4MT0iMyIgeTE9IjMiIHgyPSIxNyIgeTI9IjE3IiBzdHJva2U9IiNmZjBmMjMiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PGxpbmUgeDE9IjE3IiB5MT0iMyIgeDI9IjMiIHkyPSIxNyIgc3Ryb2tlPSIjZmYwZjIzIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjwvc3ZnPg==") !important;
      }`;
    GM_addStyle(css);
    return;
  }

  // 我图网优化
  if (location.href.indexOf("https://weili.ooopic.com/weili_") > -1) {
    let css = `
        /* 屏蔽详情页广告 */
        .wt-activeTopBanner {
            display: none !important;
        }
        div.wt-detailsHd > div.wt-detailsRight.v1 {
            display: none !important;
        }
        
        div.wt-detailsPack-hd > div.wt-pk-titWrap {
          display: none !important;
        }

        /* 屏蔽剪切蒙版字体兼容 DarkReader */
        .wt-detailsPack-hd .wt-pk-colList .wt-pk-colItem.on .wt-pk-price b{
            color: var(--red-color) !important;
            background :  unset !important;
            -webkit-background-clip:  unset !important;
            -webkit-text-fill-color: unset !important;
        }
        .wt-detailsPack-hd .wt-pk-colList .wt-pk-price b{
            background :  unset !important;
            -webkit-background-clip:  unset !important;
            -webkit-text-fill-color: unset !important;
        }
         `;
    GM_addStyle(css);
    return;
  }

  // 小鱼儿系统优化
  if (window.location.host === "www.yrxitong.com") {
    let css = `
        /* 屏蔽详情页广告 */
        #web {
            background: none !important;
        }
        `;
    GM_addStyle(css);
    return;
  }

  // CG分享网优化 width: 120px; font-size: 16px;
  if (window.location.host === "www.cgfxw.com") {
    const css = `
      #btn-search{
        height: 28px;
        border: 0;
        margin-left: 10px;
        border-radius: 3px;
        color: #fff;
        background-color: #429296;
        /* 修改鼠标指针样式 */
        cursor: pointer;
      }
      `;
    GM_addStyle(css);
    // 加一个谷歌搜索按钮
    const newButton = `<td><button id='btn-search' >用谷歌搜索</button></td>`;
    document
      .querySelector("#scbar_form > table > tbody > tr > td.scbar_btn_td")
      .insertAdjacentHTML("afterend", newButton);

    // 监听点击事件
    document.querySelector("#btn-search").addEventListener("click", (event) => {
      event.preventDefault();
      // console.log('按钮被点击了,但不会提交表单');
      // 在这里添加你的自定义逻辑

      const url = `https://www.google.com/search?q=site%3Awww.cgfxw.com+${document.querySelector("#scbar_txt").value}`;
      // 然后新标签打开
      open(url, "");
    });

    return;
  }

  // 超星泛雅优化
  if (window.location.host === "mooc1.chaoxing.com") {
    setTimeout(
      () =>
        document.querySelectorAll("video").forEach((video) => {
          // 清空暂停视频函数
          video.pause = () => {};
        }),
      3000
    );
    return;
  }

  // Microsoft Copilot 优化
  if (window.location.host === "copilot.microsoft.com") {
    const css = `
    /* 修改对话框的宽度,默认 46.5rem  */
    .max-w-chat {
      max-width: min(100%,55rem) !important;
    }
    
    /* 修改输入框的宽度 */
    .w-expanded-composer {
      width: min(calc(100vw - 1.5rem),55rem) !important;
    }  
    `;
    GM_addStyle(css);

    // 移除所有的复制事件
    document.addEventListener(
      "copy",
      function (event) {
        event.stopPropagation();
      },
      true
    );

    // // 可选:移除所有的上下文菜单事件
    // document.addEventListener(
    //   "contextmenu",
    //   function (event) {
    //     event.stopPropagation();
    //   },
    //   true
    // );
    // // 可选:移除所有的选择事件
    // document.addEventListener(
    //   "selectstart",
    //   function (event) {
    //     event.stopPropagation();
    //   },
    //   true
    // );
    // // 可选:移除所有的剪切事件
    // document.addEventListener(
    //   "cut",
    //   function (event) {
    //     event.stopPropagation();
    //   },
    //   true
    // );
    // // 可选:移除所有的粘贴事件
    // document.addEventListener(
    //   "paste",
    //   function (event) {
    //     event.stopPropagation();
    //   },
    //   true
    // );
    // // 可选:移除所有可能的 oncontextmenu 属性
    // document.querySelectorAll("*").forEach(function (element) {
    //   element.oncontextmenu = null;
    // });

    return;
  }

  // 老王论坛优化
  if (location.href.indexOf("https://laowang.vip/forum.php?mod=viewthread&tid=") > -1) {
    const css = `
    .pcb .jammer {
      display: none;
    }
    `;
    GM_addStyle(css);
    return;
  }

  // 建E网优化
  if (window.location.host.indexOf(".justeasy.cn") > -1) {
    const css = `
    /* 以便兼容 DarkReader */
    body {
      background: none !important;
    }

    /* 屏蔽搜索框广告 */
    .HeaderNav_activityIconEntry__0_BDK {
      display: none !important;
    }
    `;
    GM_addStyle(css);
    return;
  }

  // 番茄小说优化
  if (location.href.indexOf("https://fanqienovel.com/library") > -1) {
    const css = `
    /* 强制显示完整书名 */
    .book-item-text .book-item-title {
      overflow: visible !important;
      font-size: 17px !important;
    }
    `;
    GM_addStyle(css);
    return;
  }
})();