Last active
May 21, 2021 00:31
-
-
Save PeraSite/8d3c549f952e7a0d9c01d80a56c97a33 to your computer and use it in GitHub Desktop.
SMC Goorm Helper
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
| // ==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(); | |
| }); | |
| })(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
사용 방법