Skip to content

Commit

Permalink
Minor refactoring & Major formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
trasherdk committed Nov 25, 2022
1 parent f480898 commit 215b9a2
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 101 deletions.
1 change: 1 addition & 0 deletions examples/geocoding-nominatim.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/png" href="../images/favicon.png">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.0/dist/leaflet.css" />
<link rel="stylesheet" href="../src/leaflet-search.css" />
<link rel="stylesheet" href="style.css" />
Expand Down
Binary file added images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title>Leaflet.Control.Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
<link rel="stylesheet" href="examples/style.css" />
</head>

Expand Down
54 changes: 27 additions & 27 deletions src/leaflet-search-geocoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ any contributions is welcome <3
module.exports = factory(require('leaflet'))
} else {
// Browser globals
if (typeof window.L === 'undefined') { throw 'Leaflet must be loaded first' }
if (typeof window.L === 'undefined') { throw new Error('Leaflet must be loaded first') }
factory(window.L)
}
})(function (L) {
Expand All @@ -31,36 +31,36 @@ any contributions is welcome <3
autoCollapse: true,
minLength: 2
},
/* onAdd: function (map) {
L.Control.Search.prototype.onAdd.call(this, map);
console.log('Geocoder',this.options)
}, */
/* onAdd: function (map) {
L.Control.Search.prototype.onAdd.call(this, map);
console.log('Geocoder',this.options)
}, */
geocoders: {
/*
'google': {
urlTmpl: "//maps.googleapis.com/maps/api/geocode/json?key={key}&address={text}"
//todo others
},
'here': {
urlTmpl: https://geocoder.ls.hereapi.com/6.2/geocode.json?apiKey={apiKey}&searchtext={text}"
params: function(opts, text) {
/*
'google': {
urlTmpl: "//maps.googleapis.com/maps/api/geocode/json?key={key}&address={text}"
//todo others
},
'here': {
urlTmpl: https://geocoder.ls.hereapi.com/6.2/geocode.json?apiKey={apiKey}&searchtext={text}"
params: function(opts, text) {
//opts is leaflet options input
//text is input text searched
//opts is leaflet options input
//text is input text searched
return {
'apiKey': opts.apikey,
'format': 'json',
'q': text,
'jsonp': 'herejsoncallback',
};
},
callback: function(resp) {
//TODO refact resp data
}
return {
'apiKey': opts.apikey,
'format': 'json',
'q': text,
'jsonp': 'herejsoncallback',
};
},
callback: function(resp) {
//TODO refact resp data
}
"//nominatim.openstreetmap.org/search?"
} */
"//nominatim.openstreetmap.org/search?"
} */
}
})
})
Loading

0 comments on commit 215b9a2

Please sign in to comment.