腾讯云-合作伙伴学堂 - 自动学习外挂

此插件的目的是为了实现用户在<腾讯云-合作伙伴学堂>能够自动挂机学习, 插件会自动点击 <播放>, <静音>, <恢复播放进度>, <确认>, <下一课>按钮。目前已知的问题如下: 1.有时候由于学习窗口处于不活跃状态, 所以插件的功能可能会无法触发; 2.此插件只能自动挂机当前章节下的所有课程, 如果用户希望学习其他章节的内容, 需要手动切换章节.

  1. // ==UserScript==
  2. // @name 腾讯云-合作伙伴学堂 - 自动学习外挂
  3. // @version 1.4
  4. // @description 此插件的目的是为了实现用户在<腾讯云-合作伙伴学堂>能够自动挂机学习, 插件会自动点击 <播放>, <静音>, <恢复播放进度>, <确认>, <下一课>按钮。目前已知的问题如下: 1.有时候由于学习窗口处于不活跃状态, 所以插件的功能可能会无法触发; 2.此插件只能自动挂机当前章节下的所有课程, 如果用户希望学习其他章节的内容, 需要手动切换章节.
  5. // @match https://cloudpartner.lexiangla.com/classes/*
  6. // @match https://cloudpartner.lexiangla.com/teams/*
  7. // @match https://cloud.tencent.com/edu/learning/*
  8. // @match https://lexiangla.com/teams/*
  9. // @author CapSnake
  10. // @namespace https://gf.qytechs.cn/zh-CN/users/200326-snake-cap
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. function getUnsafeWindow() {
  18. if (this) {
  19. //console.log(this);
  20. if (typeof(this.unsafeWindow) !== "undefined") { //Greasemonkey, Scriptish, Tampermonkey, etc.
  21. return this.unsafeWindow;
  22. } else if (typeof(unsafeWindow) !== "undefined" && this === window && unsafeWindow === window) { //Google Chrome natively
  23. var node = document.createElement("div");
  24. node.setAttribute("onclick", "return window;");
  25. return node.onclick();
  26. }
  27. } else { //Opera, IE7Pro, etc.
  28. return window;
  29. }
  30. }
  31.  
  32. var myUnsafeWindow = getUnsafeWindow();
  33.  
  34. var processTimer = null;
  35. var cntRetry = 0;
  36. myUnsafeWindow.clearInterval(processTimer);
  37. // 每隔5秒检测一次
  38. processTimer = myUnsafeWindow.setInterval(TimeProcess, 5000);
  39.  
  40. // 检测函数
  41. function TimeProcess() {
  42. // 播放按钮表示时,点击按钮
  43. var playDiv = $(".vjs-big-play-button");
  44. //console.log("playDiv:", playDiv);
  45. if (playDiv.length > 0 && playDiv.css('display') != 'none') {
  46. console.log('点击播放');
  47. //playBtn.click();
  48. var playBtn = $("#learn-video-player_html5_api");
  49. //console.log("playBtn:", playBtn);
  50. playBtn.get(0).play();
  51. }
  52.  
  53. // 设置播放器静音
  54. var muteBtn = $(".vjs-mute-control.vjs-control.vjs-button.enable-volume-control");
  55. //console.log('muteBtn:', muteBtn);
  56. if (muteBtn.length > 0 && muteBtn.css('display') != 'none') {
  57. var title = muteBtn.attr("title");
  58. //console.log('title:', title);
  59. if (title.length > 0 && title != '取消静音') {
  60. console.log('点击静音');
  61. $("#learn-video-player_html5_api").prop('muted', true);
  62. }
  63. }
  64.  
  65. // 恢复播放按钮表示时,点击按钮
  66. var continuePlayBtn = $(".tcp-continue-play-buttom");
  67. //console.log(continuePlayBtn);
  68. if (continuePlayBtn.length > 0 && continuePlayBtn.css('display') != 'none') {
  69. console.log('点击恢复播放');
  70. continuePlayBtn.click();
  71. }
  72.  
  73. // 确定按钮表示时,点击按钮
  74. var confirmBtn = $(".venom-btn.venom-btn-primary");
  75. //console.log(confirmBtn);
  76. if (confirmBtn.length > 0 && confirmBtn.css('display') != 'none') {
  77. console.log('点击确定');
  78. confirmBtn.click();
  79. }
  80.  
  81. // 下一课按钮表示时,点击按钮
  82. var nextClassBtn = $("a.blue.ml-m");
  83. //console.log(nextClassBtn);
  84. if (nextClassBtn.length > 0 && nextClassBtn.css('display') != 'none') {
  85. console.log('点击下一课');
  86.  
  87. var marker = '<span id = "marker"></span>';
  88. nextClassBtn.append(marker);
  89. //console.log('marker:', $('#marker'));
  90. $('#marker').click();
  91. }
  92. }
  93. })();

QingJ © 2025

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