Last active
December 28, 2015 22:49
-
-
Save greghaygood/7574191 to your computer and use it in GitHub Desktop.
Template for the Week 7 homework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Week 7 Assignment</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<style type="text/css"> | |
#wrapper { width: 90%; margin: 0 auto;} | |
#inputs { text-align: center;} | |
#map { width: 100%; height: 300px; } | |
.highlight { color: blue;} | |
</style> | |
</head> | |
<body> | |
<div id="wrapper"> | |
<form name="search"> | |
<div id="inputs"> | |
Query: <input name="q" type="text" /> | |
<button type="submit">Search</button> | |
</div> | |
<hr/> | |
<div id="map"></div> | |
<div class="results"> | |
<ul> | |
</ul> | |
</div> | |
</form> | |
</div> | |
<script type="text/javascript" | |
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC8wZ1qW-kuxPuc5HOMhDWpegI1v4fs_QQ&sensor=false"> | |
</script> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script> | |
<script type="text/javascript" src="js/week7.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!window.console) window.console = {}; | |
if (!window.console.log) window.console.log = function() {}; | |
var MyTwitterMapApi = (function(options) { | |
var public = {}, | |
self = this, | |
options = options || {}, | |
API_BASE = window.location.href.replace(/\/[^\/]+.html\??(.*)/, '/'), | |
map = null, | |
markers = []; | |
// setup my Google map canvas | |
function initializeMap() { | |
} | |
// add a marker to the map | |
function addMarker(data) { | |
// data object format: {coordinates: array, title: string} | |
// INSERT CODE TO ADD A MARKER AND INFO WINDOW | |
// INSERT CODE TO ADD THE EVENT LISTENER FOR THE MARKER | |
} | |
// extra credit: remove a marker from the map | |
function removeMarker(data) { | |
// INSERT CODE TO REMOVE A MARKER AND INFO WINDOW, AS WELL AS ITS EVENT LISTENER | |
} | |
// setup the various event listeners needed for this app | |
function setupListeners() { | |
console.log('setupListeners()'); | |
setupSearchListener(); | |
// INSERT CODE TO SETUP A MAP | |
// INSERT 'ON' EVENT LISTENER FOR TWITTER SEARCH RESULTS | |
// INSERT 'ON' EVENT LISTENER FOR ADDING A MAP MARKER | |
} | |
// setup the event listener for running a Twitter search | |
function setupSearchListener() { | |
// 1. setup a click handler that will react to the button push | |
} | |
// apply any text changes such as keyword highlighting, twitter handle linking, etc | |
function markupTweet(data) { | |
// data object format: {tweet: string, keyword: string} | |
// INSERT CODE TO APPLY FORMATTING TO A TWEET | |
} | |
// show tweets in the browser | |
function displayTweets(data) { | |
// data object format: {response: OBJ, results: OBJ, keyword: string} | |
if ( !(data.results && data.response && data.response.length) ) { return; } // must have those to continue | |
var results = data.results, | |
response = data.response, | |
$results = $(data.results); | |
// 1. clear out the existing result area | |
// INSERT CODE HERE | |
// 2. loop through tweets, apply markupTweet() to each, then append to my result area | |
// INSERT CODE HERE | |
} | |
var init = function() { | |
console.log('init()'); | |
setupListeners(); | |
}; | |
public = { | |
init: init | |
}; | |
return public; | |
}()); | |
MyTwitterMapApi.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment