// ==UserScript==
// @name U校园英语网课答案显示[修复可用版本]
// @namespace gongchen
// @version 1.0
// @description 小窗口显示U校园板块测试答案,修复可用版本
// @author gongchen
// @compatible Chrome
// @match *://ucontent.unipus.cn/_pc_default/pc.html?*
// @connect *://ucontent.unipus.cn/*
// @grant GM_xmlhttpRequest
// @run-at document-end
// @require https://lib.baomitu.com/jquery/3.6.0/jquery.min.js
// @downloadURL none
// ==/UserScript==
var url = location.href
var answer = []
$('head').append('');
$.getScript("https://lib.baomitu.com/layui/2.6.8/layui.js", function(data, status, jqxhr) {
layui.use('element', function(){
var element = layui.element;
});
layer.closeAll();
show();
showanswer();
});
var show = ()=>{
layer.open({
type: 1,
area: ['400px', '400px'],
offset: 'l',
id: 'msgt',
closeBtn: 1,
title: "U校园网课助手(答案显示)",
shade: 0,
maxmin: true,
anim: 2,
content:'
公告
单元测试下载app搜索

'+
'
'+
''
});
}
var showanswer = ()=>{
GM_xmlhttpRequest({
method: 'GET',
url: 'https://ucontent.unipus.cn/course/api/content/course-v1:Unipus+nhce_3_rw_3+2018_09/u1g5/default/',
headers: {
'X-ANNOTATOR-AUTH-TOKEN': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcGVuX2lkIjoidHV4NkNCQVc4aGRrcnFZdzc5SEpEWDF2aTR5Z2ptcDUiLCJuYW1lIjoiIiwiZW1haWwiOiIiLCJhZG1pbmlzdHJhdG9yIjoiZmFsc2UiLCJleHAiOjE5MDI5NzAxNTcwMDAsImlzcyI6IlI0aG03RmxQOFdvS0xaMUNmTkllIiwiYXVkIjoiZWR4LnVuaXB1cy5jbiJ9.CwuQmnSmIuts3hHAMf9lT954rKHXUNkps-PfRJp0KnU'
},
timeout: 5000,
onload: function(xhr) {
if (xhr.status == 200) {
let obj = JSON.parse(xhr.responseText) || {};
let questionList = JSON.parse(obj.content)['questions:scoopquestions']['questions']
for (let question of questionList){
var content = document.getElementsByClassName("content")[0]
let el = '' + '
'
el = el + '' + question.answers[0] + ' | '
$("#content>table>tbody").append($(el));
}
}
}
});
}