From b6df761b92a8e5630df6dee01eb3debafe867d59 Mon Sep 17 00:00:00 2001 From: Jacob Casper Date: Fri, 13 Mar 2020 18:44:04 -0500 Subject: [PATCH 1/1] Initial commit --- README.md | 3 +++ background.js | 13 +++++++++++++ manifest.json | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 README.md create mode 100644 background.js create mode 100644 manifest.json 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"] + } +} -- 2.20.1