// ==UserScript== // @name 深圳大学大物预习题小助手 // @namespace http://tampermonkey.net/ // @version 0.4 // @description 自动提供参考答案 // @author nut // @include http://172.31.80.245:8101/Student/ReadyForExam/* // @grant none // @require https://unpkg.com/ajax-hook@2.0.3/dist/ajaxhook.min.js // @downloadURL none // ==/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(//g) for(const i in arrHtml){let qusArr=arrHtml[i].match(/(.*?)<\/Describe>/)[0].match(/Text="(.*?)\"/g) let quse="" let ans=arrHtml[i].match(/(.*?)<\/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