forked from cutting-room-floor/tutorial-sherlock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
185 lines (156 loc) · 8.43 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
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'/>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src='http://underscorejs.org/underscore-min.js'></script>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
<!--<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet'/> -->
<!--can't quite work -->
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
<script>
mapbox.auto('map', 'codeforamerica.map-ht6lb7bx');
</script>
<!--stylesheet-->
<link href='stylesheet.css' rel="stylesheet" type="text/css">
</head>
<body class='section-0'>
<div id='pane'><div id='map'></div></div>
<article>
<section id='cover' class='cover active'>
<h1>Adventure on the Towpath</h1>
<p>by ?</p>
<small class='scroll'>Scroll ▼</small>
</section>
<section id='baker'>
<h2>Station Road Bridge Trailhead</h2>
<p>Begin your journey here. Hop on the towpath from this trailhead.</p>
</section>
<section id='aldgate'>
<h2>The Boston Store Visitor Center</h2>
<p>Arthur Cadogan West was found dead, head crushed in on train tracks at Aldgate Station at 6AM Tuesday morning. West worked at Woolwich Arsenal on the Bruce-Partington submarine, a secret military project. Plans for the submarine had been stolen and seven of the ten missing papers were found in West's possession. Mycroft implores Sherlock to take the case and recover the three missing papers.</p>
</section>
<section id='london-bridge'>
<h2>London Bridge</h2>
<p>Holmes and Watson's investigations take them across London. Sherlock deduces that West was murdered elsewhere, then moved to Aldgate Station to create the illusion that he was crushed on the tracks by a train. On their way to Woolwich Sherlock dispatches a telegram to Mycroft at London Bridge: "Send list of all foreign spies known to be in England, with full address."</p>
</section>
<section id='woolwich'>
<h2>Woolwich Arsenal</h2>
<p>While investigating at Woolwich Arsenal Sherlock learns that West did not have the three keys—door, office, and safe—necessary to steal the papers. The train station clerk mentions seeing an agitated West boarding the 8:15 train to London Bridge. Sherlock suspects West of following someone who had access to the Woolwich chief's keyring with all three keys.</p>
</section>
<section id='gloucester'>
<h2>Gloucester Road</h2>
<p>Mycroft responds to Sherlock's telegram and mentions several spies. Hugo Oberstein of 13 Caulfield Gardens catches Sherlock's eye. He heads to the nearby Gloucester Road station to investigate and learns that the windows of Caulfield Gardens open over rail tracks where trains stop frequently.</p>
</section>
<section id='caulfield-gardens'>
<h2>13 Caulfield Gardens</h2>
<p>Holmes deduces that the murderer placed West atop a stopped train at Caulfield Gardens. The train traveled to Aldgate Station before West's body finally toppled off. Backtracking to the criminal's apartment, Holmes finds a series of classified ads from <em>The Daily Telegraph</em> stashed away. All are under the name Pierrot: "Monday night after nine. Two taps. Only ourselves. Do not be so suspicious. Payment in hard cash when goods delivered."</p>
</section>
<section id='telegraph'>
<h2>The Daily Telegraph</h2>
<p>Holmes and Watson head to The Daily Telegraph and place an ad to draw out the criminal. It reads: "To-night. Same hour. Same place. Two taps. Most vitally important. Your own safety at stake. Pierrot." The trap works and Holmes catches the criminal: Colonel Valentine Walter, the brother of Woolwich Arsenal's chief. He confesses to working for Hugo Oberstein to obtain the submarine plans in order to pay off his debts.</p>
</section>
<section id='charing-cross'>
<h2>Charing Cross Hotel</h2>
<p>Walter writes to Oberstein and convinces him to meet in the smoking room of the Charing Cross Hotel where he promises additional plans for the submarine in exchange for money. The plan works and Holmes and Watson catch both criminals.</p>
<small class='colophon'>
Adapted from <a href='http://www.gutenberg.org/files/2346/2346-h/2346-h.htm'>Project Gutenberg</a><br/>
Map data © <a href='http://openstreetmap.org/copyright'>OpenStreetMap Contributors</a><br/>
Map design © <a href='http://mapbox.com/about/maps/'>MapBox</a>
</small>
</section>
</article>
<script>
var geojson = [
{ "geometry": { "type": "Point", "coordinates": [-81.592026, 41.191926] },
"properties": { "id": "cover", "zoom": 11 } },
{ "geometry": { "type": "Point", "coordinates": [-81.570826, 41.279983] },
"properties": { "id": "baker", "zoom": 15 } },
{ "geometry": { "type": "Point", "coordinates": [-81.559281, 41.263074] },
"properties": { "id": "aldgate", "zoom": 15 } },
{ "geometry": { "type": "Point", "coordinates": [-81.548660, 41.241691] },
"properties": { "id": "london-bridge", "zoom": 18 } },
{ "geometry": { "type": "Point", "coordinates": [-81.518249, 41.091926] },
"properties": { "id": "woolwich", "zoom": 15 } },
{ "geometry": { "type": "Point", "coordinates": [-81.523801, 41.077467] },
"properties": { "id": "gloucester", "zoom": 18 } },
{ "geometry": { "type": "Point", "coordinates": [-81.522031, 41.076642] },
"properties": { "id": "caulfield-gardens", "zoom": 18 } },
{ "geometry": { "type": "Point", "coordinates": [-81.519842, 41.080431] },
"properties": { "id": "telegraph", "zoom": 18 } },
{ "geometry": { "type": "Point", "coordinates": [-81.548660, 41.241691] },
"properties": { "id": "charing-cross", "zoom": 18 } }
];
var tiles = mapbox.layer().tilejson({
tiles: [ "http://a.tiles.mapbox.com/v3/examples.map-ht61b7bx/{z}/{x}/{y}.png" ]
});
var spots = mapbox.markers.layer()
// Load up markers from geojson data.
.features(geojson)
// Define a new factory function. Takes geojson input and returns a
// DOM element that represents the point.
.factory(function(f) {
var el = document.createElement('div');
el.className = 'spot spot-' + f.properties.id;
return el;
});
// Creates the map with tile and marker layers and
// no input handlers (mouse drag, scrollwheel, etc).
var map = mapbox.auto('map', 'codeforamerica.map-ht61b7bx' [tiles, spots], null, []);
// Array of story section elements.
var sections = document.getElementsByTagName('section');
// Array of marker elements with order matching section elements.
var markers = _(sections).map(function(section) {
return _(spots.markers()).find(function(m) {
return m.data.properties.id === section.id;
});
});
// Helper to set the active section.
var setActive = function(index, ease) {
// Set active class on sections, markers.
_(sections).each(function(s) { s.className = s.className.replace(' active', '') });
_(markers).each(function(m) { m.element.className = m.element.className.replace(' active', '') });
sections[index].className += ' active';
markers[index].element.className += ' active';
// Set a body class for the active section.
document.body.className = 'section-' + index;
// Ease map to active marker.
if (!ease) {
map.centerzoom(markers[index].location, markers[index].data.properties.zoom||14);
} else {
map.ease.location(markers[index].location).zoom(markers[index].data.properties.zoom||14).optimal(0.5, 1.00);
}
return true;
};
// Bind to scroll events to find the active section.
window.onscroll = _(function() {
// IE 8
if (window.pageYOffset === undefined) {
var y = document.documentElement.scrollTop;
var h = document.documentElement.clientHeight;
} else {
var y = window.pageYOffset;
var h = window.innerHeight;
}
// If scrolled to the very top of the page set the first section active.
if (y === 0) return setActive(0, true);
// Otherwise, conditionally determine the extent to which page must be
// scrolled for each section. The first section that matches the current
// scroll position wins and exits the loop early.
var memo = 0;
var buffer = (h * 0.3333);
var active = _(sections).any(function(el, index) {
memo += el.offsetHeight;
return y < (memo-buffer) ? setActive(index, true) : false;
});
// If no section was set active the user has scrolled past the last section.
// Set the last section active.
if (!active) setActive(sections.length - 1, true);
}).debounce(10);
// Set map to first section.
setActive(0, false);
</script>
</body>
</html>