Greasy Fork镜像 支持简体中文。

TX NBA

腾讯nba小助手

目前為 2022-11-29 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name TX NBA
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.93
  5. // @description 腾讯nba小助手
  6. // @author ok!
  7. // @match https://kbs.sports.qq.com/kbsweb/game*
  8. // @run-at document-end
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. //调整滚轮前进后退的秒数
  13. var wheel_sec = 8;
  14. //等待广告误伤提示的秒数
  15. var playcheck_time=8000;
  16. var timeadd=1;
  17. var video_elem1;
  18. var video_elem2;
  19. var v_elem;
  20.  
  21. let a_bug15 = document.createElement("script");
  22. a_bug15.innerHTML = `const _createClass = 0;const _classCallCheck= 0;const _typeof = 0;const beacon= 0;window.Beacon=0;const str=0;`;
  23. document.head.appendChild(a_bug15);
  24. console.log("not-playing4");
  25.  
  26. Object.defineProperty(HTMLMediaElement.prototype, 'playing', {
  27. get: function(){
  28. return !!(this.currentTime > 0 && !this.paused && !this.ended && this.readyState > 2);
  29. }
  30. })
  31.  
  32. function clean_ads(){
  33.  
  34. var clear_mark = setInterval(function(){
  35. //点击开始播放
  36. /*
  37. if(document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_video_container > video")){
  38.  
  39. document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_video_container > video").autoplay=true;
  40. setTimeout(function(){
  41. if(document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_video_container > video").playing)
  42. {console.log("playing0");}
  43. else{
  44. document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_bottom > txpdiv > txpdiv.txp_left_controls > txpdiv.txp_btn.txp_btn_play").click();
  45. console.log("not-playing0");
  46. setTimeout(function(){
  47. //广告暂替刷新
  48. if(document.querySelector("#tvpLiveMod > txpdiv > txp")){
  49. console.log("成功刷新");
  50. window.location.reload(true);
  51. }},3000);
  52. }},7000);
  53.  
  54.  
  55. }
  56. */
  57.  
  58. //广告暂替刷新
  59. if(document.querySelector("#tvpLiveMod > txpdiv > txp")){
  60. console.log("成功刷新");
  61. window.location.reload(true);
  62.  
  63. }
  64. //大大大
  65. else{
  66.  
  67. //watermark
  68.  
  69. if(document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_video_container > video")||document.querySelector("#tvpVideoPopupMod")){
  70.  
  71.  
  72. if (document.querySelector("txpdiv.txp-watermark")){
  73. setTimeout(function(){document.querySelector("txpdiv.txp-watermark").remove();
  74. // document.querySelector("txpdiv.txp_top_btns").remove();
  75. // document.querySelector("txpdiv.txp_bottom > txpdiv > txpdiv.txp_right_controls > txpdiv:nth-child(3) > txpdiv.txp_popup.txp_popup_definition > txpdiv > txpdiv:nth-child(3)").click();
  76. },1000);
  77. }
  78. if (document.querySelector("txpdiv.txp-watermark")){
  79. setTimeout(function(){document.querySelector("txpdiv.txp-watermark").remove();
  80. // document.querySelector("txpdiv.txp_top_btns").remove();
  81. // document.querySelector("txpdiv.txp_bottom > txpdiv > txpdiv.txp_right_controls > txpdiv:nth-child(3) > txpdiv.txp_popup.txp_popup_definition > txpdiv > txpdiv:nth-child(3)").click();
  82. },1000);
  83. }
  84. //document.querySelector("#tvpVideoMod txpdiv.txp-watermark").remove();
  85. video_elem1 = document.querySelector("#tvpVideoPopupMod > div.txp_videos_container > video:nth-child(1)");
  86. v_elem = document.querySelector("#tvpVideoPopupMod");
  87.  
  88. //
  89. if(document.querySelector("#tvpVideoPopupMod > txpdiv.txp_player_external")){
  90. video_elem2 = document.querySelector("#tvpVideoPopupMod > txpdiv.txp_player_external");
  91. video_elem2.onwheel = function(e){e.preventDefault()};
  92. }
  93.  
  94. video_elem1.onwheel = function(e){e.preventDefault()};
  95.  
  96. v_elem.onwheel = function(e){e.preventDefault()};
  97. v_elem.onwheel = wheel_e;
  98.  
  99. function wheel_e (event) {
  100. event.preventDefault();
  101. video_elem1.currentTime += (event.deltaY>0?wheel_sec/1:-wheel_sec) ;
  102. v_elem.onwheel="";
  103. setTimeout(function(){v_elem.onwheel= wheel_e;},300);
  104.  
  105. }
  106. console.log("第1个live= ");
  107.  
  108. }
  109. /*
  110. else if(document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_watermark")){
  111. document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_watermark").remove();
  112.  
  113. }
  114. */
  115.  
  116. else if (document.querySelector("#tvpVideoMod")){
  117.  
  118. if (document.querySelector("#tvpVideoMod txpdiv.txp-watermark")){
  119. setTimeout(function(){document.querySelector("#tvpVideoMod txpdiv.txp-watermark").remove();
  120. // document.querySelector("#tvpVideoMod txpdiv.txp_top_btns").remove();
  121. document.querySelector("#tvpVideoMod txpdiv.txp_bottom > txpdiv > txpdiv.txp_right_controls > txpdiv:nth-child(3) > txpdiv.txp_popup.txp_popup_definition > txpdiv > txpdiv:nth-child(3)").click();
  122. },1000);
  123. }
  124.  
  125. // 滚轮前进后退
  126.  
  127. video_elem1 = document.querySelector("video");
  128.  
  129. // video_elem2 = document.querySelector("#tvpVideoMod > div.txp_videos_container > video:nth-child(2)");
  130. v_elem = document.querySelector("#tvpVideoMod");
  131. //document.querySelector("#tvpVideoMod > div.txp_videos_container");
  132.  
  133. video_elem1.onwheel = function(e){e.preventDefault()};
  134. // video_elem2.onwheel = function(e){e.preventDefault()};
  135. v_elem.onwheel = function(e){e.preventDefault()};
  136. v_elem.onwheel = wheel_e;
  137.  
  138. function wheel_e (event) {
  139. event.preventDefault();
  140.  
  141.  
  142. // event.deltaY = Math.min(Math.max(.125,event.deltaY), 4);
  143. //console.log(wheel_sec);
  144. video_elem1.currentTime += (event.deltaY>0?wheel_sec/1:-wheel_sec) ;
  145.  
  146. v_elem.onwheel="";
  147. setTimeout(function(){v_elem.onwheel= wheel_e;},300);
  148.  
  149. }
  150. console.log("第2个video= ");
  151.  
  152. }
  153. //点击开始播放
  154.  
  155. if(document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_video_container > video")){
  156.  
  157. // document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_video_container > video").autoplay=true;
  158. setTimeout(function(){
  159. if(document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_video_container > video").playing)
  160. {console.log("playing");}
  161. else{
  162. document.querySelector("#tvpLiveMod > txpdiv > txpdiv.txp_bottom > txpdiv > txpdiv.txp_left_controls > txpdiv.txp_btn.txp_btn_play").click();
  163. console.log("not-playing");
  164.  
  165. setTimeout(function(){
  166. //广告暂替刷新
  167. if(document.querySelector("#tvpLiveMod > txpdiv > txp")){
  168. console.log("成功刷新");
  169. window.location.reload(true);
  170. }},3000);
  171.  
  172. }
  173. },playcheck_time);
  174.  
  175. }
  176.  
  177.  
  178.  
  179. // if(document.querySelector("#tvpVideoMod > txpdiv.txp_player.txp_player_desktop")||document.querySelector("#tvpLiveMod > txpdiv")){
  180.  
  181. // console.log("运行完次数"+timeadd++);
  182.  
  183. clearInterval(clear_mark);
  184.  
  185. // }
  186.  
  187. }
  188.  
  189. },6000);
  190. }
  191.  
  192. /*
  193. if(document.querySelector("#tvpLiveMod txp.txp_overlay_error")){document.querySelector("#tvpLiveMod txp.txp_overlay_error").remove();}
  194. }
  195. */
  196.  
  197. clean_ads();
  198.  
  199.  
  200. //以下代码有参考"天天の記事簿"的博客
  201. (function() {
  202. function ajaxEventTrigger(event) {
  203. var ajaxEvent = new CustomEvent(event, { detail: this });
  204. window.dispatchEvent(ajaxEvent);
  205. }
  206.  
  207. var oldXHR = window.XMLHttpRequest;
  208.  
  209. function newXHR() {
  210. var realXHR = new oldXHR();
  211. // this指向window
  212. realXHR.addEventListener('abort', function () { ajaxEventTrigger.call(this, 'ajaxAbort'); }, false);
  213.  
  214. realXHR.addEventListener('error', function () { ajaxEventTrigger.call(this, 'ajaxError'); }, false);
  215.  
  216. realXHR.addEventListener('load', function () { ajaxEventTrigger.call(this, 'ajaxLoad'); }, false);
  217.  
  218. realXHR.addEventListener('loadstart', function () { ajaxEventTrigger.call(this, 'ajaxLoadStart'); }, false);
  219.  
  220. realXHR.addEventListener('progress', function () { ajaxEventTrigger.call(this, 'ajaxProgress'); }, false);
  221.  
  222. realXHR.addEventListener('timeout', function () { ajaxEventTrigger.call(this, 'ajaxTimeout'); }, false);
  223. realXHR.addEventListener('loadend', function () { ajaxEventTrigger.call(this, 'ajaxLoadEnd'); }, false);
  224.  
  225. realXHR.addEventListener('readystatechange', function() { ajaxEventTrigger.call(this, 'ajaxReadyStateChange'); }, false);
  226.  
  227. return realXHR;
  228. }
  229.  
  230. window.XMLHttpRequest = newXHR;
  231. })();
  232. //调用
  233. var xhr = new XMLHttpRequest();
  234.  
  235. window.addEventListener('ajaxReadyStateChange', function (e) {
  236. //console.log(e.detail.responseText); // XMLHttpRequest Object
  237. let jsonto_array=JSON.parse(e.detail.responseText);
  238. console.log(jsonto_array.data.isPay);
  239. if(jsonto_array.data.isPay){
  240. clean_ads();
  241. }
  242. });
  243. window.addEventListener('ajaxAbort', function (e) {
  244. //console.log(e.detail.responseText); // XHR 返回的内容
  245. });
  246. /*
  247. xhr.open('GET', 'info.json');
  248. xhr.send();
  249. */

QingJ © 2025

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