Initial commit
authorJacob Casper <dev@jacobcasper.com>
Fri, 13 Mar 2020 23:44:04 +0000 (18:44 -0500)
committerJacob Casper <dev@jacobcasper.com>
Fri, 13 Mar 2020 23:44:04 +0000 (18:44 -0500)
README.md [new file with mode: 0644]
background.js [new file with mode: 0644]
manifest.json [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
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 (file)
index 0000000..3ed7694
--- /dev/null
@@ -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 (file)
index 0000000..3ecb8ab
--- /dev/null
@@ -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"]
+  }
+}