JumpVideo

skip video

  1. // ==UserScript==
  2. // @name JumpVideo
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.6
  5. // @description skip video
  6. // @author You
  7. // @match https://lms.ouchn.cn/course/*/learning-activity/*
  8. // @icon https://www.google.com/s2/favicons?domain=ouchn.cn
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. check();
  16. // Your code here...
  17. })();
  18.  
  19. function check(){
  20. var retryCount = 0;
  21. var maxRetry = 3;
  22. var currentURL = window.location.href;
  23. var isNext = false;
  24. console.log("经过测试,interval 在切换视频时不会改变");
  25. var lock = setInterval(function(){
  26. console.log("开始检测是否播放完毕.....");
  27. let video = document.querySelector('#video video');
  28. if (currentURL !== window.location.href && isNext == true) {
  29. currentURL = window.location.href;
  30. isNext = false;
  31. }else if(currentURL == window.location.href && isNext == true){
  32. console.log("出现故障了,无法跳转到下一个作业,清除定时作业,lock:",lock);
  33. clearInterval(lock);
  34. }
  35. if(video == null || typeof video == 'undefined'){
  36. if(retryCount < maxRetry){
  37. console.log('可能是由于加载缓慢导致的未初始化问题,重试次数:'+retryCount+',最大次数:'+maxRetry)
  38. retryCount++;
  39. return;
  40. }else{
  41. console.log("判定为当前页面没有视频,直接下一个作业");
  42. retryCount = 0;
  43. $(".next").click();
  44. isNext = true;
  45. return;
  46. }
  47.  
  48. }
  49. if (video.paused && video.duration != video.currentTime) {
  50. video.playbackRate=4;
  51. video.muted = true;
  52. $('.mvp-toggle-play').click();
  53. return;
  54. }else if(video.duration == video.currentTime){
  55. console.log("播放完毕,下一个视频");
  56. $(".next").click();
  57. isNext = true;
  58. }},3000);
  59. }

QingJ © 2025

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