Skip to content

Instantly share code, notes, and snippets.

@code
Created January 14, 2013 09:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code/4528989 to your computer and use it in GitHub Desktop.
Save code/4528989 to your computer and use it in GitHub Desktop.
Speak Thai chrome extension
{
"name": "Speak Thai",
"description": "Reads out selected thai text",
"version": "0.1",
"permissions": ["contextMenus"],
"background": {
"scripts": ["speak-thai.js"]
},
"manifest_version": 2
}
var speakThai = function(text){
var url = 'http://translate.google.co.th/translate_tts?ie=UTF-8&tl=th&q='+text;
var audio = new Audio(url);
audio.play();
};
chrome.contextMenus.create({
"title" : "Speak Thai",
"contexts" : ["selection"],
onclick: function(info, tab) { speakThai(info.selectionText); }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment