diff --git a/.gitignore b/.gitignore index a9a0619..9db6961 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ web-ext-artifacts/ browser-polyfill.js +*.pem diff --git a/README.md b/README.md index 1bbca7f..7b79ca1 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,21 @@ cp node_modules/webextension-polyfill/dist/browser-polyfill.js . web-ext build -n upload_to_danbooru.zip -i README.md ``` +### Chrome + +```sh +npm install --global crx3 +test -f key.pem || openssl genrsa -out key.pem 4096 +crx3 -p key.pem -o web-ext-artifacts/upload_to_danbooru.crx < web-ext-artifacts/upload_to_danbooru.zip +``` + ## Install ```sh firefox web-ext-artifacts/upload_to_danbooru.zip ``` + +### Chrome + +Open `chrome://extensions`, enable `Developer mode`, then drop +`web-ext-artifacts/upload_to_danbooru.crx` onto the page. diff --git a/background.js b/background.js index 4735819..f589e4f 100644 --- a/background.js +++ b/background.js @@ -13,7 +13,7 @@ browser.contextMenus.onClicked.addListener(async function(info, tab) { const settings = await browser.storage.sync.get(['url', 'openIn']); const danbooruUrl = settings.url || DefaultDanbooruURL; - const batch = info.modifiers.some((key) => key === "Ctrl"); + const batch = (info.modifiers || []).some((key) => key === "Ctrl"); let url, active = true; if (batch) { @@ -30,6 +30,7 @@ browser.contextMenus.onClicked.addListener(async function(info, tab) { switch (settings.openIn) { case "current": await browser.tabs.update(tab.id, {url: url.href}); + break; case "background": active = false default: diff --git a/manifest.json b/manifest.json index fb801fd..66c4656 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Upload to Danbooru", "description": "Add a context menu option for images to upload to Danbooru.", - "version": "1.0.0", + "version": "1.0.1", "options_ui": { "page": "options.html", "browser_style": true