-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
277 lines (254 loc) · 16.1 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
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="static/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="static/css/kb.css">
<script src="static/js/jquery-3.2.1.min.js"></script>
<script src="dist/shabdawali.js" ></script>
<style>
#heading-container{
text-align: center;
}
#shabdawali {
font-family: 'Open Sans Condensed', sans-serif;
}
.m5 {
margin-right: 5px;
}
</style>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4812VFLT3M"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-4812VFLT3M');
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4922790412146333" crossorigin="anonymous"></script>
</head>
<body>
<!-- <div class="container" id="heading-container">
<h1 style="color: #49a1e0"> <img src="static/shabdawali_logo.png" height="50px" style="margin: 20px"> शब्दावली / Shabdawali</h1>
</div> -->
<div class="container">
<div class="row" style="height: 45%">
<div class="col-12 d-flex justify-content-center align-items-center">
<p style="font-size: 2.2em; text-align: center;">
<span id="shabdawali"></span>
</p>
</div>
</div>
<div class="row" style="height: 45%">
<div class="col-12 d-flex justify-content-center align-items-end" >
<div>
<p>
<div class="row"> <!-- aligning the buttons -->
<div class="col-12">
<button type="button" id="btn-blinkCursor" class="btn btn-outline-dark m5">Show Cursor</button>
<button type="button" id="btn-keySound" class="btn btn-outline-dark m5">Keypress Sound</button>
<button type="button" id="btn-dynamicPause" class="btn btn-outline-dark m5">Dynamic Pauses</button>
<button id="btn-user-input" class="btn btn-primary m5">Edit Text</button>
</div>
</div>
<div class="modal" id="userInputModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header justify-content-between">
<h4 class="modal-title">Edit</h4>
<button type="button" class="close">×</button>
</div>
<div class="modal-body">
<textarea class="form-control" rows="13" style="border:none; resize:none;" id="custom-input"></textarea>
</div>
<div class="modal-footer justify-content-between">
<button class="btn btn-primary" id="btnCloseModal">Save and Close</button>
</div>
</div>
</div>
</div>
</p>
<ul id="keyboard" style="bottom: 0px">
<li class="symbol"><span class="off" for="ch`">`</span><span class="on" for="ch~">~</span></li>
<li class="symbol"><span class="off" for="ch1">1</span><span class="on" for="ch!">!</span></li>
<li class="symbol"><span class="off" for="ch2">2</span><span class="on" for="ch@">@</span></li>
<li class="symbol"><span class="off" for="ch3">3</span><span class="on" for="ch#">#</span></li>
<li class="symbol"><span class="off" for="ch4">4</span><span class="on" for="ch$">$</span></li>
<li class="symbol"><span class="off" for="ch5">5</span><span class="on" for="ch%">%</span></li>
<li class="symbol"><span class="off" for="ch6">6</span><span class="on" for="ch^">^</span></li>
<li class="symbol"><span class="off" for="ch7">7</span><span class="on" for="ch&">&</span></li>
<li class="symbol"><span class="off" for="ch8">8</span><span class="on" for="ch*">*</span></li>
<li class="symbol"><span class="off" for="ch9">9</span><span class="on" for="ch(">(</span></li>
<li class="symbol"><span class="off" for="ch0">0</span><span class="on" for="ch)">)</span></li>
<li class="symbol"><span class="off" for="ch-">-</span><span class="on" for="ch_">_</span></li>
<li class="symbol"><span class="off" for="ch=">=</span><span class="on" for="ch+">+</span></li>
<li class="delete lastitem" for="chdel"><span>delete</span></li>
<li class="tab" ><span for="chtab">tab</span></li>
<li class="letter" ><span for="chq">q</span></li>
<li class="letter" ><span for="chw">w</span></li>
<li class="letter" ><span for="che">e</span></li>
<li class="letter" ><span for="chr">r</span></li>
<li class="letter" ><span for="cht">t</span></li>
<li class="letter" ><span for="chy">y</span></li>
<li class="letter" ><span for="chu">u</span></li>
<li class="letter" ><span for="chi">i</span></li>
<li class="letter" ><span for="cho">o</span></li>
<li class="letter" ><span for="chp">p</span></li>
<li class="symbol"><span class="off" for="ch[">[</span><span class="on" for="ch{" >{</span></li>
<li class="symbol"><span class="off" for="ch]">]</span><span class="on" for="ch}" >}</span></li>
<li class="symbol lastitem"><span class="off" for="ch\\">\</span><span class="on" for="ch|">|</span></li>
<li class="capslock">caps lock</li>
<li class="letter" ><span for="cha" >a</span></li>
<li class="letter" ><span for="chs" >s</span></li>
<li class="letter" ><span for="chd" >d</span></li>
<li class="letter" ><span for="chf" >f</span></li>
<li class="letter" ><span for="chg" >g</span></li>
<li class="letter" ><span for="chh" >h</span></li>
<li class="letter" ><span for="chj" >j</span></li>
<li class="letter" ><span for="chk" >k</span></li>
<li class="letter" ><span for="chl" >l</span></li>
<li class="symbol"><span class="off" for="ch;">;</span><span class="on" for="ch:">:</span></li>
<li class="symbol"><span class="off" for="ch-single">'</span><span class="on" for='ch"'>"</span></li>
<li class="return lastitem"><span>return</span></li>
<li class="left-shift"><span>shift</span></li>
<li class="letter" ><span for="chz" >z</span></li>
<li class="letter" ><span for="chx" >x</span></li>
<li class="letter" ><span for="chc" >c</span></li>
<li class="letter" ><span for="chv" >v</span></li>
<li class="letter" ><span for="chb" >b</span></li>
<li class="letter" ><span for="chn" >n</span></li>
<li class="letter" ><span for="chm" >m</span></li>
<li class="symbol"><span class="off" for="ch," >,</span><span class="on"for="ch<" ><</span></li>
<li class="symbol"><span class="off" for="ch." >.</span><span class="on"for="ch>" >></span></li>
<li class="symbol"><span class="off" for="ch/" >/</span><span class="on"for="ch?" >?</span></li>
<li class="right-shift lastitem"><span>shift</span></li>
<li class="space lastitem" ><span for="ch "> </span></li>
</ul>
</div>
</div>
</div>
</div>
<audio id="audio" controls style="display:none">
<source src="static/media/typewriter_key_sound3.mp3" type="audio/mpeg"> Your browser does not support the audio element.
</audio>
<!-- <div id="typingBox" spellcheck="true"></div>
<div>
<textarea id="typingBox2" spellcheck="true"></textarea>
</div>
<div id="commonText"></div>
<div id="letter"></div> -->
<script>
var lettersWithShift = ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "{", "}", "|", "<", "?", ">", ":", "'", "\"" ];
var description = [
"शब्दावली / Shabdawali",
"Amazing human like typing effects beyond your imagination",
"It does typo, and correct them",
"Small size 1.7k (when compressed)",
"No dependency & CPU friendly",
"Dynamic speed to type/delete long sentences",
"Can be used as jQuery plugin, React component, or with other libraries",
"You can fully control it's behavior",
"You can use it for playing music notes",
"You can use it for typing demo",
"You can use it for typing tweets",
"You can use it for posts with typing effects"
];
var descriptionTyper;
$(document).ready(function(){
// toggle Keypress sound on button click.
var keySound = false;
function loadDescriptionTyper(){
$("#shabdawali").html("");
descriptionTyper = shabdawali( document.getElementById("shabdawali"), {
lines: description,
replacable : true,
cursorEffect : true,
typoEffect: true,
dynamicPause: true,
repeat: false,
onCharChange : function(char){
if (keySound) document.getElementById('audio').play();
$("#keyboard .keyPressed").removeClass("keyPressed");
if(lettersWithShift.indexOf(char) !== -1){
$("#keyboard li.left-shift").addClass("keyPressed");
}
if(char === "BS"){
$("#keyboard li.delete").addClass("keyPressed");
}else if(char === "DEL"){
$("#keyboard li.delete").addClass("keyPressed");
}else if(char === "CR"){
$("#keyboard li.return").addClass("keyPressed");
}else{
if(char.indexOf("'") === -1) {
$("[for='ch"+char+"']").parent("li").addClass("keyPressed");
/* if (descriptionTyper.currentLineIndex === 11) {
$('#audios').append('<iframe id="audio" allow="autoplay" src="static/media/keyboardTap.webm" style="display: none;">');
} else if ($('#audio').length) {
$('#audios').remove();
} */
}
}
setTimeout(function(){
$("#keyboard .keyPressed").removeClass("keyPressed");
},500);
},
onLineChange : function(){
$("#keyboard li.return").addClass("keyPressed");
setTimeout(function(){
$("#keyboard .keyPressed").removeClass("keyPressed");
},400);
},
} );
descriptionTyper.checkIfFitsForTypoEffect = function(word){
//if(word === "correct" || ( Math.floor((Math.random() * 3) + 1) !== 2 && word.length > 7) )
if(word.trim() === "correct" )
return true;
}
descriptionTyper.start();
}
loadDescriptionTyper();
$('#btn-keySound').on('click', function() {
$(this).toggleClass("btn-outline-secondary btn-outline-dark");
$(this).text(function(i, t){
return t === "Keypress Sound" ? "Stop Sound" : "Keypress Sound";
});
keySound = !keySound;
});
// allow user to check whether to display blinking cursor or not.
var showCursor = false;
$("#btn-blinkCursor").on("click", function() {
(showCursor) ? descriptionTyper.showCursor() : descriptionTyper.hideCursor();
showCursor = !showCursor;
$(this).toggleClass("btn-outline-secondary btn-outline-dark");
$(this).text(function(i, t){
return t === "Show Cursor" ? "Hide Cursor" : "Show Cursor";
});
});
//allow user to choose whether or not they want dynamicPause
var dynPause = false;
$("#btn-dynamicPause").on("click",function(){
(dynPause) ? descriptionTyper.dynamicPause = true : descriptionTyper.dynamicPause = false;
$(this).toggleClass("btn-outline-secondary btn-outline-dark");
$(this).text(function(i, t){
return t === "Dynamic Pauses" ? "Stop Pauses" : "Dynamic Pauses";
});
});
$('#btn-user-input').on('click', function () {
$("#custom-input").val(description.join("\n"));
descriptionTyper.pause();
$("#userInputModal").show();
});
$('#btnCloseModal').on('click', function () {
description = $("#custom-input").val().split("\n");
$(".shabdawali-cursor").remove()
$("#userInputModal").hide();
descriptionTyper.stop();
loadDescriptionTyper();
});
$('.close').on('click', function () {
$("#userInputModal").hide();
descriptionTyper.resume();
});
});
</script>
</body>
</html>