anatomy 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20f0dec3c0eda4fbff6a6af803a5ebb10ce7c2f3
4
- data.tar.gz: a49d167cf070f380d466bf047fa4f21d49c4a4d7
3
+ metadata.gz: 9311046d401a0d15a452eec56f8f868007228622
4
+ data.tar.gz: cf129729337533d951cbb7645a5443e43e9cb903
5
5
  SHA512:
6
- metadata.gz: f223c6fe311ff82971cd7481e9b2371c4a952fcc6b8575c9dd38f7e123ebbce9727fae99d48b2f456ba902b0cccdf2647b8d70c390935d83d20b6b2bcdeeb136
7
- data.tar.gz: 928790cd88ec3937d3b75e7b10b368f7a6e558173626497ed90284b90b493df17705ac5575b5dfd06946ef35246b1a03c4ada2921a889f6960b6e8bc77e7e830
6
+ metadata.gz: 9df53430925e40d018243f582067035b83ec028a88aa13aa237ecc572d8c85af2d1e11359bfa83bda98f8b5fd425eee17aa2dbca8072f633611b888889185500
7
+ data.tar.gz: 0036bb071e4d09f701d1c7f76598e4f2861c14926a48939da62b534ff78d2445e7fde57073ad82c4756f233125c23c32b4ba6062a9d32c81475214f1bda7227f
data/lib/anatomy/data.ay CHANGED
@@ -128,6 +128,11 @@ def(Part top):
128
128
  then: @parent top
129
129
  else: self
130
130
 
131
+ def(Part contains-part?(other)):
132
+ if(self == other)
133
+ then: true
134
+ else: @parts any? &.contains-part?(other)
135
+
131
136
  def(content?(String)): true
132
137
  def(content?(Element)): true
133
138
  def(content?(nil)): true
@@ -63,6 +63,7 @@ def(over(b & data Block)):
63
63
  <div: over(b content)
64
64
 
65
65
  in-reference? = dynamic(false)
66
+ in-sidebar? = dynamic(false)
66
67
 
67
68
  def(over(t & data Target)):
68
69
  <a(name = t name): nil
@@ -122,7 +123,7 @@ def(over(e & data Element)):
122
123
  <script(async = true, defer = true, src = url) {}
123
124
 
124
125
  .aux:
125
- unless(^(in-reference?)):
126
+ unless(^(in-reference?) || ^(in-sidebar?)):
126
127
  over(e content)
127
128
 
128
129
  def(over(nil)): nil
@@ -157,14 +158,22 @@ def(url(p, anchor = nil)):
157
158
  filename(p)
158
159
 
159
160
 
160
- def(toc-leaf(part)):
161
- <li:
161
+ def(toc-leaf(current-part, part)):
162
+ classes = []
163
+
164
+ when(part == current-part):
165
+ classes << "current"
166
+
167
+ when(part contains-part?(current-part)):
168
+ classes << "active"
169
+
170
+ <li(class = classes join(" ")):
162
171
  <a(href = url(part)):
163
172
  over(part title)
164
173
 
165
174
  unless(part omit-children-from-table-of-contents? || part parts empty?):
166
175
  <ol:
167
- part parts collect [p]: toc-leaf(p) --&.(Self toc-leaf(_))
176
+ part parts collect &.(Self toc-leaf(current-part, _))
168
177
 
169
178
 
170
179
  def(render(part, out = ".")):
@@ -212,19 +221,15 @@ def(render(part, out = ".")):
212
221
 
213
222
  <ul(.search-results) {}
214
223
 
215
- <div(#sidebar):
216
- unless(part parts empty?):
217
- [ <h4: "On this page:"
218
-
219
- <ol(.toc):
220
- part parts collect [s]: toc-leaf(s)
221
- ]
224
+ with(in-sidebar? = true):
225
+ <div(#sidebar):
226
+ <h2:
227
+ <a(href = url(part top)):
228
+ over(part top title)
222
229
 
223
- when(part parent):
224
- [ <h4: "Up one level:"
225
- <ol(.toc):
226
- toc-leaf(part parent)
227
- ]
230
+ <ol(.toc):
231
+ part top parts collect [p]:
232
+ toc-leaf(part, p)
228
233
 
229
234
  when(analytics-id = ENV["ANALYTICS_ID"]):
230
235
  <script: UnescapedString new(i"
@@ -257,7 +262,7 @@ def(render-part(part, out = ".", depth = 1)):
257
262
  <ol(.toc, #table-of-contents):
258
263
  part parts collect [sub]:
259
264
  render(sub, out)
260
- toc-leaf(sub)
265
+ toc-leaf(part, sub)
261
266
  else:
262
267
  part parts collect [sub]:
263
268
  render-part(sub, out, depth + 1)
@@ -307,6 +312,8 @@ def(all-css-additions(p)):
307
312
  assets = p css-additions to-a
308
313
 
309
314
  p parts each [sub]:
310
- assets += all-css-additions(sub)
315
+ -- exclude parts that have their own page
316
+ unless(top(sub) == sub):
317
+ assets += all-css-additions(sub)
311
318
 
312
319
  assets
data/public/anatomy.css CHANGED
@@ -10,17 +10,18 @@ input,textarea,select { font-family: inherit; font-size: inherit; font-weight: i
10
10
  a { text-decoration: none; color: inherit; }
11
11
 
12
12
  html {
13
- background-color: #f5f5f5;
14
- color: #151515;
13
+ background-color: #f5f5f5;
14
+ color: #151515;
15
15
  }
16
16
 
17
17
  body {
18
- font-family: Palatino, 'Palatino Linotype', 'Palatino LT STD', 'Book Antiqua', Georgia, serif;
18
+ font-family: Helvetica, Arial, sans-serif;
19
19
  }
20
20
 
21
21
  code {
22
22
  font-size: 14px;
23
- background: #e0e0e0;
23
+ background: #fbfbfb;
24
+ color: #202020;
24
25
  padding: 2px 5px;
25
26
  border-radius: 5px;
26
27
  }
@@ -61,7 +62,7 @@ h2 {
61
62
  font-size: 20px;
62
63
  font-weight: 500;
63
64
  line-height: 20px;
64
- border-bottom: 1px dotted #bbb;
65
+ border-bottom: 1px dotted #d0d0d0;
65
66
  padding-bottom: .25em;
66
67
  margin-bottom: .75em;
67
68
  }
@@ -80,15 +81,15 @@ p {
80
81
  }
81
82
 
82
83
  pre {
83
- font-size: 14px;
84
- font-weight: 400;
85
- line-height: 24px;
84
+ font-size: 14px;
85
+ font-weight: 400;
86
+ line-height: 24px;
86
87
  }
87
88
 
88
89
  blockquote {
89
- font-size: 17px;
90
- font-weight: 400;
91
- line-height: 23px;
90
+ font-size: 17px;
91
+ font-weight: 400;
92
+ line-height: 23px;
92
93
  }
93
94
 
94
95
  .section img {
@@ -118,17 +119,17 @@ dd {
118
119
 
119
120
  #main {
120
121
  width: 700px;
121
- margin-left: 220px;
122
+ margin-left: 250px;
122
123
  }
123
124
 
124
125
  #content {
125
- padding: 32px 0;
126
+ padding: 32px;
126
127
  }
127
128
 
128
129
  #sidebar {
129
- color: #777;
130
- padding: 32px;
131
- width: 136px;
130
+ background: #202020;
131
+ color: #e0e0e0;
132
+ width: 250px;
132
133
  height: 100%;
133
134
  overflow: auto;
134
135
  position: fixed;
@@ -136,6 +137,57 @@ dd {
136
137
  top: 0;
137
138
  bottom: 0;
138
139
  }
140
+ #sidebar h2 {
141
+ padding: 0;
142
+ border: none;
143
+ }
144
+ #sidebar h2 a {
145
+ padding: .5em;
146
+ color: #f5f5f5;
147
+ background: #151515;
148
+ display: block;
149
+ font-weight: bold;
150
+ }
151
+ #sidebar h2 a:hover {
152
+ text-decoration: none;
153
+ background: #303030;
154
+ }
155
+ #sidebar .toc {
156
+ font-size: 1em;
157
+ margin: 0;
158
+ padding: 0;
159
+ }
160
+ #sidebar .toc ol {
161
+ margin: 0;
162
+ padding: 0 0 0 1em;
163
+ }
164
+ #sidebar .toc li {
165
+ list-style-type: none;
166
+ }
167
+ #sidebar .toc a {
168
+ padding: .5em 1em;
169
+ display: block;
170
+ color: #e0e0e0;
171
+ }
172
+ #sidebar .toc a:hover {
173
+ color: #f5f5f5;
174
+ background: #505050;
175
+ text-decoration: none;
176
+ }
177
+ #sidebar .toc code {
178
+ background: #151515;
179
+ color: #f5f5f5;
180
+ }
181
+ #sidebar .toc li ol {
182
+ display: none;
183
+ }
184
+ #sidebar .toc li.active ol {
185
+ display: block;
186
+ }
187
+ #sidebar .toc li.current > a {
188
+ background: #303030;
189
+ }
190
+
139
191
  .search {
140
192
  width: 200px;
141
193
  position: fixed;
@@ -149,11 +201,11 @@ div.search:hover {
149
201
  .search #search {
150
202
  width: 186px;
151
203
  padding: 5px;
152
- border: 2px solid #eee;
204
+ border: 2px solid #e0e0e0;
153
205
  }
154
206
  .search .search_results {
155
207
  margin: 0;
156
- border: 2px solid #eee;
208
+ border: 2px solid #e0e0e0;
157
209
  border-top: 0;
158
210
  display: none;
159
211
  background: #fff;
@@ -165,36 +217,20 @@ div.search:hover {
165
217
  .search .search_results .parent {
166
218
  font-size: 12px;
167
219
  font-style: italic;
168
- color: #555;
220
+ color: #505050;
169
221
  }
170
222
  .search .search_results .parent a {
171
- color: #222;
223
+ color: #202020;
172
224
  }
173
225
  .search .search_results .tag {
174
226
  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;
227
+ color: #505050;
192
228
  }
193
229
 
194
230
  .section .section {
195
231
  margin: 1em 0;
196
232
  padding: 1em 0;
197
- border-bottom: .1em dotted #000;
233
+ border-bottom: .1em dotted #151515;
198
234
  }
199
235
  .section .section .section {
200
236
  margin: 0;
@@ -204,17 +240,13 @@ div.search:hover {
204
240
  .definition {
205
241
  margin: 2em 0;
206
242
  padding: 2em 0 0;
207
- border-top: .1em dotted #ddd;
243
+ border-top: .1em dotted #d0d0d0;
208
244
  }
209
245
  .definition .thumb pre {
210
246
  background: #e0e0e0;
211
247
  padding: .6em .75em;
212
248
  margin-bottom: 1em;
213
249
  }
214
- .definition.macro .thumb pre {
215
- /* same as unquote background */
216
- background: #fff0f0;
217
- }
218
250
 
219
251
  .verbatim, .interaction {
220
252
  margin: 0 1em 1em;
@@ -240,11 +272,11 @@ code a:link,
240
272
  code a:visited {
241
273
  color: inherit;
242
274
  text-decoration: none;
243
- border-bottom: .1em solid #ddd;
275
+ border-bottom: .1em solid #d0d0d0;
244
276
  }
245
277
  pre a:hover,
246
278
  code a:hover {
247
- border-bottom-color: #333;
279
+ border-bottom-color: #303030;
248
280
  }
249
281
 
250
282
  blockquote {
@@ -264,7 +296,7 @@ table th, table td {
264
296
  margin-top: -1.5em;
265
297
  margin-right: -15em;
266
298
  padding: .5em;
267
- color: #777;
299
+ color: #b0b0b0;
268
300
  }
269
301
 
270
302
  .centered {
@@ -286,7 +318,7 @@ table th, table td {
286
318
  }
287
319
  .interaction .caret {
288
320
  font-weight: bold;
289
- color: #999;
321
+ color: #d0d0d0;
290
322
  }
291
323
 
292
324
  .error_output {
data/public/highlight.css CHANGED
@@ -1,60 +1,60 @@
1
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 */
2
+ .c { color: #b0b0b0 } /* Comment */
3
+ .err { color: #ac4142; } /* Error */
4
+ .k { color: #90a959; font-weight: bold } /* Keyword */
5
+ .cm { color: #b0b0b0 } /* Comment.Multiline */
6
+ .cp { color: #ac4142; font-weight: bold } /* Comment.Preproc */
7
+ .c1 { color: #b0b0b0 } /* Comment.Single */
8
+ .cs { color: #ac4142; font-weight: bold; } /* Comment.Special */
9
+ .gd { color: #151515; background-color: #ffdddd } /* Generic.Deleted */
10
10
  .ge { font-style: italic } /* Generic.Emph */
11
- .gr { color: #aa0000 } /* Generic.Error */
11
+ .gr { color: #ac4142 } /* Generic.Error */
12
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 */
13
+ .gi { color: #151515; background-color: #ddffdd } /* Generic.Inserted */
14
+ .go { color: #b0b0b0 } /* Generic.Output */
15
+ .gp { color: #505050 } /* Generic.Prompt */
16
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 */
17
+ .gu { color: #b0b0b0 } /* Generic.Subheading */
18
+ .gt { color: #ac4142 } /* Generic.Traceback */
19
+ .kc { color: #90a959; font-weight: bold } /* Keyword.Constant */
20
+ .kd { color: #90a959; font-weight: bold } /* Keyword.Declaration */
21
+ .kn { color: #90a959; font-weight: bold } /* Keyword.Namespace */
22
+ .kp { color: #90a959 } /* Keyword.Pseudo */
23
+ .kr { color: #90a959; font-weight: bold } /* Keyword.Reserved */
24
+ .kt { color: #b0b0b0; font-weight: bold } /* Keyword.Type */
25
+ .m { color: #75b5aa; font-weight: bold } /* Literal.Number */
26
+ .s { color: #ac4142; } /* Literal.String */
27
+ .na { color: #6a9fb5 } /* Name.Attribute */
28
+ .nb { color: #8f5536 } /* Name.Builtin */
29
+ .nc { color: #aa759f; font-weight: bold } /* Name.Class */
30
+ .no { color: #75b5aa; font-weight: bold } /* Name.Constant */
31
+ .nd { color: #505050 } /* Name.Decorator */
32
+ .ne { color: #aa759f; font-weight: bold } /* Name.Exception */
33
+ .nf { color: #75b5aa; font-weight: bold } /* Name.Function */
34
+ .nl { color: #6a9fb5; font-style: italic } /* Name.Label */
35
+ .nn { color: #aa759f; font-weight: bold } /* Name.Namespace */
36
+ .py { color: #6a9fb5; font-weight: bold } /* Name.Property */
37
+ .nt { color: #aa759f; font-weight: bold } /* Name.Tag */
38
+ .nv { color: #6a9fb5 } /* Name.Variable */
39
+ .ow { color: #90a959 } /* Operator.Word */
40
+ .w { color: #d0d0d0 } /* Text.Whitespace */
41
+ .mf { color: #75b5aa; font-weight: bold } /* Literal.Number.Float */
42
+ .mh { color: #75b5aa; font-weight: bold } /* Literal.Number.Hex */
43
+ .mi { color: #75b5aa; font-weight: bold } /* Literal.Number.Integer */
44
+ .mo { color: #75b5aa; font-weight: bold } /* Literal.Number.Oct */
45
+ .sb { color: #d28445; } /* Literal.String.Backtick */
46
+ .sc { color: #d28445; } /* Literal.String.Char */
47
+ .sd { color: #d28445; } /* Literal.String.Doc */
48
+ .s2 { color: #d28445; } /* Literal.String.Double */
49
+ .se { color: #6a9fb5; } /* Literal.String.Escape */
50
+ .sh { color: #d28445; } /* Literal.String.Heredoc */
51
+ .si { color: #75b5aa; } /* Literal.String.Interpol */
52
+ .sx { color: #f4bf75; } /* Literal.String.Other */
53
+ .sr { color: #90a959; } /* Literal.String.Regex */
54
+ .s1 { color: #ac4142; } /* Literal.String.Single */
55
+ .ss { color: #f4bf75; } /* Literal.String.Symbol */
56
+ .bp { color: #8f5536 } /* Name.Builtin.Pseudo */
57
+ .vc { color: #6a9fb5 } /* Name.Variable.Class */
58
+ .vg { color: #f4bf75 } /* Name.Variable.Global */
59
+ .vi { color: #75b5aa } /* Name.Variable.Instance */
60
+ .il { color: #75b5aa; font-weight: bold } /* Literal.Number.Integer.Long */
data/public/main.js CHANGED
@@ -8,230 +8,183 @@ var X_OFFSET = 50,
8
8
  SLIDE_HEIGHT;
9
9
 
10
10
  $(function(){
11
- bindSearch();
12
- sidebarTree();
11
+ bindSearch();
13
12
 
14
- if (!$(".slides").length)
15
- return;
13
+ if (!$(".slides").length)
14
+ return;
16
15
 
17
- SLIDE_WIDTH = $(".slide").outerWidth();
18
- SLIDE_HEIGHT = $(".slide").outerHeight();
16
+ SLIDE_WIDTH = $(".slide").outerWidth();
17
+ SLIDE_HEIGHT = $(".slide").outerHeight();
19
18
 
20
- positionSlides();
21
- bindKeys();
22
- bindTouch();
19
+ positionSlides();
20
+ bindKeys();
21
+ bindTouch();
23
22
  });
24
23
 
25
24
  function positionSlides() {
26
- var initialPos = -(SLIDE_WIDTH / 2);
27
-
28
- if (window.location.hash) {
29
- where = window.location.hash.slice(1).split(",");
30
- position = parseInt(where[0]);
31
- detail[position] = parseInt(where[1]) || 0;
32
- initialPos -= (SLIDE_WIDTH + X_OFFSET) * position;
33
- }
25
+ var initialPos = -(SLIDE_WIDTH / 2);
34
26
 
35
- $(".slide:not(.continue)").each(function(i){
36
- $(this).css("margin-left", initialPos);
37
- $(this).addClass("group-" + i);
27
+ if (window.location.hash) {
28
+ where = window.location.hash.slice(1).split(",");
29
+ position = parseInt(where[0]);
30
+ detail[position] = parseInt(where[1]) || 0;
31
+ initialPos -= (SLIDE_WIDTH + X_OFFSET) * position;
32
+ }
38
33
 
39
- var yPos = (SLIDE_HEIGHT / 2) + Y_OFFSET;
40
- $(this).nextUntil(":not(.continue)").each(function(){
41
- $(this).css({
42
- "margin-left": initialPos,
43
- "margin-top": yPos
44
- });
34
+ $(".slide:not(.continue)").each(function(i){
35
+ $(this).css("margin-left", initialPos);
36
+ $(this).addClass("group-" + i);
45
37
 
46
- $(this).addClass("group-" + i);
38
+ var yPos = (SLIDE_HEIGHT / 2) + Y_OFFSET;
39
+ $(this).nextUntil(":not(.continue)").each(function(){
40
+ $(this).css({
41
+ "margin-left": initialPos,
42
+ "margin-top": yPos
43
+ });
47
44
 
48
- yPos += (SLIDE_HEIGHT + Y_OFFSET);
49
- });
45
+ $(this).addClass("group-" + i);
50
46
 
51
- initialPos += SLIDE_WIDTH + X_OFFSET;
47
+ yPos += (SLIDE_HEIGHT + Y_OFFSET);
52
48
  });
49
+
50
+ initialPos += SLIDE_WIDTH + X_OFFSET;
51
+ });
53
52
  }
54
53
 
55
54
  function bindKeys() {
56
- $(document).bind("keydown", "left", function(){
57
- if (animating || position == 0)
58
- return;
55
+ $(document).bind("keydown", "left", function(){
56
+ if (animating || position == 0)
57
+ return;
59
58
 
60
- $(".slide").each(moveX(1));
61
- });
59
+ $(".slide").each(moveX(1));
60
+ });
62
61
 
63
- $(document).bind("keydown", "right", function(){
64
- if (animating || position + 1 == $(".slide:not(.continue)").length)
65
- return;
62
+ $(document).bind("keydown", "right", function(){
63
+ if (animating || position + 1 == $(".slide:not(.continue)").length)
64
+ return;
66
65
 
67
- $(".slide").each(moveX(-1));
68
- });
66
+ $(".slide").each(moveX(-1));
67
+ });
69
68
 
70
- $(document).bind("keydown", "up", function(){
71
- var d = detail[position],
72
- group = $(".group-" + position);
69
+ $(document).bind("keydown", "up", function(){
70
+ var d = detail[position],
71
+ group = $(".group-" + position);
73
72
 
74
- if (animating || d == 0)
75
- return;
73
+ if (animating || d == 0)
74
+ return;
76
75
 
77
- group.each(moveY(1));
78
- });
76
+ group.each(moveY(1));
77
+ });
79
78
 
80
- $(document).bind("keydown", "down", function(){
81
- var d = detail[position],
82
- group = $(".group-" + position);
79
+ $(document).bind("keydown", "down", function(){
80
+ var d = detail[position],
81
+ group = $(".group-" + position);
83
82
 
84
- if (animating || d + 1 == group.length)
85
- return;
83
+ if (animating || d + 1 == group.length)
84
+ return;
86
85
 
87
- group.each(moveY(-1));
88
- });
86
+ group.each(moveY(-1));
87
+ });
89
88
  }
90
89
 
91
90
  function bindTouch() {
92
- var startX, endX;
93
- $(".slides").bind("touchstart", function(e){
94
- startX = e.originalEvent.touches[0].pageX;
95
- });
96
-
97
- $(".slides").bind("touchmove", function(e){
98
- endX = e.originalEvent.touches[0].pageX;
99
- e.preventDefault();
100
- });
101
-
102
- $(".slides").bind("touchend", function(e){
103
- if ((startX - endX) > 50)
104
- $(".slide").each(moveX(-1));
105
- else if ((endX - startX) > 50)
106
- $(".slide").each(moveX(1));
107
- });
91
+ var startX, endX;
92
+ $(".slides").bind("touchstart", function(e){
93
+ startX = e.originalEvent.touches[0].pageX;
94
+ });
95
+
96
+ $(".slides").bind("touchmove", function(e){
97
+ endX = e.originalEvent.touches[0].pageX;
98
+ e.preventDefault();
99
+ });
100
+
101
+ $(".slides").bind("touchend", function(e){
102
+ if ((startX - endX) > 50)
103
+ $(".slide").each(moveX(-1));
104
+ else if ((endX - startX) > 50)
105
+ $(".slide").each(moveX(1));
106
+ });
108
107
  }
109
108
 
110
109
  function bindSearch() {
111
- $("#search").keyup(function(){
112
- $(".search_results").empty();
113
-
114
- if (!$("#search").val().length) {
115
- $(".search_results").hide();
116
- return;
117
- }
118
-
119
- var q = $("#search").val().toLowerCase(),
120
- matches = [];
121
-
122
- console.log(q, SEARCH_TAGS);
123
- $.each(SEARCH_TAGS, function(i, t){
124
- var k = t[0].toLowerCase(),
125
- n = t[1],
126
- url = t[2],
127
- item = "<li>" + n + "</li>";
128
-
129
- if (k.indexOf(q) == -1 || matches.indexOf(url) != -1)
130
- return;
131
-
132
- matches.push(url);
133
-
134
- if (k == q)
135
- $(".search_results").prepend(item);
136
- else
137
- $(".search_results").append(item);
138
- });
139
-
140
- if (matches.length == 0)
141
- $(".search_results").hide();
142
- else
143
- $(".search_results").show();
144
- });
145
- }
110
+ $("#search").keyup(function(){
111
+ $(".search_results").empty();
112
+
113
+ if (!$("#search").val().length) {
114
+ $(".search_results").hide();
115
+ return;
116
+ }
117
+
118
+ var q = $("#search").val().toLowerCase(),
119
+ matches = [];
146
120
 
147
- function sidebarTree() {
148
- $("#sidebar .toc li").each(function(){
149
- var sub = $(this).find("ol:first");
150
- if (!sub.length) return;
151
-
152
- var toggle = document.createElement("span");
153
- $(toggle).addClass("toggle");
154
-
155
- $(this).find("ol").hide();
156
-
157
- function face(hover) {
158
- if (hover) {
159
- if (sub.css("display") == "none")
160
- $(toggle).html("&#9660");
161
- else
162
- $(toggle).html("&#9650")
163
- } else {
164
- if (sub.css("display") == "none")
165
- $(toggle).html("&#9661");
166
- else
167
- $(toggle).html("&#9651")
168
- }
169
- }
170
-
171
- $(toggle).html("&#9661;");
172
- $(toggle).click(function(){
173
- $(this).next("ol").slideToggle("fast", function(){
174
- face(false);
175
- });
176
- });
177
-
178
- $(toggle).mouseenter(function(){
179
- face(true);
180
- });
181
-
182
- $(toggle).mouseleave(function(){
183
- face(false);
184
- });
185
-
186
- $(toggle).insertAfter($(this).find("a:first"));
121
+ console.log(q, SEARCH_TAGS);
122
+ $.each(SEARCH_TAGS, function(i, t){
123
+ var k = t[0].toLowerCase(),
124
+ n = t[1],
125
+ url = t[2],
126
+ item = "<li>" + n + "</li>";
127
+
128
+ if (k.indexOf(q) == -1 || matches.indexOf(url) != -1)
129
+ return;
130
+
131
+ matches.push(url);
132
+
133
+ if (k == q)
134
+ $(".search_results").prepend(item);
135
+ else
136
+ $(".search_results").append(item);
187
137
  });
188
138
 
189
- if ($("#sidebar .toc:nth(1) > li:contains(ol)").length == 1)
190
- $("#sidebar .toc:nth(1) .toggle:first").click();
139
+ if (matches.length == 0)
140
+ $(".search_results").hide();
141
+ else
142
+ $(".search_results").show();
143
+ });
191
144
  }
192
145
 
193
146
  function moveX(diff) {
194
- animating = true;
195
- position -= diff;
196
-
197
- if (detail[position] == undefined)
198
- detail[position] = 0;
199
-
200
- return function(){
201
- $(this).animate({
202
- "margin-left": getLeft($(this)) + ((SLIDE_WIDTH + X_OFFSET) * diff)
203
- }, {
204
- "duration": 250,
205
- "complete": (function(){
206
- animating = false;
207
- window.location.hash =
208
- position + "," + detail[position];
209
- })
210
- });
211
- };
147
+ animating = true;
148
+ position -= diff;
149
+
150
+ if (detail[position] == undefined)
151
+ detail[position] = 0;
152
+
153
+ return function(){
154
+ $(this).animate({
155
+ "margin-left": getLeft($(this)) + ((SLIDE_WIDTH + X_OFFSET) * diff)
156
+ }, {
157
+ "duration": 250,
158
+ "complete": (function(){
159
+ animating = false;
160
+ window.location.hash =
161
+ position + "," + detail[position];
162
+ })
163
+ });
164
+ };
212
165
  }
213
166
 
214
167
  function moveY(diff) {
215
- animating = true;
216
- detail[position] -= diff;
217
- return function(){
218
- $(this).animate({
219
- "margin-top": getTop($(this)) + ((SLIDE_HEIGHT + Y_OFFSET) * diff)
220
- }, {
221
- "duration": 250,
222
- "complete": (function(){
223
- animating = false;
224
- window.location.hash =
225
- position + "," + detail[position];
226
- })
227
- });
228
- };
168
+ animating = true;
169
+ detail[position] -= diff;
170
+ return function(){
171
+ $(this).animate({
172
+ "margin-top": getTop($(this)) + ((SLIDE_HEIGHT + Y_OFFSET) * diff)
173
+ }, {
174
+ "duration": 250,
175
+ "complete": (function(){
176
+ animating = false;
177
+ window.location.hash =
178
+ position + "," + detail[position];
179
+ })
180
+ });
181
+ };
229
182
  }
230
183
 
231
184
  function getLeft(ele) {
232
- return parseInt(ele.css("margin-left"), 10);
185
+ return parseInt(ele.css("margin-left"), 10);
233
186
  }
234
187
 
235
188
  function getTop(ele) {
236
- return parseInt(ele.css("margin-top"), 10);
189
+ return parseInt(ele.css("margin-top"), 10);
237
190
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anatomy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Suraci
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-22 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: atomy