Greasy Fork

Greasy Fork is available in English.

中国保密在线网-自动完成视频打卡

中国保密在线网-自动完成视频打卡插件

当前为 2022-07-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         中国保密在线网-自动完成视频打卡
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  中国保密在线网-自动完成视频打卡插件
// @author       You
// @match        http://*/*
// @grant        none
// @license MIT
// ==/UserScript==


(function() {
    'use strict';

class HttpRequest extends window.XMLHttpRequest {
  constructor() {
    super(...arguments);
    this._url = "";
    this._params = "";
  }
  open() {
    const arr = [...arguments];
    const url = arr[1];
    if (/studyTime\/saveCoursePackage.do/g.test(url)) {
      const [path, params] = url.split(/\?/);
      this._url = path;
      this._params = params;
      const replaceNum = url.match(/resourceLength=(\d*)&/)[1];
      if (this._params) {
        arr[1] = url.replace(/(?<=studyLength=)(\d*)/, replaceNum).replace(/(?<=studyTime=)(\d*)/, 1758750684863);
      }
      Toast("任务完成");
    }

    return super.open(...arr);
  }
}

function Toast(msg, duration) {
  duration = isNaN(duration) ? 3000 : duration;
  var m = document.createElement("div");
  m.innerHTML = msg;
  m.style.cssText =
    "max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 9999999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
  document.body.appendChild(m);
  setTimeout(function () {
    var d = 0.5;
    m.style.webkitTransition =
      "-webkit-transform " + d + "s ease-in, opacity " + d + "s ease-in";
    m.style.opacity = "0";
    setTimeout(function () {
      document.body.removeChild(m);
    }, d * 1000);
  }, duration);
}

window.XMLHttpRequest = HttpRequest;
    // Your code here...
})();