mirror of
https://github.com/XFox111/PasswordGeneratorExtension.git
synced 2026-04-22 08:08:01 +03:00
3ecb6c4a31
- Migrated to WXT - Migrated to NPM - Added Insert & copy action - Added ESLint
23 lines
610 B
TypeScript
23 lines
610 B
TypeScript
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();
|
|
});
|
|
});
|
|
},
|
|
});
|