|
|
@ -14,29 +14,20 @@ function findFirstFilledOutPasswordInput() |
|
|
|
frames = document.getElementsByTagName('frame'); |
|
|
|
for(i in frames) |
|
|
|
arDocuments.push(frames[i].contentDocument); |
|
|
|
|
|
|
|
// add iframes
|
|
|
|
iframes = document.getElementsByTagName('frame'); |
|
|
|
for(i in iframes) |
|
|
|
arDocuments.push(iframes[i].contentDocument); |
|
|
|
|
|
|
|
|
|
|
|
// iterate over documents looking for password inputs
|
|
|
|
for(i in arDocuments) |
|
|
|
{ |
|
|
|
result = document.evaluate("//input[@type='password']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); |
|
|
|
|
|
|
|
// iterate over password inputs looking for filled ones
|
|
|
|
for(i=0;i<result.snapshotLength;i++) |
|
|
|
{ |
|
|
|
if(result.snapshotItem(i).value != '') |
|
|
|
{ |
|
|
|
input = result.snapshotItem(i); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
result = document.evaluate("//input[@type='password' and not(text() = '')]", document.body, null, XPathResult.ANY_TYPE, null); |
|
|
|
|
|
|
|
if (result.snapshotLength > 0) |
|
|
|
{ |
|
|
|
input = result.snapshotItem(result.snapshotItem(0)); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if(input) |
|
|
|
break; |
|
|
|
if(input) |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
return input; |
|
|
@ -120,7 +111,7 @@ chrome.extension.onRequest.addListener( |
|
|
|
|
|
|
|
var _waitForAutofill = window.setInterval(function() { |
|
|
|
if(document.readyState == "complete") { |
|
|
|
input = findFirstFilledOutPasswordInput() |
|
|
|
input = false; //findFirstFilledOutPasswordInput()
|
|
|
|
chrome.runtime.sendMessage({showIcon: (input != false)}); |
|
|
|
window.clearInterval(_waitForAutofill); |
|
|
|
} |
|
|
|