TX NBA

腾讯nba小助手

目前为 2021-11-24 提交的版本。查看 最新版本

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

QingJ © 2025

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