passforios/passExtension/passProcessor.js

37 lines
1 KiB
JavaScript
Raw Normal View History

2017-06-10 23:40:47 +08:00
var PassProcessor = function() {};
PassProcessor.prototype = {
run: function(arguments) {
var url
var error
try {
2017-06-25 12:52:08 +08:00
url = document.URL
2017-06-10 23:40:47 +08:00
} catch (e) {
error = e
} finally {
2017-06-25 12:52:08 +08:00
arguments.completionFunction({"url_string": url, "error": error});
2017-06-10 23:40:47 +08:00
}
},
finalize: function(arguments) {
2017-06-25 12:52:08 +08:00
if (arguments["password"]) {
var passwordElement = document.querySelector("input[type=password]")
if (passwordElement) {
passwordElement.setAttribute('value', arguments["password"])
passwordElement.value = arguments["password"]
}
}
if (arguments["username"]) {
var usernameElement = document.querySelector("input[type=email], input[type=text]")
if (usernameElement) {
usernameElement.setAttribute('value', arguments["username"])
usernameElement.value = arguments["username"]
}
}
2017-06-10 23:40:47 +08:00
}
};
// The JavaScript file must contain a global object named "ExtensionPreprocessingJS".
var ExtensionPreprocessingJS = new PassProcessor;