Created
January 14, 2013 09:56
-
-
Save code/4528989 to your computer and use it in GitHub Desktop.
Speak Thai chrome extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Speak Thai", | |
"description": "Reads out selected thai text", | |
"version": "0.1", | |
"permissions": ["contextMenus"], | |
"background": { | |
"scripts": ["speak-thai.js"] | |
}, | |
"manifest_version": 2 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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