网页自动获取题目匹配题库答案填充(原创1.0)
作者:互联网
/***欢迎使用
网页自动获取题目匹配题库答案填充(原创1.0)**
1.可手动添加本地题库,
一键复制,
无序key自动匹配,
2.通过调试可获取相应div类下的值/元素
3.遍历实现多选,可在console中执行
4.不足指出还请海涵与指点,谢谢
***/
var setting = [];
var minimum = [];
minimum.div = $(
'<div style="padding: 5px;border: 1px dashed rgb(0, 85, 68); position: fixed; top: 8px; right: 5px; z-index: 99999; background-color: rgba(184, 247, 255, 0.2); overflow-x: auto;display:block;">最大化' + '</div>'
).appendTo('body').click(function () {
$(setting.div).css('display', 'block');
$(minimum.div).css('display', 'none');
});
var ad = "To learn for happy with our flock";
setting.div = $(
'<div style="border: 1px dashed rgb(0, 85, 68); width: 330px; position: fixed; top: 8px; right: 5px; z-index: 99999; background-color: rgba(184, 247, 255, 0.9);display:none;">' +
'<span style="font-size: medium;"></span>' +
'<div style="display: inline-block;box-sizing: border-box;top:0;right:0;"><minimize style="position:absolute;top:5px;right:6px;width:5%;font-size:16px;line-height: 12px;font-weight: bold; cursor:context-menu; user-select:none;">一</minimize></div>' +
'<div id="cx-notice" style="font-size:18px;color:red;font-family: Times New Roman;text-align: center;height:24px;border-top: 0px solid #000;border-bottom: 1px solid #000;margin: 1px 0px;overflow: hidden;">' + ad + '</div>' +
'<input id="timu01" type="text" placeholder="题目答案类" style="width:100px;margin-left: 10px;">' + '<input id="da01" type="text" placeholder="题目答案类" style="width:100px;margin-left: 10px;">' +
'<button id="timuda" style="width:25%;margin: 4px 8px;background-color: rgba(184, 247, 255, 0.4);">一键获取' + '</button>' +
'<button id="mc" style="height:30px;width:70%;margin: 2px 49px;background-color: rgba(184, 247, 255, 0.4);">复制(手动添加arr)</button>' +
'<input id="exam" type="text" placeholder="考试题目类" style="width:245px;margin:3px 40px;">' +
'<button id="examing" style="height:30px;width:70%;background-color: rgba(184, 247, 255, 0.4);margin: 2px 49px;">开始答题(选择)</button>' +
'<div id="vi_con" style="width:99%;display: inline-block;OVERFLOW-Y: auto; padding-top: 3px;padding-left: 3px;padding-bottom: 0px;FONT-SIZE: 10pt;OVERFLOW: auto;LINE-HEIGHT: 100%; FONT-FAMILY: 宋体; HEIGHT:93px; TEXT-ALIGN: left;"></div>' +
'</div>'
).appendTo('body');
$('minimize').click(function () {
$(setting.div).css('display', 'none');
$(minimum.div).css('display', 'block');
});
var err = 0;
var arr = {
// 题库需手动添加,格式可借助IDE,快速排版~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"审计工作底稿的归档期限为审计报告日后的()": "D",
"注册会计师王某明知委托单位公司的财务报表有重大错报,却在委托单位的压力下出具了无保留意见的审计报告行为,王某的行为属于()": "C",
"审计程序的起点是()": "A",
"下列选项中,属于内部证据的是()": "D",
"Y公可欠公司100万货款,且注册会计师有理由相信欠款可能存在重大差错,则注册会计师对公司的应收账款应采取的措施是()": "C",
"注册会计师每年审计固定资产时,应该对固定资产进行观察盘点,重点是()": "A",
"企业生产业务开始执行的依据是()": "A",
"注册会计师对企业进行盘点时,发现所有权不属于被审计单位的存货,则应当()": "B",
"注册会计师对存货审计的必要程序是()": "A",
" 审计工作底稿归()": "D"
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
var timuda = document.getElementById('timuda');
timuda.addEventListener("click", mfGettimuda, false);
function mfGettimuda() {
var timu = document.getElementById('timu01').value, da = document.getElementById('da01').value;
var items = document.getElementsByClassName(timu).length;
if (err == 0) {
alert('答案题目不显示,调试:\ndocument.getElementsByClassName(timu/da)[0].children[0].innerText.slice(10,-8)');
err += 1;
}
if (timu.length <= 0) {
alert("1号输入框不能为空");
} else if (da.length <= 0) {
alert("2号输入框不能为空");
} else {
for (var i = 0; i <= items; i++) {
// 可调式区~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var gett = document.getElementsByClassName(timu)[i].children[0].innerText.slice(10, -8);
var getd = document.getElementsByClassName(da)[i].children[3].innerText.slice(5);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
document.getElementById('vi_con').append('"' + gett + '":"' + getd + '",');
}
}
};
var mc = document.getElementById('mc');
mc.addEventListener("click", mfCopy, false);
function mfCopy() {
var copyTest = document.getElementById("vi_con").innerText;
var inputTest = document.createElement('input');
inputTest.value = copyTest;
document.body.appendChild(inputTest);
inputTest.select();
document.execCommand("Copy");
inputTest.className = 'oInput';
inputTest.style.display = 'none';
alert('复制成功');
}
var examing = document.getElementById('examing');
examing.addEventListener("click", mfExam, false);
function mfExam() {
var examVa = document.getElementById('exam').value
if (examVa.length <= 0) {
alert('缺少题目 div class 父类');
}
var items = document.getElementsByClassName(examVa).length;
for (var i = 0; i <= items; i++) {
var item = document.getElementsByClassName(examVa)[i].children[0].innerText.slice(10, -8);
var vs = arr[item];
// vs = "ABC"
if (vs == null) {
alert('arr题库中没有,请手动更新' + item);
break;
} else {
var aRlen = vs.length;
// 不同条件筛选 实现的方法之一,多选可遍历选择答案
for (var j = 0; j <= aRlen; j++) {
var getAnRadio = vs[j];
switch (getAnRadio) {
case "A":
document.getElementsByClassName('test_answer')[i].children[0].click();
break;
case "B":
document.getElementsByClassName('test_answer')[i].children[2].click();
break;
case "C":
document.getElementsByClassName('test_answer')[i].children[4].click();
break;
case "D":
document.getElementsByClassName('test_answer')[i].children[6].click();
break;
}
}
}
}
}
IDE数据处理
标签:1.0,网页,会计师,minimum,var,题库,div,display 来源: https://blog.csdn.net/sugarbew/article/details/112056928