-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
272 lines (198 loc) · 10.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<!-- !DOCTYPE html -->
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<!-- requirements: -->
<script src="javascripts/jquery-1.4.2.js"></script>
<script src="javascripts/jquery-ui-1.8.custom.min.js"></script>
<!-- using this for demo, just to do tooltip pop-ups a la Simile in horizontal layout. -->
<script src="javascripts/jquery.tools.min.js"></script>
<!-- now load Chronos: -->
<script src="javascripts/chronos/jquery.chronos.js"></script>
<!-- ...and the necessary CSS -->
<link media="all" type="text/css" href="javascripts/chronos/timeline.css" rel="Stylesheet" charset="utf-8" />
<link media="all" type="text/css" href="javascripts/ui-lightness/jquery-ui-1.7.2.custom.css" rel="Stylesheet" charset="utf-8" />
<style>
body {
color: #4a5584;
font-size: 14px;
font-family: helvetica, arial, sans-serif;
}
</style>
<script>
$(window).load(
function() {
var chronos_config = {
orientation: 'vertical',
startID: 3932,
mapTags: true,
url: 'http://slebinos.mit.edu/dev/repertoire-chronos/',
/* would like to get this sort of thing working at some point:
http://api.flickr.com/services/feeds/photos_public.gne?tags=water&lang=en-us&format=json
// Data vals
data_start: 'items',
data_url: 'http://slebinos.mit.edu/dev/repertoire-chronos/json.php?url=http%3A%2F%2Fapi.flickr.com%2Fservices%2Ffeeds%2Fphotos_public.gne%3Ftags%3Dwater%26lang%3Den-us%26format%3Djson',
date_name: 'date_taken',
id_name: 'link',
title_name: 'title',
*/
js_path: 'javascripts/'
};
var URLString = document.location.toString(); // Have to do this so we can run .match() on it...?
var data_url = false;
// http://spreadsheets.google.com/feeds/list/tXTRNT-JFvyfpFoybaHhltw/1/public/basic?alt=json
// Really basic check to make sure we've got a google URL and not something else...not rigorous, but will do for demo.
//if (URLString.match('spreadsheets.google.com') && URLString.match('gs_url=(.*?)&')) {
if (!chronos_config.data_url) {
if (URLString.match('gs_url=(.*?)&')) {
var matches = URLString.match('gs_url=(.*?)&')
chronos_config['data_url'] = decodeURIComponent(matches[1]);
chronos_config['data_start'] = 'feed.entry';
chronos_config['date_name'] = 'content.$t.start';
chronos_config['id_name'] = 'content.$t.eventid';
chronos_config['title_name'] = 'title.$t';
chronos_config['startID'] = null;
chronos_config['mapTags'] = false;
/*
} else if (URLString.match('gs_url=(.*?)&')) {
alert("I'm sorry, the URL must be a Google spreadsheets URL. See below for formatting instructions. (Reverting to default data-set.)");
chronos_config['data_url'] = 'http://slebinos.mit.edu/dev/repertoire-chronos/json.php?url=http%3A%2F%2Fslebinos.mit.edu%2Fus-iran%2Fevents.js%3Fs%3D1910-01-01%26e%3D2000-12-31';
chronos_config['tag_name'] = 'tags';
*/
} else {
chronos_config['data_url'] = 'http://slebinos.mit.edu/dev/repertoire-chronos/json.php?url=http%3A%2F%2Fslebinos.mit.edu%2Fus-iran%2Fevents.js%3Fs%3D1910-01-01%26e%3D2000-12-31';
chronos_config['tag_name'] = 'tags';
}
}
if (URLString.match('start_date=(.*?)&')) {
var matches = URLString.match('start_date=(.*?)&')
var spaced_date = decodeURIComponent(matches[1]).replace(/\+/g, ' ');
if ( spaced_date.match(/[a-zA-Z]{3} [0-9]{2}, [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}/) ) {
chronos_config['startDate'] = spaced_date;
}
}
if (URLString.match('start_id=(.*?)&')) {
var matches = URLString.match('start_id=(.*?)&')
if ( decodeURIComponent(matches[1]).match(/[0-9]*/) ) {
chronos_config['startID'] = decodeURIComponent(matches[1]).match(/[0-9]*/);
}
}
$('input#horiz').click(function() {
chronos_config['orientation'] = 'horizontal';
$('#chronos').chronos(chronos_config);
return false;
});
$('input#vert').click(function() {
chronos_config['orientation'] = 'vertical';
$('#chronos').chronos(chronos_config);
return false;
});
$('#chronos').chronos(chronos_config);
$("div#data_config").hide();
$('p#try_data').toggle(
function () { $("div#data_config").slideDown(); },
function () { $("div#data_config").slideUp(); }
);
if (chronos_config.orientation == 'horizontal') {
// Demoing tooltip (jQuery Tools)
//$("#timelineYears img.eDot").tooltip({
$("img.eDot").tooltip({
// events: { def: "click, mouseout" }, // There's probably a way to get it to close if you click outside, but will require more coding which isn't worth it just yet...
opacity: 0.65,
// tweak the position
offset: [10, 2],
// use the "slide" effect
effect: 'toggle'
// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: false } });
}
}
);
</script>
<title>
Repertoire Chronos Demo
</title>
</head>
<body>
<!-- BEGIN HTML CODE FOR THE TIMELINE -->
<!-- if I want to prevent 'flopping' in all situations...set height/width (depending on orientation--width for vertical orientation, for example) -->
<div id='container'>
<div id="chronos" class="panelResize"></div>
<!-- END HTML CODE FOR THE TIMELINE -->
<div id="gs">
<h2>HyperStudio's Chronos Timeline</h2>
<p><a href="http://hyperstudio.mit.edu/software/repertoire/chronos/">http://hyperstudio.mit.edu/software/repertoire/chronos/</a></p>
<p id='try_data'>To try your own data set, click here:</p>
<div id="data_config">
<form id='gs' name='gs' action='' method='GET'>
<p>Enter your Google Spreadsheet URL here to see your data in the Chronos timeline:<br />
(for an example, try:<br />
<a href="http://spreadsheets.google.com/feeds/list/tXTRNT-JFvyfpFoybaHhltw/1/public/basic?alt=json">http://spreadsheets.google.com/feeds/list/tXTRNT-JFvyfpFoybaHhltw/1/public/basic?alt=json</a></p>
URL:
<input type='text' id='gs_field' value='' name='gs_url' size='100' /><br />
Start date (formatted like "Jan 01, 1960 00:00:00"):
<input type='text' id='date_field' value='' name='start_date' size='50' /><br />
Start ID:
<input type='text' id='startID_field' value='' name='start_id' size='10' /><br />
<input type='submit' id='gs_submit' name='gs_submit' value='Update' /><br />
</form>
<p>Note that this application expects three fields (column names) to be present in your spreadsheet:</p>
<ul>
<li>- start (the field containing the datetime information)</li>
<li>- eventid (an arbitrary numeric identifier)</li>
<li>- title (title or description of datetime event)</li>
</ul>
<p>For more details on formatting your spreadsheet and generating a URL, see here.</p>
</div>
<div id='chronos_tags'></div>
</div>
<!--
<div id="dataMonitor">
<!--
<div id="thisWidgetTopStuff"><span class='dataTitle'>Currently dragged widget top-related data: </span><span class='data'>0<span></div>
<div id="secondsToPixels"><span class='dataTitle'>secondsToPixels (currently dragged widget): </span><span class='data'>0<span></div>
<div id="dragChange"><span class='dataTitle'>dragChange: </span><span class='data'>0<span></div>
<div id="secondsMoved"><span class='dataTitle'>secondsMoved: </span><span class='data'>0<span></div>
<div id="pixelsToMove">
<span class='dataTitle'>pixelsToMove: </span><span class='data'>0<span>
</div>
<div id="stpSetting"><span class='dataTitle'>Setting seconds to pixels, what's up?</span><span class='data'></span></div>
<div id="newStp1"><span class='dataTitle'></span><span class='data'></span></div>
<div id="newStp2"><span class='dataTitle'></span><span class='data'></span></div>
<div id="newStp3"><span class='dataTitle'></span><span class='data'></span></div>
<div id="newStp4"><span class='dataTitle'></span><span class='data'></span></div>
<div id="scalerPosDebug"><span class='dataTitle'>Scaler Pos Debugging:</span><span class='data'></span></div>
<div id="dates"><span class='dataTitle'>Dates:</span><span class='data'></span></div>
-->
<!--
<div id="dragtype"><span class='dataTitle'>Scaler Drag type: </span><span class='data'></span></div>
<div id="initial"><span class='dataTitle'>INITIAL Scaler View Widget data: </span><span class='data'></span></div>
<div id="stpOld"><span class='dataTitle'>Old STP for Scaler View Widget: </span><span class='data'></span></div>
-->
<!--
<div id="centerSetDump"><span class='dataTitle'>Center set dump: </span><span class='data'></span></div>
-->
<!--
<div id="changingStp"><span class='dataTitle'>Changing STP? </span><span class='data'></span></div>
<div id="stpNew"><span class='dataTitle'>New STP for Scaler View Widget: </span><span class='data'></span></div>
<div id="preResize"><span class='dataTitle'>Pre-resize data: </span><span class='data'></span></div>
<div id="postResize"><span class='dataTitle'>Post-resize Widget data: </span><span class='data'></span></div>
<div id="mousePos"><span class='dataTitle'>Mouse POS data: </span><span class='data'></span></div>
<div id="svw"><span class='dataTitle'>Post-resetting newTop data: </span><span class='data'></span></div>
<div id="newtop"><span class='dataTitle'>Setting new top on SVW to:</span><span class='data'></span></div>
-->
<!-- div id="ow"><span class='dataTitle'>Other Widget data:</span><span class='data'></span></div -->
<!--
<div id="dates"><span class='dataTitle'>Dates:</span><span class='data'></span></div>
-->
<!--
<div id="eventListing"><span class='dataTitle'>Selected Event:</span><span class='data'></span></div>
<div id="debug"></div>
-->
<!--
</div>
-->
<div class='clear'></div>
</div>
</body>
</html>