Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Commit

Permalink
added context menu to search selected text
Browse files Browse the repository at this point in the history
  • Loading branch information
nirajkaushal authored and njks5 committed Feb 3, 2016
1 parent b00f6ab commit 3e791f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions js/background.js
Expand Up @@ -85,3 +85,14 @@ chrome.omnibox.onInputEntered.addListener( function(text) {
chrome.tabs.update(tabs[0].id, {url: "https://duckduckgo.com/?q="+encodeURIComponent(text)});
});
});

//This adds Context Menu when user select some text.
//create context menu
chrome.contextMenus.create({
title : 'Search DuckDuckGo for "%s"',
contexts : ["selection"],
onclick : function(info){
var queryText = info.selectionText;
chrome.tabs.create({url:"https://duckduckgo.com/?q="+queryText});
}
});
3 changes: 2 additions & 1 deletion manifest.json
Expand Up @@ -446,6 +446,7 @@
},
"permissions": [
"https://chrome.duckduckgo.com/*",
"tabs"
"tabs",
"contextMenus"
]
}

0 comments on commit 3e791f9

Please sign in to comment.