Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2018-11-10 00:18:45 +0300
committerPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2018-11-10 00:18:45 +0300
commit655b76233039904cf218627411fceca5a8fde68e (patch)
tree298fb82e115adcfc3312acea512dba4a31062216 /main.js
parent66e43c0603735e4652390e44c6ee783aac59dc9a (diff)
Map provider choice on mission planner page
Diffstat (limited to 'main.js')
-rw-r--r--main.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/main.js b/main.js
index 57f2d40f..2e5ed087 100644
--- a/main.js
+++ b/main.js
@@ -11,10 +11,28 @@ googleAnalyticsService.getConfig().addCallback(function (config) {
chrome.storage = chrome.storage || {};
+let globalSettings = {
+ mapProviderType: null,
+ mapApiKey: null
+};
+
$(document).ready(function () {
// translate to user-selected language
localize();
+ chrome.storage.local.get('map_provider_type', function (result) {
+ if (typeof result.map_provider_type === 'undefined') {
+ result.map_provider_type = 'osm';
+ }
+ globalSettings.mapProviderType = result.map_provider_type;
+ });
+ chrome.storage.local.get('map_api_key', function (result) {
+ if (typeof result.map_api_key === 'undefined') {
+ result.map_api_key = '';
+ }
+ globalSettings.mapApiKey = result.map_api_key;
+ });
+
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
GUI.log('Running - OS: <strong>' + GUI.operating_system + '</strong>, ' +
'Chrome: <strong>' + window.navigator.appVersion.replace(/.*Chrome\/([0-9.]*).*/, "$1") + '</strong>, ' +
@@ -282,6 +300,22 @@ $(document).ready(function () {
googleAnalyticsConfig.setTrackingPermitted(check);
});
+ $('#map-provider-type').val(globalSettings.mapProviderType);
+ $('#map-api-key').val(globalSettings.mapApiKey);
+
+ $('#map-provider-type').change(function () {
+ chrome.storage.local.set({
+ 'map_provider_type': $(this).val()
+ });
+ globalSettings.mapProviderType = $(this).val();
+ });
+ $('#map-api-key').change(function () {
+ chrome.storage.local.set({
+ 'map_api_key': $(this).val()
+ });
+ globalSettings.mapApiKey = $(this).val();
+ });
+
function close_and_cleanup(e) {
if (e.type == 'click' && !$.contains($('div#options-window')[0], e.target) || e.type == 'keyup' && e.keyCode == 27) {
$(document).unbind('click keyup', close_and_cleanup);