Added tts.google web plugin
This commit is contained in:
parent
b6fcdf75f4
commit
a4e2db184d
2 changed files with 53 additions and 0 deletions
34
platypush/backend/http/static/js/tts.google.js
Normal file
34
platypush/backend/http/static/js/tts.google.js
Normal 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();
|
||||
});
|
||||
|
19
platypush/backend/http/templates/plugins/tts.google.html
Normal file
19
platypush/backend/http/templates/plugins/tts.google.html
Normal 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>
|
||||
|
Loading…
Reference in a new issue