diff --git a/roberts games/ClusterTruckProject-master.zip b/roberts games/ClusterTruckProject-master.zip deleted file mode 100644 index 91cff93b..00000000 Binary files a/roberts games/ClusterTruckProject-master.zip and /dev/null differ diff --git a/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/.firebaserc b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/.firebaserc new file mode 100644 index 00000000..4c0b5252 --- /dev/null +++ b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "nyevents-77bd9" + } +} diff --git a/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/firebase.json b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/firebase.json new file mode 100644 index 00000000..e7829392 --- /dev/null +++ b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/firebase.json @@ -0,0 +1,10 @@ +{ + "hosting": { + "public": "public", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ] + } +} diff --git a/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/404.html b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/404.html new file mode 100644 index 00000000..829eda8f --- /dev/null +++ b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/404.html @@ -0,0 +1,33 @@ + + + + + + Page Not Found + + + + +
+

404

+

Page Not Found

+

The specified file was not found on this website. Please check the URL for mistakes and try again.

+

Why am I seeing this?

+

This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html file in your project's configured public directory.

+
+ + diff --git a/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/README.md b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/README.md new file mode 100644 index 00000000..a638ee02 --- /dev/null +++ b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/README.md @@ -0,0 +1,2 @@ +# ClusterTruckProject +Single page web app created as part of the ClusterTruck interview process diff --git a/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/index.html b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/index.html new file mode 100644 index 00000000..86b951ae --- /dev/null +++ b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/index.html @@ -0,0 +1,46 @@ + + + + + + + Document + + + + + + + + + +
+
+

ClusterTruck Take Home Problem

+

Created by: Logan Schiessle

+
+
+ +
+ None
+ 0
+ 1
+
+
+
+
+ + \ No newline at end of file diff --git a/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/markers.js b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/markers.js new file mode 100644 index 00000000..913280f3 --- /dev/null +++ b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/markers.js @@ -0,0 +1,91 @@ +var map; +var facetChoice; +var facetChosen = 0; +var sw; +var ne; + + +//Runs when the page is loaded, in order to create a google map with the center in New York City. +function initMap() { + var newYorkCityLatLong = new google.maps.LatLng(40.7128, -74.0059); + map = new google.maps.Map(document.getElementById('map'), { + center: newYorkCityLatLong, + zoom: 9, + }); + + //this listener works, but I am having a very hard time getting the NY Times api to work the way it is supposed to when using the sw, + //and ne parameters. When those are supplied it is supposed to keep the results to those within the box created by those two points, + //but it doesn't work, not here or in their console. A different way to do this would be to manually check if every point is within the + //parameters. + google.maps.event.addListener(map, 'bounds_changed', function() { + var bounds = map.getBounds(); + sw = bounds.getSouthWest(); + ne = bounds.getNorthEast(); + swLat = sw.lat().toFixed(5); + swLng = sw.lng().toFixed(5); + neLat = ne.lat().toFixed(5); + neLng = ne.lng().toFixed(5); + loadMarkers(); + }); +} + +//Queries the NY Times Geographic API and takes the results and creates markers out of them. +function loadMarkers() { + var url = "https://api.nytimes.com/svc/semantic/v2/geocodes/query.json"; + if(facetChosen) { + url += '?' + $.param({ + 'sw': swLat + ',' + swLng, + 'ne': neLat + ',' + neLng, + 'facet': facetChoice, + 'country_code': "US", + 'api-key': "af9bf1c31430421ab0ab8f940e8b987f" + }); + facetChosen = 0; + } else { + url += '?' + $.param({ + 'sw': swLat + ',' + swLng, + 'ne': neLat + ',' + neLng, + 'country_code': "US", + 'api-key': "af9bf1c31430421ab0ab8f940e8b987f" + }); +} + var things; + //This proxyurl was used to overcome a Access-Control-Allow-Origin error with CORS. + const proxyurl = "https://cors-anywhere.herokuapp.com/"; + //could use this fetch method, or a GET ajax call. + fetch(proxyurl + url) + .then(response => response.text()) + .then(contents => JSON.parse(contents)) + .then(function(data){ + console.log(url); + for (var i = 0; i < data.results.length; i++) { + var latLon = new google.maps.LatLng(data.results[i].latitude,data.results[i].longitude); + var marker = new google.maps.Marker({ + position: latLon, + }); + marker.addListener('click', addInfoWindow(data, marker, i)); + marker.setMap(map); + } + }); + } + +//Creates an info window to be opened when a marker is clicked. +function addInfoWindow(data, marker, index) { + return function() { + var infowindow = new google.maps.InfoWindow({ + content: '

' + data.results[index].name + '

' + + '

' + data.results[index].name + ' has a lat/lng of (' + data.results[index].latitude + ', ' + data.results[index].longitude + '). ' + + 'It also has an elevation of ' + data.results[index].elevation + ' feet.

' + }); + infowindow.open(map, marker); + } +} + +//Takes radio button input and reloads markers based on the change in facets. +function changeFacet(val) { + if (val > 0) { + facetChoice = val; + facetChosen = 1; + } + loadMarkers(); +} \ No newline at end of file diff --git a/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/styles.css b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/styles.css new file mode 100644 index 00000000..98a063d4 --- /dev/null +++ b/roberts games/ClusterTruckProject-master/ClusterTruckProject-master/public/styles.css @@ -0,0 +1,77 @@ +#title { + background-color: orange; + height: 100px; + width: 100%; + display: inline-block; +} + +#titleWords { + float: left; + width: 90%; + height: 100px; + margin: 0px; +} + +#map { + height: 100%; + width: 100%; +} + +html, body { + height: 100%; + margin: 0; + padding: 0; + font-family: 'Ubuntu', sans-serif; + background-color: #eee; +} + +h1, h2 { + margin-top: 0; + text-align: center; +} + +.facetButton { + background-color: black; + color: white; + padding: 16px; + font-size: 16px; + border: none; + cursor: pointer; +} + +.facetDrop { + float: right; + width: 10%; + height: 50px; + margin-top: 15px; +} + +.facetDrop-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + z-index: 1; + width: 100%; +} + + +.facetDrop-content a { + color: black; + padding: 12px 16px; + display: block; +} + +.facetDrop-content a:hover { + background-color: #f1f1f1 +} + +.facetDrop:hover .facetDrop-content { + display: block; +} + +.facetDrop:hover .facetButton { + background-color: white; + color: black; +}