使用js进行智慧树刷课

按照以下操作步骤即可

1.使用谷歌浏览器打开所刷课的视频
在这里插入图片描述
2.按f12调出控制面板
3.点击清除 并把代码粘贴 回车
在这里插入图片描述

(function() {
 'use strict';
 const $ = window.jQuery;
 var zhs_halt = false;

 function keeping() {
  if ( zhs_halt ) return;

  // 读取视频时长计算标识
  var video_finished = $(".current_play b").hasClass("time_icofinish");

  // 暂停后自动播放
  if ( $("video")[0].paused && !video_finished ) {
    
    
   $("#playButton").click();
  }

  // 自动切换下一个视频
  if ( video_finished ) {
   // 点击 next 按钮
   // $("#nextBtn").click();
   // 由于智慧树网页设计问题,在一定情况下点击 next 按钮后无法跳转到视频页面,故采用模拟点击方法
   var current_video = $(".video.current_play");
   var videos = $(".video");
   var click = false;
   $(".video").each(function(){
    if( click ){
     $(this).click();
     click = false;
    }
    if($(this).hasClass("current_play")) click = true;
   })
  }

  // 静音
  if ( $("video")[0].volume ) {
   $(".volumeIcon")[0].click();
  }

  // 自动切换到1.5if ( $("video")[0].playbackRate != 1.5 ) {
    
    
   $(".speedTab15")[0].click();
  }

  // 弹题自动选择第一个选项
  if ( $(".dialog-test").length ) {
   var test = $(".dialog-test");
   var test_option = test.find(".topic-item").length - 1;
   test_option = parseInt( Math.random() * test_option );
   test.find(".topic-item")[test_option].click();
   test.find(".dialog-footer").find(".btn")[0].click();
   $("#playButton").click();
  }

 }

 $(window).ready(function(){
  setInterval(keeping, 3000);
 })

})();

猜你喜欢

转载自blog.csdn.net/weixin_47284756/article/details/114310585