diff --git a/javascript/jtalk/README.md b/javascript/jtalk/README.md new file mode 100644 index 0000000..1809dfb --- /dev/null +++ b/javascript/jtalk/README.md @@ -0,0 +1,12 @@ +文字しゃべる君 +============ + +できること +-------- +- 入力された文字をしゃべります +- *ただしGoogle翻訳に依存 + - つまりオンラインでしか利用できない + +ライセンス +-------- +©2012 [@kou029w](http://twitter.com/kou029w) - [MIT license](http://kou029w.appspot.com/mit-license.txt) \ No newline at end of file diff --git a/javascript/jtalk/jtalk.html b/javascript/jtalk/jtalk.html new file mode 100644 index 0000000..0e8b852 --- /dev/null +++ b/javascript/jtalk/jtalk.html @@ -0,0 +1,23 @@ + + + + + jTalk + + + + + + + +

jTalk

+ +
+ +
+ + diff --git a/javascript/jtalk/src/jtalk.css b/javascript/jtalk/src/jtalk.css new file mode 100644 index 0000000..da8c4c7 --- /dev/null +++ b/javascript/jtalk/src/jtalk.css @@ -0,0 +1,17 @@ +body { + margin:0 10%;} +h1 { + font-family:serif; + padding:8px; + border-bottom:3px solid #F7750D;} +#input_text,#output { + font-size:large; + font-family:sans-serif; + line-height:140%;} +#input_text { + width:100%;} +#output { + word-break:break-all; + padding:5px 2px;} +#output_text_new { + display:none;} diff --git a/javascript/jtalk/src/jtalk.js b/javascript/jtalk/src/jtalk.js new file mode 100644 index 0000000..a1a6e70 --- /dev/null +++ b/javascript/jtalk/src/jtalk.js @@ -0,0 +1,18 @@ +$(function(){ + $('#input_text').focus(); + $('#input_text').keypress(function(e){ + if( $(this).val() && e.which == 13 ){ + $('#output_voice').attr('src', + 'http://translate.google.com/translate_tts?tl=ja&q=' + + encodeURIComponent($(this).val())); + $('#output_text_new').attr('id','output_text'); + $('
',{ + id:'output_text_new', + html:$(this).val().replace(' ',' ') } + ).insertAfter('#output_voice'); + $(this).val(''); + $('#output_text_new').fadeIn(''); + $('#output_text').fadeTo('',0.5); + }; + }); +});