This commit is contained in:
jllord 2013-05-27 18:35:21 -07:00
parent 57fe85f917
commit 65c5f1d14e
6 changed files with 145 additions and 72 deletions

View File

@ -1 +1 @@
[{"name":"Sweet Bar Bakery","address":"2355 Broadway","city":"Oakland","state":"Ca","long":"-122.266011839473","lat":"37.8129222733119","geoaccuracy":"house","country":"USA","wifipassword":"cupcakes","outlets":"yes","couch":"no","largetable":"yes","brewing":"","outdoorseating":"yes","hexcolor":"#A0FD14","rowNumber":1},{"name":"Awaken Cafe","address":"1429 Broadway","city":"Oakland","state":"Ca","long":"-122.271131495076","lat":"37.8046753170488","geoaccuracy":"house","country":"USA","wifipassword":"iced coffee","outlets":"yes","couch":"yes","largetable":"yes","brewing":"Four Barrel","outdoorseating":"","hexcolor":"#A0FD14","rowNumber":2},{"name":"Panther Coffee","address":"2390 NW 2nd Ave","city":"Miami","state":"Fl","long":"-80.1991536666667","lat":"25.8000021666667","geoaccuracy":"house","country":"USA","wifipassword":"espresso","outlets":"yes","couch":"no","largetable":"yes","brewing":"In-house","outdoorseating":"yes","hexcolor":"#A0FD14","rowNumber":3},{"name":"Haddon Hill Cafe","address":"504 Wesley Ave","city":"Oakland","state":"Ca","long":"-122.2488474","lat":"37.8049159","geoaccuracy":"cafe","country":"USA","wifipassword":"haddon10","outlets":"yes","couch":"no","largetable":"yes","brewing":"Sight Glass","outdoorseating":"yes","hexcolor":"#A0FD14","rowNumber":4},{"name":"Subrosa","address":"419 40th Street","city":"Oakland","state":"Ca","long":"-122.2604838","lat":"37.8283586","geoaccuracy":"cafe","country":"USA","wifipassword":"-","outlets":"yes","couch":"no","largetable":"no","brewing":"Four Barrel","outdoorseating":"yes","hexcolor":"#A0FD14","rowNumber":5}]
[{"name":"Sweet Bar Bakery","address":"2355 Broadway","city":"Oakland","state":"Ca","long":"-122.266011839473","lat":"37.8129222733119","country":"USA","wifipassword":"cupcakes","outlets":"yes","couch":"no","largetable":"yes","brewing":"","outdoorseating":"yes","hexcolor":"#FF4646","rowNumber":1},{"name":"Awaken Cafe","address":"1429 Broadway","city":"Oakland","state":"Ca","long":"-122.271131495076","lat":"37.8046753170488","country":"USA","wifipassword":"iced coffee","outlets":"yes","couch":"yes","largetable":"yes","brewing":"Four Barrel","outdoorseating":"","hexcolor":"#FF4646","rowNumber":2},{"name":"Panther Coffee","address":"2390 NW 2nd Ave","city":"Miami","state":"Fl","long":"-80.1991536666667","lat":"25.8000021666667","country":"USA","wifipassword":"espresso","outlets":"yes","couch":"no","largetable":"yes","brewing":"In-house","outdoorseating":"yes","hexcolor":"#FF4646","rowNumber":3},{"name":"Haddon Hill Cafe","address":"504 Wesley Ave","city":"Oakland","state":"Ca","long":"-122.2488474","lat":"37.8049159","country":"USA","wifipassword":"haddon10","outlets":"yes","couch":"no","largetable":"yes","brewing":"Sight Glass","outdoorseating":"yes","hexcolor":"#FF4646","rowNumber":4},{"name":"SubRosa Coffee","address":"419 40th Street","city":"Oakland","state":"Ca","long":"-122.2604838","lat":"37.8283586","country":"USA","wifipassword":"-","outlets":"yes","couch":"no","largetable":"no","brewing":"Four Barrel","outdoorseating":"yes","hexcolor":"#FF4646","rowNumber":5}]

BIN
coffeerings.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -1,55 +1,67 @@
/* Page Specific CSS */
body {font-family: Merriweather; background: #FFFEF8; color: #333; font-size: 16px; border: 10px #F1EFDE solid; margin: 0px; padding: 20px 20px 200px 20px; }
h1, h2, h3, h4, h5, h6 {font-family: Amatic SC;}
h1 {font-size: 40px;}
body {font-family: Lato; background: #fff; color: #333; font-size: 16px; border: 52px #F8F8F8 solid; margin: 0px; padding: 20px 20px 200px 20px; }
h1, h2, h3, h4, h5, h6 {}
h1 {font-size: 80px; font-family: Amatic SC; font-weight: normal; margin: 0px;}
h2 {font-size: 50px; font-family: Amatic SC; font-weight: normal; margin: 11px 0px;}
h3 {font-family: Amatic SC; font-size: 30px; margin: 10px 0px;}
h4 {font-size: Lato; font-size: 24px;}
h3.functionH {/*background-color: #47CCFC; color: #fff;*/ padding: 4px 8px; margin-top: 52px; border-top: 3px solid #47CCFC; border-left: 3px solid #47CCFC; border-right: 3px solid #47CCFC; margin-left: -14px; padding-left: 14px;
padding-top: 9px; }
img {width: 100%;}
.container {margin: 24px 0px;}
#tableFilter {margin: 12px 0px; border: none; border-bottom: 1px solid #333; background-color: transparent; padding: 0px; font-family: Merriweather; color: #333; font-size: 13px; height: 22px;}
p a, a {color: #333; text-decoration: none; padding-bottom: 0px; border-bottom: 2px #FD9393 solid;}
p a:visted {color: #ff00ff;}
p a, a {color: #333; text-decoration: none; padding-bottom: 0px; border-bottom: 1px #FD9393 solid;}
a:hover {color: #47CCFC;}
a:visited {color: #333;}
small {padding: 10px 0px;}
p {line-height: 24px;}
small {padding: 10px 0px; font-size: 10px;}
p {margin: 0px; padding: 0px; font-size: 12px;}
li {line-height: 19px; font-size: 12px;}
ol {line-height: 24px;}
a.button {border: none;}
#map {height: 400px; max-width: 530px; background: #DADADA;}
#map {height: 400px; max-width: 530px; min-width: 300px; background: #DADADA;}
#map a {border: none;}
::selection {background: #ff00ff;} /*#44FFB4*/
::-moz-selection {background: #ff00ff;}
::selection {background: #E5FF1D;}
::-moz-selection {background: #E5FF1D;}
/*.goToTop {font-size: 9px; font-family: Helvetica; text-transform: uppercase; }*/
#menu {/*background: #47CCFC;*/ color: #fff; padding: 20px; float: left; position: fixed; left: 40px; top: 40px; max-width: 300px; font-family: Helvetica; font-size: 14px;}
#menu ul {list-style: none; margin: 0px; padding: 0px;}
#menu li {line-height: 34px;}
#menu li a {padding: 4px 8px; background-color: #F0F0F0; text-decoration: none; border: none;}
#menu li a.a2 {background-color: #CCF4FF;}
#menu li a:hover {background-color: #e7e7e7; color: #333;}
ul.nav {list-style: none; margin: 0px; padding: 0px;}
ul.nav li {display: inline; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding-right: 4px;}
ul.nav li a {border: none;}
ul.nav li a:hover {border-bottom: 1px #FD9393 solid;}
#wrapper {margin: 0px auto; max-width: 900px; padding-top: 40px; /*margin-left: 250px;*/}
pre {word-wrap: break-word; padding: 14px; background: #F0F0F0; }
code {font-family: "Consolas", "Ubuntu Mono", monospace; line-height: 22px; font-size: 13px; color: #636363; font-weight: normal;}
.button {padding: 5px 4px; background-color: #FF7031; font-size: 10px; color: #fff;}
.dotted {margin: 20px -28px; padding: 20px 28px; background-color: #CCF4FF; border: 8px solid #47CCFC; margin-top: 44px; padding-top: 0px;}
.dotted li {padding: 0px 2px;}
.dotted h2 {margin-top: inherit;}
.button {padding: 5px 5px; background-color: #BEBEBE; font-size: 10px; color: #fff;}
.button:hover {background: #B9FCFC; color: #47CCFC;}
.fauxButton {padding: 5px 5px; background-color: #FF4646; font-size: 11px; color: #fff; display: inline;}
.fauxButton .selected {background-color: #FF4646;}
.colorText {color: #FF4646; text-transform: uppercase; font-weight: 700;}
.leaflet-popup-content h2 {margin-bottom: 4px; margin-top: auto;}
.leaflet-popup-content h2 {font-family: Lato; font-size: 20px; text-transform: uppercase;}
#latestSpot, #selectedSpot {height: 400px; max-width: 350px; width: 100%; float: right;}
#rightSide {height: 400px; max-width: 350px; width: 100%; float: right; padding-top: 5px;}
#selectedSpot {display: none;}
#latestSpot ul, #selectedSpot ul {list-style: none; margin: 0px; padding: 0px;}
#latestSpot li, #selectedSpot li{line-height: 34px;}
#latestSpot ul, #selectedSpot ul {list-style: none; margin-top: 12px 0px; padding: 0px;}
#latestSpot li, #selectedSpot li{}
#hackSpotsTable {cursor: pointer; margin-top: 80px;}
#hackSpotsTable .tHeader:hover {color: #FF7031;}
.spotRow:hover {color: #FF7031;}
.spotRow {border-left: 3px solid #ff00ff;}
.hideRow {display: none;}
#hackSpotsTable {cursor: pointer; background: #fff; min-width: 600px;}
.tHeader::after {content: " \2193 \2191 "; font-size: 10px; padding-left: 3px;}
#hackSpotsTable .tHeader:hover {color: #FF4646;}
.spotRow:hover {color: #FF4646;}
.spotRow {border-left: 3px solid #ff00ff;}
.hideRow {display: none;}
.selectedRow {color: #FF4C0D;}
.category {text-transform: uppercase; font-size: 9px; letter-spacing: .2em; padding-right: 6px;}
#info p {font-size: 14px; padding: 4px; line-height: 19px; font-weight: 300;}
#info {border-top: 4px #F8F8F8 solid;}
@media (max-width: 1024px) {
body {border: 20px #F8F8F8 solid; margin: 0px; padding: 20px 20px 80px 20px; }
}

View File

@ -13,7 +13,7 @@
table {text-align: left; width: 100%}
th {padding: 10px 0px;}
td, text {padding: 3px 20px 3px 0px; font-size: 14px;}
#tableFilter, #basicFilter, #dogFilter {margin: 12px 0px; border: none; border-bottom: 1px solid #333; background-color: transparent; padding: 0px; font-family: Merriweather; color: #fff; font-size: 13px; height: 22px;}
#tableFilter {margin: 12px 0px; border: none; border-bottom: 1px solid #333; background-color: transparent; padding: 0px; font-family: Merriweather; color: #fff; font-size: 13px; height: 22px;}
.noMatches {margin-left: 20px; font-size: 11px; font-style: italic; visibility: hidden;}
/* Containers */

View File

@ -8,30 +8,52 @@
<script type="text/javascript" src='js/sheetsee.js'></script>
<link rel="shortcut icon" href="https://raw.github.com/jllord/sheetsee-cache/master/favicon-p.png"/>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.css' rel='stylesheet' />
<link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Amatic+SC:400,700' 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">
</head>
<body>
<div id="wrapper">
<h1>Hack Spots</h1>
<div id="container">
<div id="latestSpot"></div>
<div id="selectedSpot"></div>
<div>
<ul class="nav">
<li><strong>The collected favorites of those who hack<strong></li>
<li><a href="#info">INFO</a> -</li>
<li><a href="http://jlord.github.com/sheetsee.js" target="_blank">POWERED BY SHEETSEE.JS</a> -</li>
<li><a href="http://www.github.com/jlord/hack-spots" target="_blank">GITHUB</a> -</li>
<li><a href="http://www.twitter.com/jllord" target="_blank">@JLLORD</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 id="hackSpotsTable"></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>When I'm visiting a new city I'd like to know which coffee shops have the best vibes, great coffee and are good for hunkering down and having a good hack. Yelp will tell you where the Starbucks is and Foursquare will tell you where your friend's have <em>been</em> - but did they like it and was it a grab in go place or a hack place? Plus, what about the people I don't follow on Foursquare or who can't check-in when in other countries?</p>
<p>This website is hooked up to <a href="" target="_blank">this Google Spreadsheet</a>, which I've shared with friends. They add their favorite spots and every visitor to the site gets the latest data.</p>
<p>Besides being a list I've wanted to have, it's a fantastic (or I think so) way of using <a href="http://jlord.github.io/sheetsee.js" target="_blank">sheetsee.js</a>, which is a little JavaScript library I've been working on. Sheetsee.js helps you hook a website to a Google spreadsheet that you then use to create or collaborate on data. </p>
</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">State</th><th class="tHeader">Country</th></tr>
<tr><th class="tHeader">Name</th><th class="tHeader">Address</th><th class="tHeader">City</th><th class="tHeader">State</th><th class="tHeader">Country</th><th class="">Elsewhere</th></tr>
{{#rows}}
<tr id="{{rowNumber}}" class="spotRow"><td>{{name}}</td><td>{{address}}</td><td>{{city}}</td><td>{{state}}</td><td>{{country}}</td><td><a class="button" href="https://maps.google.com/maps?q={{address}},{{city}},{{state}}" target="_blank">Map it!</a></td></tr>
<tr id="{{rowNumber}}" class="spotRow"><td>{{name}}</td><td>{{address}}</td><td>{{city}}</td><td>{{state}}</td><td>{{country}}</td><td><a class="button" href="https://maps.google.com/maps?q={{address}},{{city}},{{state}}" target="_blank">G Map</a> <a class="button" href="http://www.yelp.com/search?find_desc={{name}},{{city}},{{state}}" target="_blank">Yelp</a></td></tr>
<tr class="hideRow"><td>wifi: {{wifipassword}}</td></tr>
{{/rows}}
</table>
@ -39,32 +61,40 @@
<script id="latestSpot" type="text/html">
{{#rows}}
<h2>Recently Added</h2>
<h3>{{name}}</h3>
<p>{{address}}, {{city}}, {{state}}
<h4 class="fauxButton">MOST RECENT SPOT</h4>
<h2>{{name}}</h2>
<p class="colorText">{{address}}, {{city}}, {{state}}
<ul>
<li>Wifi: {{wifipassword}}</li>
<li>Outlets: {{outlets}}</li>
<li>Couch: {{couch}}</li>
<li>Large Table: {{largetable}}</li>
<li>Outdoor Seating: {{outdoorseating}}</li>
<li>Brewing: {{brewing}}</li>
<li><span class="category">Wifi:</span> {{wifipassword}}</li>
<li><span class="category">Outlets:</span> {{outlets}}</li>
<li><span class="category">Couch:</span> {{couch}}</li>
<li><span class="category">Large Table:</span> {{largetable}}</li>
<li><span class="category">Outdoor Seating:</span> {{outdoorseating}}</li>
<li><span class="category">Brewing:</span> {{brewing}}</li>
</ul>
<ul>
<li><a href="https://maps.google.com/maps?q={{address}},{{city}},{{state}}" target="_blank">View in Google Maps</a></li>
<li><a href="http://www.yelp.com/search?find_desc={{name}},{{city}},{{state}}" target="_blank">Find on Yelp</a></li>
</ul>
{{/rows}}
</script>
<script id="selectedSpot" type="text/html">
{{#rows}}
<h2>Selected Spot</h2>
<h3>{{name}}</h3>
<p>{{address}}, {{city}}, {{state}}
<h4 class="fauxButton">SELECTED SPOT</h4>
<h2>{{name}}</h2>
<p class="colorText">{{address}}, {{city}}, {{state}}
<ul>
<li>Wifi: {{wifipassword}}</li>
<li>Outlets: {{outlets}}</li>
<li>Couch: {{couch}}</li>
<li>Large Table: {{largetable}}</li>
<li>Outdoor Seating: {{outdoorseating}}</li>
<li>Brewing: {{brewing}}</li>
<li><span class="category">Wifi:</span> {{wifipassword}}</li>
<li><span class="category">Outlets:</span> {{outlets}}</li>
<li><span class="category">Couch:</span> {{couch}}</li>
<li><span class="category">Large Table:</span> {{largetable}}</li>
<li><span class="category">Outdoor Seating:</span> {{outdoorseating}}</li>
<li><span class="category">Brewing:</span> {{brewing}}</li>
</ul>
<ul>
<li><a href="https://maps.google.com/maps?q={{address}},{{city}},{{state}}" target="_blank">View in Google Maps</a></li>
<li><a href="http://www.yelp.com/search?find_desc={{name}},{{city}},{{state}}" target="_blank">Find on Yelp</a></li>
</ul>
{{/rows}}
</script>
@ -72,12 +102,14 @@
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
Sheetsee.makeTable(gData, "#hackSpotsTable")
Sheetsee.initiateTableFilter(gData, "#tableFilter", "#hackSpotsTable")
$('.spotRow').click(function(event) {
$('.spotRow').live("click", function(event) {
$('.spotRow').removeClass("selectedRow")
console.log("clicked!")
var rowNumber = $(this).closest("tr").attr("id")
console.log(rowNumber)
$('#' + rowNumber).addClass("selectedRow")
var dataElement = Sheetsee.getMatches(gData, rowNumber, "rowNumber")
console.log(dataElement)
var selectedSpot = ich.selectedSpot({
rows: dataElement
})
@ -95,6 +127,13 @@
})
$('#latestSpot').html(latestSpot)
function refocusMap(){
var searchTerm = $('#tableFilter').val()
var searchData = Sheetsee.getKeyword(gData, searchTerm)
var searchCoords = ""
// map.setView(viewCoords, zoomLevel)
}
})
var optionsJSON = ["name", "address", "city", "rownumber"]
@ -107,12 +146,16 @@
function addPopups(map, markerLayer) {
markerLayer.on('click', function(e) {
var feature = e.layer.feature
var popupContent = '<h2>' + feature.opts.name + '</h2>' +
'<h3>' + feature.opts.address + ', ' + feature.opts.city + '</h3>'
var popupContent = '<h2>' + feature.opts.name + '</h2>'
e.layer.bindPopup(popupContent,{closeButton: false,})
})
}
$('.resetMap').click(function() {
$('.spotRow').removeClass("selectedRow")
markerLayer = Sheetsee.addMarkerLayer(geoJSON, map, 11)
$('#latestSpot').css("display", "inline")
$('#selectedSpot').css("display", "none")
})
</script>

View File

@ -88,15 +88,32 @@ function makeTable(data, targetDiv) {
//
// // // // // // // // // // // // // // // // // // // // // // // // // //
function getGroupCount(data, groupTerm) {
function getKeywordCount(data, keyword) {
console.log(data, keyword)
var group = []
data.forEach(function (d) {
if (d.status.match(groupTerm)) group.push(d)
for(var key in d) {
var value = d[key].toString().toLowerCase()
if (value.match(keyword.toLowerCase())) group.push(d)
}
})
return group.length
if (group = []) return "0"
}
function getKeyword(data, keyword) {
console.log(data, keyword)
var group = []
data.forEach(function (d) {
for(var key in d) {
var value = d[key].toString().toLowerCase()
if (value.match(keyword.toLowerCase())) group.push(d)
}
})
return group
if (group = []) return "null"
}
function getColumnTotal(data, column){
var total = []
data.forEach(function (d) {
@ -741,7 +758,8 @@ exports.mostFrequent = mostFrequent
exports.addUnitsLabels = addUnitsLabels
exports.getOccurance = getOccurance
exports.getMatches = getMatches
exports.getGroupCount = getGroupCount
exports.getKeyword = getKeyword
exports.getKeywordCount = getKeywordCount
exports.getColumnTotal = getColumnTotal
exports.getMax = getMax
exports.getMin = getMin