Skip to content

Instantly share code, notes, and snippets.

@PeraSite
Last active May 21, 2021 00:31
Show Gist options
  • Select an option

  • Save PeraSite/8d3c549f952e7a0d9c01d80a56c97a33 to your computer and use it in GitHub Desktop.

Select an option

Save PeraSite/8d3c549f952e7a0d9c01d80a56c97a33 to your computer and use it in GitHub Desktop.
SMC Goorm Helper
// ==UserScript==
// @name SMC Goorm Exam Helper
// @namespace http://github.com/PeraSite/ExamHelper
// @version 0.4
// @description Help to clear exam easier, faster!
// @author JJH / PeraSite
// @match https://smc.goorm.io/exam*
// @icon https://www.google.com/s2/favicons?domain=goorm.io
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.onload = () => {
document.getElementsByClassName('form-control')[0].focus();
};
const button = document.getElementsByClassName("_2ZQwqp")[0]
document.addEventListener("keypress", function(event) {
if (event.keyCode == 13) {
button.click();
}
});
let checkFunction = function() {
if(document.getElementsByClassName('form-control')[0]?.value == "") return true;
const elements = document.getElementsByClassName("Toastify__toast-container");
if(elements.length == 1) {
if(elements[0].childElementCount >= 1) {
const textObject = document.querySelector("#app > div > div.Toastify > div > div > div.Toastify__toast-body");
if(textObject == null) {
return false;
}
const textValue = textObject.textContent;
console.log(textValue);
if(textValue != "정답입니다." && textValue != "제출되었습니다. 채점 결과는 공개하지 않습니다.") {
document.getElementsByClassName('form-control')[0].value = "";
document.getElementsByClassName('form-control')[0].focus();
return false;
}
let nextButton = document.getElementById("ExamFooterNavNext");
if(nextButton != null) {
nextButton.click();
} else {
document.getElementsByClassName('_3TYF83')[0].click();
document.getElementsByClassName('mx-1 btn btn-primary btn-md')[0].click();
}
return true;
}
}
};
button.addEventListener('click', ()=>{
let timer = function() {
console.log('timer');
if(!checkFunction())
setTimeout(timer, 100);
};
timer();
});
})();
@PeraSite
Copy link
Author

사용 방법

  1. Chrome 확장 프로그램인 Tampermonkey 설치
  2. 새 스크립트 추가를 누른 뒤 이 글의 코드를 붙여넣음

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