-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
74 lines (66 loc) · 2.64 KB
/
view.php
File metadata and controls
74 lines (66 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<nav class="blue lighten-1">
<div class="nav-wrapper">
<div class="container">
<div class="brand-logo" style="font-family: 'Comfortaa'"><a href="./index.php">speakr</a></div>
<ul class="right">
<li><a href="./index.php?action=tutorial">Voice Creator</a></li>
</ul>
</div>
</div>
</nav>
<main>
<div class="container" style="margin: 20px auto">
<div class="row">
<div class="col s12 l6 offset-l3">
<div class="card white">
<div class="card-content center-align">
<span class="card-title">Speak</span>
Enter your name and the text you want to hear spoken!
<div class="input-field">
<input type="text" name="name" id="name">
<label for="name">Name</label>
</div>
<div class="input-field">
<input type="text" name="in-text" id="in-text">
<label for="in-text">Text</label>
</div>
<button class=" btn btn-large blue lighten-1" type="submit" id="submit">Submit</button>
</div>
</div>
</div>
</div>
</div>
</main>
</body>
<script src="js/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
const submitButton = $("#submit");
submitButton.click(function() {
let name = $("#name").val();
let text = $("#in-text").val();
$.ajax({
type: 'POST',
url: './index.php',
data: {
"action": "speak",
"text": text,
"name": name
},
success: function(data) {
json = JSON.parse(data);
new Audio('clips/' + json["name"] + '/' + json["outfile"]).play()
}
});
})
</script>
</html>