Last active
February 2, 2024 08:21
-
-
Save kde713/44a2dbdf39a54a90becf0270b84edbca to your computer and use it in GitHub Desktop.
국민대학교 안전교육 이수 스크립트 (2020.04.09 동작확인)
This file contains hidden or 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
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); |
Thank you~!
i love you~!
당신 덕분에 모교가 빛납니다.
당신 덕분에 모교가 빛납니다.
최고에요
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you~!