Created
December 9, 2013 20:10
-
-
Save cliss/7879929 to your computer and use it in GitHub Desktop.
Tacky Lights Navigator. This small bit of HTML & Javascript takes a series of addresses, and converts that into an ordered list. Each item in the list is an Apple Maps navigation link from [Your Current Location] to [That House]. This file is designed to be hosted in Dropbox and then added to your home screen on your iPhone.
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
<html> | |
<head> | |
<title>Tacky Lights</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<meta name="viewport" content="width=device-width" /> | |
<!--<link rel="apple-touch-icon-precomposed" sizes="120x120" href="put-your-holiday-icon-here" />--> | |
</head> | |
<body> | |
<ol id="list"></ol> | |
<script type="text/javascript"> | |
var addresses = []; | |
addresses.push("10424 Marbury Terrace, Glen Allen, VA"); | |
addresses.push("1021 E Cary St, Richmond, VA 23219"); | |
addresses.push("1508 Grove Avenue, Richmond, VA"); | |
addresses.push("Monument Avenue, Richmond, VA"); | |
addresses.push("6421 Fitzhugh Avenue, Richmond, VA"); | |
addresses.push("Pee, 7035 Three Chopt Road, Richmond, VA"); | |
addresses.push("8202 Shelley Road, Richmond, VA"); | |
addresses.push("9215 Venetian Way, Richmond, VA"); | |
addresses.push("9604 Asbury Court, Richmond, VA"); | |
addresses.push("9213 Holbrook Drive, Henrico, VA"); | |
addresses.push("Pee, 1420 N Parham Road, Richmond, VA"); | |
addresses.push("2300 Wistar Court, Henrico, VA"); | |
addresses.push("2334 Thousand Oaks Drive, Richmond, VA"); | |
addresses.push("2503 Pine Grove Drive, Richmond, VA"); | |
addresses.push("9004 Covewood Road, Glen Allen, VA"); | |
addresses.push("4623 Packard Road, Glen Allen, VA"); | |
addresses.push("9328 Coleson Road, Glen Allen, VA"); | |
addresses.push("4901 Daffodil Road, Glen Allen, VA"); | |
addresses.push("9300 Howze Road, Glen Allen, VA"); | |
addresses.push("9716 Wendhurst Drive, Glen Allen, VA"); | |
function replaceAll(str, from, to) { | |
return str.split(from).join(to); | |
} | |
$(document).ready(function() { | |
for (var i=0; i < addresses.length; ++i) { | |
var from = "Current+Location"; | |
var to = addresses[i]; | |
$("#list").append("<li><a href='http://maps.apple.com/?daddr=" + replaceAll(to, " ", "+") + "&saddr=" + from + "'>" + to.substr(0, to.indexOf(",")) + "</a></li>"); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
¯_(ツ)_/¯ no reason, really.
Pretty useful!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not write the array as an Array literal instead of all the addresses.push syntax.