Skip to content

Instantly share code, notes, and snippets.

@kde713
Last active February 2, 2024 08:21
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save kde713/44a2dbdf39a54a90becf0270b84edbca to your computer and use it in GitHub Desktop.
Save kde713/44a2dbdf39a54a90becf0270b84edbca to your computer and use it in GitHub Desktop.
국민대학교 안전교육 이수 스크립트 (2020.04.09 동작확인)
const INTERVAL = 10000;
var getQueryVariable = function (key) {
let query = window.location.search.substring(1);
let vars = query.split('&');
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == key) {
return decodeURIComponent(pair[1]);
}
}
console.error('Query variable %s not found', key);
}
var kmuMacro = function (progressNo, pageNo) {
const givenGap = 10 * 60;
console.log(`현재 ${pageNo} 페이지를 수강중입니다`);
$.ajax({
type: "POST",
async: false,
url: "/Edu/ContentsViewNextProcess",
data: { "scheduleMemberProgressNo": progressNo, "gapTime": givenGap, "currentPage": pageNo },
success: function (data) {
if (data.Success == true) {
console.log(`${pageNo} 페이지 수강처리 완료. ${INTERVAL / 1000}초간 대기합니다...`);
if (data.IsLastPage == true) {
alert("수고 하셨습니다. 해당 교육이 완료 되었습니다.");
return;
}
setTimeout(function () {
kmuMacro(progressNo, pageNo + 1);
}, INTERVAL);
} else {
console.error('처리 도중 오류가 발생했습니다: API 처리 실패');
alert(data.Message);
}
},
error: function (xhr, status, error) {
console.error('처리 도중 오류가 발생했습니다: API 비정상');
alert("err : " + error);
}
});
};
var progressNumber = getQueryVariable('scheduleMemberProgressNo');
console.log('진도 ID: ', progressNumber);
var currentPageNumber = getCurrentPageNumber();
console.log('현재 페이지: ', currentPageNumber);
kmuMacro(progressNumber, currentPageNumber - 1);
@KyuhwanYeon
Copy link

Thank you~!

@enduf7686
Copy link

Thank you~!

@ray4167
Copy link

ray4167 commented Mar 27, 2019

Thank you~! You've saved me from hell!

@azure-in-lab
Copy link

Thank you~!

@fool8474
Copy link

Thank you~!

@visionNoob
Copy link

i love you~!

@pookjw
Copy link

pookjw commented Dec 5, 2019

당신 덕분에 모교가 빛납니다.

@KimMilim
Copy link

KimMilim commented May 6, 2020

당신 덕분에 모교가 빛납니다.

@Hong-been
Copy link

최고에요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment