🎉 - 1st commit !

This commit is contained in:
Florian SYLVAIN
2021-03-12 18:42:58 +01:00
parent 04dc03da26
commit 927df9bb72
5 changed files with 43 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
{
"manifest_version": 2,
"name": "WhatDoesItMean",
"version": "0.0.1",
"description": "Highlight a word, right clic and select 'What does it mean?' to find its Wikipedia definition.",
"icons": {
"16":"wikipedia16.png",
"48":"wikipedia48.png",
"128":"wikipedia128.png"
},
"browser_action": {
"default_icon":"wikipedia16.png"
},
"background": {
"scripts": ["redirect.js"],
"presistent": false
},
"permissions": [
"contextMenus",
"tabs",
"activeTab"
]
}
+16
View File
@@ -0,0 +1,16 @@
var contextMenuButton = {
"id":"wdim",
"title":"What does it mean?",
"contexts": ["selection"]
};
chrome.contextMenus.create(contextMenuButton);
chrome.contextMenus.onClicked.addListener(function(clickData, tab){
if (clickData.menuItemId == "wdim" && clickData.selectionText){
word = clickData.selectionText;
if (word.length < 24) {
chrome.tabs.create({url:"https://wikipedia.org/wiki/" + word});
} else {
console.error("Text length > 24 characters !")
}
}
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB