同花顺问财助手

去除无意义行列、优化表格展示---test

  1. // ==UserScript==
  2. // @name 同花顺问财助手
  3. // @namespace
  4. // @icon http://s.thsi.cn/cd/iwc-web-result-red-rabbit-project/unifiedwap/static/img/iwencai_logo.png
  5. // @version 1.20
  6. // @description 去除无意义行列、优化表格展示---test
  7. // @author wang
  8. // @match http://www.iwencai.com/*
  9. // @match http://search.10jqka.com.cn/*
  10. // @match https://www.iwencai.com/*
  11. // @match https://search.10jqka.com.cn/*
  12. // @require https://unpkg.com/ajax-hook@2.1.3/dist/ajaxhook.min.js
  13. // @license MIT
  14. // @grant GM_addStyle
  15. // @grant GM_xmlhttpRequest
  16. // @grant GM_notification
  17. // @connect *
  18. // @namespace https://gf.qytechs.cn/users/984773
  19. // ==/UserScript==
  20.  
  21. ;(function () {
  22. 'use strict'
  23. //劫持函数
  24. function addXMLRequestCallback(callback) {
  25. // oldSend 旧函数 i 循环
  26. var oldSend, i
  27. //判断是否有callbacks变量
  28. if (XMLHttpRequest.callbacks) {
  29. //判断XMLHttpRequest对象下是否存在回调列表,存在就push一个回调的函数
  30. XMLHttpRequest.callbacks.push(callback)
  31. } else {
  32. //如果不存在则在xmlhttprequest函数下创建一个回调列表/callback数组
  33. XMLHttpRequest.callbacks = [callback]
  34. // 保存 XMLHttpRequest 的send函数
  35. oldSend = XMLHttpRequest.prototype.send
  36. //获取旧xml的send函数,并对其进行劫持(替换) function()则为替换的函数
  37. //以下function函数是一个替换的例子
  38. XMLHttpRequest.prototype.send = function () {
  39. // 把callback列表上的所有函数取出来
  40. for (i = 0; i < XMLHttpRequest.callbacks.length; i++) {
  41. // 把this传入进去
  42. XMLHttpRequest.callbacks[i](this)
  43. }
  44. //循环回调xml内的回调函数
  45. // 调用旧的send函数 并传入this 和 参数
  46. oldSend.apply(this, arguments)
  47. //由于我们获取了send函数的引用,并且复写了send函数,这样我们在调用原send的函数的时候,需要对其传入引用,而arguments是传入的参数
  48. }
  49. }
  50. }
  51. // e.g.
  52. //传入回调 接收xhr变量
  53. addXMLRequestCallback(function (xhr) {
  54. //调用劫持函数,填入一个function的回调函数
  55. //回调函数监听了对xhr调用了监听load状态,并且在触发的时候再次调用一个function,进行一些数据的劫持以及修改
  56. xhr.addEventListener('loadend', function () {
  57. // 输入xhr所有相关信息
  58. // console.log(xhr)
  59. if (xhr.readyState == 4 && xhr.status == 200) {
  60. // 如果xhr请求成功 则返回请求路径
  61. if (xhr.responseURL.indexOf('set-history') != -1) {
  62. if (
  63. document
  64. .getElementsByClassName('input-base-copy')[0]
  65. .innerHTML.indexOf('dde大单净额;资金流向;') != -1
  66. ) {
  67. return
  68. }
  69. let timeID
  70. if (timeID) return
  71. console.log('同花顺问财助手---启动!!!')
  72. console.time('同花顺问财助手---耗时')
  73. let conditionList
  74. if(document.getElementsByClassName('left-bar-ul')[0].children[1].className=='selected'){
  75. conditionList = [
  76. '最新价',
  77. '个股热度排名',
  78. '分时涨跌幅:前复权',
  79. '最新涨跌幅',
  80. '涨跌幅:前复权',
  81. '营业收入行业排名',
  82. '所属同花顺行业',
  83. '总市值',
  84. '(市净率(pb)/同花顺二级行业市净率)',
  85. '(市盈率(pe)/同花顺二级行业市盈率)',
  86. '(市盈率(pe,ttm)/市盈率(pe,ttm)行业中值)',
  87. '净资产收益率roe(加权,公布值)',
  88. '((竞价未匹配量*竞价匹配价)/a股市值(不含限售股))',
  89. '((竞价未匹配量*竞价匹配价)/总市值)',
  90. '((竞价未匹配金额/总市值)*10000.0)',
  91. '((竞价未匹配金额/总市值)*1000.0)',
  92. '((竞价未匹配金额/总市值)*100.0)',
  93. '委比',
  94. '分时委比',
  95. '小单净比',
  96. '中单净比',
  97. 'dde大单净比',
  98. '主力资金流向',
  99. '主力增仓占比',
  100. '(成交量/成交量)',
  101. ]
  102. Array.prototype.remove = function(val) {
  103. var index = this.indexOf(val);
  104. if (index > -1) {
  105. this.splice(index, 1);
  106. }
  107. };
  108. if (
  109. document
  110. .getElementsByClassName('input-base-copy')[0]
  111. .innerHTML.indexOf('涨幅大于-10%排行') != -1
  112. ) {
  113. conditionList.remove('最新价')
  114. conditionList.remove('所属同花顺行业')
  115. //conditionList.remove('最新价')
  116. //conditionList.remove('最新价')
  117. }
  118. }
  119. if(document.getElementsByClassName('left-bar-ul')[0].children[2].className=='selected'){
  120. conditionList = [
  121. '指数@涨跌幅:前复权',
  122. '指数@涨停家数占比',
  123. '指数@一字涨停家数占比',
  124. '指数@非一字涨停家数占比',
  125. '指数@上涨家数占比',
  126. '指数@下跌家数占比',
  127. '指数@分时涨跌幅:前复权',
  128. '指数@委比',
  129. '指数@分时委比',
  130. '指数@上涨家数',
  131. '指数@分时上涨家数'
  132. ]
  133. }
  134.  
  135. try {
  136. const li_arr = document.getElementsByClassName('select-box-li')
  137. for (let i = 0; i < li_arr.length; i++) {
  138. timeID = setTimeout(() => {
  139. const li = li_arr[i]
  140. const li_selected = li.children[0].children[1].className
  141. if (li && li_selected.indexOf('selected') != -1) {
  142. if (conditionList.indexOf(li.title) == -1) {
  143. li.click()
  144. }
  145. }
  146. if (i == li_arr.length - 1) {
  147. console.log('同花顺问财助手---清理完成')
  148. console.timeEnd('同花顺问财助手---耗时')
  149. clearTimeout(timeID)
  150. }
  151. }, i * 110)
  152. }
  153. } catch (error) {
  154. console.error(error)
  155. }
  156. }
  157. }
  158. })
  159. })
  160. })()

QingJ © 2025

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