Permalink
Browse files

Loading image for geocoder

  • Loading branch information...
dhcole committed May 1, 2012
1 parent ff2b86b commit 6226bb37841af5f644f47f67e980c67f932c7d81
View
Binary file not shown.
File renamed without changes.
View
File renamed without changes.
View
@@ -9,7 +9,7 @@
</head>
<body class="right">
<div id="header"><div class="limiter">
- <img src="logo.png">
+ <img src="img/logo.png">
<h1>Exploring A Wider Circle Donations</h1>
</div></div>
<div id="content"><div class="limiter">
View
@@ -282,4 +282,4 @@
.zoomer,
.close,
.mapbox-watermark,
-.ts-error .mapbox-logo { background-image:url(map.png); }
+.ts-error .mapbox-logo { background-image:url(img/map.png); }
View
BIN pin-s.png
Binary file not shown.
View
@@ -143,13 +143,15 @@ MB.geocoder = function(el, m, opt) {
})
)
.append($('<input type="submit">'))
+ .append($('<div id="geocode-error">'))
.submit(function(e) {
e.preventDefault();
geocode($('input[type=text]', this).val());
})
);
var geocode = function(query) {
query = encodeURIComponent(query);
+ $('form.geocode').addClass('loading');
switch(opt.service) {
case 'mapquest open':
reqwest({
@@ -158,9 +160,17 @@ MB.geocoder = function(el, m, opt) {
jsonpCallback: 'callback',
success: function (r) {
r = r[0];
+
+ if (MB.maps[m].geocodeLayer) {
+ MB.maps[m].geocodeLayer.removeAllMarkers();
+ }
+
+ $('form.geocode').removeClass('loading');
+
if (r === undefined) {
- console.log('The search you tried did not return a result.');
+ $('#geocode-error').text('This address cannot be found.').fadeIn('fast');
} else {
+ $('#geocode-error').hide();
MB.maps[m].setExtent([
new MM.Location(r.boundingbox[1], r.boundingbox[2]),
new MM.Location(r.boundingbox[0], r.boundingbox[3])
View
@@ -167,7 +167,7 @@ form.geocode input[type=text] {
float: left;
}
form.geocode input[type=submit] {
- background: url(map.png) no-repeat -125px -4px #fff;
+ background: url(img/map.png) no-repeat -125px -4px #fff;
text-indent: -9999px;
width: 20px;
height: 20px;
@@ -190,7 +190,22 @@ form.geocode input[type=submit]:active {
-moz-box-shadow:inset rgba(0,0,0,0.1) 0px 1px 3px;
-webkit-box-shadow:inset rgba(0,0,0,0.1) 0px 1px 3px;
}
-
+form.geocode.loading input[type=submit] {
+ background: url(img/ajax-loader.gif) no-repeat 50% 50%;
+ border-color:#bbb;
+ background-color:#ddd;
+ box-shadow:inset rgba(0,0,0,0.1) 0px 1px 3px;
+ -moz-box-shadow:inset rgba(0,0,0,0.1) 0px 1px 3px;
+ -webkit-box-shadow:inset rgba(0,0,0,0.1) 0px 1px 3px;
+ }
+#geocode-error {
+ display: none;
+ position: relative;
+ top: 1em;
+ clear: both;
+ color: red;
+ font-size: 11px;
+ }
a.zoomer {
top: 60px;
}
@@ -227,7 +242,7 @@ a.zoomer {
.mmg-default {
width: 20px;
height: 40px;
- background: url(map.png) -120px -30px;
+ background: url(img/map.png) -120px -30px;
left: -10px;
top: -30px;
}

0 comments on commit 6226bb3

Please sign in to comment.