Greasy Fork

今日头条与建E网优化

2024/1/27 17:33:33

目前为 2024-02-28 提交的版本。查看 最新版本

// ==UserScript==
// @name        今日头条与建E网优化
// @namespace   Violentmonkey Scripts
// @match       https://www.toutiao.com/*
// @match       https://www.justeasy.cn/*
// @grant       none
// @version     0.0.10
// @author      YeSilin
// @license     MIT
// @grant       GM_addStyle
// @description 2024/1/27 17:33:33
// ==/UserScript==


// 屏蔽今日头条置顶文章
if(window.location.href === "https://www.toutiao.com/"){
    let css = `
    .feed-card-wrapper.feed-card-article-wrapper.sticky-cell{
        display: none;
    }
    `
    GM_addStyle(css)
}


// 修复今日头条个人主页兼容 DarkReader
if(window.location.href.indexOf("https://www.toutiao.com/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";
}


// 屏蔽建E网鼠标经过灰色案例背景
if(window.location.href.indexOf("https://www.justeasy.cn")>-1){
  let css = `
  .commont_list_main .item_list_1 .list .hove_bg{
    background: none;
  }
//   .tietu_commont_list .tietu_masonry .item .commont_pic a::before{
//     background: none;
//   }
  `
  GM_addStyle(css)
}



// 等待网页内容加载完毕
window.addEventListener("load", function(){

  // 优化今日头条视频自动打开评论
  if(window.location.href.indexOf("https://www.toutiao.com/video/")>-1){
    document.querySelector(".video-action-button.comment").click()
  }

  // 优化今日头条文章自动打开评论
  if(window.location.href.indexOf("https://www.toutiao.com/article/")>-1){
    document.querySelector(".side-drawer-btn").click()
  }

})