From: Jacob Casper Date: Fri, 13 Mar 2020 23:44:04 +0000 (-0500) Subject: Initial commit X-Git-Url: https://git.jacobcasper.com/?a=commitdiff_plain;h=261ad1e8f3e022a494641edb9ab334a1ead7900e;p=cliktionary.git Initial commit --- 261ad1e8f3e022a494641edb9ab334a1ead7900e diff --git a/README.md b/README.md new file mode 100644 index 0000000..5f7661f --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Cliktionary + +A Firefox WebExtension that lets you search Wiktionary for any text you right click. diff --git a/background.js b/background.js new file mode 100644 index 0000000..3ed7694 --- /dev/null +++ b/background.js @@ -0,0 +1,13 @@ +browser.menus.create({ + id: "cliktionary", + title: "Cliktionary", + contexts: ["selection"] +}); + +browser.menus.onClicked.addListener((info, tab) => { + switch (info.menuItemId) { + case "cliktionary": + browser.tabs.create({url: `https://en.wiktionary.org/wiki/${info.selectionText}`}); + break; + } +}); diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..3ecb8ab --- /dev/null +++ b/manifest.json @@ -0,0 +1,16 @@ +{ + "manifest_version": 2, + "name": "Cliktionary", + "version": "0.1", + + "description": "Search Wiktionary for any text you right click.", + + "permissions": [ + "menus", + "tabs" + ], + + "background": { + "scripts": ["background.js"] + } +}