Advertisement
Guest User

Untitled

a guest
Apr 8th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. // ==UserScript==
  2. // @name iAmResponding autologin
  3. // @namespace uppercase
  4. // @description autologin to iAmResponding
  5. // @include http://iamresponding.com/*
  6. // @include https://iamresponding.com/*
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10.  
  11. /*
  12. =======================================================================
  13. Change these variables to match your login info. *Only* change the
  14. words, leave the single quotes and semicolons on the end.
  15. =======================================================================
  16. */
  17.  
  18. var department = '';
  19. var username = '';
  20. var password = '';
  21.  
  22. /*
  23. This variable, if set to "true", will make the script show an "alert()"
  24. informing the user that the script is working correctly, and that we're waiting
  25. for the page to finish loading before we log in. Because the IaR login button
  26. requires some client-side scripts to run before it works, we wait until the
  27. page is finished loading before "clicking" the login button. The way the Midori
  28. browser handles "alert()" is unobtrusive, but in other browsers this may cause
  29. issues. If it's causing problems for you, change this line to:
  30.  
  31. var showLoginAlert = false;
  32. */
  33.  
  34. var showLoginAlert = false;
  35.  
  36. /*
  37. =======================================================================
  38. Don't mess with the stuff below unless you know what you're doing.
  39. =======================================================================
  40. */
  41.  
  42.  
  43. /*
  44. Shows an alert letting the user know that this script is working correctly
  45. on the login page.
  46. */
  47.  
  48. if( document.getElementById("subscriberLogin") && showLoginAlert ){
  49. alert('Autologin working, please wait.');
  50. };
  51.  
  52. /*
  53. Add an event handler that runs the afterPageLoad() function when the page
  54. *finishes* loading. This is needed because the "login" button on the IaR
  55. website requires some client-side javascript to run before it works.
  56. */
  57. window.onload = afterPageLoad;
  58.  
  59.  
  60.  
  61. // contains code that runs after the IaR website loads
  62. // * auto-login
  63. // * "select version" of website (mobile/desktop)
  64. function afterPageLoad(){
  65.  
  66. setTimeout(afterPageLoad, 30000); // run every 30 seconds
  67.  
  68.  
  69.  
  70.  
  71. // if we're on the main ("desktop" version) site, there will be a
  72. // button for brining up the login form.
  73. var LoginPopupButton = document.getElementById("subscriberLogin");
  74.  
  75.  
  76.  
  77. /*
  78. if IAR website can't detect our browser, we'll be sent to a "choose
  79. version" page with a "mobile" and "desktop" link. We want that link,
  80. especially since we'll get sent back to this page if we're logged out
  81. for whatever reason -- and we can't login from that page.
  82. */
  83.  
  84. var desktopLink = document.getElementById("lnkDesktop");
  85.  
  86. // --------------------------------------------------------------------
  87. // are we at the page we can log in at?
  88. if(LoginPopupButton){
  89. // yes, so let's login. First, "click" the button so the page
  90. // builds the login form
  91. document.getElementById("subscriberLogin").click();
  92.  
  93. // grab the login form
  94. var form = document.getElementById("Form1");
  95.  
  96. // enter our data
  97. form.elements["ddlsubsciribers"].value = department;
  98. form.elements["memberfname"].value = username;
  99. form.elements["password"].value = password;
  100.  
  101. // "check" the "remember me" checkbox
  102. form.elements["chkRemberMe"].checked = true;
  103.  
  104. // and "click" the "login" button to log in
  105. document.getElementById("login").click();
  106.  
  107. // --------------------------------------------------------------------
  108. // or are we on the "select version" (desktop/mobile) page?
  109. } else if(desktopLink){
  110. // Yes, so click the link to get to the desktop version
  111. desktopLink.click();
  112. };
  113.  
  114.  
  115. // there's a clock on the "responding" page -- it's badly formated and
  116. // looks messed up. Let's fix it by moving it to where it should be.
  117. /*
  118. var clock = document.getElementById("ClockTime");
  119.  
  120. // if it's on the page, let's change the span's style attribute, so it
  121. // looks good.
  122. if( clock ) {
  123. clock.setAttribute("style", "text-align: center; line-height: 150%; top: 10px; right: 10px; position: absolute;");
  124.  
  125. };
  126. */
  127. }; // close function afterPageLoad()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement