keydown 0.7.1 → 0.9.0

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.
Files changed (137) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +3 -0
  3. data/LICENSE +1 -1
  4. data/README.md +16 -15
  5. data/VERSION +1 -1
  6. data/keydown.gemspec +9 -6
  7. data/lib/keydown.rb +9 -22
  8. data/lib/keydown/html_helpers.rb +12 -0
  9. data/lib/keydown/{lib/slide.rb → slide.rb} +16 -19
  10. data/lib/keydown/{lib/slidedeck.rb → slidedeck.rb} +20 -5
  11. data/lib/keydown/tasks.rb +5 -0
  12. data/lib/keydown/tasks/base.rb +15 -0
  13. data/lib/keydown/tasks/generate.rb +5 -1
  14. data/lib/keydown/tasks/slides.rb +1 -1
  15. data/lib/version.rb +1 -1
  16. data/spec/lib/html_helpers_spec.rb +26 -0
  17. data/spec/lib/slide_spec.rb +29 -17
  18. data/spec/lib/slidedeck_spec.rb +41 -13
  19. data/spec/spec_helper.rb +2 -6
  20. data/spec/tasks/generate_spec.rb +41 -20
  21. data/spec/tasks/slides_spec.rb +83 -44
  22. data/templates/deck.js/code.html.haml +1 -0
  23. data/templates/deck.js/index.html.haml +54 -0
  24. data/templates/deck.js/slide.html.haml +6 -0
  25. data/templates/generate/css/%presentation_name%.css +12 -1
  26. data/templates/generate/deck.js/core/deck.core.css +394 -0
  27. data/templates/generate/deck.js/core/deck.core.js +461 -0
  28. data/templates/generate/deck.js/core/deck.core.scss +432 -0
  29. data/templates/generate/deck.js/extensions/codemirror/CONTRIBUTORS.txt +2 -0
  30. data/templates/generate/deck.js/extensions/codemirror/MIT-LICENSE.txt +21 -0
  31. data/templates/generate/deck.js/extensions/codemirror/README.md +120 -0
  32. data/templates/generate/deck.js/extensions/codemirror/VERSION.txt +1 -0
  33. data/templates/generate/deck.js/extensions/codemirror/codemirror.js +21 -0
  34. data/templates/generate/deck.js/extensions/codemirror/deck.codemirror.css +89 -0
  35. data/templates/generate/deck.js/extensions/codemirror/deck.codemirror.js +213 -0
  36. data/templates/generate/deck.js/extensions/codemirror/deck.codemirror.scss +107 -0
  37. data/templates/generate/deck.js/extensions/codemirror/mode/clike/clike.js +247 -0
  38. data/templates/generate/deck.js/extensions/codemirror/mode/clike/index.html +102 -0
  39. data/templates/generate/deck.js/extensions/codemirror/mode/clojure/clojure.js +207 -0
  40. data/templates/generate/deck.js/extensions/codemirror/mode/clojure/index.html +85 -0
  41. data/templates/generate/deck.js/extensions/codemirror/mode/coffeescript/LICENSE +22 -0
  42. data/templates/generate/deck.js/extensions/codemirror/mode/coffeescript/coffeescript.js +325 -0
  43. data/templates/generate/deck.js/extensions/codemirror/mode/coffeescript/index.html +722 -0
  44. data/templates/generate/deck.js/extensions/codemirror/mode/css/css.js +124 -0
  45. data/templates/generate/deck.js/extensions/codemirror/mode/css/index.html +56 -0
  46. data/templates/generate/deck.js/extensions/codemirror/mode/diff/diff.css +3 -0
  47. data/templates/generate/deck.js/extensions/codemirror/mode/diff/diff.js +13 -0
  48. data/templates/generate/deck.js/extensions/codemirror/mode/diff/index.html +99 -0
  49. data/templates/generate/deck.js/extensions/codemirror/mode/haskell/haskell.js +242 -0
  50. data/templates/generate/deck.js/extensions/codemirror/mode/haskell/index.html +60 -0
  51. data/templates/generate/deck.js/extensions/codemirror/mode/htmlmixed/htmlmixed.js +79 -0
  52. data/templates/generate/deck.js/extensions/codemirror/mode/htmlmixed/index.html +52 -0
  53. data/templates/generate/deck.js/extensions/codemirror/mode/javascript/index.html +78 -0
  54. data/templates/generate/deck.js/extensions/codemirror/mode/javascript/javascript.js +348 -0
  55. data/templates/generate/deck.js/extensions/codemirror/mode/lua/index.html +72 -0
  56. data/templates/generate/deck.js/extensions/codemirror/mode/lua/lua.js +138 -0
  57. data/templates/generate/deck.js/extensions/codemirror/mode/php/index.html +49 -0
  58. data/templates/generate/deck.js/extensions/codemirror/mode/php/php.js +115 -0
  59. data/templates/generate/deck.js/extensions/codemirror/mode/plsql/index.html +63 -0
  60. data/templates/generate/deck.js/extensions/codemirror/mode/plsql/plsql.js +217 -0
  61. data/templates/generate/deck.js/extensions/codemirror/mode/python/LICENSE.txt +21 -0
  62. data/templates/generate/deck.js/extensions/codemirror/mode/python/index.html +123 -0
  63. data/templates/generate/deck.js/extensions/codemirror/mode/python/python.js +321 -0
  64. data/templates/generate/deck.js/extensions/codemirror/mode/r/LICENSE +24 -0
  65. data/templates/generate/deck.js/extensions/codemirror/mode/r/index.html +74 -0
  66. data/templates/generate/deck.js/extensions/codemirror/mode/r/r.js +141 -0
  67. data/templates/generate/deck.js/extensions/codemirror/mode/rst/index.html +526 -0
  68. data/templates/generate/deck.js/extensions/codemirror/mode/rst/rst.css +75 -0
  69. data/templates/generate/deck.js/extensions/codemirror/mode/rst/rst.js +333 -0
  70. data/templates/generate/deck.js/extensions/codemirror/mode/ruby/LICENSE +24 -0
  71. data/templates/generate/deck.js/extensions/codemirror/mode/ruby/index.html +172 -0
  72. data/templates/generate/deck.js/extensions/codemirror/mode/ruby/ruby.js +195 -0
  73. data/templates/generate/deck.js/extensions/codemirror/mode/scheme/index.html +65 -0
  74. data/templates/generate/deck.js/extensions/codemirror/mode/scheme/scheme.js +202 -0
  75. data/templates/generate/deck.js/extensions/codemirror/mode/smalltalk/index.html +56 -0
  76. data/templates/generate/deck.js/extensions/codemirror/mode/smalltalk/smalltalk.js +122 -0
  77. data/templates/generate/deck.js/extensions/codemirror/mode/sparql/index.html +41 -0
  78. data/templates/generate/deck.js/extensions/codemirror/mode/sparql/sparql.js +143 -0
  79. data/templates/generate/deck.js/extensions/codemirror/mode/stex/index.html +96 -0
  80. data/templates/generate/deck.js/extensions/codemirror/mode/stex/stex.js +167 -0
  81. data/templates/generate/deck.js/extensions/codemirror/mode/velocity/index.html +103 -0
  82. data/templates/generate/deck.js/extensions/codemirror/mode/velocity/velocity.js +146 -0
  83. data/templates/generate/deck.js/extensions/codemirror/mode/xml/index.html +42 -0
  84. data/templates/generate/deck.js/extensions/codemirror/mode/xml/xml.js +231 -0
  85. data/templates/generate/deck.js/extensions/codemirror/mode/xmlpure/index.html +60 -0
  86. data/templates/generate/deck.js/extensions/codemirror/mode/xmlpure/xmlpure.js +481 -0
  87. data/templates/generate/deck.js/extensions/codemirror/mode/yaml/index.html +68 -0
  88. data/templates/generate/deck.js/extensions/codemirror/mode/yaml/yaml.js +95 -0
  89. data/templates/generate/deck.js/extensions/codemirror/themes/cobalt.css +17 -0
  90. data/templates/generate/deck.js/extensions/codemirror/themes/default.css +19 -0
  91. data/templates/generate/deck.js/extensions/codemirror/themes/elegant.css +9 -0
  92. data/templates/generate/deck.js/extensions/codemirror/themes/neat.css +8 -0
  93. data/templates/generate/deck.js/extensions/codemirror/themes/night.css +20 -0
  94. data/templates/generate/deck.js/extensions/goto/deck.goto.css +41 -0
  95. data/templates/generate/deck.js/extensions/goto/deck.goto.html +6 -0
  96. data/templates/generate/deck.js/extensions/goto/deck.goto.js +118 -0
  97. data/templates/generate/deck.js/extensions/goto/deck.goto.scss +46 -0
  98. data/templates/generate/deck.js/extensions/hash/deck.hash.css +13 -0
  99. data/templates/generate/deck.js/extensions/hash/deck.hash.html +2 -0
  100. data/templates/generate/deck.js/extensions/hash/deck.hash.js +125 -0
  101. data/templates/generate/deck.js/extensions/hash/deck.hash.scss +15 -0
  102. data/templates/generate/deck.js/extensions/menu/deck.menu.css +24 -0
  103. data/templates/generate/deck.js/extensions/menu/deck.menu.js +127 -0
  104. data/templates/generate/deck.js/extensions/menu/deck.menu.scss +29 -0
  105. data/templates/generate/deck.js/extensions/navigation/deck.navigation.css +43 -0
  106. data/templates/generate/deck.js/extensions/navigation/deck.navigation.html +3 -0
  107. data/templates/generate/deck.js/extensions/navigation/deck.navigation.js +83 -0
  108. data/templates/generate/deck.js/extensions/navigation/deck.navigation.scss +56 -0
  109. data/templates/generate/deck.js/extensions/scale/deck.scale.css +16 -0
  110. data/templates/generate/deck.js/extensions/scale/deck.scale.js +155 -0
  111. data/templates/generate/deck.js/extensions/scale/deck.scale.scss +17 -0
  112. data/templates/generate/deck.js/extensions/status/deck.status.css +14 -0
  113. data/templates/generate/deck.js/extensions/status/deck.status.html +6 -0
  114. data/templates/generate/deck.js/extensions/status/deck.status.js +42 -0
  115. data/templates/generate/deck.js/extensions/status/deck.status.scss +16 -0
  116. data/templates/generate/deck.js/support/jquery.1.6.4.min.js +4 -0
  117. data/templates/generate/deck.js/support/modernizr.custom.js +4 -0
  118. data/templates/generate/deck.js/themes/style/neon.css +114 -0
  119. data/templates/generate/deck.js/themes/style/neon.scss +139 -0
  120. data/templates/generate/deck.js/themes/style/swiss.css +75 -0
  121. data/templates/generate/deck.js/themes/style/swiss.scss +91 -0
  122. data/templates/generate/deck.js/themes/style/web-2.0.css +187 -0
  123. data/templates/generate/deck.js/themes/style/web-2.0.scss +214 -0
  124. data/templates/generate/deck.js/themes/transition/fade.css +44 -0
  125. data/templates/generate/deck.js/themes/transition/fade.scss +70 -0
  126. data/templates/generate/deck.js/themes/transition/horizontal-slide.css +79 -0
  127. data/templates/generate/deck.js/themes/transition/horizontal-slide.scss +94 -0
  128. data/templates/generate/deck.js/themes/transition/vertical-slide.css +97 -0
  129. data/templates/generate/deck.js/themes/transition/vertical-slide.scss +116 -0
  130. data/templates/keydown.css.erb +27 -23
  131. metadata +171 -32
  132. data/Gemfile.lock +0 -41
  133. data/templates/generate/css/rocks.css +0 -392
  134. data/templates/generate/css/syntax_highlighting.css +0 -135
  135. data/templates/generate/js/rocks.js +0 -419
  136. data/templates/rocks/index.rhtml +0 -132
  137. data/templates/rocks/slide.rhtml +0 -10
@@ -0,0 +1,68 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror 2: YAML mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="yaml.js"></script>
8
+ <link rel="stylesheet" href="../../theme/default.css">
9
+ <style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
10
+ <link rel="stylesheet" href="../../css/docs.css">
11
+ </head>
12
+ <body>
13
+ <h1>CodeMirror 2: YAML mode</h1>
14
+ <form><textarea id="code" name="code">
15
+ --- # Favorite movies
16
+ - Casablanca
17
+ - North by Northwest
18
+ - The Man Who Wasn't There
19
+ --- # Shopping list
20
+ [milk, pumpkin pie, eggs, juice]
21
+ --- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs
22
+ name: John Smith
23
+ age: 33
24
+ --- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces
25
+ {name: John Smith, age: 33}
26
+ ---
27
+ receipt: Oz-Ware Purchase Invoice
28
+ date: 2007-08-06
29
+ customer:
30
+ given: Dorothy
31
+ family: Gale
32
+
33
+ items:
34
+ - part_no: A4786
35
+ descrip: Water Bucket (Filled)
36
+ price: 1.47
37
+ quantity: 4
38
+
39
+ - part_no: E1628
40
+ descrip: High Heeled "Ruby" Slippers
41
+ size: 8
42
+ price: 100.27
43
+ quantity: 1
44
+
45
+ bill-to: &id001
46
+ street: |
47
+ 123 Tornado Alley
48
+ Suite 16
49
+ city: East Centerville
50
+ state: KS
51
+
52
+ ship-to: *id001
53
+
54
+ specialDelivery: >
55
+ Follow the Yellow Brick
56
+ Road to the Emerald City.
57
+ Pay no attention to the
58
+ man behind the curtain.
59
+ ...
60
+ </textarea></form>
61
+ <script>
62
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
63
+ </script>
64
+
65
+ <p><strong>MIME types defined:</strong> <code>text/x-yaml</code>.</p>
66
+
67
+ </body>
68
+ </html>
@@ -0,0 +1,95 @@
1
+ CodeMirror.defineMode("yaml", function() {
2
+
3
+ var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
4
+ var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
5
+
6
+ return {
7
+ token: function(stream, state) {
8
+ var ch = stream.peek();
9
+ var esc = state.escaped;
10
+ state.escaped = false;
11
+ /* comments */
12
+ if (ch == "#") { stream.skipToEnd(); return "comment"; }
13
+ if (state.literal && stream.indentation() > state.keyCol) {
14
+ stream.skipToEnd(); return "string";
15
+ } else if (state.literal) { state.literal = false; }
16
+ if (stream.sol()) {
17
+ state.keyCol = 0;
18
+ state.pair = false;
19
+ state.pairStart = false;
20
+ /* document start */
21
+ if(stream.match(/---/)) { return "def"; }
22
+ /* document end */
23
+ if (stream.match(/\.\.\./)) { return "def"; }
24
+ /* array list item */
25
+ if (stream.match(/\s*-\s+/)) { return 'meta'; }
26
+ }
27
+ /* pairs (associative arrays) -> key */
28
+ if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) {
29
+ state.pair = true;
30
+ state.keyCol = stream.indentation();
31
+ return "atom";
32
+ }
33
+ if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
34
+
35
+ /* inline pairs/lists */
36
+ if (stream.match(/^(\{|\}|\[|\])/)) {
37
+ if (ch == '{')
38
+ state.inlinePairs++;
39
+ else if (ch == '}')
40
+ state.inlinePairs--;
41
+ else if (ch == '[')
42
+ state.inlineList++;
43
+ else
44
+ state.inlineList--;
45
+ return 'meta';
46
+ }
47
+
48
+ /* list seperator */
49
+ if (state.inlineList > 0 && !esc && ch == ',') {
50
+ stream.next();
51
+ return 'meta';
52
+ }
53
+ /* pairs seperator */
54
+ if (state.inlinePairs > 0 && !esc && ch == ',') {
55
+ state.keyCol = 0;
56
+ state.pair = false;
57
+ state.pairStart = false;
58
+ stream.next();
59
+ return 'meta';
60
+ }
61
+
62
+ /* start of value of a pair */
63
+ if (state.pairStart) {
64
+ /* block literals */
65
+ if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
66
+ /* references */
67
+ if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
68
+ /* numbers */
69
+ if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
70
+ if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
71
+ /* keywords */
72
+ if (stream.match(keywordRegex)) { return 'keyword'; }
73
+ }
74
+
75
+ /* nothing found, continue */
76
+ state.pairStart = false;
77
+ state.escaped = (ch == '\\');
78
+ stream.next();
79
+ return null;
80
+ },
81
+ startState: function() {
82
+ return {
83
+ pair: false,
84
+ pairStart: false,
85
+ keyCol: 0,
86
+ inlinePairs: 0,
87
+ inlineList: 0,
88
+ literal: false,
89
+ escaped: false
90
+ };
91
+ }
92
+ };
93
+ });
94
+
95
+ CodeMirror.defineMIME("text/x-yaml", "yaml");
@@ -0,0 +1,17 @@
1
+ .cm-s-cobalt { background: #002240; color: white; }
2
+ .cm-s-cobalt span.CodeMirror-selected { background: #b36539 !important; }
3
+ .cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
4
+ .cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
5
+ .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
6
+
7
+ .cm-s-cobalt span.cm-comment { color: #08f; }
8
+ .cm-s-cobalt span.cm-atom { color: #845dc4; }
9
+ .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
10
+ .cm-s-cobalt span.cm-keyword { color: #ffee80; }
11
+ .cm-s-cobalt span.cm-string { color: #3ad900; }
12
+ .cm-s-cobalt span.cm-meta { color: #ff9d00; }
13
+ .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
14
+ .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
15
+ .cm-s-cobalt span.cm-error { color: #9d1e15; }
16
+ .cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
17
+ .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
@@ -0,0 +1,19 @@
1
+ .cm-s-default span.cm-keyword {color: #708;}
2
+ .cm-s-default span.cm-atom {color: #219;}
3
+ .cm-s-default span.cm-number {color: #164;}
4
+ .cm-s-default span.cm-def {color: #00f;}
5
+ .cm-s-default span.cm-variable {color: black;}
6
+ .cm-s-default span.cm-variable-2 {color: #05a;}
7
+ .cm-s-default span.cm-variable-3 {color: #0a5;}
8
+ .cm-s-default span.cm-property {color: black;}
9
+ .cm-s-default span.cm-operator {color: black;}
10
+ .cm-s-default span.cm-comment {color: #a50;}
11
+ .cm-s-default span.cm-string {color: #a11;}
12
+ .cm-s-default span.cm-string-2 {color: #f50;}
13
+ .cm-s-default span.cm-meta {color: #555;}
14
+ .cm-s-default span.cm-error {color: #f00;}
15
+ .cm-s-default span.cm-qualifier {color: #555;}
16
+ .cm-s-default span.cm-builtin {color: #30a;}
17
+ .cm-s-default span.cm-bracket {color: #cc7;}
18
+ .cm-s-default span.cm-tag {color: #170;}
19
+ .cm-s-default span.cm-attribute {color: #00c;}
@@ -0,0 +1,9 @@
1
+ .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
2
+ .cm-s-elegant span.cm-comment {color: #262;font-style: italic;}
3
+ .cm-s-elegant span.cm-meta {color: #555;font-style: italic;}
4
+ .cm-s-elegant span.cm-variable {color: black;}
5
+ .cm-s-elegant span.cm-variable-2 {color: #b11;}
6
+ .cm-s-elegant span.cm-qualifier {color: #555;}
7
+ .cm-s-elegant span.cm-keyword {color: #730;}
8
+ .cm-s-elegant span.cm-builtin {color: #30a;}
9
+ .cm-s-elegant span.cm-error {background-color: #fdd;}
@@ -0,0 +1,8 @@
1
+ .cm-s-neat span.cm-comment { color: #a86; }
2
+ .cm-s-neat span.cm-keyword { font-weight: bold; color: blue; }
3
+ .cm-s-neat span.cm-string { color: #a22; }
4
+ .cm-s-neat span.cm-builtin { font-weight: bold; color: #077; }
5
+ .cm-s-neat span.cm-special { font-weight: bold; color: #0aa; }
6
+ .cm-s-neat span.cm-variable { color: black; }
7
+ .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
8
+ .cm-s-neat span.cm-meta {color: #555;}
@@ -0,0 +1,20 @@
1
+ /* Loosely based on the Midnight Textmate theme */
2
+
3
+ .cm-s-night { background: #0a001f; color: #f8f8f8; }
4
+ .cm-s-night span.CodeMirror-selected { background: #a8f !important; }
5
+ .cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
6
+ .cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
7
+ .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
8
+
9
+ .cm-s-night span.cm-comment { color: #6900a1; }
10
+ .cm-s-night span.cm-atom { color: #845dc4; }
11
+ .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
12
+ .cm-s-night span.cm-keyword { color: #599eff; }
13
+ .cm-s-night span.cm-string { color: #37f14a; }
14
+ .cm-s-night span.cm-meta { color: #7678e2; }
15
+ .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
16
+ .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
17
+ .cm-s-night span.cm-error { color: #9d1e15; }
18
+ .cm-s-night span.cm-bracket { color: #8da6ce; }
19
+ .cm-s-night span.cm-comment { color: #6900a1; }
20
+ .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
@@ -0,0 +1,41 @@
1
+ .deck-container .goto-form {
2
+ position: absolute;
3
+ z-index: 3;
4
+ bottom: 10px;
5
+ left: 50%;
6
+ height: 1.75em;
7
+ margin: 0 0 0 -7.125em;
8
+ line-height: 1.75em;
9
+ padding: 0.625em;
10
+ display: none;
11
+ background: #ccc;
12
+ overflow: hidden;
13
+ }
14
+ .borderradius .deck-container .goto-form {
15
+ -webkit-border-radius: 10px;
16
+ -moz-border-radius: 10px;
17
+ border-radius: 10px;
18
+ }
19
+ .deck-container .goto-form label {
20
+ font-weight: bold;
21
+ }
22
+ .deck-container .goto-form label, .deck-container .goto-form input {
23
+ display: inline-block;
24
+ font-family: inherit;
25
+ }
26
+
27
+ .deck-goto .goto-form {
28
+ display: block;
29
+ }
30
+
31
+ #goto-slide {
32
+ width: 4.375em;
33
+ margin: 0 0.625em;
34
+ height: 1.4375em;
35
+ }
36
+
37
+ @media print {
38
+ .goto-form, #goto-slide {
39
+ display: none !important;
40
+ }
41
+ }
@@ -0,0 +1,6 @@
1
+ <!-- Place the following snippet at the bottom of the deck container. -->
2
+ <form action="." method="get" class="goto-form">
3
+ <label for="goto-slide">Go to slide:</label>
4
+ <input type="number" name="slidenum" id="goto-slide">
5
+ <input type="submit" value="Go">
6
+ </form>
@@ -0,0 +1,118 @@
1
+ /*!
2
+ Deck JS - deck.goto
3
+ Copyright (c) 2011 Caleb Troughton
4
+ Dual licensed under the MIT license and GPL license.
5
+ https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6
+ https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7
+ */
8
+
9
+ /*
10
+ This module adds the necessary methods and key bindings to show and hide a form
11
+ for jumping to any slide number in the deck (and processes that form
12
+ accordingly). The form-showing state is indicated by the presence of a class on
13
+ the deck container.
14
+ */
15
+ (function($, deck, undefined) {
16
+ var $d = $(document);
17
+
18
+ /*
19
+ Extends defaults/options.
20
+
21
+ options.classes.goto
22
+ This class is added to the deck container when showing the Go To Slide
23
+ form.
24
+
25
+ options.selectors.gotoForm
26
+ The element that matches this selector is the form that is submitted
27
+ when a user hits enter after typing a slide number in the gotoInput
28
+ element.
29
+
30
+ options.selectors.gotoInput
31
+ The element that matches this selector is the text input field for
32
+ entering a slide number in the Go To Slide form.
33
+
34
+ options.keys.goto
35
+ The numeric keycode used to toggle between showing and hiding the Go To
36
+ Slide form.
37
+ */
38
+ $.extend(true, $[deck].defaults, {
39
+ classes: {
40
+ goto: 'deck-goto'
41
+ },
42
+
43
+ selectors: {
44
+ gotoForm: '.goto-form',
45
+ gotoInput: '#goto-slide'
46
+ },
47
+
48
+ keys: {
49
+ goto: 71 // g
50
+ }
51
+ });
52
+
53
+ /*
54
+ jQuery.deck('showGoTo')
55
+
56
+ Shows the Go To Slide form by adding the class specified by the goto class
57
+ option to the deck container.
58
+ */
59
+ $[deck]('extend', 'showGoTo', function() {
60
+ $[deck]('getContainer').addClass($[deck]('getOptions').classes.goto);
61
+ $($[deck]('getOptions').selectors.gotoInput).focus();
62
+ });
63
+
64
+ /*
65
+ jQuery.deck('hideGoTo')
66
+
67
+ Hides the Go To Slide form by removing the class specified by the goto class
68
+ option from the deck container.
69
+ */
70
+ $[deck]('extend', 'hideGoTo', function() {
71
+ $[deck]('getContainer').removeClass($[deck]('getOptions').classes.goto);
72
+ $($[deck]('getOptions').selectors.gotoInput).blur();
73
+ });
74
+
75
+ /*
76
+ jQuery.deck('toggleGoTo')
77
+
78
+ Toggles between showing and hiding the Go To Slide form.
79
+ */
80
+ $[deck]('extend', 'toggleGoTo', function() {
81
+ $[deck]($[deck]('getContainer').hasClass($[deck]('getOptions').classes.goto) ? 'hideGoTo' : 'showGoTo');
82
+ });
83
+
84
+ $d.bind('deck.init', function() {
85
+ // Bind key events
86
+ $d.unbind('keydown.deckgoto').bind('keydown.deckgoto', function(e) {
87
+ var key = $[deck]('getOptions').keys.goto;
88
+
89
+ if (e.which === key ||$.inArray(e.which, key) > -1) {
90
+ e.preventDefault();
91
+ $[deck]('toggleGoTo');
92
+ }
93
+ });
94
+
95
+ // Process form submittal, go to the slide entered
96
+ $($[deck]('getOptions').selectors.gotoForm)
97
+ .unbind('submit.deckgoto')
98
+ .bind('submit.deckgoto', function(e) {
99
+ var $field = ($($[deck]('getOptions').selectors.gotoInput)),
100
+ i = parseInt($field.val(), 10);
101
+
102
+ if (!($.isNaN(i) || i < 1 || i > $[deck]('getSlides').length)) {
103
+ $[deck]('go', i - 1);
104
+ $[deck]('hideGoTo');
105
+ $field.val('');
106
+ }
107
+
108
+ e.preventDefault();
109
+ });
110
+
111
+ $($[deck]('getOptions').selectors.gotoInput)
112
+ .unbind('keydown.deckgoto')
113
+ .bind('keydown.deckgoto', function(e) {
114
+ e.stopPropagation();
115
+ });
116
+ });
117
+ })(jQuery, 'deck');
118
+
@@ -0,0 +1,46 @@
1
+ .deck-container {
2
+ .goto-form {
3
+ position:absolute;
4
+ z-index:3;
5
+ bottom:10px;
6
+ left:50%;
7
+ height:1.75em;
8
+ margin:0 0 0 -7.125em;
9
+ line-height:1.75em;
10
+ padding:0.625em;
11
+ display:none;
12
+ background:#ccc;
13
+ overflow:hidden;
14
+
15
+ .borderradius & {
16
+ -webkit-border-radius:10px;
17
+ -moz-border-radius:10px;
18
+ border-radius:10px;
19
+ }
20
+
21
+ label {
22
+ font-weight:bold;
23
+ }
24
+
25
+ label, input {
26
+ display:inline-block;
27
+ font-family:inherit;
28
+ }
29
+ }
30
+ }
31
+
32
+ .deck-goto .goto-form {
33
+ display:block;
34
+ }
35
+
36
+ #goto-slide {
37
+ width:4.375em;
38
+ margin:0 0.625em;
39
+ height:1.4375em;
40
+ }
41
+
42
+ @media print {
43
+ .goto-form, #goto-slide {
44
+ display:none !important;
45
+ }
46
+ }