Greasy Fork

Greasy Fork is available in English.

天天基金 - 基金PC详情页精简

移除页面乱七八糟的内容, 专注走势和净值

目前为 2021-11-30 提交的版本,查看 最新版本

// ==UserScript==
// @name        天天基金 - 基金PC详情页精简
// @namespace   Violentmonkey Scripts
// @grant       none
// @description 移除页面乱七八糟的内容, 专注走势和净值
// @version     1.0.1
// @author      SkayZhang
// @license     MIT
// @icon        https://j5.dfcfw.com/image/201502/20150227144530.png
// @supportURL  http://greasyfork.icu/zh-CN/scripts/436307/feedback
// @match       *://fund.eastmoney.com/*
// @description 2021/11/30 上午10:54:52
// @require     https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
// ==/UserScript==
(function () {
  'use strict';
  let chatDom;
  
  $("body>*").css("opacity","0")
  
  let state = localStorage.getItem("cleanState")
  
  setTimeout(()=>{
    if(state){
      main.init();
      main.clean();
      main.build();
    }else main.addBtn();
  },500);
  let main = {
    init(){
      $("body").append(`<style>.btnBox{display:flex;align-items:center;justify-content:center;} .btn{cursor:pointer;margin:0 7.5px;width:80px;height:40px;background-color:#4372ba;color:#fff;display:flex;align-items:center;justify-content:center;border-radius:8px;}</style>`)
      chatDom = $(".estimatedchart").html();
    },
    clean(){
      // 待移除元素列表
      let removeList = ["#rightadvert","#BottomSwith","#_AdSame_divsub_pd","#AIAssistant",".buyWayWrap",".fund_item.quotationItem_DataMap.popTab",".choseBuyWay-shadow",".quotationItem",".fundDetail-footer",".fundDetail-tools"]
      // 遍历列表并移除元素
      for(let i in removeList){
        $(removeList[i]).remove();
      }

      // 待移除元素下级列表
      let removeSubList = [".adcommon",".fundtypeNav",".SitePath",".lazy",".recentBrowse",".declare",".cpright",".cls_btn"]
      // 遍历下级列表并移除元素
      for(let i in removeSubList){
        $(removeSubList[i]).parent().remove();
      }
    },
    build(){
      $(".choseBuyWay").append(chatDom);
      $(".fundInfoItem").append(`<div class="btnBox"><div class="btn" onclick="javascript:location.reload();">刷新页面</div><div class="btn" onclick="javascript:localStorage.removeItem('cleanState');location.reload();">正常模式</div></div>`)
      $(".choseBuyWay img").css("width","430px")
      $(".fundDetail-main").css("height","270px")
      $(".merchandiseDetail .fundDetail-main").css("border","1px solid #cce0ff")
      $(".estimatedsideInfo").remove();
      $(".item_title.hd").remove();
      $("body>*").css("opacity","1")
    },
    addBtn(){
      $("body").append(`<style>#cleanBtn{cursor:pointer;position:fixed;left:15px;bottom:calc(50vh - 30px);width:60px;height:60px;background-color:#4372ba;color:#fff;display:flex;align-items:center;justify-content:center;border-radius:8px;}</style>`)
      $("body").append(`<div id="cleanBtn" onclick="javascript:localStorage.setItem('cleanState','true');location.reload();"><div>精简模式</div></div>`)
      $("body>*").css("opacity","1")
    }
  }
})();