-
Notifications
You must be signed in to change notification settings - Fork 2
/
pastypass.client.js
30 lines (25 loc) · 1.02 KB
/
pastypass.client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Generic browser handler code from here:
// https://www.smashingmagazine.com/2017/04/browser-extension-edge-chrome-firefox-opera-brave-vivaldi/
window.browser = (function () {
return window.msBrowser ||
window.browser ||
window.chrome;
})();
console.log("[i] Starting PastyPass...");
// this may not be needed...
function pasteMe(e) { this.value = e.clipboardData.getData('text/plain'); };
browser.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.command == "enablePaste") {
var inputFields = document.getElementsByTagName('input');
for (var i = 0; i < inputFields.length; i++) {
var field = inputFields[i];
if (field.type == "password") {
field.onpaste = function(e) { this.value = e.clipboardData.getData('text/plain'); };
console.log("[!] pasting should be enabled for field with id: "+field.id);
}
// debug thing...
// console.log("[i] done with item "+i);
}
sendResponse("DONE");
}
});