Crack Forclass 2

这同样适用于 Forclass,Sunclass,271BAY,Zhizhiniao

目前為 2020-07-20 提交的版本,檢視 最新版本

// ==UserScript==
// @name               Crack Forclass 2
// @namespace          https://crack-forclass-2.houtarchat.ml/
// @version            1.0.0
// @description        这同样适用于 Forclass,Sunclass,271BAY,Zhizhiniao
// @author             Houtarchat
// @match              *://*.forclass.net/Student/Wdzy*
// @match              *://*.271bay.com/Student/Wdzy*
// @contributionURL    https://www.houtarchat.ml/donate.html
// @contributionAmount 5 RMB
// @grant              none
// @license            GNU General Public License
// ==/UserScript==

(function () {
  "use strict";
  var formatJson = function (json, options) {
    var reg = null,
      formatted = "",
      pad = 0,
      PADDING = "    ";
    options = options || {};
    options.newlineAfterColonIfBeforeBraceOrBracket =
      options.newlineAfterColonIfBeforeBraceOrBracket === true ? true : false;
    options.spaceAfterColon = options.spaceAfterColon === false ? false : true;
    if (typeof json !== "string") {
      json = JSON.stringify(json);
    } else {
      json = JSON.parse(json);
      json = JSON.stringify(json);
    }
    reg = /([\{\}])/g;
    json = json.replace(reg, "\r\n$1\r\n");
    reg = /([\[\]])/g;
    json = json.replace(reg, "\r\n$1\r\n");
    reg = /(\,)/g;
    json = json.replace(reg, "$1\r\n");
    reg = /(\r\n\r\n)/g;
    json = json.replace(reg, "\r\n");
    reg = /\r\n\,/g;
    json = json.replace(reg, ",");
    if (!options.newlineAfterColonIfBeforeBraceOrBracket) {
      reg = /\:\r\n\{/g;
      json = json.replace(reg, ":{");
      reg = /\:\r\n\[/g;
      json = json.replace(reg, ":[");
    }
    if (options.spaceAfterColon) {
      reg = /\:/g;
      json = json.replace(reg, ":");
    }
    json.split("\r\n").forEach(function (node, index) {
      var i = 0,
        indent = 0,
        padding = "";
      if (node.match(/\{$/) || node.match(/\[$/)) {
        indent = 1;
      } else if (node.match(/\}/) || node.match(/\]/)) {
        if (pad !== 0) {
          pad -= 1;
        }
      } else {
        indent = 0;
      }
      for (i = 0; i < pad; i++) {
        padding += PADDING;
      }
      if (node === "") {
        formatted += padding + node + "\r\n";
      }
      pad += indent;
    });
    return formatted;
  };

  var xhttp;
  if (window.XMLHttpRequest) {
    // 用于现代浏览器的代码
    xhttp = new XMLHttpRequest();
  } else {
    // 应对老版本 IE 浏览器的代码
    xhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }

  xhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
      window.prompt("Response", formatJson(this.responseText.d.result));
    }
  };

  xhttp.open(
    "POST",
    "http://webservice.forclass.net/ANAService.asmx/GetSCStudentAssignmentList",
    true
  );
  xhttp.setRequestHeader("Content-type", "application/json; charset=UTF-8");
  var session = getSession();
  var data = {
    count: 10,
    fromDate: "",
    index: 1,
    page: 1,
    sName: "待完成",
    session: session,
    stateName: "全部",
    subject: "全部",
    toDate: ""
  };
  xhttp.send(JSON.stringify(data));
})();