anatomy 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.md +201 -0
- data/bin/anatomy +5 -0
- data/lib/anatomy/atomy.ay +202 -0
- data/lib/anatomy/base.ay +151 -0
- data/lib/anatomy/cmd.ay +60 -0
- data/lib/anatomy/data.ay +147 -0
- data/lib/anatomy/html.ay +73 -0
- data/lib/anatomy/language/parser.ay +130 -0
- data/lib/anatomy/processor.ay +35 -0
- data/lib/anatomy/renderers/html.ay +306 -0
- data/lib/anatomy/ruby.ay +178 -0
- data/lib/anatomy/server.ay +80 -0
- data/lib/anatomy/slides.ay +48 -0
- data/lib/anatomy/stages/collect.ay +35 -0
- data/lib/anatomy/stages/meta.ay +100 -0
- data/lib/anatomy/stages/resolve.ay +55 -0
- data/lib/anatomy/stages/traverse.ay +34 -0
- data/lib/anatomy.ay +4 -0
- data/public/anatomy.css +427 -0
- data/public/highlight.css +60 -0
- data/public/jquery.hotkeys.js +99 -0
- data/public/jquery.js +16 -0
- data/public/main.js +237 -0
- metadata +110 -0
data/public/anatomy.css
ADDED
@@ -0,0 +1,427 @@
|
|
1
|
+
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td { margin: 0; padding: 0; }
|
2
|
+
table { border-collapse: collapse; border-spacing: 0; }
|
3
|
+
fieldset,img { border: 0; }
|
4
|
+
address,caption,cite,code,dfn,th,var { font-style: normal; font-weight: normal; }
|
5
|
+
li { list-style: none; }
|
6
|
+
caption,th { text-align: left; }
|
7
|
+
h1,h2,h3,h4,h5,h6 { font-size: 100%; font-weight: normal; }
|
8
|
+
abbr,acronym { border: 0; font-variant: normal; }
|
9
|
+
input,textarea,select { font-family: inherit; font-size: inherit; font-weight: inherit; }
|
10
|
+
a { text-decoration: none; color: inherit; }
|
11
|
+
|
12
|
+
html {
|
13
|
+
background-color: #f5f5f5;
|
14
|
+
color: #151515;
|
15
|
+
}
|
16
|
+
|
17
|
+
body {
|
18
|
+
font-family: Palatino, 'Palatino Linotype', 'Palatino LT STD', 'Book Antiqua', Georgia, serif;
|
19
|
+
}
|
20
|
+
|
21
|
+
code {
|
22
|
+
font-size: 14px;
|
23
|
+
background: #e0e0e0;
|
24
|
+
padding: 2px 5px;
|
25
|
+
border-radius: 5px;
|
26
|
+
}
|
27
|
+
|
28
|
+
h1 code, h2 code, h3 code { font-size: 1em; }
|
29
|
+
|
30
|
+
a:link {
|
31
|
+
text-decoration: none;
|
32
|
+
color: #6a9fb5;
|
33
|
+
}
|
34
|
+
a:visited {
|
35
|
+
color: #aa759f;
|
36
|
+
}
|
37
|
+
a:hover {
|
38
|
+
text-decoration: underline;
|
39
|
+
}
|
40
|
+
|
41
|
+
ol, ul {
|
42
|
+
margin-left: 2em;
|
43
|
+
}
|
44
|
+
ol li {
|
45
|
+
list-style: decimal;
|
46
|
+
}
|
47
|
+
ul li {
|
48
|
+
list-style: disc;
|
49
|
+
}
|
50
|
+
|
51
|
+
strong { font-weight: bold }
|
52
|
+
em { font-style: italic }
|
53
|
+
|
54
|
+
h1 {
|
55
|
+
font-size: 23px;
|
56
|
+
font-weight: 500;
|
57
|
+
line-height: 23px;
|
58
|
+
}
|
59
|
+
|
60
|
+
h2 {
|
61
|
+
font-size: 20px;
|
62
|
+
font-weight: 500;
|
63
|
+
line-height: 20px;
|
64
|
+
border-bottom: 1px dotted #bbb;
|
65
|
+
padding-bottom: .25em;
|
66
|
+
margin-bottom: .75em;
|
67
|
+
}
|
68
|
+
|
69
|
+
h3 {
|
70
|
+
font-size: 17px;
|
71
|
+
font-weight: 500;
|
72
|
+
line-height: 23px;
|
73
|
+
}
|
74
|
+
|
75
|
+
p {
|
76
|
+
margin: 1em 0;
|
77
|
+
font-size: 16px;
|
78
|
+
font-weight: 400;
|
79
|
+
line-height: 24px;
|
80
|
+
}
|
81
|
+
|
82
|
+
pre {
|
83
|
+
font-size: 14px;
|
84
|
+
font-weight: 400;
|
85
|
+
line-height: 24px;
|
86
|
+
}
|
87
|
+
|
88
|
+
blockquote {
|
89
|
+
font-size: 17px;
|
90
|
+
font-weight: 400;
|
91
|
+
line-height: 23px;
|
92
|
+
}
|
93
|
+
|
94
|
+
.section img {
|
95
|
+
max-width: 100%;
|
96
|
+
}
|
97
|
+
|
98
|
+
.toc {
|
99
|
+
margin-bottom: 2em;
|
100
|
+
line-height: 1.4em;
|
101
|
+
}
|
102
|
+
#table_of_contents {
|
103
|
+
font-size: 1.1em;
|
104
|
+
}
|
105
|
+
#table_of_contents > li {
|
106
|
+
margin-bottom: 1em;
|
107
|
+
}
|
108
|
+
#table_of_contents > li > a {
|
109
|
+
font-weight: bold;
|
110
|
+
}
|
111
|
+
.toc p {
|
112
|
+
padding: 0;
|
113
|
+
}
|
114
|
+
|
115
|
+
dd {
|
116
|
+
margin: 0 0 1em 2em;
|
117
|
+
}
|
118
|
+
|
119
|
+
#main {
|
120
|
+
width: 700px;
|
121
|
+
margin-left: 220px;
|
122
|
+
}
|
123
|
+
|
124
|
+
#content {
|
125
|
+
padding: 32px 0;
|
126
|
+
}
|
127
|
+
|
128
|
+
#sidebar {
|
129
|
+
color: #777;
|
130
|
+
padding: 32px;
|
131
|
+
width: 136px;
|
132
|
+
height: 100%;
|
133
|
+
overflow: auto;
|
134
|
+
position: fixed;
|
135
|
+
left: 0;
|
136
|
+
top: 0;
|
137
|
+
bottom: 0;
|
138
|
+
}
|
139
|
+
.search {
|
140
|
+
width: 200px;
|
141
|
+
position: fixed;
|
142
|
+
top: 2em;
|
143
|
+
right: 2em;
|
144
|
+
opacity: .5;
|
145
|
+
}
|
146
|
+
div.search:hover {
|
147
|
+
opacity: 1;
|
148
|
+
}
|
149
|
+
.search #search {
|
150
|
+
width: 186px;
|
151
|
+
padding: 5px;
|
152
|
+
border: 2px solid #eee;
|
153
|
+
}
|
154
|
+
.search .search_results {
|
155
|
+
margin: 0;
|
156
|
+
border: 2px solid #eee;
|
157
|
+
border-top: 0;
|
158
|
+
display: none;
|
159
|
+
background: #fff;
|
160
|
+
}
|
161
|
+
.search .search_results li {
|
162
|
+
list-style: none;
|
163
|
+
padding: 5px;
|
164
|
+
}
|
165
|
+
.search .search_results .parent {
|
166
|
+
font-size: 12px;
|
167
|
+
font-style: italic;
|
168
|
+
color: #555;
|
169
|
+
}
|
170
|
+
.search .search_results .parent a {
|
171
|
+
color: #222;
|
172
|
+
}
|
173
|
+
.search .search_results .tag {
|
174
|
+
font-style: italic;
|
175
|
+
color: #555;
|
176
|
+
}
|
177
|
+
#sidebar h4 {
|
178
|
+
font-style: italic;
|
179
|
+
}
|
180
|
+
#sidebar .toc {
|
181
|
+
margin-left: 1em;
|
182
|
+
font-size: 0.9em;
|
183
|
+
}
|
184
|
+
#sidebar .toc .toggle {
|
185
|
+
margin-left: .5em;
|
186
|
+
font-size: 10px;
|
187
|
+
cursor: pointer;
|
188
|
+
color: #777;
|
189
|
+
}
|
190
|
+
#sidebar .toc ol {
|
191
|
+
margin: 0 0 0 1em;
|
192
|
+
}
|
193
|
+
|
194
|
+
.section .section {
|
195
|
+
margin: 1em 0;
|
196
|
+
padding: 1em 0;
|
197
|
+
border-bottom: .1em dotted #000;
|
198
|
+
}
|
199
|
+
.section .section .section {
|
200
|
+
margin: 0;
|
201
|
+
border: none;
|
202
|
+
}
|
203
|
+
|
204
|
+
.definition {
|
205
|
+
margin: 2em 0;
|
206
|
+
padding: 2em 0 0;
|
207
|
+
border-top: .1em dotted #ddd;
|
208
|
+
}
|
209
|
+
.definition .thumb pre {
|
210
|
+
background: #e0e0e0;
|
211
|
+
padding: .6em .75em;
|
212
|
+
margin-bottom: 1em;
|
213
|
+
}
|
214
|
+
.definition.macro .thumb pre {
|
215
|
+
/* same as unquote background */
|
216
|
+
background: #fff0f0;
|
217
|
+
}
|
218
|
+
|
219
|
+
.verbatim, .interaction, .highlight {
|
220
|
+
margin: 0 1em 1em;
|
221
|
+
}
|
222
|
+
|
223
|
+
.interaction pre {
|
224
|
+
overflow-x: auto;
|
225
|
+
}
|
226
|
+
|
227
|
+
pre a:link,
|
228
|
+
pre a:visited,
|
229
|
+
code a:link,
|
230
|
+
code a:visited {
|
231
|
+
color: inherit;
|
232
|
+
text-decoration: none;
|
233
|
+
border-bottom: .1em solid #ddd;
|
234
|
+
}
|
235
|
+
pre a:hover,
|
236
|
+
code a:hover {
|
237
|
+
border-bottom-color: #333;
|
238
|
+
}
|
239
|
+
|
240
|
+
blockquote {
|
241
|
+
margin-left: 2em;
|
242
|
+
}
|
243
|
+
|
244
|
+
table p {
|
245
|
+
margin: .5em 0;
|
246
|
+
}
|
247
|
+
table th, table td {
|
248
|
+
padding: 0 .5em;
|
249
|
+
}
|
250
|
+
|
251
|
+
.margin_note {
|
252
|
+
width: 13em;
|
253
|
+
float: right;
|
254
|
+
margin-top: -1.5em;
|
255
|
+
margin-right: -15em;
|
256
|
+
padding: .5em;
|
257
|
+
color: #777;
|
258
|
+
}
|
259
|
+
|
260
|
+
.centered {
|
261
|
+
text-align: center;
|
262
|
+
}
|
263
|
+
.smaller {
|
264
|
+
font-size: 82%;
|
265
|
+
}
|
266
|
+
.larger {
|
267
|
+
font-size: 122%;
|
268
|
+
}
|
269
|
+
|
270
|
+
.interaction .error:before {
|
271
|
+
content: "error: ";
|
272
|
+
}
|
273
|
+
.interaction .error {
|
274
|
+
font-style: italic;
|
275
|
+
color: red;
|
276
|
+
}
|
277
|
+
.interaction .caret {
|
278
|
+
font-weight: bold;
|
279
|
+
color: #999;
|
280
|
+
}
|
281
|
+
|
282
|
+
.error_output {
|
283
|
+
display: block;
|
284
|
+
font-style: italic;
|
285
|
+
background: #fee;
|
286
|
+
color: #a33;
|
287
|
+
}
|
288
|
+
|
289
|
+
.annotated #content {
|
290
|
+
position: static;
|
291
|
+
padding: 0;
|
292
|
+
}
|
293
|
+
.annotated #sidebar {
|
294
|
+
z-index: 1;
|
295
|
+
background: rgba(255, 255, 255, .5);
|
296
|
+
}
|
297
|
+
.annotated_source {
|
298
|
+
width: 100%;
|
299
|
+
}
|
300
|
+
.annotated_source thead h1 {
|
301
|
+
line-height: 1em;
|
302
|
+
margin: 1.2em 0 .39em 0;
|
303
|
+
font-weight: bold;
|
304
|
+
}
|
305
|
+
.annotated_source .prose {
|
306
|
+
background: #fff;
|
307
|
+
width: 30em;
|
308
|
+
max-width: 30em;
|
309
|
+
min-width: 30em;
|
310
|
+
padding: 1em 2em 0 3.5em;
|
311
|
+
overflow-x: auto;
|
312
|
+
vertical-align: top;
|
313
|
+
text-align: left;
|
314
|
+
}
|
315
|
+
.annotated_source .prose code,
|
316
|
+
.annotated_source .prose pre {
|
317
|
+
background: #f8f8ff;
|
318
|
+
border: .1em solid #dedede;
|
319
|
+
padding: 0 0.2em;
|
320
|
+
overflow-x: auto;
|
321
|
+
}
|
322
|
+
.annotated_source .code {
|
323
|
+
background: #f5f5ff;
|
324
|
+
border-left: .1em solid #e5e5e5;
|
325
|
+
padding: 1.1em 2em 0em 1.5em;
|
326
|
+
vertical-align: top;
|
327
|
+
}
|
328
|
+
|
329
|
+
.slides {
|
330
|
+
overflow: hidden;
|
331
|
+
background: #f0f0f0;
|
332
|
+
}
|
333
|
+
.slides #main {
|
334
|
+
margin: 0;
|
335
|
+
padding: 0;
|
336
|
+
position: relative;
|
337
|
+
background: #f0f0f0;
|
338
|
+
height: 100%;
|
339
|
+
width: auto;
|
340
|
+
overflow: hidden;
|
341
|
+
}
|
342
|
+
.slides > .search {
|
343
|
+
display: none;
|
344
|
+
}
|
345
|
+
.slides #content .section > .section_header {
|
346
|
+
display: none;
|
347
|
+
}
|
348
|
+
.slides #content .section > p {
|
349
|
+
display: none;
|
350
|
+
}
|
351
|
+
.slides #sidebar {
|
352
|
+
display: none;
|
353
|
+
}
|
354
|
+
.slide {
|
355
|
+
width: 824px;
|
356
|
+
height: 568px;
|
357
|
+
margin: 0 auto;
|
358
|
+
padding: 100px;
|
359
|
+
border: 0;
|
360
|
+
position: absolute;
|
361
|
+
left: 50%;
|
362
|
+
top: 50%;
|
363
|
+
margin: -384px 0 0 -512px;
|
364
|
+
background: #fff;
|
365
|
+
}
|
366
|
+
.slide h2 {
|
367
|
+
font-size: 5em;
|
368
|
+
line-height: 1em;
|
369
|
+
text-align: center;
|
370
|
+
margin: 0 0 1em;
|
371
|
+
}
|
372
|
+
.slide h2 .continue {
|
373
|
+
font-size: .5em;
|
374
|
+
color: #bbb;
|
375
|
+
position: absolute;
|
376
|
+
top: -3.75em;
|
377
|
+
right: 1em;
|
378
|
+
}
|
379
|
+
.slide p {
|
380
|
+
font-size: 2em;
|
381
|
+
line-height: 1.4em;
|
382
|
+
}
|
383
|
+
.slide .body pre,
|
384
|
+
.slide .body code {
|
385
|
+
font-size: 24px;
|
386
|
+
line-height: 1.4em;
|
387
|
+
}
|
388
|
+
.slide .body > ul {
|
389
|
+
margin-bottom: 1em;
|
390
|
+
}
|
391
|
+
.slide ul li {
|
392
|
+
list-style: disc;
|
393
|
+
font-size: 30px;
|
394
|
+
}
|
395
|
+
.slide li p {
|
396
|
+
font-size: 1em;
|
397
|
+
margin: 0;
|
398
|
+
padding-bottom: .5em;
|
399
|
+
}
|
400
|
+
.slide.title,
|
401
|
+
.slide.title_only {
|
402
|
+
display: table;
|
403
|
+
width: 1024px;
|
404
|
+
height: 768px;
|
405
|
+
padding: 0;
|
406
|
+
}
|
407
|
+
.slide.title .body,
|
408
|
+
.slide.title_only h1 {
|
409
|
+
display: table-cell;
|
410
|
+
vertical-align: middle;
|
411
|
+
}
|
412
|
+
.slide.title h1 {
|
413
|
+
text-align: center;
|
414
|
+
font-size: 5em;
|
415
|
+
margin-bottom: 0;
|
416
|
+
}
|
417
|
+
.slide.title p {
|
418
|
+
width: 512px;
|
419
|
+
margin: 0 auto;
|
420
|
+
line-height: 1.4em;
|
421
|
+
text-align: center;
|
422
|
+
padding-bottom: 1em;
|
423
|
+
}
|
424
|
+
.slide.title_only h1 {
|
425
|
+
text-align: center;
|
426
|
+
font-size: 5em;
|
427
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
.hll { background-color: #ffffcc }
|
2
|
+
.c { color: #888888 } /* Comment */
|
3
|
+
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
4
|
+
.k { color: #008800; font-weight: bold } /* Keyword */
|
5
|
+
.cm { color: #888888 } /* Comment.Multiline */
|
6
|
+
.cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
|
7
|
+
.c1 { color: #888888 } /* Comment.Single */
|
8
|
+
.cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
|
9
|
+
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
10
|
+
.ge { font-style: italic } /* Generic.Emph */
|
11
|
+
.gr { color: #aa0000 } /* Generic.Error */
|
12
|
+
.gh { color: #303030 } /* Generic.Heading */
|
13
|
+
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
14
|
+
.go { color: #888888 } /* Generic.Output */
|
15
|
+
.gp { color: #555555 } /* Generic.Prompt */
|
16
|
+
.gs { font-weight: bold } /* Generic.Strong */
|
17
|
+
.gu { color: #606060 } /* Generic.Subheading */
|
18
|
+
.gt { color: #aa0000 } /* Generic.Traceback */
|
19
|
+
.kc { color: #008800; font-weight: bold } /* Keyword.Constant */
|
20
|
+
.kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
|
21
|
+
.kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
|
22
|
+
.kp { color: #008800 } /* Keyword.Pseudo */
|
23
|
+
.kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
|
24
|
+
.kt { color: #888888; font-weight: bold } /* Keyword.Type */
|
25
|
+
.m { color: #0000DD; font-weight: bold } /* Literal.Number */
|
26
|
+
.s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
|
27
|
+
.na { color: #336699 } /* Name.Attribute */
|
28
|
+
.nb { color: #003388 } /* Name.Builtin */
|
29
|
+
.nc { color: #bb0066; font-weight: bold } /* Name.Class */
|
30
|
+
.no { color: #003366; font-weight: bold } /* Name.Constant */
|
31
|
+
.nd { color: #555555 } /* Name.Decorator */
|
32
|
+
.ne { color: #bb0066; font-weight: bold } /* Name.Exception */
|
33
|
+
.nf { color: #0066bb; font-weight: bold } /* Name.Function */
|
34
|
+
.nl { color: #336699; font-style: italic } /* Name.Label */
|
35
|
+
.nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
|
36
|
+
.py { color: #336699; font-weight: bold } /* Name.Property */
|
37
|
+
.nt { color: #bb0066; font-weight: bold } /* Name.Tag */
|
38
|
+
.nv { color: #336699 } /* Name.Variable */
|
39
|
+
.ow { color: #008800 } /* Operator.Word */
|
40
|
+
.w { color: #bbbbbb } /* Text.Whitespace */
|
41
|
+
.mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
|
42
|
+
.mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
|
43
|
+
.mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
|
44
|
+
.mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
|
45
|
+
.sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
|
46
|
+
.sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
|
47
|
+
.sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
|
48
|
+
.s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
|
49
|
+
.se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
|
50
|
+
.sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
|
51
|
+
.si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
|
52
|
+
.sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
|
53
|
+
.sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
|
54
|
+
.s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
|
55
|
+
.ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
|
56
|
+
.bp { color: #003388 } /* Name.Builtin.Pseudo */
|
57
|
+
.vc { color: #336699 } /* Name.Variable.Class */
|
58
|
+
.vg { color: #dd7700 } /* Name.Variable.Global */
|
59
|
+
.vi { color: #3333bb } /* Name.Variable.Instance */
|
60
|
+
.il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Hotkeys Plugin
|
3
|
+
* Copyright 2010, John Resig
|
4
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
5
|
+
*
|
6
|
+
* Based upon the plugin by Tzury Bar Yochay:
|
7
|
+
* http://github.com/tzuryby/hotkeys
|
8
|
+
*
|
9
|
+
* Original idea by:
|
10
|
+
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
11
|
+
*/
|
12
|
+
|
13
|
+
(function(jQuery){
|
14
|
+
|
15
|
+
jQuery.hotkeys = {
|
16
|
+
version: "0.8",
|
17
|
+
|
18
|
+
specialKeys: {
|
19
|
+
8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
|
20
|
+
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
|
21
|
+
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
|
22
|
+
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
|
23
|
+
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
|
24
|
+
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
|
25
|
+
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
|
26
|
+
},
|
27
|
+
|
28
|
+
shiftNums: {
|
29
|
+
"`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
|
30
|
+
"8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
|
31
|
+
".": ">", "/": "?", "\\": "|"
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
function keyHandler( handleObj ) {
|
36
|
+
// Only care when a possible input has been specified
|
37
|
+
if ( typeof handleObj.data !== "string" ) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
|
41
|
+
var origHandler = handleObj.handler,
|
42
|
+
keys = handleObj.data.toLowerCase().split(" ");
|
43
|
+
|
44
|
+
handleObj.handler = function( event ) {
|
45
|
+
// Don't fire in text-accepting inputs that we didn't directly bind to
|
46
|
+
if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
|
47
|
+
event.target.type === "text") ) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
|
51
|
+
// Keypress represents characters, not special keys
|
52
|
+
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
|
53
|
+
character = String.fromCharCode( event.which ).toLowerCase(),
|
54
|
+
key, modif = "", possible = {};
|
55
|
+
|
56
|
+
// check combinations (alt|ctrl|shift+anything)
|
57
|
+
if ( event.altKey && special !== "alt" ) {
|
58
|
+
modif += "alt+";
|
59
|
+
}
|
60
|
+
|
61
|
+
if ( event.ctrlKey && special !== "ctrl" ) {
|
62
|
+
modif += "ctrl+";
|
63
|
+
}
|
64
|
+
|
65
|
+
// TODO: Need to make sure this works consistently across platforms
|
66
|
+
if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
|
67
|
+
modif += "meta+";
|
68
|
+
}
|
69
|
+
|
70
|
+
if ( event.shiftKey && special !== "shift" ) {
|
71
|
+
modif += "shift+";
|
72
|
+
}
|
73
|
+
|
74
|
+
if ( special ) {
|
75
|
+
possible[ modif + special ] = true;
|
76
|
+
|
77
|
+
} else {
|
78
|
+
possible[ modif + character ] = true;
|
79
|
+
possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
|
80
|
+
|
81
|
+
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
82
|
+
if ( modif === "shift+" ) {
|
83
|
+
possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
for ( var i = 0, l = keys.length; i < l; i++ ) {
|
88
|
+
if ( possible[ keys[i] ] ) {
|
89
|
+
return origHandler.apply( this, arguments );
|
90
|
+
}
|
91
|
+
}
|
92
|
+
};
|
93
|
+
}
|
94
|
+
|
95
|
+
jQuery.each([ "keydown", "keyup", "keypress" ], function() {
|
96
|
+
jQuery.event.special[ this ] = { add: keyHandler };
|
97
|
+
});
|
98
|
+
|
99
|
+
})( jQuery );
|