-
-
Save atommarvel/7558095 to your computer and use it in GitHub Desktop.
GTother Device Login Experience (GDLE) let's you manage your device logins for GTother in a snap. Be sure to add your login credentials to the beginning script to make it even faster.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GDLE | |
// @namespace http://www.atommarvel.com/ | |
// @version 2.0 | |
// @description GDLE let's you manage your device logins for GTother in a snap. | |
// @match https://auth.lawn.gatech.edu/* | |
// @copyright 2013+, Atom Marvel Raiff | |
// ==/UserScript== | |
//Add your account info here! | |
login_username = ""; | |
login_password = ""; | |
//init vars | |
var macAddresses=[]; | |
var username = document.getElementById("username"); | |
var password = document.getElementById("password"); | |
var mac = document.getElementById("devlogin_mac"); | |
var placement = document.getElementById("form_options"); | |
var divBtn = document.createElement("div"); | |
divBtn.setAttribute('align',"center"); | |
var fixAlert = document.getElementsByName("devlogin_mac")[0]; | |
var fixSubmit = document.getElementsByName("login_form")[0]; | |
fixSubmit.removeAttribute("onSubmit"); | |
fixAlert.removeAttribute("onkeyup"); | |
var dkeys = []; | |
if(localStorage.gtOtherKeys){ | |
dkeys = localStorage.gtOtherKeys.split(","); | |
console.log("found devices!"); | |
} | |
else { | |
localStorage.gtOtherKeys = ""; | |
console.log("found no devices!"); | |
} | |
console.log(dkeys); | |
username.value = login_username; | |
password.value = login_password; | |
var submitValue = function(mac_address) { | |
mac.value = mac_address; | |
}; | |
var createBtn = function(i){ | |
var s0 = document.createElement("button"); | |
console.log(dkeys[i]); | |
s0.innerText = dkeys[i]; | |
s0.setAttribute("id",dkeys[i]); | |
s0.onclick = submitValue.bind(null, localStorage[dkeys[i]]); | |
divBtn.appendChild(s0); | |
}; | |
var addDevice = function(){ | |
new_key = document.getElementById("dname").value; | |
new_value = document.getElementById("dmac").value; | |
console.log(localStorage.gtOtherKeys.split(",").indexOf(new_key)!=-1); | |
if(localStorage.gtOtherKeys.split(",").indexOf(new_key)==-1){ | |
if(localStorage.gtOtherKeys!=""){ | |
localStorage.gtOtherKeys = localStorage.gtOtherKeys+","+new_key; | |
} | |
else | |
localStorage.gtOtherKeys = new_key; | |
dkeys.push(new_key); | |
createBtn(localStorage.gtOtherKeys.split(",").length-1); | |
} | |
else | |
document.getElementById(new_key).onclick = submitValue.bind(null, new_value); | |
localStorage[new_key] = new_value; | |
}; | |
var cleartext = function(){ | |
if(this.value=="Device Name" || this.value=="Mac Address") | |
this.value=''; | |
}; | |
for(i = 0; i<dkeys.length; i++){ | |
createBtn(i); | |
} | |
//create form | |
var form = document.createElement("form"); | |
form.setAttribute('method',"post"); | |
form.setAttribute('action',"submit.php"); | |
var title = document.createElement("input"); | |
title.setAttribute('type',"text"); | |
title.setAttribute('id',"dname"); | |
title.value = "Device Name"; | |
title.onclick = cleartext; | |
form.appendChild(title); | |
var address = document.createElement("input"); | |
address.setAttribute('type',"text"); | |
address.setAttribute('id',"dmac"); | |
address.value = "Mac Address"; | |
address.onclick = cleartext; | |
form.appendChild(address); | |
var btn = document.createElement("input"); | |
btn.setAttribute('type',"button"); | |
btn.setAttribute('value',"Add a Device"); | |
btn.onclick = addDevice; | |
form.appendChild(btn); | |
placement.appendChild(divBtn); | |
placement.appendChild(form); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment