1
0
mirror of https://github.com/XFox111/PasswordGeneratorExtension.git synced 2026-04-22 08:08:01 +03:00

Version 1.0 (initial commit)

This commit is contained in:
Michael Gordeev
2020-10-06 16:27:04 +03:00
parent b824eec2dd
commit c56539f618
27 changed files with 1413 additions and 2 deletions
+35
View File
@@ -0,0 +1,35 @@
function AddContextMenu()
{
chrome.contextMenus.create(
{
id: "generate",
contexts: [ "all" ],
title: chrome.i18n.getMessage("generate")
}
);
}
// Setting up context menu event listener
chrome.contextMenus.onClicked.addListener(() => GeneratePassword(null));
// Adding context menu entry if needed
chrome.runtime.onInstalled.addListener(() =>
{
// Adding context menu option
chrome.storage.sync.get({ showContext: true }, (settings) =>
{
if (settings.showContext !== false)
AddContextMenu();
});
});
chrome.storage.onChanged.addListener((changes, area) =>
{
if (area != "sync" || changes["showContext"] == null)
return;
if (changes["showContext"].newValue === false)
chrome.contextMenus.removeAll();
else
AddContextMenu();
});