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

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

  1. // ==UserScript==
  2. // @name 天天基金 - 基金PC详情页精简
  3. // @namespace Violentmonkey Scripts
  4. // @grant none
  5. // @description 移除页面乱七八糟的内容, 专注走势和净值
  6. // @version 1.0.4
  7. // @author SkayZhang
  8. // @license MIT
  9. // @icon https://j5.dfcfw.com/image/201502/20150227144530.png
  10. // @supportURL https://gf.qytechs.cn/zh-CN/scripts/436307/feedback
  11. // @match *://fund.eastmoney.com/*
  12. // @description 2021/11/30 上午10:54:52
  13. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
  14. // ==/UserScript==
  15. (function () {
  16. 'use strict'
  17. let id = ""
  18. let chatDom
  19. $("body>*").css("opacity","0")
  20. let state = localStorage.getItem("cleanState")
  21. setTimeout(()=>{
  22. if(state){
  23. main.init()
  24. main.clean()
  25. main.build()
  26. }else main.addBtn()
  27. },500);
  28. let main = {
  29. init(){
  30. id = window.location.pathname.replace("/","")
  31. id = id.substring(0,id.indexOf("."))
  32. $("body").append(`<style>.estimatedMap .estimatedchart{padding:0} .fund-common-second-menu{padding-bottom:5px;} .title{padding-left:7px;font-size:23px;line-height:28px;float:left;} .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>`)
  33. chatDom = $(".estimatedchart").html()
  34. },
  35. clean(){
  36. // 移除顶部广告
  37. $("body>div[id!=body]").first().remove()
  38. // 待移除元素列表
  39. let removeList = ["#rightadvert","#BottomSwith","#_AdSame_divsub_pd",".buyWayWrap",".fund_item.quotationItem_DataMap.popTab",".choseBuyWay-shadow",".dropdown.head-item.droplist",".logo.fl","h1.fl",".item_title.hd",".quotationItem",".estimatedsideInfo",".fundDetail-footer",".fundDetail-tools",".fl.links","#referAd1",".referAdDiv"]
  40. // 遍历列表并移除元素
  41. for(let i in removeList){
  42. $(removeList[i]).remove()
  43. }
  44.  
  45. // 待移除元素下级列表
  46. let removeSubList = [".adcommon",".fundtypeNav",".SitePath",".lazy",".recentBrowse",".declare",".cpright",".cls_btn","#float_phone"]
  47. // 遍历下级列表并移除元素
  48. for(let i in removeSubList){
  49. $(removeSubList[i]).parent().remove()
  50. }
  51. },
  52. build(){
  53. // 移动走势图未知
  54. $(".choseBuyWay").append(`<div class="estimatedMap" id="estimatedMap"><div class="estimatedchart hasLoading">${chatDom}</div></div>`)
  55. $(".choseBuyWay img").css("width","430px")
  56. $(".merchandiseDetail .fundDetail-main").css("border","1px solid #cce0ff")
  57. // 加入脚本控制按钮
  58. $(".fundDetail-main").css("height","270px")
  59. $(".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>`)
  60. // 修改页面头部
  61. $(".inner").prepend(`<div class="title">${$(".fundDetail-tit").text()}</div>`);
  62. $(".fundDetail-header").remove();
  63. // 移除顽固内容
  64. let cleanAIAssistant = setInterval(()=>{
  65. if($("#AIAssistant")){
  66. let domHtml = $("#AIAssistant").html()
  67. if(domHtml && domHtml.length>5){
  68. $("#AIAssistant").remove();
  69. clearInterval(cleanAIAssistant)
  70. main.update();
  71. }
  72. }
  73. },500);
  74. $("body>*").css("opacity","1")
  75. },
  76. addBtn(){
  77. $("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>`)
  78. $("body").append(`<div id="cleanBtn" onclick="javascript:localStorage.setItem('cleanState','true');location.reload();"><div>精简模式</div></div>`)
  79. $("body>*").css("opacity","1")
  80. },
  81. update(){
  82. // 清除所有计时器
  83. let end = setInterval(()=>{}, 100);
  84. for (let i = 1; i <= end; i++) {
  85. clearInterval(i);
  86. }
  87. // 开始准备更新趋势图和净值
  88. let img = $("#estimatedMap").find("img");
  89. let imgurl = $(img).attr("src");
  90. setInterval(function() {
  91. let today = new Date();
  92. if (today.getDay() > 0 && today.getDay() < 6) {
  93. if (today.getHours() >= 9 && today.getHours() < 12) {
  94. $(img).attr("src", imgurl + "?v=" + Math.random())
  95. main.queryData()
  96. } else {
  97. if (today.getHours() >= 13 && today.getHours() < 15) {
  98. $(img).attr("src", imgurl + "?v=" + Math.random())
  99. main.queryData()
  100. }
  101. }
  102. }
  103. }, 30000)
  104. },
  105. queryData(){
  106. // 跨域请求获取净值
  107. var _script = document.createElement("script");
  108. _script.setAttribute("charset", "utf-8");
  109. _script.setAttribute("type", "text/javascript");
  110. _script.setAttribute("src", "http://fundgz.1234567.com.cn/js/" + id + ".js?rt=" + new Date().getTime());
  111. document.getElementsByTagName("head")[0].appendChild(_script);
  112. if(/safari/.test(window.navigator.userAgent.toLowerCase())){
  113. _script.parentNode.removeChild(_script);
  114. }else{
  115. _script.onload = function() {
  116. _script.parentNode.removeChild(_script);
  117. }
  118. }
  119. }
  120. }
  121. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址