Skip to content

Instantly share code, notes, and snippets.

@jasonalderman
Last active February 9, 2016 10:20
Show Gist options
  • Save jasonalderman/9118dd742b1209f2bbf1 to your computer and use it in GitHub Desktop.
Save jasonalderman/9118dd742b1209f2bbf1 to your computer and use it in GitHub Desktop.
Chrome extension to look up words on Wordnik.
An extension for Google Chrome that lets you look up words on Wordnik.
It's outdated—the manifest version is 1 when it should be 2—but it may work for you if you
• download the files
• go to chrome://extensions
• check "Developer Mode"
• "Load unpacked extension..."
The .zip file contains the following files:
- manifest.json
- background.html
- wordniklookup.js
- wordnikfavicon.png
- wordnik48.png
<script src="wordniklookup.js"></script>
{
"name": "Define Selection on Wordnik",
"description": "Adds a context menu item to look up selected text on http://wordnik.com/.",
"version": "0.1",
"icons": {
"16": "wordnikfavicon.png",
"48": "wordnik48.png"},
"permissions": ["contextMenus","tabs"],
"background_page": "background.html"
}
// Modified from the sample code that was...
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Callback for loading definition in new tab
function defineWord(info, tab) {
chrome.tabs.create({
"url": "http://www.wordnik.com/words/"+info.selectionText
});
}
// Create context menu item for selections.
var id = chrome.contextMenus.create({"title": "Find definition on Wordnik", "contexts":["selection"],
"onclick": defineWord});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment