Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Course selector
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Automagically gets you into full courses :)
  6. // @author You
  7. // @match https://webadvisor.uoguelph.ca/WebAdvisor/WebAdvisor*
  8. // @grant none
  9. // ==/UserScript==
  10. var submitIntervalSeconds = 5;
  11. var messageOfTheDay = "Fuck life";
  12. var numCourses = $("select").length - 2;
  13. var pass = "";
  14. var user = "";
  15.  
  16. (function() {
  17. 'use strict';
  18. function getRandomInt(max) {
  19. return Math.floor(Math.random() * Math.floor(max));
  20. }
  21.  
  22. // Time to press button is in 5 second intervals
  23. var content = document.getElementById('content');
  24. let motd = $("#content").find("h1").text(messageOfTheDay);
  25. let num = getRandomInt(numCourses) +1;
  26. var i = 0;
  27. for(i =0; i < numCourses; i++){
  28. $("#LIST_VAR1_"+(i+1)).attr("selectedIndex",0).change();
  29. }
  30. $("#LIST_VAR1_"+num).attr("selectedIndex",1).change();
  31. setTimeout(function () {
  32. let submitButtons = $(".shortButton");
  33. let students = $(".WBST_Bars:contaains('Students')");
  34. let register = $("a:contains('Register and Drop Sections')");
  35. let login = $("span:contains('Log In')");
  36. let password = $("#CURR_PWD");
  37. let username = $("#USER_NAME");
  38. if(password){
  39. password.val(pass);
  40. }
  41. if(username){
  42. username.val(user);
  43. }
  44. if(submitButtons && submitButtons[0]){
  45. submitButtons[0].click();
  46. }else {
  47. if(students && students[0]){
  48. students[0].click();
  49. }
  50. if(register && register[0]){
  51. register[0].click();
  52. }
  53. if(login && login[0]){
  54. $($("span:contains('Log In')")[0]).parent()[0].click();
  55. }
  56. }
  57.  
  58. }, submitIntervalSeconds*1000);
  59. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement