forked from Mottie/Keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
825 lines (779 loc) · 26 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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Virtual Keyboard</title>
<!-- jQuery (required) & jQuery UI + theme (optional) -->
<link href="docs/css/jquery-ui.min.css" rel="stylesheet">
<script src="docs/js/jquery.min.js"></script>
<script src="docs/js/jquery-ui.min.js"></script>
<script src="docs/js/jquery-migrate-1.2.1.min.js"></script>
<!-- keyboard widget css & script (required) -->
<link href="css/keyboard.css" rel="stylesheet">
<script src="js/jquery.keyboard.js"></script>
<!-- keyboard extensions (optional) -->
<script src="js/jquery.mousewheel.js"></script>
<script src="js/jquery.keyboard.extension-typing.js"></script>
<script src="js/jquery.keyboard.extension-autocomplete.js"></script>
<script src="js/jquery.keyboard.extension-caret.js"></script>
<!-- demo only -->
<link rel="stylesheet" href="docs/css/bootstrap.min.css">
<link rel="stylesheet" href="docs/css/font-awesome.min.css">
<link href="docs/css/demo.css" rel="stylesheet">
<link href="docs/css/tipsy.css" rel="stylesheet">
<link href="docs/css/prettify.css" rel="stylesheet">
<script src="docs/js/bootstrap.min.js"></script>
<script src="docs/js/demo.js"></script>
<script src="docs/js/jquery.tipsy.min.js"></script>
<script src="docs/js/prettify.js"></script> <!-- syntax highlighting -->
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" name="top">
<span class="fa fa-keyboard-o fa-lg"></span>
</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home <span class="sr-only">(current)</span></a></li>
<li><a href="docs/basic.html">Basic</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Layouts <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="docs/layouts.html">Standard</a></li>
<li><a href="docs/layouts2.html">Greywyvern</a></li>
<li><a href="docs/layouts3.html">Microsoft Keyboard</a></li>
<li><a href="docs/calculator.html"><span class="fa fa-calculator fa-lg"></span> Calculator</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Extensions <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="docs/altkeys-popup.html">Alt-keys</a></li>
<li><a href="#autocomplete">Autocomplete</a></li>
<li><a href="#caret">Caret</a></li>
<li><a href="docs/extender.html">Extender</a></li>
<li><a href="docs/preview-keyset.html">Keyset</a></li>
<li><a href="docs/mobile.html">Mobile</a></li>
<li><a href="docs/jquery-mobile-1.4.html">Mobile v1.4</a></li>
<li><a href="docs/navigate.html">Navigate</a></li>
<li><a href="docs/scramble.html">Scramble</a></li>
<li><a href="#typing">Typing</a></li>
</ul>
</li>
<li><a href="//jsfiddle.net/Mottie/egb3a1sk/"><span class="fa fa-flask fa-lg"></span> Playground</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="//github.com/Mottie/Keyboard"><span class="fa fa-github fa-lg" title="GitHub"></span></a></li>
<li><a href="//github.com/Mottie/Keyboard/archive/master.zip"><span class="fa fa-download fa-lg" title="Download"></span></a></li>
<li><a href="//github.com/Mottie/Keyboard/wiki"><span class="fa fa-file-text-o fa-lg" title="Documentation"></span></a></li>
<li><a href="//github.com/Mottie/Keyboard/issues"><span class="fa fa-bug fa-lg" title="Issues"></span></a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div id="page-wrap">
<h1>
<a href="//github.com/Mottie/Keyboard">Virtual Keyboard</a><br>
<small class="version"></small>
</h1>
<iframe class="github-btn" src="https://ghbtns.com/github-btn.html?user=Mottie&repo=keyboard&type=fork&count=true" width="90" height="20" title="Fork on GitHub"></iframe>
<iframe class="github-btn" src="https://ghbtns.com/github-btn.html?user=Mottie&repo=keyboard&type=watch&count=true" width="100" height="20" title="Star on GitHub"></iframe>
<h5>Original by
<a class="external" href="//jsatt.blogspot.com/2010/01/on-screen-keyboard-widget-using-jquery.html">Jeremy Satterfield</a>,
updated & maintained by <a class="external" href="//wowmotty.blogspot.com/2010/11/jquery-ui-keyboard-widget.html">Rob Garrison</a>
</h5>
<ul id="console">
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
<h5>
Click inside the input or textarea to open the keyboard<br>
Click on the keyboard title, then scroll down to see its code
</h5>
<div class="block" id="autocomplete">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">QWERTY Text</span>
</h2>
<input id="text" type="text" placeholder=" Enter something...">
<br>
<small>
* Placeholder (watermark).<br>
* <a href="//github.com/Mottie/Keyboard/wiki/Setup#autocomplete">Autocomplete</a> extension.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><input id="text" type="text" placeholder=" Enter something..."></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">// Autocomplete demo
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure",
"COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript",
"Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ];
$('#text')
.keyboard({ layout: 'qwerty' })
.autocomplete({
source: availableTags
})
// position options added after v1.23.4
.addAutocomplete({
position : {
of : null, // when null, element will default to kb.$keyboard
my : 'right top', // 'center top', (position under keyboard)
at : 'left top', // 'center bottom',
collision: 'flip'
}
})
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">QWERTY Password</span>
<img id="password-opener" class="tooltip-tipsy" title="Click to open the virtual keyboard" src="css/images/keyboard.svg">
</h2>
<input id="password" type="password">
<br>
<small>
* Click icon to open keyboard.<br>
* Stay open until accept/cancel/esc.<br>
* Key hover disabled in this type.<br>
* Demo: Reveal letters with <a class="external" href="//jsfiddle.net/Mottie/24n8wsak/">Caret extension</a>.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><img id="passwd" class="tooltip-tipsy" title="Click to open the virtual keyboard" src="css/images/keyboard.svg">
<input id="password" type="password"></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#password')
.keyboard({
openOn : null,
stayOpen : true,
layout : 'qwerty'
})
.addTyping();
$('#password-opener').click(function(){
var kb = $('#password').getkeyboard();
// close the keyboard if the keyboard is visible and the button is clicked a second time
if ( kb.isOpen ) {
kb.close();
} else {
kb.reveal();
}
});</pre>
</div>
</div>
<div class="block" id="caret">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">QWERTY (mod) Text Area</span>
</h2>
<textarea id="qwerty-mod"></textarea>
<br>
<small>
* Locked input (no manual input).<br>
* Known readonly bug in Safari.<br>
* <a href="//github.com/Mottie/Keyboard/wiki/Setup#caret">Caret</a> extension.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="qwerty-mod"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#qwerty-mod')
.keyboard({
lockInput: true, // prevent manual keyboard entry
layout: 'custom',
customLayout: {
'normal': [
'` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
'{tab} q w e r t y u i o p [ ] \\',
'a s d f g h j k l ; \' {enter}',
'{shift} z x c v b n m , . / {shift}',
'{accept} {space} {left} {right}'
],
'shift': [
'~ ! @ # $ % ^ & * ( ) _ + {bksp}',
'{tab} Q W E R T Y U I O P { } |',
'A S D F G H J K L : " {enter}',
'{shift} Z X C V B N M < > ? {shift}',
'{accept} {space} {left} {right}'
]
}
})
.addCaret({
// extra class name added to the caret
// "ui-keyboard-caret" class is always added
caretClass : '',
// *** for future use ***
// data-attribute containing the character(s) next to the caret
charAttr : 'data-character',
// # character(s) next to the caret (can be negative for RTL)
charIndex : 1,
// caret position adjustments
offsetX : 0,
offsetY : 0
})
.addTyping();</pre>
<h4>CSS</h4>
<pre class="prettyprint lang-css">.ui-keyboard-caret {
background: #c00;
width: 1px;
margin-top: 3px;
}</pre>
</div>
</div>
<div class="block" id="typing">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">International</span>
<img id="inter-type" class="tooltip-tipsy" title="Try out the typing extension!" src="css/images/keyboard.svg">
</h2>
<textarea id="inter"></textarea>
<br>
<small>
* <a class="external" href="//bootswatch.com/darkly/">Bootswatch Darkly</a> theme.<br>
* <a href="//github.com/Mottie/Keyboard/wiki/Setup#typing">Typing</a> extension.<br>
* See basic non-library <a class="external" href="//jsfiddle.net/Mottie/jsh0377k/">theme</a>.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><img id="inter-type" class="tooltip-tipsy" title="Try out the typing extension!" src="css/images/keyboard.svg">
<textarea id="inter"></textarea></pre>
<h4>CSS</h4>
<pre class="prettyprint lang-css">/* override bootstrap active state */
button.btn-default:active {
background-color: #FFF;
-webkit-box-shadow: none;
box-shadow: none;
}
button.btn-default:active:hover {
background-color: #3276B1;
}
/* override Bootstrap excessive button padding */
button.ui-keyboard-button.btn {
padding: 1px 6px;
}
/* Bootswatch Darkly input is too bright */
.ui-keyboard-input.light, .ui-keyboard-preview.light { color: #222; background: #ddd; }
.ui-keyboard-input.dark, .ui-keyboard-preview.dark { color: #ddd; background: #222; }
</pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#inter')
.keyboard({
layout: 'international',
css: {
// input & preview
// "label-default" for a darker background
// "light" for white text
input: 'form-control input-sm dark',
// keyboard container
container: 'center-block well',
// default state
buttonDefault: 'btn btn-default',
// hovered button
buttonHover: 'btn-primary',
// Action keys (e.g. Accept, Cancel, Tab, etc);
// this replaces "actionClass" option
buttonAction: 'active',
// used when disabling the decimal button {dec}
// when a decimal exists in the input area
buttonDisabled: 'disabled'
}
})
.addTyping();
// Script - typing extension
// simulate typing into the keyboard, use:
// \t or {t} = tab, \b or {b} = backspace, \r or \n or {e} = enter
// added {l} = caret left, {r} = caret right & {d} = delete
$('#inter-type').click(function(){
$('#inter').getkeyboard().reveal().typeIn("{t}Hal{l}{l}{d}e{r}{r}l'o{b}o {e}{t}World", 500);
return false;
});</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Alphabetical</span>
</h2>
<textarea id="alpha"></textarea>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="alpha"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#alpha')
.keyboard({ layout: 'alpha' })
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Colemak</span>
</h2>
<textarea id="colemak"></textarea>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="colemak"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#colemak')
.keyboard({ layout: 'colemak' })
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Dvorak</span>
</h2>
<textarea id="dvorak"></textarea>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="dvorak"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#dvorak')
.keyboard({ layout: 'dvorak' })
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Num Pad</span>
</h2>
<input id="num" class="alignRight" type="text">
<br>
<small>
* Input restricted.<br>
* Pasting (ctrl-v) not allowed.<br>
* Auto accept content.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><input id="num" class="alignRight" type="text"></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#num')
.keyboard({
layout : 'num',
restrictInput : true, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true
})
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: Hex</span>
</h2>
<input id="hex" type="text">
<br>
<small>
* maxLength = 6.<br>
* Input restricted.<br>
* Lowercase included.<br>
* Valid @ length = 6.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html">
<input id="hex" type="text"></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#hex')
.keyboard({
layout: 'custom',
customLayout: {
'default' : [
'C D E F',
'8 9 A B',
'4 5 6 7',
'0 1 2 3',
'{bksp} {a} {c}'
]
},
maxLength : 6,
// Prevent keys not in the displayed keyboard from being typed in
restrictInput : true,
// include lower case characters (added v1.25.7)
restrictInclude : 'a b c d e f',
// don't use combos or A+E could become a ligature
useCombos : false,
// activate the "validate" callback function
acceptValid : true,
validate : function(keyboard, value, isClosing){
// only make valid if input is 6 characters in length
return value.length === 6;
}
})
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: Meta Sets</span>
<img id="meta-type" class="tooltip-tipsy" title="Try out the typing extension!" src="css/images/keyboard.svg">
</h2>
<textarea id="meta"></textarea>
<br>
<small>
* <a href="//github.com/Mottie/Keyboard/wiki/Setup#typing">Typing</a> extension.<br>
* Keyboard opens showing last keyset.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="meta"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#meta')
.keyboard({
// keyboard will open showing last key set used
resetDefault: false,
layout: 'custom',
display: {
'alt' : 'AltGr:It\'s all Greek to me',
'meta1' : '\u2666:end of alphabet', // Diamond with label that shows in the title (spaces are okay here)
'meta2' : '\u2665:Russian', // Heart
'meta3' : '\u2663:zodiac', // Club
'meta99' : '\u2660:numbers' // Spade
},
customLayout: {
'default' : [
// Add labels using a ":" after the key's name and replace spaces with "_"
// without the labels this line is just 'a b c d e f g'
'a:a_letter,_that_sounds_like_"ey" b:a_bug_that_makes_honey c:is_when_I_look_around d:a_grade,_I_never_got e:is_what_girls_say_when_they_run_away_from_me f:u,_is_what_I_say_to_those_screaming_girls! g:gee,_is_that_the_end_of_my_wittiness?',
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'shift' : [
'A B C D E F G',
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'alt' : [
'\u03b1 \u03b2 \u03b3 \u03b4 \u03b5 \u03b6 \u03b7', // lower case Greek
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'alt-shift' : [
'\u0391 \u0392 \u0393 \u0394 \u0395 \u0396 \u0397', // upper case Greek
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta1' : [
't u v w x y z', // lower case end of alphabet
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta1-shift' : [
'T U V W X Y Z', // upper case
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta1-alt' : [
'0 9 8 7 6 5 4', // numbers
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta1-alt-shift' : [
') ( * & ^ % $', // shifted numbers
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta2' : [
'\u0430 \u0431 \u0432 \u0433 \u0434 \u0435 \u0436', // lower case Russian
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta2-shift' : [
'\u0410 \u0411 \u0412 \u0413 \u0414 \u0415 \u0416', // upper case Russian
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta3' : [
'\u2648 \u2649 \u264A \u264B \u264C \u264D \u264E', // Zodiac
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta99' : [
'1 2 3 4 5 6 7', // only because I ran out of ideas
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
]
}
})
.addTyping();
// Script - typing extension
var meta = $('#meta').getkeyboard();
meta
.reveal()
.typeIn('aBcD1112389\u2648\u2649', 700, function(){
meta.accept();
alert('all done!');
});</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: Junk</span>
</h2>
<textarea id="junk"></textarea>
<br>
<small>
* Use shift key - see action key sizes.<br>
* Use the decimal - only one allowed.<br>
* Toggle combo key included.<br>
* Type in 'ae' and other combo keys.<br>
* Accept content to see the callback.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="junk"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#junk')
.keyboard({
layout: 'custom',
customLayout: {
'default' : [
'a e i o u y c',
'` \' " ~ {sp:1} {dec}',
'{tab} {enter} {bksp}',
'{space}',
'{accept} {cancel} {shift}'
],
'shift' : [
'A E I O U Y C',
'` \' " ~ {sp:1} {dec}',
'{t} {sp:1} {e} {sp:1} {b}',
'{space}',
'{a} {sp:1} {c} {sp:1} {s}'
]
},
// Added here as an example on how to add combos
combos : {
'a' : { e: '\u00e6' },
'A' : { E: '\u00c6' }
},
// example callback function
accepted : function(e, keyboard, el){ alert('The content "' + el.value + '" was accepted!'); }
})
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: Mapped Keys</span>
</h2>
<textarea id="map"></textarea>
<br>
<small>
* No preview window.<br>
* Type in a-g.<br>
* Type in A-G (shifted).<br>
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="map"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">// *** Mapped keys ***
$('#map').keyboard({
layout: 'custom',
customLayout: {
'default' : [
// "n(a):title_or_tooltip"; n = new key, (a) = actual key, ":label" = title_or_tooltip (use an underscore "_" in place of a space " ")
'\u03b1(a):lower_case_alpha_(type_a) \u03b2(b):lower_case_beta_(type_b) \u03b3(c):lower_case_gamma_(type_c) \u03b4(d):lower_case_delta_(type_d) \u03b5(e):lower_case_epsilon_(type_e) \u03b6(f):lower_case_zeta_(type_f) \u03b7(g):lower_case_eta_(type_g)', // lower case Greek
'{shift} {accept} {cancel}'
],
'shift' : [
'\u0391(A) \u0392(B) \u0393(C) \u0394(D) \u0395(E) \u0396(F) \u0397(G)', // upper case Greek
'{shift} {accept} {cancel}'
]
},
usePreview: false // no preveiw
});</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: Hidden</span>
</h2>
<a href="#" class="hiddenInput">Hidden input</a>
<!-- DON'T use type="hidden" because IE doesn't like hidden inputs -->
<input id="hidden" type="text" style="display:none;">
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><a href="#" class="hiddenInput">Hidden input</a>
<!-- DON'T use type="hidden" because IE doesn't like hidden inputs -->
<input id="hidden" type="text" style="display:none;"></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">// *** Hidden input example ***
// click on a link - add focus to hidden input
$('.hiddenInput').click(function(){
$('#hidden').data('keyboard').reveal();
return false;
});
// Initialize keyboard script on hidden input
// set "position.of" to the same link as above
$('#hidden')
.keyboard({
layout : 'qwerty',
position : {
of : $('.hiddenInput'),
my : 'center top',
at : 'center top'
}
})
.addTyping();</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: iPad</span>
</h2>
<textarea id="ipad"></textarea>
<br>
<small>
* Thanks to <a class="external" href="//github.com/gitaarik">gitaarik</a> for sharing!.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="ipad"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#ipad').keyboard({
display: {
'bksp' : "\u2190",
'accept' : 'return',
'default': 'ABC',
'meta1' : '.?123',
'meta2' : '#+='
},
layout: 'custom',
customLayout: {
'default': [
'q w e r t y u i o p {bksp}',
'a s d f g h j k l {enter}',
'{s} z x c v b n m , . {s}',
'{meta1} {space} {meta1} {accept}'
],
'shift': [
'Q W E R T Y U I O P {bksp}',
'A S D F G H J K L {enter}',
'{s} Z X C V B N M ! ? {s}',
'{meta1} {space} {meta1} {accept}'
],
'meta1': [
'1 2 3 4 5 6 7 8 9 0 {bksp}',
'- / : ; ( ) \u20ac & @ {enter}',
'{meta2} . , ? ! \' " {meta2}',
'{default} {space} {default} {accept}'
],
'meta2': [
'[ ] { } # % ^ * + = {bksp}',
'_ \\ | ~ < > $ \u00a3 \u00a5 {enter}',
'{meta1} . , ? ! \' " {meta1}',
'{default} {space} {default} {accept}'
]
}
});</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: iPad email</span>
</h2>
<textarea id="ipad-email"></textarea>
<br>
<small>
* Thanks to <a class="external" href="//github.com/gitaarik">gitaarik</a> for sharing!.
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><textarea id="ipad-email"></textarea></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#ipad-email').keyboard({
display: {
'bksp' : '\u2190',
'enter' : 'return',
'default': 'ABC',
'meta1' : '.?123',
'meta2' : '#+=',
'accept' : '\u21d3'
},
layout: 'custom',
customLayout: {
'default': [
'q w e r t y u i o p {bksp}',
'a s d f g h j k l {enter}',
'{s} z x c v b n m @ . {s}',
'{meta1} {space} _ - {accept}'
],
'shift': [
'Q W E R T Y U I O P {bksp}',
'A S D F G H J K L {enter}',
'{s} Z X C V B N M @ . {s}',
'{meta1} {space} _ - {accept}'
],
'meta1': [
'1 2 3 4 5 6 7 8 9 0 {bksp}',
'` | { } % ^ * / \' {enter}',
'{meta2} $ & ~ # = + . {meta2}',
'{default} {space} ! ? {accept}'
],
'meta2': [
'[ ] { } \u2039 \u203a ^ * " , {bksp}',
'\\ | / < > $ \u00a3 \u00a5 \u2022 {enter}',
'{meta1} \u20ac & ~ # = + . {meta1}',
'{default} {space} ! ? {accept}'
]
}
});</pre>
</div>
</div>
<div class="block">
<h2>
<span class="tooltip-tipsy" title="Click, then scroll down to see this code">Custom: Lockable</span>
</h2>
<input id="lockable" type="text">
<br>
<small>
* cursor arrow keys.<br>
* keyboard enable/disable toggle.<br>
* include {del} key (opposite of {bksp})
</small>
<div class="code ui-corner-all">
<h4>HTML</h4>
<pre class="prettyprint lang-html"><input id="lockable" type="text"></pre>
<h4>Script</h4>
<pre class="prettyprint lang-js">$('#lockable').keyboard({
layout: 'custom',
customLayout: {
'normal': [
'` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
'{tab} q w e r t y u i o p [ ] \\',
'a s d f g h j k l ; \' {enter}',
'{shift} z x c v b n m , . / {shift}',
'{accept} {space} {left} {right} {sp:.2} {del} {toggle}'
],
'shift': [
'~ ! @ # $ % ^ & * ( ) _ + {bksp}',
'{tab} Q W E R T Y U I O P { } |',
'A S D F G H J K L : " {enter}',
'{shift} Z X C V B N M < > ? {shift}',
'{accept} {space} {left} {right} {sp:.2} {del} {toggle}'
]
},
css: {
// add dark themed class to keyboard popup
// to use bright svg padlock icon
popup : 'ui-keyboard-dark-theme'
}
})
.addTyping();</pre>
</div>
</div>
<div id="showcode"></div>
<div id="footer"></div>
</div>
</body></html>