timeline_setter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.document +4 -0
  2. data/LICENSE.txt +18 -0
  3. data/README +15 -0
  4. data/Rakefile +98 -0
  5. data/bin/timeline-setter +9 -0
  6. data/doc/doc.markdown +253 -0
  7. data/doc/doc_wrapper.erb +87 -0
  8. data/doc/docco.css +186 -0
  9. data/doc/timeline-setter.html +592 -0
  10. data/doc/todo.markdown +28 -0
  11. data/doc/twitter-demo.html +122 -0
  12. data/documentation/TimelineSetter/CLI.html +575 -0
  13. data/documentation/TimelineSetter/Parser.html +285 -0
  14. data/documentation/TimelineSetter/Timeline.html +513 -0
  15. data/documentation/TimelineSetter/Util.html +246 -0
  16. data/documentation/TimelineSetter.html +112 -0
  17. data/documentation/_index.html +132 -0
  18. data/documentation/class_list.html +36 -0
  19. data/documentation/css/common.css +1 -0
  20. data/documentation/css/full_list.css +53 -0
  21. data/documentation/css/style.css +318 -0
  22. data/documentation/file.README.html +70 -0
  23. data/documentation/file_list.html +38 -0
  24. data/documentation/frames.html +13 -0
  25. data/documentation/index.html +70 -0
  26. data/documentation/js/app.js +203 -0
  27. data/documentation/js/full_list.js +149 -0
  28. data/documentation/js/jquery.js +16 -0
  29. data/documentation/method_list.html +155 -0
  30. data/documentation/top-level-namespace.html +88 -0
  31. data/index.html +397 -0
  32. data/lib/timeline_setter/cli.rb +85 -0
  33. data/lib/timeline_setter/parser.rb +28 -0
  34. data/lib/timeline_setter/timeline.rb +44 -0
  35. data/lib/timeline_setter/version.rb +3 -0
  36. data/lib/timeline_setter.rb +22 -0
  37. data/public/javascripts/timeline-setter.js +822 -0
  38. data/public/javascripts/vendor/jquery-min.js +16 -0
  39. data/public/javascripts/vendor/underscore-min.js +26 -0
  40. data/public/stylesheets/timeline-setter.css +396 -0
  41. data/spec/spec_helper.rb +10 -0
  42. data/spec/test_data.csv +4 -0
  43. data/spec/timeline_setter_spec.rb +85 -0
  44. data/templates/timeline-markup.erb +61 -0
  45. data/templates/timeline-min.erb +1 -0
  46. data/templates/timeline.erb +12 -0
  47. data/timeline_setter.gemspec +104 -0
  48. metadata +189 -0
data/doc/todo.markdown ADDED
@@ -0,0 +1,28 @@
1
+ # TimelineSetter ToDo
2
+
3
+
4
+ ## Blockers
5
+
6
+ * ie
7
+ * add one-file minified option in timeline-setter binary
8
+ * docs & docco comments
9
+ * scope events
10
+ * Prettify cases with large numbers of series (they should stack up along the left)
11
+
12
+ ## Features
13
+
14
+ * zoom to fit by series
15
+ * autoresize
16
+ * wider touch targets
17
+ * pinch
18
+ * generate from google spreadsheets key instead of local csv
19
+
20
+ ## Refactor
21
+
22
+
23
+
24
+ ## Bugs
25
+
26
+ * Refactor single classes: .timeline\_notchbar should be #timeline_notchbar
27
+ * center zooming if no card selection (now it falls back to 0)
28
+ * only show scrubbing cursor if you're zoomed in
@@ -0,0 +1,122 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link href="http://propublica.github.com/timeline-setter/public/stylesheets/timeline-setter.css" rel="stylesheet" />
5
+ <script src="http://propublica.github.com/timeline-setter/public/javascripts/vendor/jquery-min.js"></script>
6
+ <script src="http://propublica.github.com/timeline-setter/public/javascripts/vendor/underscore-min.js"></script>
7
+ <script src="http://propublica.github.com/timeline-setter/public/javascripts/timeline-setter.js"></script>
8
+ <script src="https://github.com/bcherry/twitter-text-js/raw/master/twitter-text.js"></script>
9
+ <style>
10
+ #timeline_setter .TS-item_label a {
11
+ color:#2262CC;
12
+ }
13
+ #timeline_setter .TS-item_label a:hover {
14
+ text-decoration:underline;
15
+ }
16
+ </style>
17
+ </head>
18
+ <body style="height: 100%">
19
+
20
+ <div id="timeline_setter">
21
+ <div id="TS-top_matter_container">
22
+ <div class="TS-controls">
23
+ <a href="#" class="TS-zoom TS-zoom_in"><span class="TS-controls_inner_text TS-zoom_inner_text">+</span></a>
24
+ <a href="#" class="TS-zoom TS-zoom_out"><span class="TS-controls_inner_text TS-zoom_inner_text">-</span></a>
25
+ &nbsp;&nbsp;&nbsp;&nbsp;
26
+ <a href="#" class="TS-choose TS-choose_prev">&laquo; <span class="TS-controls_inner_text">Previous</span></a>
27
+ <a href="#" class="TS-choose TS-choose_next"><span class="TS-controls_inner_text">Next</span> &raquo;</a>
28
+ </div>
29
+ <div class="TS-series_nav_container"></div>
30
+ </div>
31
+
32
+ <div class="TS-notchbar_container">
33
+ <div class="TS-notchbar"></div>
34
+ </div>
35
+ <div id="TS-card_scroller">
36
+ <div id="TS-card_scroller_inner">
37
+ </div>
38
+ </div>
39
+ </div>
40
+
41
+ <script type="text/javascript">
42
+ $(function() {
43
+ var reqsDone = 0;
44
+ var usernames = ['propublica', 'nytimes', 'latimes', 'tpm'];
45
+ var tsTimeline = [];
46
+
47
+ var getTwitter = function(username) {
48
+ $.getJSON("http://api.twitter.com/1/statuses/user_timeline.json?callback=?", {screen_name : username, count : 10}, function(data) {
49
+ twitterToTS(data);
50
+ reqsDone += 1;
51
+ if (reqsDone === usernames.length)
52
+ TimelineSetter.Timeline.boot(tsTimeline);
53
+ });
54
+ };
55
+
56
+ var twitterToTS = function(data) {
57
+ _(data).each(function(item) {
58
+ var datum = {};
59
+ datum['timestamp'] = Date.parse(item['created_at']);
60
+ datum['date'] = item['created_at'];
61
+ datum['display_date'] = humanDate(datum['timestamp']);
62
+ datum['description'] = twttr.txt.autoLink(item['text']);
63
+ datum['link'] = "http://twitter.com/" + item['user']['screen_name'] + '/status/' + item['id_str'];
64
+ datum['series'] = item['user']['screen_name'];
65
+ tsTimeline.push(datum);
66
+ });
67
+ };
68
+
69
+ var humanDate = function(timestamp) {
70
+ var d = new Date(timestamp);
71
+ var bigHours = d.getHours() > 12;
72
+ var isPM = d.getHours() >= 12;
73
+ var strDate = (d.getMonth() + 1) + '/' + d.getDate() + ", "
74
+ var strTime = (bigHours ? d.getHours() - 12 : (d.getHours() > 0 ? d.getHours() : "12")) + ":" + padNumber(d.getMinutes()) + " " + (isPM ? 'p.m.' : 'a.m.');
75
+ return strDate + strTime;
76
+ };
77
+
78
+ var padNumber = function(number) {
79
+ return (number < 10 ? '0' : '') + number;
80
+ };
81
+
82
+ _(usernames).each(getTwitter);
83
+ });
84
+ </script>
85
+ <script id="TS-year_notch_tmpl" type="text/jst">
86
+ <div class="TS-year_notch TS-year_notch_<%= timestamp %>">
87
+ <span class="TS-year_notch_year_text"><%= human %></span>
88
+ </div>
89
+ </script>
90
+ <script id="TS-notch_tmpl" type="text/jst">
91
+ <div class="TS-notch TS-notch_<%= timestamp %> TS-notch_<%= series.replace(/\W/, "") %> TS-notch_color_<%= topcolor %>"></div>
92
+ </script>
93
+ <script id="TS-series_legend_tmpl" type="text/jst">
94
+ <div class="TS-series_legend_item TS-series_legend_item<%= name.replace(/\W/, "") %>">
95
+ <span class="TS-series_legend_swatch TS-series_legend_swatch_<%= color %>">&nbsp;</span> <span class="TS-series_legend_text"><%= name %></span>
96
+ </div>
97
+ </script>
98
+ <script id="TS-card_tmpl" type="text/jst">
99
+ <div class="TS-card_container TS-card_container_<%= (card.get("series") || "").replace(/\W/, "") %>">
100
+ <div class="TS-css_arrow TS-css_arrow_up TS-css_arrow_color_<%= card.get("topcolor") %>"></div>
101
+ <div class="TS-item TS-item_color_<%= card.get("topcolor") %>" data-timestamp="<%= card.get("timestamp") %>">
102
+ <div class="TS-item_label">
103
+ <% if (!_.isEmpty(card.get("html"))){ %>
104
+ <div class="TS-item_user_html">
105
+ <%= card.get("html") %>
106
+ </div>
107
+ <% } %>
108
+ <%= card.get("description") %>
109
+ </div>
110
+ <% if (!_.isEmpty(card.get("link"))){ %>
111
+ <div class="TS-read_btn"><a target="_blank" href="<%= card.get("link") %>">Read More</a></div>
112
+ <% } %>
113
+
114
+ <div class="TS-item_year">
115
+ <span class="TS-item_year_text"><%= (card.get("display_date") || "").length > 0 ? card.get("display_date") : card.get("date") %></span>
116
+ <div class="TS-permalink">&#8734;</div>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </script>
121
+ </body>
122
+ </html>