Browser Extension, Google Chrome, Javascript, Plurk-It

Plurk-it A Simple Google Chrome Extension for using Plurk.com

manifest.json

 {
"name": "Plurk-it", "description": "Adds context menu item that shares the current page on Plurk. If text is selected, provides a context menu item to search plurk posts for the selected text.",
"version": "0.1",
"permissions": ["contextMenus"],
"background": { "scripts": ["app.js"] },
"manifest_version": 2
}

app.js

chrome.contextMenus.create({"title": "Plurk-it", "contexts":["page"],"onclick": plurkIt});
function plurkIt(i, t){
var createProperties = {url: "http://plurk.com/?qualifier=shares&status=" + encodeURIComponent(t.title) + "%20%2D%20" + encodeURI(t.url)};
chrome.tabs.create(createProperties);
}
chrome.contextMenus.create({"title": "Search Plurks", "contexts":["selection"],"onclick": searchPlurks});
function searchPlurks(i, t){
var createProperties = {url: "http://www.plurk.com/search?q=" + encodeURIComponent(i.selectionText)};
chrome.tabs.create(createProperties);
}

Another simple add-on that makes using Plurk.com easier. Demonstrates getting tab info (title and url) passed to the context menu click handler function. In case you didn’t know, Plurk was the first to timeline user posts (long before facebook did).

Advertisement
Standard
Browser Extension, Google Chrome, Google-Translate-It, Javascript

Google-Translate-it A Google Chrome Extension in Five Elegant Lines Of Javascript

manifest.json

{
  "name": "Google-Translate-it",
  "description": "Adds context menu that, when text is selected, opens up a new tab with the google translation tool.",
  "version": "0.1",
  "permissions": ["contextMenus"],
  "background": {
    "scripts": ["app.js"]
  },
  "manifest_version": 2
}

app.js

chrome.contextMenus.create({"title": "Google-Translate-it", "contexts":["selection"],"onclick": translateIt});
function translateIt(i, t){
	var createProperties = {url: "http://translate.google.com/?q=" + encodeURIComponent(i.selectionText)};
	chrome.tabs.create(createProperties);
}

Yeah, I know, I could have used an anonymous function which would have made it four lines of javascript. The extra line is there for beauty.

Standard