jtalkを追加
This commit is contained in:
parent
be17a4910e
commit
9c73e33535
4 changed files with 70 additions and 0 deletions
12
javascript/jtalk/README.md
Normal file
12
javascript/jtalk/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
文字しゃべる君
|
||||
============
|
||||
|
||||
できること
|
||||
--------
|
||||
- 入力された文字をしゃべります
|
||||
- *ただしGoogle翻訳に依存
|
||||
- つまりオンラインでしか利用できない
|
||||
|
||||
ライセンス
|
||||
--------
|
||||
©2012 [@kou029w](http://twitter.com/kou029w) - [MIT license](http://kou029w.appspot.com/mit-license.txt)
|
23
javascript/jtalk/jtalk.html
Normal file
23
javascript/jtalk/jtalk.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 2011 kou029w
|
||||
Licensed under the MIT License.
|
||||
http://kou029w.appspot.com/mit-license.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>jTalk</title>
|
||||
<meta charset='utf-8'>
|
||||
<script src='http://www.google.com/jsapi'></script>
|
||||
<script>google.load('jquery','1.6');</script>
|
||||
<script src='src/jtalk.js'></script>
|
||||
<link rel='stylesheet' type='text/css' href='src/jtalk.css' />
|
||||
</head>
|
||||
<body>
|
||||
<h1>jTalk</h1>
|
||||
<input id='input_text'>
|
||||
<div id='output'>
|
||||
<audio id='output_voice' autoplay></audio>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
17
javascript/jtalk/src/jtalk.css
Normal file
17
javascript/jtalk/src/jtalk.css
Normal file
|
@ -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;}
|
18
javascript/jtalk/src/jtalk.js
Normal file
18
javascript/jtalk/src/jtalk.js
Normal file
|
@ -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');
|
||||
$('<div>',{
|
||||
id:'output_text_new',
|
||||
html:$(this).val().replace(' ',' ') }
|
||||
).insertAfter('#output_voice');
|
||||
$(this).val('');
|
||||
$('#output_text_new').fadeIn('');
|
||||
$('#output_text').fadeTo('',0.5);
|
||||
};
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue