-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
292 lines (225 loc) · 7.32 KB
/
index.html
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="icon" class='favicon' href="https://play-lh.googleusercontent.com/QW3c_VI5OJgySmPMFwZ_bS2dI5FycDvd74W4xvIZqUVyfJ0uh00zGVjevTeZ_tarig" type="image/x-icon">
</head>
<body>
<style>
.center-div {
width: 1000px;
height:1000px;
}
.favicon {
border-radius: 50%;
}
.audio-div {
width: 700px;
height:500px;
box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
background-color: white;
margin-left: 350px;
margin-top: 180px;
position: relative;
top: 0px;
border-radius: 30px;
}
body {
background-color: whitesmoke;
overflow: hidden;
background-image: url("https://wallpapers.com/images/featured/i9neq2ed7blcu74r.jpg");
}
.audiotag {
margin-left: 200px;
margin-top: 30px;
}
.textarea {
width: 500px;
height: 300px;
margin-left: 100px;
margin-top: 20px;
font-size: 20px;
font-family: sans-serif;
/* border: 1px solid #DDDDDD; */
-webkit-transition: all 0.30s ease-in-out;
outline: none;
}
.textarea:focus {
box-shadow: 0 0 5px rgba(81, 203, 238, 1);
border: 1px solid rgba(81, 203, 238, 1);
}
#source1 {
margin-left: 300px;
background-color: dodgerblue;
color: white;
padding: 10px;
position: relative;
top:30px;
border-radius: 5px;
/* text-decoration: none; */
}
.title-h1 {
text-align: center;
font-size: 18px;
font-family: sans-serif;
position: relative;
top:20px;
}
.title-p {
text-align: center;
font-size: 18px;
font-family: sans-serif;
position: relative;
top:20px;
left: 100px;
width: 500px;
}
#enter {
background-color: dodgerblue;
color: white;
padding: 10px;
border-radius: 5px;
text-decoration: none;
border: none;
position: relative;
bottom: 12px;
}
@media screen and (max-width:600px) {
.center-div {
width: 320px;
height:844px;
}
.favicon {
border-radius: 50%;
}
.audio-div {
width: 375px;
height:700px;
box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
background-color: white;
margin-left:0px;
margin-top: 100px;
border-radius: 30px;
}
body {
background-color: whitesmoke;
overflow: hidden;
background-image: url("https://wallpapers.com/images/featured/i9neq2ed7blcu74r.jpg");
}
.audiotag {
margin-left: 200px;
margin-top: 30px;
}
.textarea {
width: 320px;
height: 400px;
margin-left: 30px;
margin-top: 50px;
font-size: 20px;
font-family: sans-serif;
/* border: 1px solid #DDDDDD; */
-webkit-transition: all 0.30s ease-in-out;
outline: none;
}
.textarea:focus {
box-shadow: 0 0 5px rgba(81, 203, 238, 1);
border: 1px solid rgba(81, 203, 238, 1);
}
#source1 {
margin-left: 120px;
background-color: dodgerblue;
color: white;
padding: 10px;
position: relative;
top:30px;
border-radius: 5px;
/* text-decoration: none; */
}
.title-h1 {
font-size: 18px;
font-family: sans-serif;
position: relative;
top:30px;
}
.title-p {
font-size: 15px;
font-family: sans-serif;
position: relative;
top:40px;
left: 40px;
width: 300px;
}
#enter {
background-color: dodgerblue;
color: white;
padding: 10px;
border-radius: 5px;
text-decoration: none;
border: none;
position: relative;
top: 30px;
left: 100px;
}
}
</style>
<div class="center-div">
</div>
<script>
// let enter = document.getElementById("enter");
// enter.addEventListener("click",(event) => {
// event.preventDefault();
// let textarea = document.getElementById("textarea").value;
// console.log(textarea);
let audio;
audio = document.createElement("div");
audio.setAttribute("class","audio-div");
audio.innerHTML = `
<h1 class="title-h1">Text to Speech Generator</h1>
<p class="title-p">Enter Text => Click Enter => Wait for 5 Seconds => Click the Blue Button => Hear your text In Speech format</p>
<textarea name="textarea" id="myTextarea" class="textarea" cols="30" rows="10"></textarea>
<button id="enter" type=submit onclick="getTextareaValue()">Enter</button>
<a id="source1" target="_blank">Click to hear</a>
`;
document.querySelector(".center-div").append(audio);
function getTextareaValue() {
// Get the textarea element by its ID
const textarea = document.getElementById('myTextarea');
// Get the value from the textarea
const myText = textarea.value;
// Use the retrieved value as needed
console.log(myText);
// You can then use the myText variable to provide the input text to the API
// and make the necessary API request
const options = {
method: 'POST',
headers: {
'content-type': 'application/json',
'X-RapidAPI-Key': '0dbd38fc8dmsh7004146a64a1761p17226ejsnceab381ff0ef',
'X-RapidAPI-Host': 'text-to-speech53.p.rapidapi.com'
},
body: JSON.stringify({
text: myText, // Use the retrieved textarea value as the input text
lang: 'ta', // Update with the appropriate language code
format: 'mp3' // Update with the desired output format
})
};
let x;
// Make the API request with the options object and handle the response
fetch('https://text-to-speech53.p.rapidapi.com/', options)
.then(response => response.json())
.then(response => {
console.log(response)
x = response;
console.log(x);
document.getElementById("source1").href = x.speech;
document.getElementById("source2").href = x.speech;
})
.catch(err => console.error(err));
}
// });
</script>
</body>
</html>