This repository has been archived by the owner on Mar 15, 2023. It is now read-only.
forked from jlord/hack-spots
/
index.html
684 lines (655 loc) · 29.6 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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
<html><head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Independent Bookstores in New York City - Best Community Bookstores in NYC</title>
<meta name="google-site-verification" content="hEfog9h0E3JQW91ZUZM5ayPb6DND0WbUa2_W8yTIuVw">
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/social.jpg">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/mustache.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.0/jquery.scrollTo.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://api.mapbox.com/mapbox-gl-js/v0.34.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v0.34.0/mapbox-gl.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Acme|Lato" rel="stylesheet">
<link media="screen" rel="stylesheet" type="text/css" href="css/site.css">
<meta property="title" name="title" content="Independent Bookstores in New York City - Best Community Bookstores in NYC">
<meta property="description" name="description" content="A guide to and map of every independent bookstore in New York City. We have a full list of community bookstores in NYC with locations and descriptions.">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="www.nycbookstores.org">
<meta name="twitter:title" content="NYC Bookstores">
<meta name="twitter:description" content="A Guide To The Many Independent Bookstores Of New York City">
<meta name="twitter:image" content="https://www.nycbookstores.org/img/social.jpg">
<meta property="og:url" content="https://www.nycbookstores.org/">
<meta property="og:title" content="NYC Bookstores">
<meta property="og:description" content="A Guide To The Many Independent Bookstores Of New York City">
<meta property="og:image" content="https://www.nycbookstores.org/img/social.jpg">
</head>
<body>
<div id="wrapper">
<h1>NYC Bookstores</h1>
<div>
<ul class="nav">
<li><h2>The Many Independent Bookstores of New York City</h2></li>
<li><a id="viewInfo">info</a></li>
<li><a href="https://github.com/nyc-bookstores/nyc-bookstores.github.io" target="_blank">github</a></li>
<li><a href="https://www.twitter.com/alazyreader" target="_blank">@alazyreader</a></li>
</ul>
</div>
<div class="container">
<div id="map"></div>
<div id="info">
<p>New York City loves its independent bookstores. It <a href="https://www.nytimes.com/2006/10/15/nyregion/thecity/15book.html" target="_blank">eulogizes those that have faded</a> and celebrates when new ventures are launched. And while the historic <a href="https://untappedcities.com/2015/08/26/4th-avenue-the-history-of-nycs-book-row/" target="_blank">Book Row may have passed away in the 80s</a>, there are still many indie bookstores dotting the map. Here, I have attempted to collect all of the currently-open general-interest independent booksellers in NYC. Any store with regular-ish hours (excluding religious booksellers and appointment-only rare book sellers) is included.</p>
<p>The listings here are kept up-to-date to the best of my ability; however, I make no promises about either the accuracy or reliability of the information. If you spot an error, or I've missed a shop, please let me know by <a href="mailto:delta.mu.alpha@gmail.com" target="_blank">email</a> or <a href="https://www.twitter.com/alazyreader" target="_blank">twitter</a>. Based on the "<a href="https://github.com/jlord/hack-spots" target="_blank">Hack Spots</a>" website by <a href="https://www.twitter.com/jllord" target="_blank">@jllord</a>.</p>
<p>There are currently <span id="storeCount"></span> stores indexed on this page.</p>
</div>
<div id="selected"></div>
</div>
<div class="clearfix"></div>
<div class="container">
<div id="Stores">
<table>
<tbody><tr><th class="tHeader">Name</th><th class="tHeader">Address</th></tr>
<tr id="" class="spotRow">
<td class="name">192 Books</td>
<td>192 10th Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Aeon Bookstore</td>
<td>151 East Broadway, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Alabaster Bookshop</td>
<td>122 4th Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Albertine Books</td>
<td>972 Fifth Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Archestratus</td>
<td>160 Huron St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Argosy Books</td>
<td>116 East 59th St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Astoria Bookshop</td>
<td>31-29 31st St, Astoria</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Bankstreet Bookstore</td>
<td>2780 Broadway, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Ben's Books</td>
<td>145 Ainslie St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Berl's Brooklyn Poetry Shop</td>
<td>126A Front St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Better Read Than Dead</td>
<td>867 Broadway, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Bluestockings</td>
<td>172 Allen Street, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Bonnie Slotnick Cookbooks</td>
<td>28 East 2nd St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Book Culture</td>
<td>536 W 112th St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Book Culture on Broadway</td>
<td>2915 Broadway, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Book Culture on Columbus</td>
<td>450 Columbus Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Book Thug Nation</td>
<td>100 North 3rd St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">bookbook</td>
<td>266 Bleecker St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Bookmarc</td>
<td>400 Bleecker St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">BookMark Shoppe</td>
<td>8415 3rd Avenue, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Bookoff</td>
<td>49 W 45nd St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Books Are Magic</td>
<td>225 Smith St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Books Of Wonder</td>
<td>18 West 18th St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Books Of Wonder (Upper West Side)</td>
<td>217 West 84th St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Boulevard Books and Café</td>
<td>7518 13th Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Cafe con Libros</td>
<td>724 Prospect Place, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Catland</td>
<td>987 Flushing Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Chartwell Booksellers</td>
<td>55 E 52nd St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Civil Service Book Shop</td>
<td>38 Lispenard St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Clic Bookstore & Gallery</td>
<td>255 Centre St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Codex Books</td>
<td>1 Bleecker St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Community Bookstore</td>
<td>143 7th Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Cooking, Cocktails, and Culture</td>
<td>212 Degraw Street, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Dashwood Books</td>
<td>33 Bond St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Desert Island Comics</td>
<td>540 Metropolitan Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">East Village Books</td>
<td>99 St. Mark's Place, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Every Thing Goes Book Cafe and Neighborhood Stage</td>
<td>208 Bay St, Staten Island</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Freebird Books</td>
<td>123 Columbia St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Greenlight Bookstore</td>
<td>686 Fulton St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Greenlight Bookstore (Prospect Lefferts Gardens)</td>
<td>632 Flatbush Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Here's A Book Store</td>
<td>1964 Coney Island Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Housing Works Bookstore Café</td>
<td>126 Crosby St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Hullabaloo Books</td>
<td>711A Franklin Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Human Relations Books</td>
<td>1067 Flushing Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Idlewild Books Brooklyn</td>
<td>249 Warren St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Idlewild Books Manhattan</td>
<td>12 West 19th St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Idlewild Books Williamsburg</td>
<td>218 Bedford Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">James Cummins Bookseller</td>
<td>699 Madison Ave, 7th Floor, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Joanne Hendricks Cookbooks</td>
<td>488 Greenwich St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Kew & Willow Books</td>
<td>81-63 Lefferts Boulevard, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Kinokunya</td>
<td>1073 Avenue of the Americas, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Kitchen Arts & Letters</td>
<td>1435 Lexington Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Loft Book Store Cafe</td>
<td>350 Tompkins Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Logos Bookstore</td>
<td>1575 York Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Mast Books</td>
<td>72 Avenue A, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">McNally Jackson Books</td>
<td>52 Prince St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">McNally Jackson Books Williamsburg</td>
<td>76 North 4th St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Melville House Publishers</td>
<td>46 John St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Mercer Street Books & Records</td>
<td>206 Mercer St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Mil Mundos Books</td>
<td>323 Linden St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Molasses Books</td>
<td>770 Hart St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Namaste Bookshop</td>
<td>2 W 14th St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Pioneer Books</td>
<td>289 Van Brunt St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Posman Books Chelsea Market</td>
<td>75 9th Avenue, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Posman Books Rockefeller Center</td>
<td>30 Rockefeller Plaza, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">PowerHouse Arena</td>
<td>28 Adams St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">PowerHouse on 8th</td>
<td>1111 8th Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Printed Matter</td>
<td>195 10th Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Quest Bookshop</td>
<td>240 E 53rd St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Respect For Life Books-N-Things</td>
<td>537 Nostrand Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Revolution Books</td>
<td>437 Malcolm X Blvd, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Rizzoli Bookstore</td>
<td>1133 Broadway, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Shakespeare & Company</td>
<td>939 Lexington Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Shakespeare & Company (Upper West Side)</td>
<td>2020 Broadway, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Sister's Uptown Bookstore</td>
<td>1942 Amsterdam Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Spoonbill</td>
<td>99 Montrose Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Spoonbill & Sugartown, Booksellers</td>
<td>218 Bedford Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Standards Manual</td>
<td>212 Franklin Street, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Stories</td>
<td>458 Bergen St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Strand Bookstore</td>
<td>828 Broadway, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">TASCHEN</td>
<td>107 Greene St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Terrace Books</td>
<td>242 Prospect Park West, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">The Austin Book Shop</td>
<td>104-29 Jamaica Ave, Richmond Hill</td>
</tr>
<tr id="" class="spotRow">
<td class="name">The Book Cellar</td>
<td>1465 York Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">The Center for Fiction</td>
<td>15 Lafayette Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">The Corner Bookstore</td>
<td>1313 Madison Ave, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">The Lit. Bar</td>
<td>131 Alexander Ave, Bronx</td>
</tr>
<tr id="" class="spotRow">
<td class="name">The Mysterious Bookshop</td>
<td>58 Warren St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Three Lives & Company</td>
<td>154 West 10th St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Topos Bookstore Cafe</td>
<td>788 Woodward Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Turn The Page... Again</td>
<td>39-15a Bell Blvd, Flushing</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Unnameable Books</td>
<td>600 Vanderbilt Ave, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Unoppressive Non-Imperialist Bargain Books</td>
<td>34 Carmine St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Ursus Books</td>
<td>50 East 78th St, Suite 1C, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Westsider Rare & Used Books</td>
<td>2246 Broadway, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Westsider Records</td>
<td>233 West 72nd St, New York</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Word Bookstore</td>
<td>126 Franklin St, Brooklyn</td>
</tr>
<tr id="" class="spotRow">
<td class="name">Word Up Books</td>
<td>2113 Amsterdam Ave, New York</td>
</tr>
</tbody></table>
</div>
</div>
</div><!-- end wrapper -->
<script id="Table" type="text/html">
<table>
<tr><th class="tHeader">Name</th><th class="tHeader">Address</th></tr>
{{#rows}}
<tr id="{{rowNumber}}" class="spotRow">
<td class="name">{{name}}</td>
<td>{{address}}, {{city}}</td>
</tr>
{{/rows}}
</table>
</script>
<script id="selectedStore" type="text/html">
{{#store}}
<h2>{{name}}</h2>
<p class="address">{{address}}<p>
<p class="address">{{city}},NY {{#postcode}} {{postcode}} {{/postcode}}</p>
<p>
<a href="https://maps.google.com/maps?q={{name}} {{address}},{{city}},NY" target="_blank">View in Google Maps</a>
</p>
<ul>
<li>
<span class="store-details">Events:</span> {{events}}
<span class="store-details">Café:</span> {{cafe}}
</li>
{{#website}}
<li><a href='{{website}}' target="_blank">{{website}}</a></li>
{{/website}}
</ul>
{{#description}}
<p class="description">{{description}}</p>
{{/description}}
{{/store}}
</script>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoiYWxhenlyZWFkZXIiLCJhIjoiY2lucDZhb2JxMHp6MHRxa2pvaTFoOWpuZyJ9.DILGYYxxt7A-A_lHHwp6tQ';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/basic-v9',
center: [-73.957292, 40.729071], // arbitrary center point
zoom: 10,
minZoom: 9,
maxZoom: 17,
dragRotate: false
});
var popup = new mapboxgl.Popup({
closeOnClick: false,
closeButton: false
});
document.addEventListener('DOMContentLoaded', function() {
$.getJSON('./stores.json', function(data) {
data.sort(
function(a, b) {
var aname = a.name.toLowerCase();
var bname = b.name.toLowerCase();
return aname === bname ? 0 : +(aname > bname) || -1;
}
)
$.each(data, function(key, value) {
value.rowNumber = key;
value.slug = slugify(value.name);
});
$('#storeCount').html(data.length);
window.data = data;
loadMap(data);
});
});
window.addEventListener("hashchange", function(e){
updateViewBySlug(e.newURL.split('#')[1]);
}, false);
function updateHash(slug) {
history.pushState(null, null, "#" + slug);
}
function slugify(str) {
return str
.toLowerCase()
.replace(/é/g,'e')
.replace(/&/g,' and ')
.replace(/ /g,'-')
.replace(/[']+/g,'')
.replace(/[^\w-]+/g,'-')
.replace(/-+/g,'-')
.replace(/^-|-$/g,'');
}
function getStoreBySlug(slug) {
var ret = false;
$.each(window.data, function(key, value) {
if (value.slug === slug) {
ret = value;
return false;
}
});
return ret;
}
function updateViewBySlug(slug) {
if (slug === "info" || slug === undefined) {
showInfo(false);
} else {
var store = getStoreBySlug(slug);
if (store) {
updateSelectedStore(store, false);
}
}
}
function boundingBox(point) {
// add some buffer to a point to give the user some leeway
return [[point.x - 5, point.y - 5], [point.x + 5, point.y + 5]]
}
function updateSelectedStore(store, pushState=false) {
map.flyTo({center: [store.long, store.lat]});
popup.setLngLat([store.long, store.lat])
.setHTML(store.name)
.addTo(map);
$('#info').hide();
var template = $('#selectedStore').html();
var rendered = Mustache.render(template, {store: store});
$('#selected').html(rendered);
$('#selected').show();
if (pushState) {
updateHash(store.slug);
}
}
function showInfo(pushState=true) {
$('#selected').hide();
popup.remove();
$('#info').show();
if (pushState) {
updateHash('info');
}
}
function loadMap(data) {
var geolocate = new mapboxgl.GeolocateControl();
var points = [];
$.each(data, function(key, value) {
points.push({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [value.long, value.lat]
},
"properties": value
});
});
map.on('load', function () {
map.addLayer({
"id": "stores",
"type": "circle",
"source": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": points
}
},
"paint": {
"circle-radius": 5,
"circle-color": "#B9FCFC",
"circle-stroke-width": 2,
"circle-stroke-color": "#000000"
}
})
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
map.addControl(geolocate, 'top-right');
updateViewBySlug(window.location.hash.split("#")[1]);
});
map.on('click', function (e) {
if (!map.getLayer('stores')) { return; }
popup.remove();
// Use queryRenderedFeatures to get features at a click event's point
var features = map.queryRenderedFeatures(boundingBox(e.point), { layers: ['stores'] });
// fly to the location of the click event
if (features.length) {
var store = features[0];
// Get coordinates from the symbol and center the map on those coordinates
updateSelectedStore(store.properties, true);
}
});
// indicate that the symbols are clickable by changing the cursor style to 'pointer'.
map.on('mousemove', function (e) {
if (!map.getLayer('stores')) { return; }
var features = map.queryRenderedFeatures(boundingBox(e.point), { layers: ['stores'] });
map.getCanvas().style.cursor = features.length ? 'pointer' : '';
});
geolocate.on('geolocate', function (e) {
map.setZoom(14);
popup.setLngLat([e.coords.longitude, e.coords.latitude])
.setHTML('Current Location')
.addTo(map);
});
var template = $('#Table').html();
var rendered = Mustache.render(template, {rows: data});
$('#Stores').html(rendered);
$("#Stores tbody tr").not(':first').on("click", function() {
updateSelectedStore(data[$(this)[0].id], true);
$(window).scrollTo($("#selected"), 250, {offset: {top: -15}});
});
$('#viewInfo').on("click", showInfo);
};
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-100418882-1', 'auto');
ga('send', 'pageview');
</script>
</body></html>