Greasy Fork

Greasy Fork is available in English.

广东省专业技术人员继续教育平台学习辅助工具

自动视频学习

当前为 2019-05-13 提交的版本,查看 最新版本

// ==UserScript==
// @name         广东省专业技术人员继续教育平台学习辅助工具
// @namespace    http://greasyfork.icu
// @version      0.2
// @description  自动视频学习
// @author       midpoint
// @match        *://ggfw.gdhrss.gov.cn/zxpx/auc/play/player?*
// @grant        none
// ==/UserScript==

function start() {
  console.log('稍等,马上就开始学习啦……');
  if(typeof tm1!=="undefined") {
    clearInterval(tm1);
  }
  if(typeof tm2!=="undefined") {
    clearTimeout(tm2);
  }
  var urls=[];
  var url=$('.content-learning,.content-unstart').each(function () {
    var str;
    str=$(this).parent().attr('href');
    str=str.match(/\('(.+)'\)/);
    if(str!=null)
    {
      urls.push('http://'+document.domain+str[1]);
    }
    else
    {
      urls.push(location.href);
    }
  });

  var count=0;
  var unfinish=false;
  var str='';
  var tm1=setInterval(function() {
    str=$('.learnpercent').text();
    if(str.indexOf('完成')>0) {
      unfinish=false;
      count++;
      location.replace(urls[count]);
    }

    $('.prism-big-play-btn pause').click();
    if(unfinish || count>urls.length) return;

    unfinish=true;
//    location.replace(urls[count]);
    if(typeof tm2!=="undefined") {
      clearTimeout(tm2);
    }
    var tm2=setTimeout(function() {
      $('.prism-big-play-btn').click();
      $('.prism-button prism-button-retry').click();
      getTimu=function(index) {
        return false;
      }
    }, 2000);
  }, 3000);
  return '祝大家快乐学习!健康生活!';
}
start();