Added tts.google web plugin

This commit is contained in:
Fabio Manganiello 2018-10-14 17:17:19 +02:00
parent b6fcdf75f4
commit a4e2db184d
2 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,34 @@
$(document).ready(function() {
var $container = $('#tts-container'),
$ttsForm = $('#tts-form');
var initBindings = function() {
$ttsForm.on('submit', function(event) {
var formData = $(this).serializeArray().reduce(function(obj, item) {
var value = item.value.trim();
if (value.length > 0) {
obj[item.name] = item.value;
}
return obj;
}, {});
execute(
{
type: 'request',
action: 'tts.google.say',
args: formData,
}
);
return false;
});
};
var init = function() {
initBindings();
};
init();
});

View file

@ -0,0 +1,19 @@
<script type="text/javascript" src="{{ url_for('static', filename='js/tts.google.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/tts.css') }}"></script>
<div class="row" id="tts-container">
<form action="#" id="tts-form">
<div class="eight columns">
<input type="text" name="text" placeholder="Text to say">
</div>
<div class="two columns">
<input type="text" name="lang" placeholder="Lang code">
</div>
<div class="one column">
<button type="submit">
<i class="fa fa-volume-up"></i>
</button>
</div>
</form>
</div>