Greasy Fork

Greasy Fork is available in English.

深圳大学大物预习题小助手

开发中,仅供同学们参考,有bug别打我,私聊就好

当前为 2020-11-22 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         深圳大学大物预习题小助手
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  开发中,仅供同学们参考,有bug别打我,私聊就好
// @author       nut
// @include      http://172.31.80.30:8101/Student/ReadyForExam/*
// @grant        none
// @require      https://unpkg.com/[email protected]/dist/ajaxhook.min.js
// ==/UserScript==

(function() {
    'use strict';
ah.proxy({onRequest:(config,handler)=>{handler.next(config);},onError:(err,handler)=>{console.log(err.type)
handler.next(err)},onResponse:(response,handler)=>{if(response.config.url=="/Student/ReadyForExam/GetPaperContent"){let finalArr={}
let obj=String(response.response).replace(/\\r\\n/g,"")
let data=JSON.parse(obj).OtherDate
let arrHtml=data.match(/<Question Type=(.*?)<\/Question>/g)
for(const i in arrHtml){let qusArr=arrHtml[i].match(/<Describe>(.*?)<\/Describe>/)[0].match(/Text="(.*?)\"/g)
let quse=""
let ans=arrHtml[i].match(/<StdAnswer>(.*?)<\/StdAnswer>/)[0].slice(11,-12)
for(const j in qusArr){quse+=qusArr[j].replace(/ /g,"").slice(6,-1)}
if(!finalArr[arrHtml[i].slice(16,18)]){finalArr[arrHtml[i].slice(16,18)]=[]}
finalArr[arrHtml[i].slice(16,18)].push({qusetion:quse,answer:ans})}
setTimeout(function(){for(const i in finalArr){let question=document.getElementById(i.toLowerCase())
for(let j=0;j<question.childNodes.length;j=j+2){let item=question.childNodes[j].childNodes[0]
let lastSpan=item.getElementsByTagName("span")[item.getElementsByTagName("span").length-1]
let aSpan=document.createElement("span")
aSpan.style="color: red;font-size: 16px;"
aSpan.innerHTML=finalArr[i][j/2].answer
lastSpan.append(aSpan)}}},2000)}
handler.next(response)}})
})();