jxw教练学习

快速刷视频

// ==UserScript==
// @name        jxw教练学习
// @namespace   vurses
// @license     Mit
// @author      layenh
// @match       https://www.jxw12328.com/index/index/unstudy.html
// @grant       none
// @grant       GM_registerMenuCommand
// @grant       GM.registerMenuCommand
// @version     1.2
// @description 快速刷视频
// ==/UserScript==

(() => {
  let ids = [];
  try {
    for (x of Array.from(
      document.querySelector("body").querySelectorAll("dd[data-id]")
    )) {
      ids.push(x.dataset.id);
      let temp = x.dataset.id;
      // x.querySelector("button").onclick = function () {
      //   window.open(`/index/index/jltest/id/${temp}.html`);
      // };
    }
  } catch (error) {
    console.log("遇到错误:请联系开发者" + error);
  }
  for (id of ids) {
    console.log(id);
    $.ajax({
      url: "/manage/api/jlvideosave.html", // 后台接口
      type: "POST",
      cache: false,
      data: {
        id: id,
        end: 1,
      },
      dataType: "json",
      success(res) {
        let data = JSON.parse(res);
        console.log(data);
      },
    });
  }
})();