Greasy Fork

Greasy Fork is available in English.

南京智慧人社继续教育系统在线辅助-自动播放

南京专技人员继续教育平台、继续教育专业课学习平台(公需课),自动播放课程列表,自动跳过弹窗。截至目前2023年6月,插件可用

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         南京智慧人社继续教育系统在线辅助-自动播放
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  南京专技人员继续教育平台、继续教育专业课学习平台(公需课),自动播放课程列表,自动跳过弹窗。截至目前2023年6月,插件可用
// @author       Znonymous
// @match        https://m.mynj.cn:11188/*
// @match        https://jxjy.mynj.cn:8283/*
// @match        http://180.101.236.114:8283/*
// @run-at       document-end
// @grant        GM_notification
// @license      MIT
// ==/UserScript==

(function () {
  function playVideo() {
    if (document.querySelector("video")) {
      console.log("检查是否有视频");
      let player = document.querySelector("video")
      if (player.paused) {
        console.log("检查是否暂停");
        player.play();
      }
    }
  }

  // function setPlayerPercent(percent) {
  //   if (document.querySelector("video")) {
  //     let player = document.querySelector("video")
  //     player.currentTime = player.duration*percent/100
  //   }
  // }

  function startLearning() {
    let url = location.href;

    if (url.includes("https://m.mynj.cn:11188/zxpx/tec/play/player") || url.includes("http://180.101.236.114:8283/rsrczxpx/tec/play/player") || url.includes("https://jxjy.mynj.cn:8283/rsrczxpx/tec/play/player")) {
      // 视频是否暂停
      playVideo()
      // 消除中间播放的弹窗
      let messageDialog = document.querySelector('.dialog-button a')
      if (messageDialog) {
        console.log("有弹窗,点击")
        messageDialog.click()
        setTimeout(() => {
          console.log("弹窗后,播放视频")
          playVideo()
        }, 2000)
      }

      let learnpercent = document.querySelector(".learnpercent span span").textContent
      if (learnpercent === "已完成") {
        console.log("完成课程")
        const unfinishedDom = Array.prototype.slice.call(document.querySelectorAll('.ztree a.level0'))
          .filter(function (el) {
            return el.innerText.includes('未开始') || el.innerText.includes('未完成')
          })[0]
        if (unfinishedDom) {
          unfinishedDom.click()
        } else {
          GM_notification({
            title: "课程已经完成",
            text: "已经完成,请返回页面确认",
            highlight: true,
          })
        }
      } else {
        if (!document.querySelector("video")) {
          console.log("没有视频了,还没看完")
          GM_notification({
            title: "没有视频了,还没看完",
            text: "请返回页面重新拖动进度条",
          })
        }
      }
    }
  }
  let myTimer = setInterval(startLearning, 3000);
})()