Last active
July 3, 2016 04:20
-
-
Save PandorasFox/060d51ca52123c2e158e91110dff93bc to your computer and use it in GitHub Desktop.
This file contains 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 sis chrome fix | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description fixes logging in to rpi's SIS on chrome by disabling autocomplete/fill | |
// @author You | |
// @match https://sis.rpi.edu/rss/*Login | |
// @grant none | |
// ==/UserScript== | |
function onDown(e) { | |
e.stopImmediatePropagation(); | |
if (typeof e.target.attributes["data-currentName"] == "undefined") { | |
e.target.setAttribute("data-currentName", e.target.attributes.name.value); | |
e.target.setAttribute('name',''); | |
} | |
if (typeof e.target.attributes["data-currentID"] == "undefined") { | |
e.target.setAttribute("data-currentID", e.target.attributes.id.value); | |
e.target.setAttribute('id',''); | |
} | |
} | |
function onUp(e) { | |
e.stopImmediatePropagation(); | |
if (typeof e.target.attributes["data-currentName"] != "undefined") { | |
e.target.setAttribute("name", e.target.attributes["data-currentName"].value); | |
e.target.removeAttribute("data-currentName"); | |
} | |
if (typeof e.target.attributes["data-currentID"] != "undefined") { | |
e.target.setAttribute("id", e.target.attributes["data-currentID"].value); | |
e.target.removeAttribute("data-currentID"); | |
} | |
} | |
(function() { | |
'use strict'; | |
var sid = document.getElementById("UserID"); | |
sid.setAttribute("type", "text"); | |
sid.addEventListener( "focus", onDown ); | |
sid.addEventListener( "mousedown", onDown ); | |
sid.addEventListener( "keydown", onDown ); | |
sid.addEventListener( "blur", onUp ); | |
sid.addEventListener( "keyup", onUp ); | |
var pin = document.getElementById("PIN").children[0]; | |
pin.setAttribute("id", "pin-input"); | |
pin.addEventListener( "focus", onDown ); | |
pin.addEventListener( "mousedown", onDown ); | |
pin.addEventListener( "keydown", onDown ); | |
pin.addEventListener( "blur", onUp ); | |
pin.addEventListener( "keyup", onUp ); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment