Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name iAmResponding autologin
- // @namespace uppercase
- // @description autologin to iAmResponding
- // @include http://iamresponding.com/*
- // @include https://iamresponding.com/*
- // @grant none
- // ==/UserScript==
- /*
- =======================================================================
- Change these variables to match your login info. *Only* change the
- words, leave the single quotes and semicolons on the end.
- =======================================================================
- */
- var department = '';
- var username = '';
- var password = '';
- /*
- This variable, if set to "true", will make the script show an "alert()"
- informing the user that the script is working correctly, and that we're waiting
- for the page to finish loading before we log in. Because the IaR login button
- requires some client-side scripts to run before it works, we wait until the
- page is finished loading before "clicking" the login button. The way the Midori
- browser handles "alert()" is unobtrusive, but in other browsers this may cause
- issues. If it's causing problems for you, change this line to:
- var showLoginAlert = false;
- */
- var showLoginAlert = false;
- /*
- =======================================================================
- Don't mess with the stuff below unless you know what you're doing.
- =======================================================================
- */
- /*
- Shows an alert letting the user know that this script is working correctly
- on the login page.
- */
- if( document.getElementById("subscriberLogin") && showLoginAlert ){
- alert('Autologin working, please wait.');
- };
- /*
- Add an event handler that runs the afterPageLoad() function when the page
- *finishes* loading. This is needed because the "login" button on the IaR
- website requires some client-side javascript to run before it works.
- */
- window.onload = afterPageLoad;
- // contains code that runs after the IaR website loads
- // * auto-login
- // * "select version" of website (mobile/desktop)
- function afterPageLoad(){
- setTimeout(afterPageLoad, 30000); // run every 30 seconds
- // if we're on the main ("desktop" version) site, there will be a
- // button for brining up the login form.
- var LoginPopupButton = document.getElementById("subscriberLogin");
- /*
- if IAR website can't detect our browser, we'll be sent to a "choose
- version" page with a "mobile" and "desktop" link. We want that link,
- especially since we'll get sent back to this page if we're logged out
- for whatever reason -- and we can't login from that page.
- */
- var desktopLink = document.getElementById("lnkDesktop");
- // --------------------------------------------------------------------
- // are we at the page we can log in at?
- if(LoginPopupButton){
- // yes, so let's login. First, "click" the button so the page
- // builds the login form
- document.getElementById("subscriberLogin").click();
- // grab the login form
- var form = document.getElementById("Form1");
- // enter our data
- form.elements["ddlsubsciribers"].value = department;
- form.elements["memberfname"].value = username;
- form.elements["password"].value = password;
- // "check" the "remember me" checkbox
- form.elements["chkRemberMe"].checked = true;
- // and "click" the "login" button to log in
- document.getElementById("login").click();
- // --------------------------------------------------------------------
- // or are we on the "select version" (desktop/mobile) page?
- } else if(desktopLink){
- // Yes, so click the link to get to the desktop version
- desktopLink.click();
- };
- // there's a clock on the "responding" page -- it's badly formated and
- // looks messed up. Let's fix it by moving it to where it should be.
- /*
- var clock = document.getElementById("ClockTime");
- // if it's on the page, let's change the span's style attribute, so it
- // looks good.
- if( clock ) {
- clock.setAttribute("style", "text-align: center; line-height: 150%; top: 10px; right: 10px; position: absolute;");
- };
- */
- }; // close function afterPageLoad()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement