{"id":2790,"date":"2014-04-15T14:11:00","date_gmt":"2014-04-15T21:11:00","guid":{"rendered":"http:\/\/deathmarchtothesea.com\/?page_id=2790"},"modified":"2016-02-22T10:25:46","modified_gmt":"2016-02-22T18:25:46","slug":"beer-crawl-calculator","status":"publish","type":"page","link":"https:\/\/deathmarchtothesea.com\/?page_id=2790","title":{"rendered":"Beer March Calculator"},"content":{"rendered":"<link href=\"\/wp-content\/themes\/weaver-ii-w-fb\/jquery-ui-1.8.21.custom.min.css\" rel=\"stylesheet\">\n<link href=\"\/wp-content\/themes\/weaver-ii-w-fb\/bootstrap-responsive.min.css\" rel=\"stylesheet\">\n<link href=\"\/wp-content\/themes\/weaver-ii-w-fb\/jquery.rating.css\" rel=\"stylesheet\">\n<link href=\"\/wp-content\/themes\/weaver-ii-w-fb\/portlandbeer.css\" rel=\"stylesheet\">\n<div>\n<div>\n<div class=\"brewery-crawls-copy-full\">\n<p>If <a href=\"http:\/\/deathmarchtothesea.com\/?page_id=3760\">64oz. to Freedom<\/a>, <a href=\"http:\/\/deathmarchtothesea.com\/?p=895\" title=\"Awesome Climb The Griffith Everyone\">Climb the Griffith<\/a>, or the <a href=\"http:\/\/deathmarchtothesea.com\/?p=2536\">BrewTour<\/a> are any indication, we are a drinking club with a hiking problem. Now you too can plan a brew march of your own. Just drag a brewery from the Breweries column to the Destinations column. Once you have more than one brewery in your Destinations list, the map find a route. You can drag and drop to reorder your list, or drag the breweries back to the left to remove them from the map.<\/p>\n<p>This is a blatant copy of the <a href=\"http:\/\/www.portlandbeer.org\/breweries\/crawls\/\">Beer Crawl Calculator on PortlandBeer.org<\/a>. If you guys want to have words over this, please let us know at <a href=\"http:\/\/twitter.com\/deathmarchla\">@deathmarchla<\/a>. Nothing but respect!!!\n\t\t<\/div>\n<\/p><\/div>\n<\/div>\n<p><\/p>\n<div style=\"clear:both;\"><\/div>\n<div style='border: solid 1px #000000;width:100%;height:700px;float:left;margin-bottom:15px;' id='brewery_crawl_map'><\/div>\n<div style=\"clear:both;\"><\/div>\n<div id=\"brewery-crawl-distance\"><\/div>\n<div style=\"clear:both;\"><\/div>\n<div class=\"crawl-options\">\n<div class=\"brewery-crawl-origins\">\n<div><strong>Breweries:<\/strong><\/div>\n<ul id=\"sortable1\" class=\"connectedSortable\" style='margin-top:10px;'>\n[print_breweries]\n                <\/ul>\n<\/p><\/div>\n<div class=\"brewery-crawl-destinations\">\n<div><strong>Destinations:<\/strong><\/div>\n<ul id=\"sortable2\" class=\"connectedSortable\"><\/ul>\n<\/p><\/div>\n<div style='clear:both;'><\/div>\n<\/p><\/div>\n<\/div>\n<p><script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.7.2\/jquery.min.js\"><\/script><br \/>\n<script src=\"\/wp-content\/themes\/weaver-ii-w-fb\/jquery-ui-1.8.23.custom.min.js\"><\/script><br \/>\n<script src=\"\/wp-content\/themes\/weaver-ii-w-fb\/bootstrap.min.js\"><\/script><br \/>\n<script type=\"text\/javascript\" src=\"\/\/platform.twitter.com\/widgets.js\"><\/script><\/p>\n<p><!-- Maps pages --><br \/>\n<script type=\"text\/javascript\" src=\"http:\/\/maps.google.com\/maps\/api\/js?sensor=false\"><\/script><br \/>\n<script type=\"text\/javascript\" src=\"\/wp-content\/themes\/weaver-ii-w-fb\/jquery.ui.map.full.min.js\"><\/script><br \/>\n<script type=\"text\/javascript\"><\/p>\n<p>\/\/ Breweries Map<\/p>\n<p>$('#brewery_crawl_map').gmap({'center': '34.107629,-118.571087', 'zoom': 11, 'disableDefaultUI':false, 'callback': function(map) {\n\tvar self = this;<\/p>\n<p>[print_breweries js='1']<\/p>\n<p>\tinitialize_brewery_crawl_map();\n\tcalcRoute_brewery_crawl();\n}});<\/p>\n<p>$( \"#sortable1, #sortable2\" ).sortable({\n  connectWith: \".connectedSortable\",\n  cursor: 'move',\n  tolerance: 'pointer',\n  stop: function(event, ui) {\n\tcalcRoute_brewery_crawl();\n  }\n}).disableSelection();<\/p>\n<p>$(\"#crawlurl\").click(function(){\n\t$(this).focus();\n\t$(this).select();\n});<\/p>\n<p>var directionsDisplay;<\/p>\n<p>var map;<\/p>\n<p>function initialize_brewery_crawl_map() {\n  directionsDisplay = new google.maps.DirectionsRenderer();\n  var myOptions = {\n\tmapTypeId: google.maps.MapTypeId.TERRAIN\n  }\n  map = new google.maps.Map(document.getElementById(\"brewery_crawl_map\"), myOptions);\n  directionsDisplay.setMap(map);\n}<\/p>\n<p>function calcRoute_brewery_crawl() {\n  var points = [];\n  var waypoints = [];\n  var itemCount = 0;\n  var url = '';<\/p>\n<p>  $(\"#sortable2 li\").each(function(){\n\turl += $(this).html() + \",\";\n\tpoints[itemCount] = $(this).data('latlng');\n\titemCount++;\n  });<\/p>\n<p>  url = url.substr(0,url.length - 1)<\/p>\n<p>  url = url.replace(\/ \/g,'-');<\/p>\n<p>  if(itemCount >=2 ){\n\t  $(\"#sharecrawl\").attr(\"href\", \"https:\/\/twitter.com\/intent\/tweet?text=Check out the custom Portland brewery crawl I created! http:\/\/www.portlandbeer.org\/breweries\/crawls\/custom\/\" +url+ \" %23craftbeer\");\n\t  $(\"#sharecrawl\").attr(\"title\", \"Share your custom Portland beer crawl!!\");<\/p>\n<p>\t  $(\"#crawlurl\").attr(\"value\", \"http:\/\/www.portlandbeer.org\/breweries\/crawls\/custom\/\" +url);\n  } else {\n\t  $(\"#sharecrawl\").attr(\"href\", \"#\");\n\t  $(\"#sharecrawl\").attr(\"title\", \"Add two destinations!\");<\/p>\n<p>\t  $(\"#crawlurl\").attr(\"value\", \"Add two destinations!\");\n  }<\/p>\n<p>  if(itemCount == 1 || itemCount == 0){\n  } else {\n\tif(itemCount == 2){\n\t  var start = points[0];\n\t  var end = points[1];\n\t} else {\n\t  var start = points[0];\n\t  for(wp=1;wp<itemCount-1;wp++){\n\t\twaypoints.push({\n\t\t  location: points[wp],\n\t\t  stopover: true\n\t\t});\n\t  }\n\t  var end = points[itemCount-1];\n\t}\n\n\tvar request = {\n\t  origin:start,\n\t  destination:end,\n\t  waypoints: waypoints,\n\t  travelMode:google.maps.TravelMode.WALKING\n\t};\n\n\tvar directionsService = new google.maps.DirectionsService();\n\tdirectionsService.route(request, function(result, status) {\n\t  if (status == google.maps.DirectionsStatus.OK) {\n\t\tdirectionsDisplay.setDirections(result);\n\t\tvar totalDistance = 0;\n\t\tvar totalDuration = 0;\n\t\tfor (var i=0; i < result.routes[0].legs.length; i++) {\n\t\t\ttotalDistance = totalDistance + parseInt(result.routes[0].legs[i].distance.value);\n\t\t\ttotalDuration = totalDuration + parseInt(result.routes[0].legs[i].duration.value);\n\t\t}\n\n\t\ttotalDistance = Math.round((totalDistance * 0.00062)*10)\/10;\n\t\ttotalDuration = Math.round((totalDuration \/ 60 \/ 60));\n\n\t\t$(\"#brewery-crawl-distance\").html(\"This crawl is about \" + totalDistance + \" miles and about \" + totalDuration + \" hours of walking.\");\n\t  }\n\t});\n\n  }\n}\n\n\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If 64oz. to Freedom, Climb the Griffith, or the BrewTour are any indication, we are a drinking club with a hiking problem. Now you too can plan a brew march of your own. Just drag a brewery from the Breweries column to the Destinations column. Once you have more than one brewery in your Destinations [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":113,"menu_order":1099,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=\/wp\/v2\/pages\/2790"}],"collection":[{"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2790"}],"version-history":[{"count":33,"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=\/wp\/v2\/pages\/2790\/revisions"}],"predecessor-version":[{"id":3781,"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=\/wp\/v2\/pages\/2790\/revisions\/3781"}],"up":[{"embeddable":true,"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=\/wp\/v2\/pages\/113"}],"wp:attachment":[{"href":"https:\/\/deathmarchtothesea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}