-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
503 lines (443 loc) · 16 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<!DOCTYPE HTML>
<!--
Hyperspace by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Chanting Utility</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="assets/css/main.css" />
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
<link href="./css/jplayer.css" rel="stylesheet" type="text/css" />
<link href="./css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="./css/theme.css" rel="stylesheet" type="text/css" />
<link href="./css/progressbar.css" rel="stylesheet" type="text/css" />
<style type="text/css">
select,input, #divTime{
background-color:#5E42A6;
color:white;
}
</style>
</head>
<body>
<!-- Sidebar -->
<section id="sidebar">
<div class="inner">
<nav>
<ul>
<li><a href="#intro">Chanting</a></li>
<li><a href="#two">History</a></li>
<li><a href="#three">Get in touch</a></li>
</ul>
</nav>
</div>
</section>
<!-- Wrapper -->
<div id="wrapper">
<!-- Intro -->
<section id="intro" class="wrapper style1 fullscreen fade-up">
<div class="inner">
<div id="contact-form" class="clearfix">
<label for="name">Chant: </label>
<Select Id="drpChant" name="drpChant">
<option value="-1080">--Select a Chant--</option>
</Select>
<br>
<label for="email">Chant Count</label>
<input type="number" min="1" max="20" step="1" value="1" id="txtCount" name="txtCount" required>
<br><br>
<input type="button" value="Add To Playlist" id="btnAddToPlayList" />
<input type="button" value="Reset Playlist" id="btnResetPlaylist" />
<input type="button" value="Play" id="btnPlaySelected" />
<input type="button" value="Save Playlist" id="btnSavePlaylist" onClick="btnSavePlaylist_Click()" />
<input type="button" value="Load Playlist" id="btnLoadPlaylist" onClick="btnLoadPlaylist_Click()"/>
<div id="divPlayList">
</div>
<br>
<section>
<div id="jquery_jplayer"></div>
<div id="jplayer_inspector"></div>
</section>
</div>
</div>
</section>
<!-- One -->
<section id="two" class="wrapper style1 fade-up" style="color:white;">
<div class="inner" style="padding-top:25%;">
This small Jquery/JPlayer Utility, I humbly hope, would help people to do their chanting efficiently.
I dedicate this to the service of SSRF Inc. and attribute credits to my gurudev (Shanidev) for helping me get this in place on the first day of Mahalaya Paksham 2012.<br /><br />
Definitely there is no copyright infringements or commercial benefits to the publisher or the host. We have tried to gather the media from available public domain for the benefit of the community.<br /><br />
We have used HTML5/JQuery technology that is best rendered on Google Chrome and latest versions of Internet Explorer and Firefox. Mobile devices of similar family should render them fine as well.
</div>
</section>
<!-- Three -->
<section id="three" class="wrapper style1 fade-up" style="color:white;">
<div class="inner" style="padding-top:10%;">
<h2>Get in touch</h2>
<p>Click <a href="https://lavanyadeepak.github.io/#contact">here</a></p>
<h2>Download Source Code</h2>
<p>
You can download the source code of this utility for offline viewing and customization <a href="https://github.com/lavanyadeepak/spiritualchanting">here</a>.
</p>
</div>
</section>
</div>
<!-- Footer -->
<footer id="footer" class="wrapper style1-alt">
<div class="inner">
<ul class="menu">
<li>© Deepak Kumar Vasudevan. All rights reserved.</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</div>
</footer>
<div id="dlgProgressIndicator" title="Chanting In Progress">
<table id="tblPlayItem">
<tr>
<td>Selected Chant</td>
<td id="divSelectedChant"></td>
</tr>
<tr>
<td>Chant Composition</td>
<td id="divChantComposition"></td>
</tr>
<tr>
<td>Current Avruthi</td>
<td id="divCurrentAvruthi"></td>
</tr>
<tr>
<td><span id="spnPhoneMode">To Phone</span></td>
<td><span id="spnMute">Mute</span></td>
</tr>
<tr id="trCurrentCount" style="display:none;">
<td colspan="2">
Current Count:<span id="spnCurrentCount"></span> of <span id="spnTotalCount"></span>
</td>
<tr>
<td colspan="2">
<div class="meter green nostripes">
<span id="progress" style="width: 0%"></span>
<div id="labelProg">0%</div>
</div>
</td>
</tr>
</table>
</div>
<div style="visibility:none;">
<input type="file" id="myFile" onchange="ProcessSelectedFile(this)">
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="scripts/jquery-migrate-1.4.1.js"></script>
<script src="scripts/lodash.js"></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
<script src="assets/js/main.js"></script>
<script type="text/javascript" src="./scripts/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="./scripts/jplayer.playlist.min.js"></script>
<script type="text/javascript" src="./scripts/jquery.jplayer.inspector.js"></script>
<script type="text/javascript" src="./scripts/jquery-ui-1.8.24.custom.min.js"></script>
<script type="text/javascript" src="./scripts/jquery.blockUI.js"></script>
<script type="text/javascript" src="FileSaver.js"></script>
<script type="text/javascript" src="./chant.json"></script>
<script type="text/javascript">
var arrPlayItem = [];
var arrPlayItemChoiceCount = [];
var arrMasterPlayList = [];
var intCurrentPlayIndex = 0;
var my_jPlayer = $("#jquery_jplayer");
my_jPlayer.jPlayer("volume",0.7);
var opt_play_first = false,
opt_auto_play = true,
opt_text_playing =
opt_text_selected = "Track selected";
var isPassiveClose = 0;
var first_track = true;
$.jPlayer.timeFormat.padMin = false;
$.jPlayer.timeFormat.padSec = false;
$.jPlayer.timeFormat.sepMin = " min ";
$.jPlayer.timeFormat.sepSec = " sec";
my_jPlayer.jPlayer({
errorAlerts: true,
volume: "1",
ready: function () {
},
timeupdate: function(event) {
},
play: function(event) {
DisplayProgress();
if (arrMasterPlayList.length > 0)
{
$("#trCurrentCount").css("display","block");
$("#spnCurrentCount").text(intCurrentPlayIndex + 1);
$("#spnTotalCount").text(arrMasterPlayList.length);
}
},
pause: function(event) {
},
ended: function(event) {
intCurrentPlayIndex++;
if (intCurrentPlayIndex < arrMasterPlayList.length)
{
$("#divSelectedChant").html($("#drpChant option:selected").text());
$("#divChantComposition").html(GetPlayItemHTML());
$("#divCurrentAvruthi").html(arrMasterPlayList[intCurrentPlayIndex]);
my_jPlayer.jPlayer("setMedia", {mp3: arrMasterPlayList[intCurrentPlayIndex]});
my_jPlayer.jPlayer("play");
}
else
{
isPassiveClose = 1;
$("#dlgProgressIndicator").dialog("close");
ResetState();
if (arrMasterPlayList.length < 1)
{
$("#trCurrentCount").css("display","none");
$("#spnCurrentCount").text("");
$("#spnTotalCount").text("");
}
}
},
error: function (event) {
},
swfPath: "./scripts/",
cssSelectorAncestor: "#jp_container",
supplied: "mp3",
wmode: "window"
});
$("#btnAddToPlayList").bind("click", function (){
var strCurrentItem = $("#drpChant").val();
if (strCurrentItem < 0)
{
//Do Nothing
}
else
{
if (strCurrentItem.indexOf("SPECIALPROCESSING_") > -1)
{
strCurrentItem = strCurrentItem.split("__")[1];
var arrItems = strCurrentItem.split(",");
for (var i=0;i<arrItems.length;i++)
{
var eachItem = arrItems[i].split(":");
var iteratorValue = eachItem[1] == "n"?$("#txtCount").val():eachItem[1];
arrPlayItem.push(eachItem[0]);
arrPlayItemChoiceCount.push(iteratorValue);
}
}
else if (strCurrentItem.indexOf("BUILD_") > -1)
{
alert ('Available in next version');
/*
strCurrentItem = strCurrentItem.split("__")[1];
var arrPlayComponents = strCurrentItem.split("_");
for (var i=arrPlayComponents[1];i<arrPlayComponents[2];i++)
{
var strPlayItem = arrPlayComponents[0]+arrPlayComponents[3]+arrPlayComponents[i];
console.log (strPlayItem);
}
*/
//0 Path 1 2 lbound ubound 3 filename.mp3
}
else
{
arrPlayItem.push($("#drpChant").val());
arrPlayItemChoiceCount.push($("#txtCount").val());
}
}
});
$("#btnResetPlaylist").bind("click", function (){
arrPlayItem = [];
arrPlayItemChoiceCount = [];
arrMasterPlayList = [];
});
$("#btnPlaySelected").bind("click", function(){
if (arrPlayItem.length < 1)
{
alert ("Please add a few items into playlist to proceed");
}
else
{
for (var i=0;i<arrPlayItem.length;i++)
{
if (arrPlayItem[i].length < 1)
continue;
else
{
for (var j=0;j<arrPlayItemChoiceCount[i];j++)
{
arrMasterPlayList.push(arrPlayItem[i]);
}
}
}
$("#divSelectedChant").html($("#drpChant option:selected").text());
$("#divChantComposition").html(GetPlayItemHTML());
$("#divCurrentAvruthi").html(arrMasterPlayList[intCurrentPlayIndex]);
$("#dlgProgressIndicator").dialog("open");
my_jPlayer.jPlayer("setMedia", {mp3: arrMasterPlayList[intCurrentPlayIndex]});
DisplayProgress();
my_jPlayer.jPlayer("play");
}
});
function ResetState()
{
my_jPlayer.jPlayer("stop");
$("#btnResetPlaylist").trigger("click");
isPassiveClose = 0;
intCurrentPlayIndex =0;
$('select#drpChant').prop('selectedIndex', 0);
$('#txtCount').val(1);
}
function DisplayProgress()
{
var percentage = 0;
percentage = Math.round((intCurrentPlayIndex/arrMasterPlayList.length)*100);
$("#progress").css('background', 'green');
$("#progress").css("width", percentage + "%");
$("#labelProg").text(percentage + "%");
}
function GetPlayItemHTML()
{
var strHTML = "<table>";
strHTML += "<tr><td>Play Item</td><td>Repeat Count</td></tr>";
for (var i=0;i<arrPlayItem.length;i++)
{
strHTML += "<tr>";
strHTML += "<td>" + arrPlayItem[i] + " </td><td> "+ arrPlayItemChoiceCount[i]+"</td>";
strHTML += "</tr>";
}
strHTML += "</table>";
return (strHTML);
}
function btnSavePlaylist_Click()
{
if (arrPlayItem.length > 0)
{
var playItems = JSON.stringify(arrPlayItem);
var playItemsCount = JSON.stringify(arrPlayItemChoiceCount);
var userInput = '{"PlayItems": "'+btoa(playItems)+'","PlayItemsCount": "'+btoa(playItemsCount)+'"}';
var blob = new Blob([userInput], { type: "text/plain;charset=utf-8" });
saveAs(blob, "dynamic.txt");
}
}
function btnLoadPlaylist_Click()
{
$("#myFile").trigger("click");
}
function ProcessSelectedFile(input)
{
if (input.files.length > 0)
{
let f = input.files[0];
let reader = new FileReader();
reader.readAsText(f);
reader.onload = function() {
var jsnPlayList = JSON.parse(reader.result);
var playItems = jsnPlayList["PlayItems"];
var playItemsCount = jsnPlayList["PlayItemsCount"];
if (playItems != 'undefined' && playItemsCount != 'undefined')
{
arrPlayItem = atob(playItems).split(",");
arrPlayItemChoiceCount = atob(playItemsCount).split(",");
var jsnPlayItem = JSON.parse(arrPlayItem);
var jsnPlayItemCount = JSON.parse(arrPlayItemChoiceCount);
arrPlayItem = [];
arrPlayItemChoiceCount = [];
for (var i =0;i<jsnPlayItem.length;i++)
{
arrPlayItem.push(jsnPlayItem[i]);
arrPlayItemChoiceCount.push(jsnPlayItemCount[i]);
}
}
};
reader.onerror = function() {
console.log(reader.error);
};
}
}
$(function (){
$("#dlgProgressIndicator").dialog({
autoOpen: false,
modal:true,
resizable:false,
width:'auto',
beforeClose: function(){
if (isPassiveClose == 1)
{
return (true);
}
else
{
if (window.confirm('Closing the dialog will stop and reset the chanting'))
{
ResetState();
return (true);
}
else
return (false);
}
}
});
chantJson.chant = _.sortBy(chantJson.chant, "chantname");
for (var i in chantJson.chant) {
$("#drpChant").append("<option value='" + chantJson.chant[i].chanturl + "'>" + chantJson.chant[i].chantname + "</option>");
}
$("#spnPhoneMode").click(function()
{
var strCurrently = $("#spnPhoneMode").text();
if (strCurrently == "To Phone")
{
my_jPlayer.jPlayer("volume",0.1);
$("#divTime").css({"border-color": "#FF0000",
"border-width":"1px",
"border-style":"solid"});
$("#spnPhoneMode").text("To Audio");
}
else if (strCurrently == "To Audio")
{
my_jPlayer.jPlayer("volume",0.7);
$("#divTime").css({"border-color": "#FF0000",
"border-width":"0px",
"border-style":"none"});
$("#spnPhoneMode").text("To Phone");
}
});
$("#spnMute").click(function ()
{
var strCurrently = $("#spnMute").text();
if (strCurrently == "Mute")
{
my_jPlayer.jPlayer("mute");
$("#spnMute").text("Unmute");
}
else if (strCurrently == "Unmute")
{
my_jPlayer.jPlayer("unmute");
$("#spnMute").text("Mute");
}
});
});
String.prototype.repeat= function(n){
n= n || 1;
return Array(n+1).join(this);
}
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-35207111-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>