From 6ff8730e7cf3b8f07723b0d03f6ec88c1bd31400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Mon, 24 Jul 2017 07:15:49 +0200 Subject: [PATCH] Shall ipLocation be used? --- conf.php-dist | 3 +++ src/location.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/conf.php-dist b/conf.php-dist index 98262a62..31b81585 100644 --- a/conf.php-dist +++ b/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 diff --git a/src/location.js b/src/location.js index c1a42d97..3f92d10f 100644 --- a/src/location.js +++ b/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)