-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththirukurral.html
302 lines (211 loc) · 8.43 KB
/
thirukurral.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
293
294
295
296
297
298
299
300
301
302
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
Awesome Template
http://www.templatemo.com/preview/templatemo_450_awesome
-->
<title>Literature Love</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="css/animate.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/templatemo-style.css">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.singlePageNav.min.js"></script>
<script src="js/typed.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/custom.js"></script>
<script src="microsoft.cognitiveservices.speech.sdk.bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
<script type="text/javascript" src="exp.json"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/microsoft-cognitiveservices-speech-sdk@latest/distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle-min.js"> -->
</script>
<script>
$(document).ready(function () {
var jsonresponse;
function loadJSON(callback) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', 'exp.json', true);
xobj.onreadystatechange = function() {
if (xobj.readyState == 4 && xobj.status == "200") {
// .open will NOT return a value but simply returns undefined in async mode so use a callback
callback(xobj.responseText);
}
}
xobj.send(null);
}
// Call to function with anonymous callback
loadJSON(function(response) {
// Do Something with the response e.g.
jsonresponse = JSON.parse(response);
// Assuming json data is wrapped in square brackets as Drew suggests
});
// var jsonresponse = JSON.parse(data);
// console.log(jsonresponse['1']);
$('#submit').click(function (e) {
e.preventDefault();
var chapno = document.getElementById("sect").value;
if (chapno < 1 || chapno > 133) {
alert("Enter Chapter Number between 1 and 133");
}
else {
$("tbody").html("");
var endcount = chapno * 10;
var intcount = endcount - 9;
$("#sect_tam").text("பால்: "+jsonresponse[intcount].sect_tam);
$("#sect_eng").text("Sect Name: " + jsonresponse[intcount].sect_eng);
$("#chap_tam").text("அதிகாரம்: " + jsonresponse[intcount].chap_tam);
$("#chap_eng").text("Chapter Name: "+jsonresponse[intcount].chap_eng);
for(var i=intcount;i<=endcount;i++){
$("tbody").append("<tr rowspan='4'><th scope='row'>" + i + "</th></tr><tr><td>" + jsonresponse[i].line1 + "<br />" + jsonresponse[i].line2+"<input type='submit' onclick='playaudio(event)' class='kuralaudio btn btn-default' value='Kural Audio'></td></tr><tr><td>"+jsonresponse[i].tamil+"<input type='submit' onclick='playaudio(event)' class='tamilaudio btn btn-default' value='Tamil Audio'></td></tr><tr><td>"+jsonresponse[i].english+"<input type='submit' onclick='playaudio(event)' class='englishaudio btn btn-default' value='English Audio'></td></tr><tr><td>"+jsonresponse[i].hindi+"<input type='submit' onclick='playaudio(event)' class='englishaudio btn btn-default' value='Hindi Audio'></td></tr><br/>" );
}
}
});
});
</script>
</head>
<body id="top">
<!-- start preloader -->
<div class="preloader">
<div class="sk-spinner sk-spinner-wave">
<div class="sk-rect1"></div>
<div class="sk-rect2"></div>
<div class="sk-rect3"></div>
<div class="sk-rect4"></div>
<div class="sk-rect5"></div>
</div>
</div>
<!-- end preloader -->
<!-- start header -->
<!-- end header -->
<!-- start navigation -->
<nav class="navbar navbar-default templatemo-nav" role="navigation">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
</button>
<a href="#" class="navbar-brand">Literature Love</a>
</div>
</nav>
<!-- end navigation -->
<!-- start home -->
<!-- start service -->
<section id="service">
<div class="container">
<a href="index.html" class="btn btn-default">Back to Home</a>
<div class="row">
<div class="col-md-12">
<h2 class="wow bounceIn" data-wow-offset="50" data-wow-delay="0.3s"><span>Thirukurral</span></h2>
</div>
<form>
<label for="example-number-input" class="col-6 col-form-label">Enter Chapter Number (From 1 to 133):
</label>
<div class="col-10">
<input class="form-control" type="number" value="1" id="sect" min="1" max="133">
</div>
<input type="submit" class="btn btn-default" id="submit">
</form>
<label class="col-6 col-form-label"> <h3><div id ="sect_tam"></div>
</label><br/>
<label class="col-6 col-form-label"> <h3><div id ="sect_eng"></div></h3>
</label><br/>
<label class="col-6 col-form-label"> <h3><div id ="chap_tam"></div></h3>
</label><br/>
<label class="col-6 col-form-label"> <h3><div id ="chap_eng"></div></h3>
</label><br/>
<table class='table'><tbody>
</tbody></table>
</div>
</div>
</section>
<!-- end servie -->
<!-- start copyright -->
<footer id="copyright">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<p class="wow bounceIn" data-wow-offset="50" data-wow-delay="0.3s">
Developed by Vivek Raja P S (விவேக் ராஜா)
</div>
</div>
</div>
</footer>
<!-- end copyright -->
</body>
<script>
function playaudio(event){
// subscription key and region for speech services.
var subscriptionKey, serviceRegion;
var SpeechSDK = window.SpeechSDK;
var synthesizer;
subscriptionKey = "";
serviceRegion = "";
startSpeakTextAsyncButton = $(event.target);
console.log(startSpeakTextAsyncButton);
let inputText = startSpeakTextAsyncButton.parent().text();
console.log(inputText);
var audio = startSpeakTextAsyncButton.attr("value");
var voice = "";
var lang = "";
if(audio == "Kural Audio" || audio=="Tamil Audio"){
voice = "ta-IN-Valluvar";
lang = "ta-IN";
}
else if(audio == "English Audio"){
voice = "en-IN-Heera";
lang = "en-IN";
}
else{
voice = "hi-IN-Kalpana";
lang = "hi-IN";
}
var ssmlpre = '<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="'+lang+'"> <voice name="'+voice+'">';
var ssmlpost = '</voice></speak>'
ssmlpre = unescape(encodeURIComponent( ssmlpre ));
ssmlpost = unescape(encodeURIComponent( ssmlpost ));
var ssml = ssmlpre+inputText+ssmlpost;
startSpeakTextAsyncButton.disabled = true;
var speechConfig;
speechConfig = SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, serviceRegion);
synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig);
console.log(ssml);
synthesizer.speakSsmlAsync(
ssml,
function (result) {
startSpeakTextAsyncButton.disabled = false;
if (result.reason === SpeechSDK.ResultReason.SynthesizingAudioCompleted) {
console.log("synthesis finished for [" + ssml + "].\n");
} else if (result.reason === SpeechSDK.ResultReason.Canceled) {
console.log("synthesis failed. Error detail: " + result.errorDetails + "\n");
}
window.console.log(result);
synthesizer.close();
synthesizer = undefined;
},
function (err) {
startSpeakTextAsyncButton.disabled = false;
console.log("err");
window.console.log(err);
synthesizer.close();
synthesizer = undefined;
});
if (!!window.SpeechSDK) {
SpeechSDK = window.SpeechSDK;
startSpeakTextAsyncButton.disabled = false;
}
}
</script>
</html>