// ==UserScript== // @name 安全微伴刷课-2022 // @namespace https://github.com/Huoyuuu // @version 1.1 // @description 2023安全微伴更新后脚本已失效,推荐使用https://greasyfork.org/zh-CN/scripts/433560 // @author Huoyuuu // @match *://weiban.mycourse.cn/* // @match https://mcwk.mycourse.cn/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @license The MIT License // @downloadURL https://update.greasyfork.icu/scripts/455377/%E5%AE%89%E5%85%A8%E5%BE%AE%E4%BC%B4%E5%88%B7%E8%AF%BE-2022.user.js // @updateURL https://update.greasyfork.icu/scripts/455377/%E5%AE%89%E5%85%A8%E5%BE%AE%E4%BC%B4%E5%88%B7%E8%AF%BE-2022.meta.js // ==/UserScript== (function () { function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } var jsonData = null; const methodToken = getQueryString("methodToken"); const csCom = getQueryString("csCom"); // 判断是否开启评论 function backToList() { if (getQueryString("referrer") != null) { location.replace(document.referrer); } else { if (window.history.length > 1) { $("body").html(""); window.history.back(); } else { window.close(); } } } function getRecordUrl(url) { if (url.indexOf('open.mycourse.cn') > 0) { return `https://open.mycourse.cn/proteus/usercourse/finish.do`; } else { return `https://weiban.mycourse.cn/pharos/usercourse/v1/${methodToken}.do`; } } function finishWxCourse() { try { console.log(exportRoot.currentFrame) } catch (e) {} try { const userid = getQueryString("userCourseId"); const jiaoxuejihuaid = getQueryString("tenantCode"); var finishWxHost = document.referrer.replace("http://", "").replace("https://", "").split("/")[0]; if (document.referrer == "" || document.referrer == null || document.referrer == undefined) { finishWxHost = "weiban.mycourse.cn" } const webUrl = window.location.href; const finishWxUrl = getRecordUrl(webUrl); const finishData = { "userCourseId": userid, "tenantCode": jiaoxuejihuaid }; $.ajax({ async: false, url: finishWxUrl, type: "GET", dataType: "jsonp", data: finishData, timeout: 5000, success: function(data) { if (data.msg == "ok") { if (csCom === 'true') { let link = document.createElement('link'); link.setAttribute('rel', 'stylesheet'); link.setAttribute('type', 'text/css'); link.setAttribute('href', '/js/pop-item.css'); document.head.appendChild(link); $("body").html('
' + '
' + '

恭喜你完成本微课学习!

' + '' + '' + '
' + '
'); } else { alert("恭喜,您已完成本微课的学习"); } } else { alert("发送完成失败"); } }, error: function(XMLHttpRequest, textStatus, errorThrown) {} }); } catch (e) { alert("报了啥错误" + e) } } //屏蔽微信功能按钮 document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('hideOptionMenu'); }); if (csCom === 'true') { $("body").on("click", ".pop-jsv-prev", function() { backToList() }) $("body").on("click", ".pop-jsv-next", function() { let courseId = getQueryString("courseId"); let userProjectId = getQueryString("userProjectId"); let userCourseId = getQueryString("userCourseId"); let url = document.referrer + "#/wk/eval?courseId=" + courseId + "&userCourseId=" + userCourseId + "&userProjectId=" + userProjectId; window.open(url, "_parent"); }) } function showProgressFloatOnCanvas(progress) { if ($("#spinner").length == 0) { $("body").append( '' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
加载中:' + progress + '
' + '
' ) } $("#progressFloatOnCanvas").html("加载中:" + progress); if (progress == "100%") { $("#spinner").hide(); } } finishWxCourse() }) ();