Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var userName = null;
- var passWord = null;
- var autoFillOnly = false;
- var getUrl = document.location.href;
- chrome.extension.sendRequest( { eventName: "getSettings" },
- function(response) {
- userName = response.user;
- passWord = response.pass;
- autoFillOnly = response.autof;
- checkIfAutoUrl();
- }
- );
- function checkIfAutoUrl() {
- if (getUrl.search("#autologin~") >= 1) { // If Url contains autologin parameters, continue, else start next function and end.
- var cutUrl = getUrl.split('~'); // Separates the parameters from Url.
- var parts = cutUrl[1].split('&'); // Separates the username and password from the parameters.
- userName = parts[0]; // userName is equal to 1st parameter.
- passWord = parts[1]; // passWord is equal to 2nd parameter.
- }
- if (userName != "" || passWord != "") { // Only autoLogin if the username or password isn't null. This is to prevent it from
- autoLogin(); // unecessarily trying to log you in with incorrect info.
- }
- }
- function autoLogin() {
- var emailEle = document.getElementById("email"); // Set email box element as a variable.
- var passEle = document.getElementById("pw"); // Set password box element as a variable.
- emailEle.setAttribute("value", userName); // Fill out the email box with userName.
- passEle.setAttribute("value", passWord); // Fill out the password box with passWord.
- if (!autoFillOnly) { // Only click log-in if autoFillOnly is false.
- location.href = "javascript:void(login());"; // Press the login button.
- }
- }
Add Comment
Please, Sign In to add comment