mirror of
https://github.com/XFox111/PasswordGeneratorExtension.git
synced 2026-04-22 08:08:01 +03:00
Major 4.0 (#380)
- Migrated to WXT - Migrated to NPM - Added Insert & copy action - Added ESLint
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
export default defineContentScript({
|
||||
matches: ["<all_urls>"],
|
||||
runAt: "document_idle",
|
||||
main()
|
||||
{
|
||||
console.log("Password Generator: script loaded");
|
||||
|
||||
browser.runtime.onMessage.addListener((message: string, _, sendResponse) =>
|
||||
{
|
||||
if (message === "probe")
|
||||
// @ts-expect-error sendResponse has incorrect signature
|
||||
sendResponse(document.querySelectorAll("form input[type=password]").length);
|
||||
else
|
||||
document
|
||||
.querySelectorAll("form input[type=password]")
|
||||
.forEach(el => {
|
||||
(el as HTMLInputElement).value = message;
|
||||
(el as HTMLInputElement).focus();
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user