Skip to content

Commit

Permalink
edition 0
Browse files Browse the repository at this point in the history
free to change
  • Loading branch information
edithli committed May 3, 2016
0 parents commit 6e47316
Show file tree
Hide file tree
Showing 10 changed files with 2,570 additions and 0 deletions.
3 changes: 3 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

console.log('background script running!');

50 changes: 50 additions & 0 deletions content_script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
document.body.style.border = "5px solid black";
console.log('content script running!');

// to read in possible login information
// var inputs = document.getElementsByTagName('INPUT');
// for (var i = inputs.length - 1; i >= 0; i--) {
// var input = inputs[i];
// var type = input.type;
// console.assert(typeof type == 'string', 'input type is not a string');
// console.log('input type ' + input.type + ' input id: ' + input.id);
// // add buttons to account id and password input elements
// if (type == 'password' || input.name == 'password') {
// input.style.border = "3px solid red";
// console.log('password input id ' + input.id);
// }
// }

// the list of all documents
var docs = new Array();
docs.push(document);
// in case of iFrame
var iFrames = document.getElementsByTagName('iframe');
for (var i = iFrames.length - 1; i >= 0; i--) {
var doc1 = iFrames[i].contentDocument;
if (doc1 != null && doc1 != undefined){
docs.push(doc1);
}else {
var doc2 = iFrames[i].contentWindow.document;
if (doc2 != null || doc2 != undefined){
docs.push(doc2);
}else {
console.log('unresolved document in iframe id: ' + iFrames[i].id);
}
}
}
console.log('the number of documents: ' + docs.length);
for (var i = docs.length - 1; i >= 0; i--) {
var inputs = docs[i].getElementsByTagName('INPUT');
for (var i = inputs.length - 1; i >= 0; i--) {
var input = inputs[i];
var type = input.type;
console.assert(typeof type == 'string', 'input type is not a string');
console.log('input type ' + input.type + ' input id: ' + input.id);
// add buttons to account id and password input elements
if (type == 'password' || input.name == 'password') {
input.style.border = "3px solid red";
console.log('password input id ' + input.id);
}
}
}
Loading

0 comments on commit 6e47316

Please sign in to comment.