// ==UserScript== // @name fuck southhronline // @version 1.0.0 // @description fuck southhronline.cn // @author IcedMango // @match http://www.southhronline.cn/learn/* // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js // @connect cdn.bootcdn.net // @run-at document-end // ==/UserScript== (function () { //Set userId & corpId from request => https://igw.zhiyingwl.com/api/biz/course/pb/index/details/{CourseId}/{CorpId}?user-id={UserId} //Happy Fucking console.log("loading"); var Helper = { userId: "", corpId: "", courseId: "", wareId: "", courseData: [], initParams: function () { console.log("initParams"); const urlParams = new URLSearchParams(window.location.search); Helper.courseId = urlParams.get("course-id"); Helper.wareId = urlParams.get("course-ware-id"); setTimeout(() => { Helper.initCourseData(); }, 1000); }, initCourseData: function () { console.log("setting CourseData"); fetch( `https://igw.zhiyingwl.com/api/biz/course/pb/index/details/${Helper.courseId}/${Helper.corpId}?user-id=${Helper.userId}`, {} ) .then((response) => { return response.json(); }) .then((ret) => { if (ret.success === true) { console.log("Loaded"); Helper.courseData = ret.data.chapterDtos; console.log(ret.data.chapterDtos); console.log("chapterDtos Info"); console.log(Helper.courseData); setTimeout(() => { Helper.setFinish(); }, 5000); } }) .catch((err) => { console.log(err); alert("error"); }); }, setFinish: function () { document.querySelector("video").currentTime = 10000000; setTimeout(() => { Helper.findNext(); }, 1000); }, findNext: function () { console.log("Finding the next course"); try { Helper.courseData.forEach((el) => { let item = el.coursewares.find( (ware) => ware.finished === false ); if (!!item) { console.log("Found!ID:" + item.coursewareId); setTimeout(() => { Helper.loadNext(item.coursewareId); }, 1000); throw new exception(""); } }); } catch (error) {} }, loadNext: function (id) { console.log("Navigating..."); location.href = `http://www.southhronline.cn/learn/?course-id=${Helper.courseId}&course-ware-id=${id}&course-type=0`; } }; Helper.initParams(); })();