Greasy Fork

Greasy Fork is available in English.

吉讯职业生涯课刷课

职业生涯课刷课,目前只检测未看过的课

当前为 2020-05-19 提交的版本,查看 最新版本

// ==UserScript==
// @name         吉讯职业生涯课刷课
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  职业生涯课刷课,目前只检测未看过的课
// @author       海棠未眠
// @match        http://tyut.careersky.cn/jixun/VodLesson/AllLessons
// @grant        none
// ==/UserScript==

(function() {
// 倍速播放
let playbackRate = 1;
// 是否静音
let muted = true;


let flag = false;

function startPlayer() {
  let lessonList = $(".allLessons li");
  console.log(lessonList);
  for (let i = 0; i < lessonList.length - 1; i++) {
    const element = lessonList[i];
    if ($(element).children("span").length !== 0) {
      continue;
    } else {
      console.log("第" + i + "个视频");
      $(element).find("a")[0].click();
      flag = true;
      setTimeout(function () {
        let video = $(".video-player video");
        if (!video) {
          return;
        }
        video.attr("id", "lance");
        video = document.getElementById("lance");
        video.muted = muted;
        video.playbackRate = playbackRate;
        video.onended = function () {
          console.log("观看完成");
          $(".close")[0].click();
          console.log(66666);
        }
      }, 5500);
      break;
    }
  }
}

function findLesson() {
  let allLessonCategoryChild = $(".allLesson-category-child a");
  for (let i = 0; i < allLessonCategoryChild.length; i++) {
    if (flag) {
      return;
    }
    const element = allLessonCategoryChild[i];
    element.click();
    startPlayer();
  }
}

      let allLessonCategory = $(".allLesson-category a");
  for (let i = 0; i < allLessonCategory.length; i++) {
    if (flag) {
      break;
    }
    const element = allLessonCategory[i];
    element.click();
    findLesson();
  }


})();