mirror of
https://github.com/Floriansylvain/CtxMenuWikiChrome.git
synced 2026-08-19 11:43:17 +02:00
🎉 - 1st commit !
This commit is contained in:
@@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -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 |
Reference in New Issue
Block a user