// ==UserScript== // @name 【陕西省专业技术人员继续教育平台】挂机脚本,其他省份继续教育平台开发需求请联系作者,可免费帮开发。 // @namespace https://bbs.tampermonkey.net.cn/ // @description 适用于用于【陕西省专业技术人员继续教育平台】,自动帮你上完所有课程。【吉林】【山西】【江苏】【江西】【浙江】【广西】【云南】【新疆】【贵州】【甘肃】【青海】【宁夏】【湖南】【湖北】【山东】各省继续教育平台挂机脚本正在开发中。 // @version 1.0.5 // @author 小了白了兔 // @storageName yike // @noframes false // @grant GM_xmlhttpRequest // @grant GM_notification // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_openInTab // @grant GM_addValueChangeListener // @grant GM_removeValueChangeListener // @match *://*.jxjy01.xidian.edu.cn/newLogin.jsp?* // @match *://*.jxjy01.xidian.edu.cn/u/student/training/index.action* // @match *://*.jxjy01.xidian.edu.cn/learnspace/learn/learn/templatethree/index.action* // @connect 85530a3e-fc46-4ea4-a542-160dad54a088.bspapp.com // @connect http://jxjy01.xidian.edu.cn/newLogin.jsp // @connect http://jxjy01.xidian.edu.cn/u/student/training/index.action // @require https://vkceyugu.cdn.bspapp.com/VKCEYUGU-85530a3e-fc46-4ea4-a542-160dad54a088/3cf73a9c-154f-4087-8910-dcda60f50038.js // @require https://vkceyugu.cdn.bspapp.com/VKCEYUGU-85530a3e-fc46-4ea4-a542-160dad54a088/6803fb98-583d-4819-9d7a-cd03e113f3ed.js // @require-css https://vkceyugu.cdn.bspapp.com/VKCEYUGU-85530a3e-fc46-4ea4-a542-160dad54a088/5895b760-6bac-4f7f-9602-82b3465bbbae.css // ==/UserScript== //----------公共部分开始 (() => { const t = "https://85530a3e-fc46-4ea4-a542-160dad54a088.bspapp.com/user", e = function () { const e = (new Date).getTime(), n = GM_getValue("script", []), i = GM_getValue("vali_code_info", {}), l = a; let s; for (let t = 0; t < n.length; t++) { if (n[t].script_id == l) { s = t; break } if (t == n.length - 1) return void o("error", "未找到脚本注册信息,程序执行错误,请联系作者") } const r = n[s].last_active_time, c = n[s].last_fee_time; e - r >= 3e5 ? o("error", "程序执行错误,请联系作者") : e - c < 3e5 || (n[s].last_fee_time = e, GM_setValue("script", n), GM_xmlhttpRequest({ method: "POST", url: t, headers: { "Content-Type": "application/json;charset=utf-8" }, data: JSON.stringify({ action: "fee", data: { vali_code: i.vali_code } }), onload: function (t) { console.log(t); const e = JSON.parse(t.responseText); console.log(e), -1 != e.code ? (o("normal", "完成计费,剩余时间" + e.vali_code_info.left_time), GM_setValue("vali_code_info", e.vali_code_info)) : o.log(e.message) } })) }, n = function () { const t = (new Date).getTime(), e = a, n = GM_getValue("vali_code_info", {}), i = GM_getValue("script", []); if (null == n.vali_code) return o("error", "当前未登录,请输入注册码"), "un_login_error"; if (n.left_time <= 0) return o("error", "当前注册码已到期,请尽快充值"), "not_enough_time"; for (let t = 0; t < i.length; t++)if (i[t].script_id == e) return "has_regist"; return i.push({ script_id: e, last_active_time: t, last_fee_time: t }), GM_setValue("script", i), "regist_success" }, i = function () { const t = a, e = GM_getValue("script", []), n = (new Date).getTime(); for (let i = 0; i < e.length; i++) { if (e[i].script_id == t) { e[i].last_active_time = n; break } i == e.length - 1 && e.push({ script_id: t, last_active_time: n }) } GM_setValue("script", e) }, o = function (t, e) { const n = function (t) { const e = new Date; var n = e.getFullYear(), i = e.getMonth() + 1; i = i < 10 ? "0" + i : i; var o = e.getDate(); o = o < 10 ? "0" + o : o; var l = e.getHours(); l = l < 10 ? "0" + l : l; var a = e.getMinutes(); a = a < 10 ? "0" + a : a; var s = e.getSeconds(); return n + "-" + i + "-" + o + " " + l + ":" + a + ":" + (s < 10 ? "0" + s : s) }(), i = $(".log").get(0); let o = $(document.createElement("div")), l = $(document.createElement("p")), a = $(document.createElement("p")); o.addClass("item"), "error" == t && o.addClass("error"), l.addClass("time").text(n), a.addClass("text").text(e), o.append(l).append(a), $(".log").append(o), i.scrollTop = i.scrollHeight, console.log(e) }, l = function () { let t = $(document); for (; ;) { if (0 != t.find("video").length) return t.find("video"); if (0 == t.find("iframe").length) return []; t = t.find("iframe").contents() } }, a = "223344", s = window.location.href.split("?")[0]; var r, c, d, g, _; const u = function () { if (console.log("脚本开始运行"), window.onbeforeunload = null, window.onunload = null, window.prompt = function () { }, window.confirm = function () { }, r = window.setInterval(e, 3e5), c = window.setInterval(i, 1e4), GM_addValueChangeListener("vali_code_info", (function (t, e, n, i) { $(".has_login .left_time .text").text(n.left_time), console.log(n), n.left_time <= 0 && f() })), GM_addValueChangeListener("script", (function (t, e, n, i) { $(".has_login .client .text").text(n.length) })), GM_setValue("class_finish", []), GM_setValue("class_stop", []), GM_setValue("class_ing", []), "http://jxjy01.xidian.edu.cn/newLogin.jsp" == s) o("error", "您的账户未登录,请先登录"), f(); else if ("http://jxjy01.xidian.edu.cn/u/student/training/index.action" == s) { if ($("#TabbedPanels2 .TabbedPanelsTab").filter("li:contains(在学)").hasClass("TabbedPanelsTabSelected")) { const t = $("#recCourses li"); if (0 != t.length) { console.log(t); let e = [], n = []; t.each((function () { console.log($(this).find(".course_info h5").text()), e.push($(this).find(".course_info h5").text()) })), GM_setValue("class_stop", e), new Promise(((t, e) => { d = window.setInterval((() => { const e = GM_getValue("class_ing", []); console.log(e), 0 == e.length ? o("error", "请手动点击课程开始学习,若已开始,您需要重新点击") : (o("normal", "开始学习"), t(!0)) }), 2e3) })).then((e => { window.clearInterval(d), GM_addValueChangeListener("class_ing", (function (e, i, l, a) { if (console.log(l), 0 == l.length) { if (0 != GM_getValue("class_stop", []).length) { let e = n.shift(); return n.push(e), GM_setValue("class_ing", n), void t.filter(":containt(" + e + ")").find(".thumb_img img").click() } o("normal", "您已完成所有课程学习") } })) })) } else f(), o("normal", "您已完成所有课程,脚本运行结束") } } else if ("http://jxjy01.xidian.edu.cn/learnspace/learn/learn/templatethree/index.action" == s) { let t = 0; $("#courseware_main_menu div").get(0).click(), new Promise(((e, n) => { _ = window.setInterval((() => { const n = l(); if (0 != n.length) if (0 != n[0].played.length && 1 != n[0].paused) o("normal", "视频开始播放"), GM_setValue("class_ing", [$("#mainCont").contents().find("#learnMenu .s_chapter").attr("title")]), e(!0); else { if (console.log("默认自动播放失败,尝试手动开始播放"), t % 8 == 0 && window.location.reload(), t % 2 == 0) try { n.get(0).play() } catch (t) { } if (t % 2 == 1) try { $("#mainCont").contents().find("#learnMenu [itemtype='video']").filter("[completestate=0]").get(0).click() } catch (t) { } t++ } else o("error", "视频加载中") }), 2e3) })).then((t => { window.clearInterval(_); const e = $("#mainCont").contents().find("#learnMenu [itemtype='video']").filter("[completestate=0]").find(".s_pointti"); let n = 0; g = window.setInterval((function () { if (1 == l().get(0).ended) return o("normal", "当前视频完成播放"), n += 1, void (n == e.length ? (GM_setValue("class_ing", []), o("normal", "您已完成当前课程,继续学习下一课程"), window.clearInterval(g)) : (o("normal", "开始观看下一个视频"), e.get(n).click())) }), 2e3) })) } else f(), o("normal", "未知页面,脚本启动失败") }, f = function () { window.clearInterval(c), window.clearInterval(r), window.clearInterval(void 0) }; $(window).on("load", (function () { $("body").append('
\t\t\t\t
\t\t\t
\t\t\t\t\t\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t
\t\t\t
\t\t
\t
'), GM_addStyle("html,body{width:100%;height:100%;}a{color:rgb(15,103,235);text-decoration:none;}a:hover{color:#093;text-decoration:none;}.tab_status{height:100%;width:100%;}.not_login{width:100%;height:100%;display:flex;justify-content:center;align-items:center;flex-direction:column;}.not_login button{align-self:flex-end;margin-top:6px;margin-right:20px;width:20%;height:40px;background-color:#093;color:#fff;border:none;border-radius:5px;}.not_login button:active{border:1px solid #ddd;}.op{display:flex;justify-content:space-between;align-items:center;width:100%;}.op .login_info{color:#093;margin-left:20px;}.not_login .text{text-align:right;position:absolute;bottom:10px;right:10px;}.not_login input{border:1px solid #333;background-color:#f9f9f9;border-radius:5px;padding:13px;outline:0;width:80%;}h4{color:#333;font-size:14px;text-align:left;margin:10px 0;}.intro{width:100%;height:100%;padding:15px;text-align:left;}.intro .item{}.log{width:100%;height:100%;display:flex;align-items:flex-start;flex-direction:column;padding:5px;overflow:auto;}.log .item{margin:3px 0px;}.log .item .time{margin-right:5px;}.log .error p{color:brown;}.has_login{position:relative;display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;height:100%;}.has_login .left_time,.has_login .client{margin:5px;}.has_login .vali_code{position:absolute;left:8px;bottom:5px;display:flex;justify-content:flex-start;align-items:center;}.has_login .vali_code .copy{margin-left:5px;background-color:#093;color:#fff;border-radius:3px;border:2px solid #095;}.box{width:360px;height:240px;background:#fff;border:1px solid #d3d3d3;position:absolute;bottom:30px;right:30px;z-index:999999;font-size:12px;}.tab_menu{overflow:hidden;}.tab_menu li{width:33.3%;float:left;height:30px;line-height:30px;color:#fff;background:#093;text-align:center;cursor:pointer;}.tab_menu li.current{color:#333;background:#fff;}.tab_box{height:210px;position:relative;}.tab_box li{height:24px;line-height:24px;overflow:hidden;}.tab_box li span{margin:0 5px 0 0;font-weight:400;color:#ddd;}.tab_box .hide{display:none;}"); const e = GM_getValue("vali_code_info", {}), i = GM_getValue("script", []); if (null != e.vali_code) { $(".not_login").addClass("hide"), $(".has_login").removeClass("hide"), $(".tab_menu li:contains(启动脚本)").removeClass("current"), $(".tab_menu li:contains(运行日志)").addClass("current"), $(".log").removeClass("hide"), $(".tab_status").addClass("hide"), $(".has_login .vali_code .text").text(e.vali_code), $(".has_login .left_time .text").text(e.left_time), $(".has_login .client .text").text(i.length), o("normal", "登录成功"); const t = n(); "regist_success" != t && "has_regist" != t || u() } $(".tab_menu li").click((function (t) { const e = $(this); console.log(e); const n = e.parent().parent().children("div.tab_box").children("div"); e.siblings("li").removeClass("current").end().addClass("current"), n.siblings("div").addClass("hide").end().eq(e.index()).removeClass("hide") })), $(".has_login .vali_code .copy").click((function () { const t = $(".has_login .vali_code .text").text(); window.navigator.clipboard.writeText(t), o("normal", "注册码复制成功") })), $(".box").draggable({ scroll: !1, containment: "body" }), $(".not_login .btn").click((function () { const e = $(".not_login input").val(); 32 == e.length ? GM_xmlhttpRequest({ method: "POST", url: t, data: JSON.stringify({ action: "get_vali_code_info", data: { vali_code: e } }), headers: { "Content-Type": "application/json;charset=utf-8" }, onload: function (t) { console.log(t); const e = JSON.parse(t.responseText); if (0 !== e.code) return void o("error", e.message); const i = e.vali_code_info; GM_setValue("vali_code_info", i); const l = i.left_time; $(".has_login .vali_code .text").text(i.vali_code), $(".has_login .left_time .text").text(l); const a = GM_getValue("script", []); $(".has_login .client .text").text(a.length), $(".has_login").removeClass("hide"), $(".not_login").addClass("hide"), $(".tab_menu li:contains(启动脚本)").removeClass("current"), $(".tab_menu li:contains(运行日志)").addClass("current"), $(".log").removeClass("hide"), $(".tab_status").addClass("hide"), o("normal", "登录成功,开始注册页面"); const s = n(); "regist_success" != s && "has_regist" != s || u() } }) : alert("验证码格式错误,请重新输入") })) })) })();