苏州大学成教在线教学平台

苏州大学成教在线,自动播放下一个,弹窗屏蔽

  1. // ==UserScript==
  2. // @name 苏州大学成教在线教学平台
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0
  5. // @description 苏州大学成教在线,自动播放下一个,弹窗屏蔽
  6. // @author xiajie
  7. // @match https://cj1060-kfkc.webtrn.cn/*
  8. // @icon http://webtrn.cn/favicon.ico
  9. // @grant none
  10. // @license GPL
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. if(window.location.pathname == '/learnspace/learn/learn/templateeight/index.action'){
  17. console.log('进入课程详情');
  18.  
  19. //弹窗点击
  20. setInterval(function(){
  21. if($('.layui-layer-btn0').length>0){
  22. $('.layui-layer-btn0').click();
  23. }
  24. },1000);
  25.  
  26. //是否播放页面
  27. setTimeout(function(){
  28. var text = $('.learn-menu-cur .learn-menu-text').text();
  29. if(text != '课件'){
  30. $('#courseware_main_menu a')[0].click();
  31. }
  32. setTimeout(function(){
  33. $('#learn-helper-main').hide();
  34. $('.shade-div').hide();
  35. },2000)
  36. },3000);
  37.  
  38. }
  39.  
  40. if(window.location.pathname == '/learnspace/learn/learn/templateeight/courseware_index.action'){
  41. console.log('进入视频播放');
  42.  
  43. window.isEnd = false;
  44. //播放完成,点击下一节
  45. setInterval(function(){
  46. console.log(isEnd);
  47. if(isEnd == true){
  48. isEnd = false;
  49. var len = $('.s_point').length;
  50. for(var i=0;i<len;i++){
  51. if($('.s_point').eq(i).hasClass('s_pointerct') == false && $('.s_point').eq(i).attr('completestate') == 0 && $('.s_point').eq(i).attr('itemtype') == 'video'){
  52. var p = $('.s_point').eq(10).parent().hasClass('s_sectionwrap');
  53. if(p){
  54. $('.s_point').eq(i).parent().parent().show();
  55. $('.s_point').eq(i).parent().show();
  56. }else{
  57. $('.s_point').eq(i).parent().show();
  58. }
  59. $('.s_point').eq(i).click();
  60. break;
  61. }
  62. }
  63. }
  64. },3000);
  65. }
  66.  
  67. if(window.location.pathname == '/learnspace/learn/learn/templateeight/content_video.action'){
  68. console.log('播放内容页');
  69.  
  70. //视频暂停点击
  71. setInterval(function(){
  72. if($('#player_pause').css('display') != 'none'){
  73. $('#player_pause').click();
  74. }
  75. },1000);
  76.  
  77. //播放完成检测
  78. setInterval(function(){
  79. var now = time_to_sec($('#screen_player_time_1').text());
  80. var total = time_to_sec($('#screen_player_time_2').text());
  81. if(now >0 && total > 0 && (now / total)>0.98){
  82. window.parent.isEnd = true;
  83. }
  84. },3000);
  85.  
  86. }
  87.  
  88. function time_to_sec(time) {
  89. var s = '';
  90. var hour = 0;
  91. var min = 0;
  92. var sec= 0;
  93. if(time.split(':').length == 1){
  94. sec = time.split(':')[0];
  95. }
  96. if(time.split(':').length == 2){
  97. min = time.split(':')[0];
  98. sec = time.split(':')[1];
  99. }
  100. if(time.split(':').length == 3){
  101. hour = time.split(':')[0];
  102. min = time.split(':')[1];
  103. sec = time.split(':')[2];
  104. }
  105.  
  106. s = Number(hour*3600) + Number(min*60) + Number(sec);
  107.  
  108. return s;
  109. };
  110. })();

QingJ © 2025

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