Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change to use local copy of jquery.geocodify

  • Loading branch information...
commit 58361b020dd4096b3122ddf3397ec2e577756106 1 parent 0844bb6
@JoeGermuska JoeGermuska authored
View
3  censusweb/api/templates/map.html
@@ -5,9 +5,8 @@
{% block content %}
<link rel="stylesheet" href="{{ MEDIA_URL }}leaflet/leaflet.css" type="text/css" charset="utf-8">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
-{# <script type="text/javascript" src="https://raw.github.com/datadesk/jquery-geocodify/master/jquery.geocodify.js"></script> #}
-<script src="https://raw.github.com/JoeGermuska/jquery-geocodify/master/jquery.geocodify.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}leaflet/leaflet.js"></script>
+<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.geocodify.min.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/map.js"></script>
<div id="legend">
<form id="geocoder"></form>
View
1  censusweb/media/js/jquery.geocodify.min.js
@@ -0,0 +1 @@
+(function(a){a.fn.geocodify=function(b){var c={width:400,height:27,fontSize:"16px",buttonValue:"GO",regionBias:null,viewportBias:null,onSelect:function(a){alert("Jump to: "+a.formatted_address)},minimumCharacters:5,prepSearchString:null,filterResults:null,errorHandler:null,initialText:null,noResultsText:"No results found. Please refine your search.",acceptableAddressTypes:["street_address","route","intersection","political","country","administrative_area_level_1","administrative_area_level_2","administrative_area_level_3 ","colloquial_area","locality","sublocality","neighborhood","premise","subpremise","postal_code","natural_feature","airport","park","point_of_interest","post_box","street_number","floor","room"],keyCodes:{UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8}};return this.each(function(){var d=a(this);if(b){a.extend(c,b)}d.empty().css({position:"relative",margin:0,padding:0,width:c.width,height:c.height,"font-size":c.fontSize,"z-index":9001});document.getElementById(d.attr("id")).setAttribute("autocomplete","off");var e=d.attr("id")+"-input";a("<input>").attr({type:"text",id:e}).css({padding:"0",margin:0,position:"absolute",top:0,left:0,width:c.width,height:c.height,"outline-style":"none","outline-width":"initial","outline-color":"initial","line-height":c.fontSize,"font-size":c.fontSize,border:"1px solid #9C9C9C"}).addClass("geocodifyInput").appendTo(d);document.getElementById(e).setAttribute("autocomplete","off");var f=a("#"+e);if(c.initialText){f.val(c.initialText);f.css("color","#9C9C9C");f.focus(function(){if(f.val()==c.initialText){f.val("");f.css("color","black")}})}if(c.buttonValue){var g=d.attr("id")+"-button";a("<input>").attr({type:"button",id:g,value:c.buttonValue}).css({position:"absolute",top:0,left:c.width+10,padding:"2px",margin:0,"font-size":"90%"}).addClass("geocodifyButton").appendTo(d);var h=a("#"+g)}var i=d.attr("id")+"-close";a("<div>").attr({id:i}).hide().css({cursor:"pointer",position:"absolute",right:"5px",top:"5px",height:f.height()+12,color:"#2262CC","font-weight":"bold","font-family":"Arial, sans-serif"}).addClass("geocodifyClose").html("&#215;").appendTo(d);var j=a("#"+i);var k=d.attr("id")+"-dropdown";a("<div>").attr({id:k}).css({position:"absolute",top:f.height()+2,left:0,border:"1px solid #CCC",width:c.width-2,"z-index":8001}).addClass("geocodifyDropdown").hide().appendTo(d);var l=a("#"+k);d.reset=function(){l.empty();l.hide();j.hide()};d.previousSearch=null;d.searchCache={};d.google=new google.maps.Geocoder;d.fetch=function(a,b){if(a===d.previousSearch&&!b){return false}if(a===c.initialText){return false}d.previousSearch=a;var e=a.length;if(e<c.minimumCharacters&&!b){l.html("");l.hide();j.hide();return false}if(c.prepSearchString){a=c.prepSearchString(a)}var f={address:a};if(c.regionBias){f["region"]=c.regionBias}if(c.viewportBias){f["bounds"]=c.viewportBias}this.google.geocode(f,d.onGeocode(b))};d.onGeocode=function(b){return function(e,g){d.reset();if(g!=google.maps.GeocoderStatus.OK){if(c.errorHandler){c.errorHandler(e,g);return false}}var h=new Array;a.each(e,function(b,d){a.each(d.types,function(a,b){if((new RegExp(b)).test(c.acceptableAddressTypes.join("|"))){h.push(d);return false}})});if(c.filterResults){h=c.filterResults(h)}var i=h.length;if(i===0){var k=a("<ul>").css({margin:0,padding:0,"background-color":"white"});var m=a("<li>").html(c.noResultsText).css({cursor:"pointer","margin-left":0,padding:"5px 0 5px 8px","list-style-type":"none","text-align":"left"}).appendTo(k);k.appendTo(l);l.show();a("li",l).css("cursor","default");j.show();j.click(d.reset)}else if(i===1&&b){c.onSelect(e[0]);d.reset();d.previousSearch=e[0].formatted_address;f.val(e[0].formatted_address)}else{var k=a("<ul>").css({margin:0,padding:0,"background-color":"white"});a.each(h,function(b,e){a("<li>").html(e.formatted_address).css({cursor:"pointer","margin-left":0,padding:"5px 0 5px 8px","list-style-type":"none","font-size":c.fontSize,"text-align":"left"}).click(function(){c.onSelect(e);d.reset();d.previousSearch=e.formatted_address;f.val(e.formatted_address)}).hover(function(){a(this).css({"background-color":"#EEE",cursor:"pointer"})},function(){a(this).css({"background-color":"white",cursor:"auto"})}).appendTo(k)});k.appendTo(l);l.show();j.show();j.click(d.reset)}}};setInterval(function(){d.fetch(f.val(),false)},250);d.submit(function(){return false});if(h){h.click(function(){d.fetch(f.val(),true);return false})}d.bind(a.browser.opera?"keypress":"keydown",function(b){switch(b.keyCode){case c.keyCodes.UP:var e=a("li",l);var g=0;a.each(e,function(b,c){if(a(c).hasClass("selected")){g=b;a(c).removeClass("selected").css({"background-color":"white"})}});if(g-1<0){break}a(e[g-1]).addClass("selected").css({"background-color":"#EEE"});break;case c.keyCodes.DOWN:var e=a("li",l);var g=-1;a.each(e,function(b,c){if(a(c).hasClass("selected")){g=b;a(c).removeClass("selected").css({"background-color":"white"})}});if(g-1>=e.length){break}a(e[g+1]).addClass("selected").css({"background-color":"#EEE"});break;case c.keyCodes.RETURN:var e=a("li.selected",l);if(e){e.click()}else{d.fetch(f.val(),true)}break;default:break}})})}})(jQuery)
Please sign in to comment.
Something went wrong with that request. Please try again.