你才付费看答案
// ==UserScript==
// @name 你才付费看答案
// @namespace http://tampermonkey.net/
// @version 2.3.5
// @description 考试资料网(ppkao),上学吧,问答库,简答题等多平台免费查看答案
// @author free
// @match *://www.ppkao.com/*
// @match *://*.shangxueba.com/*.html
// @match *://*.asklib.com/*
// @match *://www.soutiyun.com/question*
// @match *://www.jiandati.com/question.aspx*
// @match *://www.shuashuati.com/ti/*.html
// @connect jieda.tikuhai.com
// @run-at document-end
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_info
// @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
var $=unsafeWindow.jQuery||jQuery,
url=location.pathname,tm,urls,option,otherData={},
gm_info=GM_info.script;
$("head").append('<script src="https://lib.baomitu.com/layui/2.6.8/layui.js"></script>');
$("head").append('<link href="https://lib.baomitu.com/layui/2.6.8/css/layui.css" rel="stylesheet">');
$(".more-button").click(function(){
document.querySelector(".list-container").classList.toggle("active")
});
switch(location.host){
case 'www.ppkao.com':
tm=$(".single-siti").find(".kt").html();
$(".answer").removeAttr("onclick");
$('.answer').on('click', '',answer);
break;
case 'www.asklib.com':
tm=$(".essaytitle").html();
$(".listtip").find(".btn").removeAttr("onclick");
$(".listtip").find(".btn").on('click', '',answer);
break;
case 'www.shuashuati.com':
var shua_info=unsafeWindow.window.__INITIAL_STATE__;
console.log(shua_info);
$(".injectImg_3Scbt").remove();
$(".tiBodyRight_3w9eE").remove();
tm=shua_info.tiDetail.question||filterImg($(".tiQuestionContent_34cHA"));
option=shua_info.tiDetail.options!==null?shua_info.tiDetail.options.map(function(index){return index.detail}):$(".tiOptions_hNYWZ").find(".tiOption_6pmwl div").map(function() {
return filterImg(this);
}).toArray();
if(shua_info.sys.userInfo!==null){
otherData={"token":shua_info.sys.userInfo.token}
}
$(".tiBlockContent_1LY0-:first").parent().html("<div class='answer_div'><button class='layui-btn layui-btn-normal'>查看答案</button></div>").removeAttr("onclick");
$('.layui-btn').on('click', '',answer);
console.log(tm,option);
break;
case location.host.indexOf("shangxueba.com")!=-1?location.host:undefined:
tm=filterImg($(".ask_title"));
$(".sub_ans_btn").removeAttr("onclick");
$('.sub_ans_btn').on('click', '',answer);
break;
case location.host.indexOf("www.soutiyun.com")!=-1?location.host:undefined:
tm=filterImg($(".question_main_title"));
$(".viewAnswer").removeAttr("href");
$('.viewAnswer').on('click', '',answer);
break;
case location.host.indexOf("www.jiandati.com")!=-1?location.host:undefined:
tm=filterImg($(".sub_cont"));
$(".sub_ans_btn").removeAttr("onclick");
$('.sub_ans_btn').on('click', '',answer);
break;
}
$('#get_da').on('click', '',answer);
function answer(){
var load = unsafeWindow.layer.load(2);
GM_xmlhttpRequest({
method: 'POST',
url: "http://jieda.tikuhai.com/?url="+location.href,
data:JSON.stringify({"question":tm,"option":option,"other":otherData}),
headers: {
'Content-type': 'application/json',
'referer':location.href,
'v':gm_info.version,
'u':gm_info.author,
't':new Date().valueOf(),
},
timeout: 5000,
onload: function(xhr) {
unsafeWindow.layer.close(load);
if (xhr.status == 200) {
console.log(xhr.responseText);
var obj;
if(xhr.responseText.indexOf("人机身份验证")!==-1){
let msg="<a target='_blank' style='color: red;background: aliceblue' href='http://jieda.tikuhai.com/'>点我完成效验</a>";
obj={
"status":200,
"question":"首次使用需要完成人机效验",
"option":[msg,msg,msg],
"answer":msg,
"msg":"请先完成效验"
};
}
else{
obj = $.parseJSON(xhr.responseText) || {};
}
console.log(obj);
if(obj.status==200){
var contont="";
//$(".single-siti").find("p").html(obj.data[3])选项暂时不加
console.log(location.host);
switch(location.host){
case 'www.ppkao.com':
$("#zhangjieList").remove();
$(".ysyd").remove();
$(".tm-bottom:first").css("height","300px");
$("strong.kt").html(obj.question);
contont="云端题目:"+obj.question+"<br>云端选项:<br>"+obj.option.join('<br>')+"<br>云端参考答案:"+obj.answer+"<br><br>"+obj.msg
$(".tm-bottom:first").html(contont);
break;
case 'www.asklib.com':
//$(".listtip").find(".btn").remove();
console.log("123");
contont="云端题目:"+obj.question+"<br>云端选项:<br>"+obj.option.join('<br>')+"<br>云端参考答案:"+obj.answer+"<br><br>"+obj.msg;
$(".listbg").html(contont);
break;
case location.host.indexOf("shangxueba.com")!=-1?location.host:undefined:
$(".sub_ans_btn").remove();
contont="云端题目:"+obj.question+"<br>云端选项:<br>"+obj.option.join('<br>')+"<br>云端参考答案:"+obj.answer+"<br><br>"+obj.msg;
$("#div_answer").html(contont);
break;
case 'www.shuashuati.com':
$(".sub_ans_btn").remove();
contont="云端题目:"+obj.question+"<br>云端选项:<br>"+obj.option.join('<br>')+"<br>云端参考答案:"+obj.answer+"<br><br>"+obj.msg;
$(".answer_div:first").html(contont);
break;
case 'www.soutiyun.com':
$(".viewAnswer").remove();
$(".answer_detail").removeAttr("style");
contont="云端题目:"+obj.question+"<br>云端选项:<br>"+obj.option.join('<br>')+"<br>云端参考答案:"+obj.answer+"<br><br>"+obj.msg;
$(".answer_detail:first").html(contont);
break;
case 'www.jiandati.com':
$(".sub_ans_btn").remove();
contont="云端题目:"+obj.question+"<br>云端选项:<br>"+obj.option.join('<br>')+"<br>云端参考答案:"+obj.answer+"<br><br>"+obj.msg;
$("#div_answer").html(contont);
break;
}
}else{
unsafeWindow.layer?unsafeWindow.layer.msg(obj.msg,{icon: 5}):alert(obj.msg);
}
} else if (xhr.status == 203) {
obj = $.parseJSON(xhr.responseText) || {};
unsafeWindow.layer?unsafeWindow.layer.msg(obj.msg,{icon: 5}):alert(obj.msg);
} else if (xhr.status == 403) {
obj = $.parseJSON(xhr.responseText) || {};
console.log(obj);
unsafeWindow.layer?unsafeWindow.layer.msg(obj.msg,{icon: 5}):alert(obj.msg);
}else {
console.log(xhr.responseText);
unsafeWindow.layer?unsafeWindow.layer.msg("题库服务器异常,请稍后再试吧~",{icon: 5}):alert("题库服务器异常,请稍后再试吧~");
}
},
ontimeout: function() {
unsafeWindow.layer.close(load);
unsafeWindow.layer?unsafeWindow.layer.msg("题库服务器异常,请稍后再试吧~",{icon: 5}):alert("题库服务器异常,请稍后再试吧~");
}
});
}
function filterImg(dom) {
return $(dom).clone().find('img[src]').replaceWith(
function () {
return $('<p></p>').text('<img src="' + $(this).attr('src') + '">');
}
).end().find('iframe[src]').replaceWith(
function () {
return $('<p></p>').text('<iframe src="' + $(this).attr('src') + '"></iframe>');
}
).end().text().trim();
}
})();