title: Simple Chrome Extension - Selection To Tab Via Context Menu
body: <p>Hey I'm looking for some help with a really simple Chrome Extension I'd like to get working. The extension is supposed to grab selected text, and then, through a context menu open a new tab with a URL looking like this: <em><a href="http://dict.cc/?s=selectedText" rel="nofollow">http://dict.cc/?s=selectedText</a></em></p>
  
  <p>This is what I've got so far:</p>
  
  <p>The Manifest.JSON:</p>
  
  <pre><code> {  
   "name": "QuickTranslate",  
   "version": "0.1",  
   "manifest_version": 2,  
   "background": {"persistent": true, "scripts": ["bg.js"]},  
   "permissions": ["contextMenus"]  
   }  
  </code></pre>
  
  <p>In my understanding, so far, everything should be just fine. Just FYI, I really don't know much about Java Script, let alone Chrome Extensions.</p>
  
  <p>The bg.js:</p>
  
  <pre><code>chrome.contextMenus.create({  
     title: "Translate '%s'",  
     contexts: ["selection"],  
     onclick: function search() {  
     chrome.tabs.create ({url: "http://dict.cc"}) },  
  });
  </code></pre>
  
  <p>Now this is where I'm stuck. I'm sure there is some (easy?) way to add the selected text to the url. '%s' did not work, at least not for me.</p>
  
  <p>Thanks for your help in advance.</p>