NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name RSGT_production // @namespace http://tampermonkey.net/ // @version 1.0 // @description try to take over the world! // @author You // @include https://www38.polyu.edu.hk/eStudent/secure/* // @grant GM_xmlhttpRequest // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @run-at document-start // ==/UserScript== console.log("RSGT excuting"); //disable image var images = document.getElementsByTagName('img'); for (var n = images.length; n--> 0;) { var img = images[n]; img.setAttribute("src", ""); } if (window.location.href.match(/.*page-not-available.jsf/)){ window.location.assign("https://www38.polyu.edu.hk/eStudent/secure/my-subject-registration/subject-register-select-acad-year-sem.jsf"); } //auto redirect document.addEventListener ("DOMContentLoaded", DOM_ContentReady); function DOM_ContentReady () { if (window.location.href.match(/.*subject-register-select-acad-year-sem.jsf/)){ console.log("auto refresh"); GM_setValue("added", "false"); GM_setValue("phase", "1"); document.getElementsByName('mainForm:yearSemDropDown')[0].selectedIndex=1; document.getElementsByName('mainForm:nextButton')[0].click(); } var code = "CBS3505"; var code1comp = ["0","1"]; //auto input if (window.location.href.match(/.*subject-register-select-subject.jsf/)){ if (!document.getElementsByClassName("errorbox") || document.getElementsByClassName("errorbox").length<2){ if (GM_getValue("phase","")==="1"){ console.log("phase1"); document.getElementsByName('mainForm:basicSearchSubjectCode')[0].value = code; GM_setValue("phase", "2"); document.getElementsByName('mainForm:basicSearchButton')[0].click(); } else if (GM_getValue("phase","")==="2"){ if (document.getElementById('mainForm:basicSearchTable:0:basicSearchAddSubjectButton_')){ GM_setValue("phase", "3"); document.getElementsByName('mainForm:basicSearchTable:0:basicSearchAddSubjectButton_')[0].click(); } else{ GM_setValue("phase", "E"); } } else if (GM_getValue("phase","")==="3"){ if (document.getElementById('mainForm:ComponentTable')){ console.log("mainForm:ComponentTable"); //when select component GM_setValue("added", "true"); for (i = 0; i < code1comp.length; i++) { document.getElementsByName('mainForm:ComponentTable:'+code1comp[i]+':selectCompSelected_')[0].click(); } GM_setValue("phase", "4"); document.getElementsByName('mainForm:selectButton')[0].click(); } } else if (GM_getValue("phase","")==="4"){ GM_setValue("phase", "end"); document.getElementsByName('mainForm:confirmButton')[0].click(); } } } }