From 39e42240344238de5c8536dc71909cb81a75ec44 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 29 May 2017 17:56:03 +0200 Subject: [PATCH] pass api key to map --- source/UI/js/Map/Map.js | 3 +++ source/UI/js/Map/MapEditor.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/source/UI/js/Map/Map.js b/source/UI/js/Map/Map.js index fc91132b..d0b47d9b 100644 --- a/source/UI/js/Map/Map.js +++ b/source/UI/js/Map/Map.js @@ -7,6 +7,7 @@ Ox.Map Basic map object API](http://code.google.com/apis/maps/documentation/javascript/). # ARGUMENTS ---------------------------------------------------------------- options options + apiKey Google API Key clickable If true, clicking on the map finds a place editable If true, places are editable find Initial query @@ -88,6 +89,7 @@ Ox.Map = function(options, self) { var that = Ox.Element({}, self) .defaults({ // fixme: isClickable? + apiKey: '', clickable: false, editable: false, find: '', @@ -524,6 +526,7 @@ Ox.Map = function(options, self) { $.getScript( document.location.protocol + '//maps.google.com/maps/api/js?callback=googleCallback&sensor=false' + + (options.api_key ? '&key=' + options.apiKey : '') ); } diff --git a/source/UI/js/Map/MapEditor.js b/source/UI/js/Map/MapEditor.js index 1b358d7f..c553095a 100644 --- a/source/UI/js/Map/MapEditor.js +++ b/source/UI/js/Map/MapEditor.js @@ -3,6 +3,7 @@ /*@ Ox.MapEditor Map Editor options Options object + apiKey Google API Key height Height in px labels If true, show labels mode Mode ('add' or 'define') @@ -23,6 +24,7 @@ Ox.MapEditor = function(options, self) { var that = Ox.Element({}, self) .defaults({ addPlace: null, + apiKey: '', collapsible: false, editPlace: null, getMatches: null, @@ -383,6 +385,7 @@ Ox.MapEditor = function(options, self) { .appendTo(self.$listStatusbar); self.$map = Ox.Map({ + apiKey: self.options.apiKey, clickable: true, editable: true, findPlaceholder: Ox._('Find on Map'),