timeline_setter 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,20 +2,41 @@ var inSearch = null;
2
2
  var searchIndex = 0;
3
3
  var searchCache = [];
4
4
  var searchString = '';
5
+ var regexSearchString = '';
6
+ var caseSensitiveMatch = false;
7
+ var ignoreKeyCodeMin = 8;
8
+ var ignoreKeyCodeMax = 46;
9
+ var commandKey = 91;
10
+
11
+ RegExp.escape = function(text) {
12
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
13
+ }
5
14
 
6
15
  function fullListSearch() {
7
16
  // generate cache
8
17
  searchCache = [];
9
18
  $('#full_list li').each(function() {
10
19
  var link = $(this).find('.object_link a');
11
- searchCache.push({name:link.text(), node:$(this), link:link});
20
+ var fullName = link.attr('title').split(' ')[0];
21
+ searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link});
12
22
  });
13
23
 
14
24
  $('#search input').keyup(function() {
15
- searchString = this.value.toLowerCase();
25
+ if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax)
26
+ || event.keyCode == commandKey)
27
+ return;
28
+ searchString = this.value;
29
+ caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
30
+ regexSearchString = RegExp.escape(searchString);
31
+ if (caseSensitiveMatch) {
32
+ regexSearchString += "|" +
33
+ $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
34
+ join('.+?');
35
+ }
16
36
  if (searchString === "") {
17
37
  clearTimeout(inSearch);
18
38
  inSearch = null;
39
+ $('ul .search_uncollapsed').removeClass('search_uncollapsed');
19
40
  $('#full_list, #content').removeClass('insearch');
20
41
  $('#full_list li').removeClass('found').each(function() {
21
42
 
@@ -47,16 +68,18 @@ var lastRowClass = '';
47
68
  function searchItem() {
48
69
  for (var i = 0; i < searchCache.length / 50; i++) {
49
70
  var item = searchCache[searchIndex];
50
- if (item.name.toLowerCase().indexOf(searchString) == -1) {
71
+ var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
72
+ var matchString = regexSearchString;
73
+ var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
74
+ if (searchName.match(matchRegexp) == null) {
51
75
  item.node.removeClass('found');
52
76
  }
53
77
  else {
54
78
  item.node.css('padding-left', '10px').addClass('found');
79
+ item.node.parents().addClass('search_uncollapsed');
55
80
  item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
56
81
  lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
57
- item.link.html(item.name.replace(new RegExp("(" +
58
- searchString.replace(/([\/.*+?|()\[\]{}\\])/g, "\\$1") + ")", "ig"),
59
- '<strong>$1</strong>'));
82
+ item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
60
83
  }
61
84
 
62
85
  if (searchCache.length === searchIndex + 1) {
@@ -41,7 +41,7 @@
41
41
 
42
42
 
43
43
  <li class="r1 ">
44
- <span class='object_link'><a href="TimelineSetter/CLI.html#compile%21-instance_method" title="TimelineSetter::CLI#compile! (method)">#compile!</a></span>
44
+ <span class='object_link'><a href="TimelineSetter/CLI.html#compile%21-instance_method" title="TimelineSetter::CLI#compile! (method)">#compile!</a></span>
45
45
 
46
46
  <small>TimelineSetter::CLI</small>
47
47
 
@@ -49,7 +49,7 @@
49
49
 
50
50
 
51
51
  <li class="r2 ">
52
- <span class='object_link'><a href="TimelineSetter/Timeline.html#config_json-instance_method" title="TimelineSetter::Timeline#config_json (method)">#config_json</a></span>
52
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#config_json-instance_method" title="TimelineSetter::Timeline#config_json (method)">#config_json</a></span>
53
53
 
54
54
  <small>TimelineSetter::Timeline</small>
55
55
 
@@ -57,7 +57,7 @@
57
57
 
58
58
 
59
59
  <li class="r1 ">
60
- <span class='object_link'><a href="TimelineSetter/CLI.html#events-instance_method" title="TimelineSetter::CLI#events (method)">#events</a></span>
60
+ <span class='object_link'><a href="TimelineSetter/CLI.html#events-instance_method" title="TimelineSetter::CLI#events (method)">#events</a></span>
61
61
 
62
62
  <small>TimelineSetter::CLI</small>
63
63
 
@@ -65,7 +65,7 @@
65
65
 
66
66
 
67
67
  <li class="r2 ">
68
- <span class='object_link'><a href="TimelineSetter/Parser.html#events-instance_method" title="TimelineSetter::Parser#events (method)">#events</a></span>
68
+ <span class='object_link'><a href="TimelineSetter/Parser.html#events-instance_method" title="TimelineSetter::Parser#events (method)">#events</a></span>
69
69
 
70
70
  <small>TimelineSetter::Parser</small>
71
71
 
@@ -73,7 +73,7 @@
73
73
 
74
74
 
75
75
  <li class="r1 ">
76
- <span class='object_link'><a href="TimelineSetter/CLI.html#html-instance_method" title="TimelineSetter::CLI#html (method)">#html</a></span>
76
+ <span class='object_link'><a href="TimelineSetter/CLI.html#html-instance_method" title="TimelineSetter::CLI#html (method)">#html</a></span>
77
77
 
78
78
  <small>TimelineSetter::CLI</small>
79
79
 
@@ -81,7 +81,7 @@
81
81
 
82
82
 
83
83
  <li class="r2 ">
84
- <span class='object_link'><a href="TimelineSetter/Timeline.html#initialize-instance_method" title="TimelineSetter::Timeline#initialize (method)">#initialize</a></span>
84
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#initialize-instance_method" title="TimelineSetter::Timeline#initialize (method)">#initialize</a></span>
85
85
 
86
86
  <small>TimelineSetter::Timeline</small>
87
87
 
@@ -89,23 +89,23 @@
89
89
 
90
90
 
91
91
  <li class="r1 ">
92
- <span class='object_link'><a href="TimelineSetter/CLI.html#initialize-instance_method" title="TimelineSetter::CLI#initialize (method)">#initialize</a></span>
92
+ <span class='object_link'><a href="TimelineSetter/Parser.html#initialize-instance_method" title="TimelineSetter::Parser#initialize (method)">#initialize</a></span>
93
93
 
94
- <small>TimelineSetter::CLI</small>
94
+ <small>TimelineSetter::Parser</small>
95
95
 
96
96
  </li>
97
97
 
98
98
 
99
99
  <li class="r2 ">
100
- <span class='object_link'><a href="TimelineSetter/Parser.html#initialize-instance_method" title="TimelineSetter::Parser#initialize (method)">#initialize</a></span>
100
+ <span class='object_link'><a href="TimelineSetter/CLI.html#initialize-instance_method" title="TimelineSetter::CLI#initialize (method)">#initialize</a></span>
101
101
 
102
- <small>TimelineSetter::Parser</small>
102
+ <small>TimelineSetter::CLI</small>
103
103
 
104
104
  </li>
105
105
 
106
106
 
107
107
  <li class="r1 ">
108
- <span class='object_link'><a href="TimelineSetter/CLI.html#outdir-instance_method" title="TimelineSetter::CLI#outdir (method)">#outdir</a></span>
108
+ <span class='object_link'><a href="TimelineSetter/CLI.html#outdir-instance_method" title="TimelineSetter::CLI#outdir (method)">#outdir</a></span>
109
109
 
110
110
  <small>TimelineSetter::CLI</small>
111
111
 
@@ -113,7 +113,7 @@
113
113
 
114
114
 
115
115
  <li class="r2 ">
116
- <span class='object_link'><a href="TimelineSetter/CLI.html#parse_options%21-instance_method" title="TimelineSetter::CLI#parse_options! (method)">#parse_options!</a></span>
116
+ <span class='object_link'><a href="TimelineSetter/CLI.html#parse_options%21-instance_method" title="TimelineSetter::CLI#parse_options! (method)">#parse_options!</a></span>
117
117
 
118
118
  <small>TimelineSetter::CLI</small>
119
119
 
@@ -121,7 +121,7 @@
121
121
 
122
122
 
123
123
  <li class="r1 ">
124
- <span class='object_link'><a href="TimelineSetter/CLI.html#sheet-instance_method" title="TimelineSetter::CLI#sheet (method)">#sheet</a></span>
124
+ <span class='object_link'><a href="TimelineSetter/CLI.html#sheet-instance_method" title="TimelineSetter::CLI#sheet (method)">#sheet</a></span>
125
125
 
126
126
  <small>TimelineSetter::CLI</small>
127
127
 
@@ -129,7 +129,7 @@
129
129
 
130
130
 
131
131
  <li class="r2 ">
132
- <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline-instance_method" title="TimelineSetter::Timeline#timeline (method)">#timeline</a></span>
132
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline-instance_method" title="TimelineSetter::Timeline#timeline (method)">#timeline</a></span>
133
133
 
134
134
  <small>TimelineSetter::Timeline</small>
135
135
 
@@ -137,7 +137,7 @@
137
137
 
138
138
 
139
139
  <li class="r1 ">
140
- <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_markup-instance_method" title="TimelineSetter::Timeline#timeline_markup (method)">#timeline_markup</a></span>
140
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_markup-instance_method" title="TimelineSetter::Timeline#timeline_markup (method)">#timeline_markup</a></span>
141
141
 
142
142
  <small>TimelineSetter::Timeline</small>
143
143
 
@@ -145,7 +145,7 @@
145
145
 
146
146
 
147
147
  <li class="r2 ">
148
- <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_min-instance_method" title="TimelineSetter::Timeline#timeline_min (method)">#timeline_min</a></span>
148
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_min-instance_method" title="TimelineSetter::Timeline#timeline_min (method)">#timeline_min</a></span>
149
149
 
150
150
  <small>TimelineSetter::Timeline</small>
151
151
 
@@ -153,7 +153,7 @@
153
153
 
154
154
 
155
155
  <li class="r1 ">
156
- <span class='object_link'><a href="TimelineSetter/CLI.html#timeline_page_path-instance_method" title="TimelineSetter::CLI#timeline_page_path (method)">#timeline_page_path</a></span>
156
+ <span class='object_link'><a href="TimelineSetter/CLI.html#timeline_page_path-instance_method" title="TimelineSetter::CLI#timeline_page_path (method)">#timeline_page_path</a></span>
157
157
 
158
158
  <small>TimelineSetter::CLI</small>
159
159
 
@@ -161,7 +161,7 @@
161
161
 
162
162
 
163
163
  <li class="r2 ">
164
- <span class='object_link'><a href="TimelineSetter/Timeline.html#tmpl-instance_method" title="TimelineSetter::Timeline#tmpl (method)">#tmpl</a></span>
164
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#tmpl-instance_method" title="TimelineSetter::Timeline#tmpl (method)">#tmpl</a></span>
165
165
 
166
166
  <small>TimelineSetter::Timeline</small>
167
167
 
@@ -169,7 +169,7 @@
169
169
 
170
170
 
171
171
  <li class="r1 ">
172
- <span class='object_link'><a href="TimelineSetter/Timeline.html#to_json-instance_method" title="TimelineSetter::Timeline#to_json (method)">#to_json</a></span>
172
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#to_json-instance_method" title="TimelineSetter::Timeline#to_json (method)">#to_json</a></span>
173
173
 
174
174
  <small>TimelineSetter::Timeline</small>
175
175
 
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.7.2
9
+ &mdash; Documentation by YARD 0.7.5
10
10
 
11
11
  </title>
12
12
 
@@ -91,12 +91,14 @@
91
91
 
92
92
 
93
93
 
94
+
95
+
94
96
  </div>
95
97
 
96
98
  <div id="footer">
97
- Generated on Wed Nov 2 15:20:08 2011 by
99
+ Generated on Mon Mar 12 11:02:59 2012 by
98
100
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
99
- 0.7.2 (ruby-1.8.7).
101
+ 0.7.5 (ruby-1.8.7).
100
102
  </div>
101
103
 
102
104
  </body>
data/index.html CHANGED
@@ -82,7 +82,7 @@
82
82
  </head>
83
83
  <body>
84
84
  <a href="http://www.propublica.org" class="propublica">&nbsp;</a>
85
- <h1>TimelineSetter 0.3.0</h1>
85
+ <h1>TimelineSetter 0.3.1</h1>
86
86
 
87
87
  <p>TimelineSetter creates beautiful timelines.</p>
88
88
 
@@ -246,7 +246,7 @@ should see a structure much like this where you&rsquo;ve specified your output:<
246
246
  |-----timeline-setter.js
247
247
  |-----vendor
248
248
  |-------underscore-min.js
249
- |-------jquery-min.js
249
+ |-------jquery-min.js
250
250
  |---stylesheets
251
251
  |-----timeline-setter.css
252
252
  </code></pre>
@@ -279,8 +279,9 @@ associated <em>event cards</em>.</p>
279
279
  <p>The <code>interval</code> option takes an <a href="#interval_notch_options">interval</a> in the form of a JavaScript date getter. The <code>container</code> option allows you to inject the entire timeline into an element with the given selector. (By default this is <code>#timeline</code>). Finally, <code>formatter</code> is a way to format dates on the timeline&rsquo;s interval notches. Write a formatter like so:</p>
280
280
 
281
281
  <pre><code>formatter : function(d, defaults) {
282
- defaults.months = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
283
- return defaults;
282
+ var months = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
283
+ defaults.month = months[d.getMonth()];
284
+ return defaults;
284
285
  }
285
286
  </code></pre>
286
287
 
@@ -328,12 +329,12 @@ second =&gt; 11:59:22
328
329
  The interval notches date spans themselves can be customized by using the <code>-i</code> flag when generating a timeline. The available parameters are</p>
329
330
 
330
331
  <pre><code>Decade
331
- Lustrum
332
+ Lustrum
332
333
  FullYear
333
334
  Month
334
- Week
335
- Date
336
- Hours
335
+ Week
336
+ Date
337
+ Hours
337
338
  Minutes
338
339
  Seconds
339
340
  </code></pre>
@@ -345,7 +346,7 @@ Seconds
345
346
  <p>As of version 0.3.0, TimelineSetter has a JavaScript API that allows programmatic access to certain events, and the ability to activate cards. To use the API, assign the <code>TimelineSetter.Timeline.boot()</code> function to a variable, and then use methods in the <code>api</code> object like so:</p>
346
347
 
347
348
  <pre><code>var currentTimeline = TimelineSetter.Timeline.boot(options);
348
- currentTimeline.api.onLoad(function() {
349
+ currentTimeline.api.onLoad(function() {
349
350
  console.log("I'm ready")
350
351
  });
351
352
  </code></pre>
@@ -360,11 +361,14 @@ currentTimeline.api.onLoad(function() {
360
361
 
361
362
  <p>Register a callback for when a card is added to the timeline. This method has access to the event name and the card object.</p>
362
363
 
363
- <pre><code>currentTimeline.api.onCardAdd(function(evtName, obj) {
364
+ <pre><code>currentTimeline.api.onCardAdd(function(evtName, obj, card) {
364
365
  console.log(obj);
366
+ console.log(card);
365
367
  });
366
368
  </code></pre>
367
369
 
370
+ <p>If you want to customize the card&rsquo;s template, set <code>card.template</code> to an undescore template function.</p>
371
+
368
372
  <h3>onCardActivate</h3>
369
373
 
370
374
  <p>Register a callback for when a card is activated (i.e. shown). This method has access to the event name and the card object.</p>
@@ -397,14 +401,25 @@ Feb. 21, 1952 and Jan. 26, 1957, as shown
397
401
  </ul>
398
402
 
399
403
 
400
- <p><a id="links"></a></p>
404
+ <p><a id="orgs"></a></p>
401
405
 
402
- <h2>Links</h2>
406
+ <h2>Media Organizations Using TimelineSetter</h2>
403
407
 
404
408
  <ul>
405
- <li>In the Wild: <a href="http://www.propublica.org/special/tbi-psycho-platoon-timeline">ProPublica: How One Blast Affected Five Soldiers</a></li>
406
- <li>In the Wild: <a href="http://www.talkingpointsmemo.com/interactive/2011/04/the-wisconsin-union-struggle-timeline.php">TPM: The Wisconsin Union Struggle Timeline</a></li>
407
- <li>In the Wild: <a href="http://timelines.latimes.com/bell/">Los Angeles Times: Bell: &lsquo;Corruption on Steroids&rsquo;</a></li>
409
+ <li><a href="http://www.propublica.org/special/tbi-psycho-platoon-timeline">ProPublica</a></li>
410
+ <li><a href="http://timelines.latimes.com/bell/">Los Angeles Times</a></li>
411
+ <li><a href="http://www.chicagotribune.com/news/local/chi-taxi-ts-docs-20111118,0,3641202.htmlstory">Chicago Tribune</a></li>
412
+ <li><a href="http://www.huffingtonpost.com/2011/09/09/ground-zero-world-trade-center-freedom-tower_n_955845.html">Huffington Post</a></li>
413
+ <li><a href="http://www.talkingpointsmemo.com/interactive/2011/04/the-wisconsin-union-struggle-timeline.php">Talking Points Memo</a></li>
414
+ <li><a href="http://www.minnpost.com/bachmanntimeline/">MinnPost</a></li>
415
+ <li><a href="http://www.jsonline.com/news/129159038.html">Milwaukee Journal-Sentinel</a></li>
416
+ <li><a href="http://www.wnyc.org/articles/its-free-country/2011/may/20/timeline-gay-marriage-nystate/">WNYC</a></li>
417
+ <li><a href="http://www.artinfo.com/news/story/37506/getting-to-know-ai-weiwei-a-multimedia-biographical-timeline/">ArtInfo</a></li>
418
+ <li><a href="http://www.globalnews.ca/afghanistan/timeline/index.html?utm_source=facebook-twitter&amp;utm_medium=link&amp;utm_campaign=community">Global TV News (Canada)</a></li>
419
+ <li><a href="http://www.pbs.org/newshour/timeline/uprising/">PBS Newshour</a></li>
420
+ <li><a href="http://www.marketplace.org/topics/economy/raising-debt-ceiling">American Public Media: Marketplace</a></li>
421
+ <li><a href="http://blog.chron.com/rickperry/timeline-the-rise-of-rick-perry/">San Antonio Express-News</a></li>
422
+ <li><a href="http://www.voanews.com/english/news/asia/southeast/Burma-Timeline-134760588.html#1183262400000-">Voice of America</a></li>
408
423
  </ul>
409
424
 
410
425
 
@@ -426,6 +441,18 @@ questions should go to <a href="mailto:opensource@propublica.org">opensource@pro
426
441
 
427
442
  <h2>Change Log</h2>
428
443
 
444
+ <p><a id="release-031"></a></p>
445
+
446
+ <h3>0.3.1</h3>
447
+
448
+ <ul>
449
+ <li>Fix position bug that was preventing card flipping in IE &lt;= 8</li>
450
+ <li>Add <code>noscript</code> fallback</li>
451
+ <li>Add Century, HalfCentury, Quincenenary, HalfHour, QuarterHour, Millenium intervals</li>
452
+ <li>Fix CLI in cases where output directory already exists</li>
453
+ </ul>
454
+
455
+
429
456
  <p><a id="release-030"></a></p>
430
457
 
431
458
  <h3>0.3.0</h3>
@@ -69,12 +69,13 @@ module TimelineSetter
69
69
  def outdir
70
70
  @options[:output] ? @options[:output] : "#{`pwd`.strip}/"
71
71
  end
72
-
72
+
73
73
  def timeline_page_path
74
74
  File.join(outdir, 'timeline.html')
75
75
  end
76
76
 
77
77
  def compile!
78
+ FileUtils.mkdir_p outdir unless File.exists? outdir
78
79
  if !@options[:no_assets] || !@options[:min]
79
80
  FileUtils.cp_r(Dir.glob("#{TimelineSetter::ROOT}/public/*"), outdir)
80
81
  # Concatenate JSTs to timeline-setter.js and remove templates.js
@@ -38,7 +38,7 @@ module TimelineSetter
38
38
  def timeline_min
39
39
  @js = ""
40
40
  @css = Kompress::CSS.new(File.open("#{TimelineSetter::ROOT}/public/stylesheets/timeline-setter.css").read).css
41
- libs = Dir.glob("#{TimelineSetter::ROOT}/public/javascripts/vendor/**")
41
+ libs = Dir.glob("#{TimelineSetter::ROOT}/public/javascripts/vendor/**").select {|q| q =~ /min/ }
42
42
  libs.each { |lib| @js << File.open(lib,'r').read }
43
43
  @min_html = Kompress::HTML.new(timeline_markup).html
44
44
  @js << File.open("#{TimelineSetter::ROOT}/public/javascripts/timeline-setter.min.js", 'r').read
@@ -1,3 +1,3 @@
1
1
  module TimelineSetter
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end