Browser Extension, Google Chrome, Javascript, Look-It-Up

Look-it-up A Google Chrome Extension that Looks Up Selected Text on dictionary.com

manifest.json

{
  "name": "Look-it-up",
  "description": "Adds context menu item that looks up selected text on dictionary.com",
  "version": "0.1",
  "permissions": ["contextMenus"],
  "background": {
    "scripts": ["app.js"]
  },
  "manifest_version": 2
}

app.js

chrome.contextMenus.create({"title": "Look-it-up", "contexts":["selection"],"onclick": lookItUp});
function lookItUp(i, t){
	var createProperties = {url: "http://www.dictionary.com/cgi-bin/dict.pl?term=" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}

Simple Google Chrome Extension that looks up selected text on dictionary.com. Obviously you should only select one word as dictionary.com will not define more than one. Same as Google-Translate-it, demonstrates getting selected text and processing it in a GET request.

Advertisement
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s