2013-05-27 20:45:59 +00:00
< html >
< head >
2014-07-30 02:10:52 +00:00
< title > NYC Bookstores< / title >
2013-05-27 20:45:59 +00:00
2015-03-08 18:37:54 +00:00
< 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 >
2015-04-04 21:43:50 +00:00
< link rel = "shortcut icon" href = "favicon.png" / >
2013-05-27 20:45:59 +00:00
2015-03-08 18:37:54 +00:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" / >
< link href = 'http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel = 'stylesheet' / >
< link rel = 'stylesheet' type = 'text/css' href = 'http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic' >
< link rel = 'stylesheet' type = 'text/css' href = 'http://fonts.googleapis.com/css?family=Amatic+SC:400,700' >
< link media = "screen" rel = "stylesheet" type = "text/css" href = "css/style.css" >
< link media = "screen" rel = "stylesheet" type = "text/css" href = "css/site.css" >
< / head >
2013-05-27 20:45:59 +00:00
< body >
< div id = "wrapper" >
2014-07-30 02:10:52 +00:00
< h1 > NYC Bookstores< / h1 >
2013-05-28 01:35:21 +00:00
< div >
< ul class = "nav" >
2014-07-30 02:10:52 +00:00
< li > < strong > The Many Bookstores of New York City< / strong > < / li >
2013-05-28 01:35:21 +00:00
< li > < a href = "#info" > INFO< / a > -< / li >
2014-07-30 02:10:52 +00:00
< li > < a href = "http://www.github.com/deltamualpha/nyc-bookstores" target = "_blank" > GITHUB< / a > -< / li >
2014-08-17 23:54:17 +00:00
< li > < a href = "http://www.twitter.com/alazyreader" target = "_blank" > @alazyreader< / a > < / li >
2013-05-28 01:35:21 +00:00
< / ul >
< / div >
< div class = "container" >
< div id = "rightSide" >
< div id = "latestSpot" > < / div >
< div id = "selectedSpot" > < / div >
< / div >
2013-05-27 20:45:59 +00:00
< div id = "map" > < / div >
< / div >
2014-08-17 23:54:17 +00:00
< div id = "info" class = "container" >
< p > Although the bookselling community of New York City is much depleted from its heyday, there still are independent bookstores out there. Unfortunately, there has also been a lack of resources available to discover and visit the stores that do exist. This site, while not on the level of the old guides, can help with that.< / p >
< p > While the data here are kept up-to-date to the best of my ability, I make no promises about the accuracy of locations or other details presented. If you spot an error, or I've missed a shop, please let me know by < a href = "mailto:delta.mu.alpha@gmail.com" > email< / a > or < a href = "https://www.twitter.com/alazyreader" > twitter< / a > . Powered by < a href = "http://jlord.github.com/sheetsee.js" target = "_blank" > sheetsee.js< / a > ; based on a project by < a href = "http://www.twitter.com/jllord" target = "_blank" > @jllord< / a > .
< / div >
2013-05-28 01:35:21 +00:00
< 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 >
2013-05-27 20:45:59 +00:00
< / div > <!-- end wrapper -->
< script id = "hackSpotsTable" type = "text/html" >
< table >
2014-08-17 23:54:17 +00:00
< tr > < th class = "tHeader" > Name< / th > < th class = "tHeader" > Address< / th > < / tr >
2013-05-27 20:45:59 +00:00
{{#rows}}
2014-08-17 23:54:17 +00:00
< tr id = "{{rowNumber}}" class = "spotRow" > < td > {{name}}< / td > < td > {{address}}, {{city}} < a href = "https://maps.google.com/maps?q={{address}},{{city}},NY" target = "_blank" > ↗ < / a > < / td > < / tr >
2013-05-27 20:45:59 +00:00
{{/rows}}
< / table >
< / script >
< script id = "latestSpot" type = "text/html" >
2014-08-17 23:54:17 +00:00
{{#rows}}
< h4 class = "fauxButton" > MOST RECENTLY ADDED< / h4 >
< h2 > {{name}}< / h2 >
< p class = "colorText" > {{address}}< p >
< p class = "colorText" > {{city}}, NY {{#postcode}} {{postcode}} {{/postcode}}< / p >
< p > < a href = "https://maps.google.com/maps?q={{address}},{{city}},NY" target = "_blank" > View in Google Maps< / a > < / p >
< ul >
< li > < span class = "category" > Events:< / span > {{events}}
< span class = "category" > Café :< / span > {{cafe}}< / li >
< li > < span class = "category" > Website:< / span > < a href = '{{website}}' > {{website}}< / a > < / li >
< / ul >
{{#description}}< ul >
< li class = "description" > {{description}}< / li >
< / ul > {{/description}}
{{/rows}}
2013-05-27 20:45:59 +00:00
< / script >
2013-07-31 07:49:22 +00:00
< script id = "theNumberofSpots" type = "text/html" >
2014-07-30 02:10:52 +00:00
< p > < strong > < span class = "red-text" > {{numberOfSpots}}< / span > bookstores mapped!< / p >
2013-07-31 07:49:22 +00:00
< / script >
2013-05-27 20:45:59 +00:00
< script id = "selectedSpot" type = "text/html" >
2013-07-31 07:49:22 +00:00
{{#rows}}
2014-07-30 02:10:52 +00:00
< h4 class = "fauxButton" > SELECTED BOOKSTORE< / h4 >
2013-07-31 07:49:22 +00:00
< h2 > {{name}}< / h2 >
2013-07-31 20:44:01 +00:00
< p class = "colorText" > {{address}}< p >
2014-08-17 23:54:17 +00:00
< p class = "colorText" > {{city}},NY {{#postcode}} {{postcode}} {{/postcode}}< / p >
< p > < a href = "https://maps.google.com/maps?q={{address}},{{city}},NY" target = "_blank" > View in Google Maps< / a > < / p >
2013-07-31 07:49:22 +00:00
< ul >
2014-08-17 23:54:17 +00:00
< li > < span class = "category" > Events:< / span > {{events}}
< span class = "category" > Café :< / span > {{cafe}}< / li >
2014-07-30 02:10:52 +00:00
< li > < span class = "category" > Website:< / span > < a href = '{{website}}' > {{website}}< / a > < / li >
2013-07-31 07:49:22 +00:00
< / ul >
2014-08-17 23:54:17 +00:00
{{#description}}< ul >
< li class = "description" > {{description}}< / li >
< / ul > {{/description}}
2013-07-31 07:49:22 +00:00
{{/rows}}
2013-05-27 20:45:59 +00:00
< / script >
< script type = "text/javascript" >
2013-07-31 23:41:47 +00:00
document.addEventListener('DOMContentLoaded', function() {
2015-04-04 21:43:50 +00:00
var gData
2014-06-29 13:51:06 +00:00
var URL = "0AnhMurQVK5pqdHU0UF9QTFRRNTQwR3hQTFdOV3laRGc"
2014-06-28 22:26:30 +00:00
Tabletop.init( { key: URL, callback: showInfo, simpleSheet: true } )
})
2015-03-08 18:37:54 +00:00
// 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)
2013-07-31 23:41:47 +00:00
2015-03-09 03:48:56 +00:00
// create geoJSON with coordinates and other
// useful bits from the original data
var optionsJSON = ["name", "address", "city", "rowNumber"]
var geoJSON = Sheetsee.createGeoJSON(gData, optionsJSON)
// change the color of the most recently added spot's marker
geoJSON[geoJSON.length - 1].properties["marker-color"] = "#FF4646"
// create map, tilelayer (map background), markers and popups
var map = Sheetsee.loadMap("map")
Sheetsee.addTileLayer(map, 'examples.map-20v6611k')
var markerLayer = Sheetsee.addMarkerLayer(geoJSON, map, "< h2 > {{ name }}< / h2 > ")
// 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.panTo([theLatestSpot.lat, theLatestSpot.long])
2015-03-08 18:37:54 +00:00
// when someone clicks on a row, highlight it and
// re-center the map
$('.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({
2015-03-09 03:48:56 +00:00
rows: dataElement
2015-03-08 18:37:54 +00:00
})
$('#latestSpot').css("display", "none")
$('#selectedSpot').html(selectedSpot).css("display", "inline")
var selectedCoords = [dataElement[0].lat, dataElement[0].long]
2015-03-09 03:48:56 +00:00
map.panTo(selectedCoords)
2015-03-08 18:37:54 +00:00
})
2013-07-31 23:41:47 +00:00
2015-03-08 18:37:54 +00:00
// 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.name || !row.address || !row.city || !row.state ) return
else latestCompleteSpot.push(row)
})
return latestCompleteSpot[0]
}
2013-07-31 23:41:47 +00:00
2015-03-09 03:48:56 +00:00
// Add click listener to the markerLayer
markerLayer.on('click', function(e) {
2015-03-08 18:37:54 +00:00
// clear any selected rows
2015-03-09 03:48:56 +00:00
$('.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
2015-03-08 18:37:54 +00:00
})
2015-03-09 03:48:56 +00:00
// 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")
})
2013-07-31 23:41:47 +00:00
2015-03-09 03:48:56 +00:00
// reset the map, zoom out, and recenter on 0,0
2015-03-08 18:37:54 +00:00
$('.resetMap').click(function() {
$('.spotRow').removeClass("selectedRow")
$('#latestSpot').css("display", "inline")
$('#selectedSpot').css("display", "none")
2015-03-09 03:48:56 +00:00
map.setView([0,0], 1)
2015-03-08 18:37:54 +00:00
})
2013-07-31 23:41:47 +00:00
2015-03-08 18:37:54 +00:00
// find total number of spots added
var theNumberofSpots = Sheetsee.ich.theNumberofSpots({
2015-03-09 03:48:56 +00:00
numberOfSpots: gData.length
2015-03-08 18:37:54 +00:00
})
$('#theNumberofSpots').html(theNumberofSpots)
}
< / script >
2013-05-27 20:45:59 +00:00
< / body >
2014-04-10 19:19:24 +00:00
< / html >