NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Auto RegisterKU // @namespace https://openuserjs.org/users/isares // @version 0.1 // @description Let Steal! // @author Isares // @license MIT // @copyright 2018, isares (https://openuserjs.org/users/isares) // -----URL----- // @match https://std.regis.ku.ac.th/_Student_Registration.php // @match https://std.regis.ku.ac.th/inst_regis.php // @grant none // ==/UserScript== (function() { 'use strict'; //setting variable var courseID = "01XXXXXX"; var lectureSec = ""; var labSec = ""; //start var file = document.location.pathname; if (file == "/_Student_Registration.php"){ //search course document.getElementsByName("Cs_Code")[0].value = courseID; document.getElementsByName("submit")[0].click(); } else if (file == "/inst_regis.php"){ if (document.getElementsByName("Lc_Section")[0] || document.getElementsByName("Lb_Section")[0]){ if (document.getElementsByName("Lc_Section")[0].value != 0){ var lcDropdown = document.getElementsByName("Lc_Section")[0]; if (lectureSec != ""){ setSelectedValue(lcDropdown, lectureSec); } else{ alert("Please fill lecture section"); } } if (document.getElementsByName("Lb_Section")[0].value != 0){ var lbDropdown = document.getElementsByName("Lb_Section")[0]; if (labSec != ""){ setSelectedValue(lbDropdown, labSec); } else{ alert("Please fill lecture section"); } } document.getElementsByName("go")[0].click(); } else if (document.documentElement.innerHTML.search("บันทึกรายวิชาเรียบร้อยแล้ว") != -1){ //end alert('Congratulation!'); } else{ //loop window.location.href = "https://std.regis.ku.ac.th/_Student_Registration.php"; } } //function function setSelectedValue(selectObj, valueToSet) { for (var i = 0; i < selectObj.options.length; i++) { if (selectObj.options[i].value == valueToSet) { selectObj.options[i].selected = true; return; } } } })();