Skip to content
Browse files

Slight code restructure and whitespace.

  • Loading branch information...
1 parent 40487b8 commit f15caaee36a9928864fe1ce272e6457190c56d72 @mertonium committed
Showing with 117 additions and 127 deletions.
  1. +117 −127 _attachments/index.html
View
244 _attachments/index.html
@@ -1,152 +1,142 @@
<!DOCTYPE html>
<html>
<head>
- <title>Mural Mapper</title>
+ <title>Art Mapper</title>
<link rel="stylesheet" href="style/main.css" type="text/css">
</head>
<body>
<div id="content">
- <h2>Public Art Locations</h2>
+ <h2>Public Art Mapper</h2>
<p>Send a geo-located tweet to <a href="http://twitter.com/PublicArtApp">@PublicArtApp</a> with location and a url to a photo of public artwork. <span id="demo">Take the tour</span></p>
<div id="muralmap"></div>
- <p>(Note: Currently only images posted via twicpic, yfrog, &amp; lockerz are displayed.)</p>
+ <p>(Note: Currently only images posted via twitpic, yfrog, &amp; lockerz are displayed.)</p>
</div>
- </body>
<script src="vendor/couchapp/loader.js"></script>
- <script type="text/javascript"
- src="http://maps.google.com/maps/api/js?sensor=false">
+ <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript" charset="utf-8">
var map;
$.couch.app(function(app) {
- var map;
- var allMarkers = [];
- var markers = [];
- var iconBlue = new google.maps.MarkerImage();
- iconBlue.url = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
- var iconBlueShadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
- iconBlue.size = new google.maps.Size(12, 20);
- iconBlue.anchor = new google.maps.Point(6, 20);
- iconBlue.origin = new google.maps.Point(0, 0);
-
- var latlng = new google.maps.LatLng(37.77493, -122.41942);
- var myOptions = {
- zoom: 13,
- center: latlng,
- mapTypeId: google.maps.MapTypeId.ROADMAP
-
- };
-
- map = new google.maps.Map(document.getElementById("muralmap"), myOptions);
- updateMarkers();
-
- $('#demo').click(function() {
- console.log('clicked');
- clearMarkers();
- updateMarkers(true);
- });
-
- function updateMarkers(demo) {
- demo = demo || false;
- $.getJSON('_list/geojson/locations', function(data) {
- var items = [];
- var indx = 0;
- //console.log(data);
-
- $.each(data.features, function(key, val) {
- var name, text, imagepath, thumbnail, point, marker;
- if(allMarkers.indexOf(val.properties.id) == -1) {
- indx++;
- name = val.properties.name;
- text = val.properties.text;
- imagepath = val.properties.tweet_image;
- thumbnail = val.properties.thumbnail;
- point = new google.maps.LatLng(parseFloat(val.geometry.coordinates[1]), parseFloat(val.geometry.coordinates[0]));
- marker = createMarker(point, name, imagepath, text, thumbnail);
-
- allMarkers.push(val.properties.id);
- var delta = (demo) ? 500 : 50;
-
- setTimeout(function() {
- if(demo) {
- map.panTo(point);
- }
- markers.push(marker);
- marker.setMap(map);
- }, delta * indx);
-
- }
- });
- });
- }
-
- function createMarker(point, name, image, text, thumbnail) {
-
-
- var html = "<div class=\"bubble_details\">"+
- "<div class=\"bubble_img_container\" >"+
- "<img class=\"bubble_img\" src=\""+image+ "\"/>"+
- "</div>"+
- "<div class=\"bubble_profile\">"+
- "<a href=http://twitter.com/"+ name + " target=\"_blank\"><img id=\"thumb\" src=\"" + thumbnail + "\"/></a>"+
- "<span>@" + name + "</span>"+
- "</div>";
- html += "<div class=\"bubble_text\">"+text.parseURL().parseUsername().parseHashtag()+"</div></div>";
-
- var markerOptions = {
- position: point,
- draggable: false,
- icon: iconBlue,
- shadow: iconBlueShadow,
- animation: google.maps.Animation.DROP
- }
- var infowindow = new google.maps.InfoWindow({
- content: html
- });
- var marker = new google.maps.Marker(markerOptions);
-
- google.maps.event.addListener(marker, 'click', function() {
- infowindow.open(map,marker);
- });
-
- return marker;
- }
-
- function clearMarkers() {
- allMarkers = [];
- if (markers) {
- for (i in markers) {
- markers[i].setMap(null);
- delete markers[i];
- }
+ var map;
+ var allMarkers = [];
+ var markers = [];
+ var iconBlue = new google.maps.MarkerImage();
+ iconBlue.url = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
+ var iconBlueShadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
+ iconBlue.size = new google.maps.Size(12, 20);
+ iconBlue.anchor = new google.maps.Point(6, 20);
+ iconBlue.origin = new google.maps.Point(0, 0);
+
+ var latlng = new google.maps.LatLng(37.77493, -122.41942);
+ var myOptions = {
+ zoom: 13,
+ center: latlng,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ };
+
+ map = new google.maps.Map(document.getElementById("muralmap"), myOptions);
+ updateMarkers();
+
+ $('#demo').click(function() {
+ console.log('clicked');
+ clearMarkers();
+ updateMarkers(true);
+ });
+
+ function updateMarkers(demo) {
+ demo = demo || false;
+ $.getJSON('_list/geojson/locations', function(data) {
+ var items = [];
+ var indx = 0;
+
+ $.each(data.features, function(key, val) {
+ var name, text, imagepath, thumbnail, point, marker;
+ if(allMarkers.indexOf(val.properties.id) === -1) {
+ indx++;
+ name = val.properties.name;
+ text = val.properties.text;
+ imagepath = val.properties.tweet_image;
+ thumbnail = val.properties.thumbnail;
+ point = new google.maps.LatLng(parseFloat(val.geometry.coordinates[1]), parseFloat(val.geometry.coordinates[0]));
+ marker = createMarker(point, name, imagepath, text, thumbnail);
+
+ allMarkers.push(val.properties.id);
+ var delta = (demo) ? 500 : 50;
+
+ setTimeout(function() {
+ if(demo) { map.panTo(point); }
+ markers.push(marker);
+ marker.setMap(map);
+ }, delta * indx);
+
}
- }
-
-
- String.prototype.parseURL = function() {
- return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) {
- return url.link(url);
- });
- };
-
- String.prototype.parseUsername = function() {
- return this.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) {
- var username = u.replace("@","")
- return u.link("http://twitter.com/"+username);
- });
- };
+ });
+ });
+ }
- String.prototype.parseHashtag = function() {
- return this.replace(/[#]+[A-Za-z0-9-_]+/g, function(t) {
- var tag = t.replace("#","%23")
- return t.link("http://search.twitter.com/search?q="+tag);
- });
+ function createMarker(point, name, image, text, thumbnail) {
+ var html = "<div class=\"bubble_details\">"+
+ "<div class=\"bubble_img_container\" >"+
+ "<img class=\"bubble_img\" src=\""+image+ "\"/>"+
+ "</div>"+
+ "<div class=\"bubble_profile\">"+
+ "<a href=http://twitter.com/"+ name + " target=\"_blank\"><img id=\"thumb\" src=\"" + thumbnail + "\"/></a>"+
+ "<span>@" + name + "</span>"+
+ "</div>";
+ html += "<div class=\"bubble_text\">"+text.parseURL().parseUsername().parseHashtag()+"</div></div>";
+
+ var markerOptions = {
+ position: point,
+ draggable: false,
+ icon: iconBlue,
+ shadow: iconBlueShadow,
+ animation: google.maps.Animation.DROP
};
+ var infowindow = new google.maps.InfoWindow({
+ content: html
+ });
+ var marker = new google.maps.Marker(markerOptions);
+
+ google.maps.event.addListener(marker, 'click', function() {
+ infowindow.open(map,marker);
+ });
+
+ return marker;
+ }
+ function clearMarkers() {
+ allMarkers = [];
+ if (markers) {
+ for (i in markers) {
+ markers[i].setMap(null);
+ delete markers[i];
+ }
+ }
+ }
+
+ String.prototype.parseURL = function() {
+ return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) {
+ return url.link(url);
+ });
+ };
+
+ String.prototype.parseUsername = function() {
+ return this.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) {
+ var username = u.replace("@","")
+ return u.link("http://twitter.com/"+username);
+ });
+ };
+
+ String.prototype.parseHashtag = function() {
+ return this.replace(/[#]+[A-Za-z0-9-_]+/g, function(t) {
+ var tag = t.replace("#","%23")
+ return t.link("http://search.twitter.com/search?q="+tag);
+ });
+ };
});
</script>
<script src="/_utils/script/json2.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
-
<script src="/_utils/script/jquery.couch.js"></script>
+ </body>
</html>

0 comments on commit f15caae

Please sign in to comment.
Something went wrong with that request. Please try again.