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

Google Chrome and Opera Extension – Look-it-up, a Dictionary Context Menu Extension

Adds context menu item that looks up selected text on dictionary sites. You have the choice of dictionary.com, merriam-webster.com (dictionary and thesaurus), thefreedictionary.com, thesaurus.com, urbandictionary.com, wikipedia.org, wiktionary.org, and yourdictionary.com to look selected terms up with. There is an options page to enable or disable the different menu items included. This is actually a rewrite and improvement of an older version that looked up terms on dictionary.com exclusively. While using the old version, I eventually found myself in need of more options for this add-on so here it is.
 

manifest.json


{
  "name": "Look-it-up",
  "description": "Adds context menu item that looks up selected text on dictionary sites",
  "version": "0.2",
  "permissions": ["contextMenus"],
  "background": {
    "scripts": ["app.js"]
  },
  "options_page": "options.html",
  "icons" : {
        "16" : "book16.png",
        "32" : "book32.png",
        "48" : "book48.png",
        "128" : "book128.png"
    },
  "manifest_version": 2
}

app.js


/** app.js */
var defaultentries = [
	{
	"menu":"dictionary.com",
	"active":1
	},{
	"menu":"merriam-webster.com-dict",
	"active":1
	},{
	"menu":"merriam-webster.com-thes",
	"active":1
	},{
	"menu":"thefreedictionary.com",
	"active":1
	},{
	"menu":"thesaurus.com",
	"active":1
	},{
	"menu":"urbandictionary.com",
	"active":1
	},{
	"menu":"wikipedia.org",
	"active":1
	},{
	"menu":"wiktionary.org",
	"active":1
	},{
	"menu":"yourdictionary.com",
	"active":1
	},
];
var entries = {};
if (!localStorage.getItem("entries")) {
	localStorage.setItem("entries", JSON.stringify(defaultentries));
}
entries = JSON.parse(localStorage.getItem("entries"));
function isActive(menu){
	console.log("isActive");
	var elen = entries.length;
	console.assert(!elen == 0);
	for(i=0;i<elen;i++){
		if(entries[i]["menu"] == menu){
			console.log(entries[i]["menu"]);
			if(entries[i]["active"] == 1){
				return true;
			}else{
				return false;
			}
		}
	}
}
function setActive(menu){
	console.log("setActive");
	var elen = entries.length;
	console.log(menu);
	console.assert(!elen == 0);
	for(i=0;i<elen;i++){
		if(entries[i]["menu"] == menu){
			entries[i]["active"] = 1;
		}
	}
	localStorage.setItem("entries", JSON.stringify(entries));
}
function setInactive(menu){
	console.log("setInactive");
	var elen = entries.length;
	console.log(menu);
	console.assert(!elen == 0);
	for(i=0;i<elen;i++){
		if(entries[i]["menu"] == menu){
			entries[i]["active"] = 0;
		}
	}
	localStorage.setItem("entries", JSON.stringify(entries));
}
/* Create the context menu */
var tm = chrome.contextMenus.create({"title": "Look-it-up", "contexts":["selection"]});
if(isActive("dictionary.com")){
	chrome.contextMenus.create({"title": "dictionary.com", "contexts":["selection"], "parentId": tm, "onclick": lookItUp1});
}
function lookItUp1(i, t){
	var createProperties = {url: "http://www.dictionary.com/cgi-bin/dict.pl?term=" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("merriam-webster.com-dict")){
	chrome.contextMenus.create({"title": "merriam-webster.com-dict", "contexts":["selection"], "parentId": tm, "onclick": lookItUp2});
}
function lookItUp2(i, t){
	var createProperties = {url: "http://www.merriam-webster.com/dictionary/" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("merriam-webster.com-thes")){
	chrome.contextMenus.create({"title": "merriam-webster.com-thes", "contexts":["selection"], "parentId": tm, "onclick": lookItUp3});
}
function lookItUp3(i, t){
	var createProperties = {url: "http://www.merriam-webster.com/thesaurus/" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("thefreedictionary.com")){
	chrome.contextMenus.create({"title": "thefreedictionary.com", "contexts":["selection"], "parentId": tm, "onclick": lookItUp4});
}
function lookItUp4(i, t){
	var createProperties = {url: "http://www.thefreedictionary.com/" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("thesaurus.com")){
	chrome.contextMenus.create({"title": "thesaurus.com", "contexts":["selection"], "parentId": tm, "onclick": lookItUp5});
}
function lookItUp5(i, t){
	var createProperties = {url: "http://thesaurus.com/search?q=" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("urbandictionary.com")){
	chrome.contextMenus.create({"title": "urbandictionary.com", "contexts":["selection"], "parentId": tm, "onclick": lookItUp6});
}
function lookItUp6(i, t){
	var createProperties = {url: "http://www.urbandictionary.com/define.php?term=" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("wikipedia.org")){
	chrome.contextMenus.create({"title": "wikipedia.org", "contexts":["selection"], "parentId": tm, "onclick": lookItUp7});
}
function lookItUp7(i, t){
	var createProperties = {url: "http://en.wikipedia.org/wiki/" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("wiktionary.org")){
	chrome.contextMenus.create({"title": "wiktionary.org", "contexts":["selection"], "parentId": tm, "onclick": lookItUp8});
}
function lookItUp8(i, t){
	var createProperties = {url: "http://en.wiktionary.org/wiki/" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}
if(isActive("yourdictionary.com")){
	chrome.contextMenus.create({"title": "yourdictionary.com", "contexts":["selection"], "parentId": tm, "onclick": lookItUp9});
}
function lookItUp9(i, t){
	var createProperties = {url: "http://www.yourdictionary.com/" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}

options.html


<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Look-it-up Options</title>
	<script type="text/javascript" src="options.js"></script>
</head>
<body>
<ul id="menu">
</ul>
<div class="summary">Changes will take place the next time you start your browser. 
Or if you don't want to close the browser you could uncheck and recheck the enabled box next to this extension on the Extensions tab page.</div>

</body>
</html>

options.js


window.onload = function () {
	ckb = chrome.extension.getBackgroundPage().entries;
	var list = document.getElementById("menu");
	for(i = 0; i < ckb.length; i++){
		console.log(ckb[i]["active"]);
		if(ckb[i]["active"] == 1){
			var li = document.createElement("li");
			var temp = "<input type=\"checkbox\" class=\"butt\" checked=\"true\" value=\"" + ckb[i]["menu"] + "\"><span>" + ckb[i]["menu"] + "</span></input>";
			
			li.innerHTML = temp;
			list.appendChild(li);
		}else{
			var li = document.createElement("li");
			var tempp = "<input type=\"checkbox\" class=\"butt\" value=\"" + ckb[i]["menu"] + "\"><span>" + ckb[i]["menu"] + "</span></input>";
			li.innerHTML = tempp;
			list.appendChild(li);
			
		}
	}
	as = document.getElementsByClassName("butt");
	for(i=0;i<as.length;i++){
		as[i].addEventListener("click",function(evt){
			if(evt.target.checked == true){
				
				chrome.extension.getBackgroundPage().setActive(evt.target.value);
			}else{
				chrome.extension.getBackgroundPage().setInactive(evt.target.value);
			}
		},false)
	}
}


Install Look-it-up Context Menu Extension in Chrome (Google Chrome Store)

Install Look-it-up Context Menu Extension in Opera (My Repository)

Advertisement
Standard
Browser Extension, Google Chrome, Javascript, Omgili Search

Google Chrome Extension – Omgili Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search Omgili (omgili.com) from the Omnibox.  To use, simply type ‘omg’, a space, and your search query into the Omnibox, then choose a time frame from the drop down, and it will open your search results up in a new tab. Omgili is a time sensitive international message board search engine (in case you didn’t know).

manifest.json


{
	"name" : "Omgili Search",
	"short_name": "omg Search",
	"description" : "To use, type 'omg' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "omg"
	},
	"icons" : {
		"16" : "omg_16.png",
		"32" : "omg_32.png",
		"48" : "omg_48.png",
		"128" : "omg_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputChanged.addListener(function (text, suggest) {
	suggest([{
				content : encodeURIComponent(text) + "&tf=day",
				description : "Search Omgili in the past day (default)"
			}, {
				content : encodeURIComponent(text) + "&tf=week",
				description : "Search Omgili in the past week"
			}, {
				content : encodeURIComponent(text) + "&tf=month",
				description : "Search Omgili in the past month"
			}, {
				content : encodeURIComponent(text) + "&tf=year",
				description : "Search Omgili in the past year"
			}, {
				content : encodeURIComponent(text) + "&tf=any",
				description : "Search Omgili with no time frame"
			}
		]);
});
chrome.omnibox.onInputEntered
.addListener(function (text) {
	var createProperties = {
		url : "http://omgili.com/search?q="
		 + text
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Omgili Message Board Search query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install Omgili Search Extension (chrome store)

Standard
Alexa-Search, Browser Extension, Google Chrome, Javascript

Google Chrome Extension – Alexa Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search Alexa (alexa.com) from the Omnibox.  To use, simply type ‘alx’, a space, and your search query into the Omnibox and it will open your search results up in a new tab.

manifest.json


{
	"name" : "Alexa Search",
	"short_name": "alx Search",
	"description" : "To use, type 'alx' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "alx"
	},
	"icons" : {
		"16" : "alx_16.png",
		"32" : "alx_32.png",
		"48" : "alx_48.png",
		"128" : "alx_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "http://www.alexa.com/search?q="
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search Alexa using the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install Alexa Search Extension (chrome store)

Standard
Browser Extension, Google Chrome, Javascript, Wikipedia-Search

Google Chrome Extension – Wikipedia Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search Wikipedia (wikipedia.com) from the Omnibox.  To use, simply type ‘wiki’, a space, and your search query into the Omnibox and it will open your search results up in a new tab.

manifest.json


{
	"name" : "Wikipedia Search",
	"short_name": "wiki Search",
	"description" : "To use, type 'wiki' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "wiki"
	},
	"icons" : {
		"16" : "wiki_16.png",
		"32" : "wiki_32.png",
		"48" : "wiki_48.png",
		"128" : "wiki_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "http://en.wikipedia.org/w/index.php?search="
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search Wikipedia for the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install Wikipedia Search Extension (chrome store)

Standard
America-Online-Web-Search, Browser Extension, Google Chrome, Javascript

Google Chrome Extension – America Online (aol.com) Web Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search America Online (aol.com) from the Omnibox.  To use, simply type ‘aol’, a space, and your search query into the Omnibox and it will open your search results up in a new tab. While America Online has web search that also sports the ‘Powered By Google’ badge, America Online has had web search features for quite some time and I believe they supplement their results with their own. The ranking is different at the very least.

manifest.json


{
	"name" : "America Online Web Search",
	"short_name": "aol Search",
	"description" : "To use, type 'aol' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "aol"
	},
	"icons" : {
		"16" : "aol_16.png",
		"32" : "aol_32.png",
		"48" : "aol_48.png",
		"128" : "aol_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "http://search.aol.com/aol/search?q="
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search using America Online Web Search for the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install America Online Web Search Extension (chrome store)

Standard
Amazon-Web-Search, Browser Extension, Google Chrome, Javascript

Google Chrome Extension – Amazon Web Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search the web using Amazon from the Omnibox.  While still experimental at Amazon and powered by Google; if Amazon turns its computing might towards web search – we’re all in for great results. To be fair, Amazon’s web search experiment is named Amazon Smart Search (which is easily confused with its commercial endeavors) (besides, how would ‘___ query term here’ look to you every day while using it?) – not Amazon Web Search (which is used in the extension). Also, I feel its fair to mention that there’s almost twice as many paid results (ads) on these result pages.

To use, simply type ‘aws’, a space, and your search query into the Omnibox and it will open your search results up in a new tab.

manifest.json


{
	"name" : "Amazon Web Search",
	"short_name": "aws Search",
	"description" : "To use, type 'aws' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "aws"
	},
	"icons" : {
		"16" : "aweb_16.png",
		"32" : "aweb_32.png",
		"48" : "aweb_48.png",
		"128" : "aweb_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "http://www.amazon.com/gp/bit/apps/web/SERP/search?&query="
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search using Amazon Web Search for the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install Amazon Web Search Extension (source zip)

File: aws.zip
CRC-32: 242f84bc
MD4: 7fffda73151dbf33aba8c5fae00a3ee8
MD5: 8f575adb94b0cfb32ac8094d78dafa03
SHA-1: 874a58947df97fdd3da00583e6b11ed941de0c81

Standard
Browser Extension, Google Chrome, Javascript, Vimeo-Search

Google Chrome Extension – Vimeo (vimeo.com) Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search Vimeo (vimeo.com) from the Omnibox.  To use, simply type ‘vim’, a space, and your search query into the Omnibox and it will open your search results up in a new tab.

manifest.json


{
	"name" : "Vimeo Search",
	"short_name": "vim Search",
	"description" : "To use, type 'vim' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "vim"
	},
	"icons" : {
		"16" : "vim_16.png",
		"32" : "vim_32.png",
		"48" : "vim_48.png",
		"128" : "vim_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "http://vimeo.com/search?q="
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search Vimeo for the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install Vimeo Search Extension (chrome store)

Standard
Browser Extension, Google Chrome, Javascript, You-Tube-Search

Google Chrome Extension – You-Tube (youtube.com) Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search YouTube from the Omnibox.  To use, simply type ‘yt’, a space, and your search query into the Omnibox and it will open your search results up in a new tab.

manifest.json


{
	"name" : "You-Tube Search",
	"short_name": "yt Search",
	"description" : "To use, type 'yt' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "yt"
	},
	"icons" : {
		"16" : "yt_16.png",
		"32" : "yt_32.png",
		"48" : "yt_48.png",
		"128" : "yt_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "http://www.youtube.com/results?search_query="
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search YouTube for the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install You-Tube Search Extension (chrome store)

Standard
Browser Extension, Google Chrome, Google-Groups-Search, Javascript

Google Chrome Extension – (Google) Groups Search, an Omnibox extension

Google Groups Search is an Omnibox browser extension that allows you to search Google Groups from the browser. To use, type ‘ggs’ & space, and a query term into the Omnibox. The search result for your query will open up in a new tab.

manifest.json


{
	"name" : "Groups Search",
	"short_name": "ggs Search",
	"description" : "To use, type 'ggs' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "ggs"
	},
	"icons" : {
		"16" : "ggs_16.png",
		"32" : "ggs_32.png",
		"48" : "ggs_48.png",
		"128" : "ggs_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "https://groups.google.com/forum/#!search/"
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search Google Groups for the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install (Google) Groups Search Search Extension (chrome store)

Standard
Browser Extension, Google Chrome, Javascript, Mozilla-Open-Directory-Search

Google Chrome Extension – Mozilla Open Directory (dmoz.org) Search, an Omnibox extension

Google Chrome Omnibox Search extension that enables you to search Mozilla Open Directory (dmoz.org) from the omnibox.  To use, simply type ‘dmoz’, a space, and your search query into the omnibox and it will open your search results up in a new tab.

From dmoz.org – “The Open Directory Project is the largest, most comprehensive human-edited directory of the Web. It is constructed and maintained by a vast, global community of volunteer editors.”

manifest.json


{
	"name" : "Mozilla Open Directory Project Search",
	"short_name": "dmoz Search",
	"description" : "To use, type 'dmoz' & space, and a query term into the Omnibox. timothytocci.com",
	"version" : "0.1",
	"background" : {
		"scripts" : ["background.js"]
	},
	"omnibox" : {
		"keyword" : "dmoz"
	},
	"icons" : {
		"16" : "dmoz_16.png",
		"32" : "dmoz_32.png",
		"48" : "dmoz_48.png",
		"128" : "dmoz_128.png"
	},
	"manifest_version" : 2
}

background.js


chrome.omnibox.onInputEntered.addListener(function (text) {
	var createProperties = {
		url : "http://www.dmoz.org/search?q="
		 + encodeURIComponent(text)
	};
	chrome.tabs.create(createProperties);
});
chrome.omnibox.onInputStarted
.addListener(function () {
	var suggestion = {
		description : "Search Mozilla Open Directory Project (dmoz) for the query: %s "
	}
	chrome.omnibox.setDefaultSuggestion(suggestion);
});

Install Mozilla Open Directory Search Extension (chrome store)

Standard