Greasy Fork

Greasy Fork is available in English.

吉讯职业生涯课刷课

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

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

// ==UserScript==
// @name         吉讯职业生涯课刷课
// @namespace    http://tampermonkey.net/
// @version      2.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;
        let video = $(".video-player video");
        while (video.length == 0) {
          video = $(".video-player video");
        }
        console.log(video);
        video.attr("id", "lance");
        video = document.getElementById("lance");
        video.muted = muted;
        video.playbackRate = playbackRate;
        video.addEventListener("ended", function () {
          console.log("视频观看结束");
          $(".close")[0].click();
          console.log(66666);
        }, false);
        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();
  }


})();