Created
August 7, 2020 08:09
-
-
Save IcedMango/26166f44ba84bfff151d9d63cdae766a to your computer and use it in GitHub Desktop.
a script help you fuck southhronline video learning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name fuck southhronline | |
// @version 1.0.0 | |
// @description fuck southhronline.cn | |
// @author IcedMango <[email protected]> | |
// @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(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment