Browse Source

Shall ipLocation be used?

master
parent
commit
6ff8730e7c
  1. 3
      conf.php-dist
  2. 5
      src/location.js

3
conf.php-dist

@ -14,6 +14,9 @@ $config['overpassUrl'] = array(
// Location of the initial view if no IP-location can be resolved. 'zoom' is optional.
$config['defaultView'] = array('lat' => 51.505, 'lon' => -0.09, 'zoom' => 18);
// Shall the initial map view be retrieved via IP location? (default: true)
$config['checkIpLocation'] = true;
// List of available user interface languages
$languages = array(
"ast", // Asturian

5
src/location.js

@ -1,6 +1,11 @@
var ipLocation = require('./ip-location')
register_hook('init_callback', function (callback) {
if ('checkIpLocation' in config && !config.checkIpLocation) {
map.setView(config.defaultView, 'zoom' in config.defaultView ? config.defaultView.zoom : 14)
return callback()
}
ipLocation('', function (err, ipLoc) {
if (typeof ipLoc === 'object' && 'latitude' in ipLoc) {
map.setView([ ipLoc.latitude, ipLoc.longitude ], 14)

Loading…
Cancel
Save