极时学防掉线

防掉线

// ==UserScript==
// @name         极时学防掉线
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  防掉线
// @author       You
// @license MIT
// @match        https://gk-elearning.yunxuetang.cn/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=61.156
// @grant        none
// ==/UserScript==

(function () {
  'use strict'
  setInterval(() => {
    const event = new Event('mousemove')
    window.dispatchEvent(event)
  }, 1000)
  const thorttle = (delay, fn) => {
    let time = Date.now()
    return () => {
      if (Date.now() - time > delay) {
        fn()
        time = Date.now()
      }
    }
  }
  window.addEventListener('mousemove', thorttle(5000, () => {
    console.log('ping')
    const nextBtn = document.querySelector('.ulcdsdk-nextchapterbutton')
    if (nextBtn) {
        nextBtn.click()
    } else {
        const text = document.querySelector('div.yxtulcdsdk-course-player__countdown > div')?.innerText
        if (text?.indexOf('恭喜您已完成本课程的学习') !== -1) {
           const list = document.querySelectorAll('li.hand.font-w400.textcolorop6.linozj.mb4.font-size-14.lh22.ml16.mr16')
           let isCurrent = false
           list.forEach((item) => {
             if (isCurrent) {
               item?.click()
               isCurrent = false
             } else if (item.classList.contains('liactive')) {
                isCurrent = true
             }
           })
        }
    }
  }))
  // Your code here...
})()

QingJ © 2025

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