Last active
August 11, 2017 15:31
-
-
Save jnwelzel/811bac4dee11c369e005 to your computer and use it in GitHub Desktop.
Injection
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
//generate the javascript content of method cloudpassSetUsername to inject into the current page | |
function injectSetUsernameFunc(usernameFieldIsId,usernameField){ | |
var js = 'window.cloudpassSetUsername = function(username){'; | |
if(usernameFieldIsId){ | |
js += 'forceChangeField( document.getElementById("'+usernameField+'"), username);'; | |
}else{ | |
js += 'forceChangeField( document.getElementsByName("'+usernameField+'")[0], username);'; | |
} | |
js += '};'; | |
return js; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment