qwercccv / chinalife_elearning_autoclick_assess

// ==UserScript==
// @name         chinalife_elearning_autoclick_assess
// @namespace    https://openuserjs.org/users/qwercccv
// @version      2024-10-21
// @description  自动点击国寿易学的课程评价
// @author       You
// @match        https://*.e-chinalife.com/els/learner-studentpc-fe/classDetail/*
// @grant        none
// @copyright 2024, qwercccv (https://openuserjs.org/users/qwercccv)
// @license MIT
// ==/UserScript==

(function () {
  'use strict';

  function clickone() {

    setTimeout(function () {
      const submitButtons = Array.from(document.querySelectorAll('span')).filter(div => div.textContent.trim() === '未完成');
      //submitButtons[0].click(); console.log("click");
      submitButtons.forEach(submitButton => {
        submitButton.click();
        console.log("click");
      });
    }, 1000);
  }

  function clickall() {
    document.getElementById("tab-intro").click();
    setTimeout(function () {
      document.getElementById("tab-assess").click();
      setTimeout(function () {
        const submitButtons = Array.from(document.querySelectorAll('span')).filter(div => div.textContent.trim() === '未完成');
        if (submitButtons.length == 0) {
          clearInterval(intva);
        }
        //submitButtons[0].click(); console.log("click");
        submitButtons.forEach(submitButton => {
          submitButton.click();
          console.log("click");
        });
      }, 1900);
    }, 150);
  }

  setTimeout(function () {
    document.getElementById("tab-assess").click();
    setTimeout(function () {
      clickone();
    }, 1500);
    var intva = setInterval(clickall, 13700);
  }, 1700);
})();