forked from jlord/hack-spots
/
index.html
245 lines (212 loc) · 13.3 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
<html>
<head>
<title>Hockey Shrines</title>
<meta charset='utf-8'>
<script type="text/javascript" src='js/jquery.js '></script>
<script type="text/javascript" src='js/tabletop1.3.4.js'></script>
<script type="text/javascript" src='js/sheetsee.js'></script>
<script type="text/javascript" src='js/leaflet.markercluster.js'></script>
<link rel="shortcut icon" href="https://raw.github.com/laurenarcher/hockey-shrines/master/favico.png"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel='stylesheet' />
<link href='https://fonts.googleapis.com/css?family=Limelight|Oxygen' rel='stylesheet' type='text/css'>
<link media="screen" rel="stylesheet" type="text/css" href="css/style.css">
<link media="screen" rel="stylesheet" type="text/css" href="css/site.css">
<link rel="stylesheet" href="css/MarkerCluster.css" />
<link rel="stylesheet" href="css/MarkerCluster.Default.css" />
</head>
<body>
<div id="wrapper">
<h1><a href = "http://hockeyshrines.ca"><img src="hs.png" alt="Hockey Shrine" height="100" width="auto"> Hockey Shrines</h1></a>
<div>
<ul class="nav">
<li><strong>Honouring our Hockey Heroes</strong></li>
<li><a href="#info">INFO</a> -</li>
<li><a href="#contribute">CONTRIBUTE!</a> -</li>
<li><a href="https://www.facebook.com/groups/1697013783916828/" target="_blank">FACEBOOK GROUP</a> -</li>
<li><a href="http://www.github.com/laurenarcher/hockey-shrines" target="_blank">GITHUB</a> -</li>
<li><a href="http://www.twitter.com/laurenarcher" target="_blank">@LAURENARCHER</a> -</li>
<li><a href="https://translate.google.com/translate?hl=en&sl=auto&tl=fr&u=http%3A%2F%2Fhockeyshrines.ca" target="_blank">Français</a></li>
</ul>
</div>
<div class="container">
<div id="rightSide">
<div id="latestSpot"></div>
<div id="selectedSpot"></div>
</div>
<div id="map"></div>
</div>
<div class="container">
<input id="tableFilter" type="text" placeholder="filter by.."></input>
<span class="clear button">Clear</span> <span class="resetMap button">Reset Map</span>
<span class="noMatches">no matches</span>
<div id="hackSpotsTable"></div>
</div>
<div id="info" class="container">
<h3>Info</h3>
<p>It seems like every community in Canada has its Hockey Heroes: The people who have made it big in Canada's official winter sport.</p>
<p>These heroes might be local hockey players who have brought home the Stanley Cup or who have won Olympic Gold. They might also be the coaches who have inspired us, the presenters who have entertained us, or one of the many people who have dedicated their lives to organizing leagues and introducing new players to the sport.</p>
<p>These people have left a lasting mark on our communities. Growing up, we heard their stories and read about their accomplishments on the walls and in the trophy cases of our local arenas.</p>
<p><a href = "http://www.theglobeandmail.com/news/national/tiny-towns-big-hockey-heroes/article709827/">Hockey Shrines come in many forms: </a>Plaques, billboards, trophies, statues, signs on the highway and even museum exhibits.</p>
<p>They are, very possibly, a uniquely Canadian phenomenon, our way of commemorating the folks who we are most proud of. These artifacts not only tell the history of our communities, but they also teach us about the importance of hockey to Canadian culture and identity.</p>
<p><a href = "http://hockeyshrines.ca">Hockey Shrines</a> is a community heritage mapping project that aspires to map and photograph these monuments, many of them located in small rural towns spread all across the country.</p>
<p>No matter what form they come in, Hockey Shrines are an important cultural heritage resource that remind us that all communities, big or small, are capable of greatness.</p>
<h3 id = "contribute">Contribute!</h3>
<div id="theNumberofSpots"></div>
<p>Do you know of an interesting or important hockey shrine in your community? Add it to our map!</p>
<p> It's very easy, just fill out this form:</p>
<div id = "frame">
<iframe src="https://docs.google.com/forms/d/1nWiBlSJRmwEKLC49khnAzgGGSpC39N3wwjavS_Na_tQ/viewform?embedded=true#start=embed" width="700" height="1650" frameborder="0" marginheight="0" marginwidth="0" marginbottom="24px">Loading...</iframe>
</div>
<h3>About Me</h3>
<p>This project was started by <a href="http://lraheritage.com" target="_blank">Lauren Archer</a>, a Cultural Heritage Specialist, historic preservationist and maker who lives in Palmerston, Ontario. She has a special interest in using technology to map and identify cultural heritage landscapes. She is also mildy obsessed with hockey and its role in Canadian life, just like everybody else. Right?</p>
<h3>Fork-n-Go</h3>
<p>This project was built using the fantastic <a href="http://jlord.github.io/sheetsee.js" target="_blank">sheetsee.js</a>, which is a JavaScript library built by <a href="http://jlord.github.io/sheetsee.js" target="_blank">Jessica Lord</a>.</p>
<p>It is also an example of a Fork-n-Go project. Fork it on <a href="http://www.github.com/laurenarcher/hockey-shrines" target="_blank">GitHub</a> to build your own community mapping project! Read more about Fork-n-Go <a href="http://jlord.us/forkngo/">here</a>.</p>
</div>
</div>
</div><!-- end wrapper -->
<script id="hackSpotsTable" type="text/html">
<table>
<tr><th class="tHeader">Name</th><th class="tHeader">Address</th><th class="tHeader">City</th><th class="tHeader">Province</th><th class="tHeader">Country</th><th class="tHeader">Important People</th>
{{#rows}}
<tr id="{{rowNumber}}" class="spotRow"><td>{{name}}</td><td>{{address}}</td><td>{{city}}</td><td>{{province}}</td><td>{{country}}</td><td width ="400">{{importantpeople}}</td></tr>
{{/rows}}
</table>
</script>
<script id="latestSpot" type="text/html">
{{#rows}}
<h4 class="fauxButton">MOST RECENT SHRINE</h4>
<h3>{{name}}</h3>
<p class="colorText">{{fulladdress}}</p>
<ul>
<li><div style="width:500px;height:200px;overflow:hidden"><a href ="{{image1}}" target="_blank"><img src="{{image1}}" alt="Hockey Shrine" onerror="this.style.display='none';"></a><a href ="{{image2}}" target="_blank"><img src="{{image2}}" alt="Hockey Shrine" onerror="this.style.display='none';"></a></div></li>
<li id = "people"><span class="category">Important People:</span> {{importantpeople}}</li>
<li><span class="category">History:</span> {{history}}</li>
<li><span class="category">Contributor:</span> {{yourname}}</li>
<li><span class="category"><a href ="{{link}}">More Info</a></span></li>
</ul>
{{/rows}}
</script>
<script id="theNumberofSpots" type="text/html">
<p><strong><span class="red-text">{{numberOfSpots}}</span> hockey shrines and growing!</p>
</script>
<script id="selectedSpot" type="text/html">
{{#rows}}
<h4 class="fauxButton">SELECTED SHRINE</h4>
<h3>{{name}}</h3>
<p class="colorText">{{fulladdress}}</p>
<ul>
<li><div style="width:500px;height:200px;overflow:hidden"><a href ="{{image1}}" target="_blank"><img src="{{image1}}" alt="Hockey Shrine" onerror="this.style.display='none';"></a><a href ="{{image2}}" target="_blank"><img src="{{image2}}" alt="Hockey Shrine" onerror="this.style.display='none';"></a></div></li>
<li id = "people"><span class="category">Important People:</span>{{importantpeople}}</li>
<li><span class="category">History:</span> {{history}}</li>
<li><span class="category">Contributor:</span> {{yourname}}</li>
<li><span class="category"><a href ="{{link}}">More Info</a></span></li>
</ul>
{{/rows}}
</script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
var gData
var URL = "1U8MAX8tlSEMmBcF0slQeQxTj_eogqfbRFMlF4m0LkEI"
Tabletop.init({ key: URL, callback: showInfo, simpleSheet: true })
})
// so long, so messy
function showInfo(gData) {
tableOptions = {
"data": gData,
"tableDiv": "#hackSpotsTable",
"filterDiv": "#tableFilter"
}
// make the table, and the search bar
Sheetsee.makeTable(tableOptions)
Sheetsee.initiateTableFilter(tableOptions)
// create geoJSON with coordinates and other
// useful bits from the original data
var optionsJSON = ["name", "address", "city", "rowNumber"]
var geoJSON = Sheetsee.createGeoJSON(gData, optionsJSON)
// create map, tilelayer (map background), markers and popups
var map = Sheetsee.loadMap("map")
Sheetsee.addTileLayer(map, 'jllord.n7aml2bc')
var markerLayer = Sheetsee.addMarkerLayer(geoJSON, map, "<h2>{{ name }}</h2>", true)
// find the latest spot with the most important
// info filled in (to prevent map breaking if
// someone is currently editing spreadsheet)
var theLatestSpot = findLatestCompleteSpot(gData)
var latestSpot = Sheetsee.ich.latestSpot({
rows: theLatestSpot
})
// set it and pan to it
$('#latestSpot').html(latestSpot)
map.setView([theLatestSpot.lat, theLatestSpot.long], 14)
// when someone clicks on a row, highlight it and
// re-center the map
// TODO show popup, change marker color
$('.spotRow').live("click", function(event) {
$('.spotRow').removeClass("selectedRow")
var rowNumber = $(this).closest("tr").attr("id")
$('#' + rowNumber).addClass("selectedRow")
var dataElement = Sheetsee.getMatches(gData, rowNumber, "rowNumber")
var selectedSpot = Sheetsee.ich.selectedSpot({
rows: dataElement
})
$('#latestSpot').css("display", "none")
$('#selectedSpot').html(selectedSpot).css("display", "inline")
var selectedCoords = [dataElement[0].lat, dataElement[0].long]
map.setView(selectedCoords, 14)
$("html, body").animate({ scrollTop: 100 }, 600)
})
// so that the first map and info that loads
// is complete and doesn't show rows that are
// actively being edited by folk
function findLatestCompleteSpot(data) {
var latestCompleteSpot = []
var startWithLatestRow = data.reverse()
startWithLatestRow.forEach(function(row){
if (!row.lat || !row.long || !row.fulladdress || !row.name ) return
else latestCompleteSpot.push(row)
})
return latestCompleteSpot[0]
}
// Add click listener to the markerLayer
markerLayer.on('click', function(e) {
// clear any selected rows
$('.spotRow').removeClass("selectedRow")
// get row number of selected marker
var rowNumber = e.layer.feature.opts.rowNumber
// find that row in the table and make consider it selected
$('#' + rowNumber).addClass("selectedRow")
// using row number, get the data for the selected spot
var dataElement = Sheetsee.getMatches(gData, rowNumber.toString(), "rowNumber")
// take those details and re-write the selected spot section
var selectedSpot = Sheetsee.ich.selectedSpot({
rows: dataElement
})
// center the map on the selected element
map.panTo([dataElement[0].lat, dataElement[0].long])
// update the spot listing
$('#latestSpot').css("display", "none")
$('#selectedSpot').html(selectedSpot).css("display", "inline")
})
// reset the map, zoom out, and recenter on 0,0
$('.resetMap').click(function() {
$('.spotRow').removeClass("selectedRow")
$('#latestSpot').css("display", "inline")
$('#selectedSpot').css("display", "none")
map.setView([0,0], 1)
})
// find total number of spots added
var theNumberofSpots = Sheetsee.ich.theNumberofSpots({
numberOfSpots: gData.length
})
$('#theNumberofSpots').html(theNumberofSpots)
if(window.location.hash) {
$('#tableFilter').val(window.location.hash.substring(1)).keyup()
}
}
$(document).on('keyup', '#tableFilter', function() {
window.location.hash = $(this).val()
})
</script>
</body>
</html>