From 712bf65e8b2ac327b610893d5b3c8a947042ce34 Mon Sep 17 00:00:00 2001 From: ilyankou Date: Wed, 16 Aug 2023 22:41:17 +0100 Subject: [PATCH] Add support for basemap api keys --- scripts/constants.js | 1 + scripts/storymap.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/constants.js b/scripts/constants.js index 921ef218..ad040ef4 100644 --- a/scripts/constants.js +++ b/scripts/constants.js @@ -10,6 +10,7 @@ var constants = { _githubRepo: 'Author GitHub Repo Link', // Map Settings _tileProvider: 'Basemap Tiles', + _tileProviderApiKey: 'Basemap Tiles API Key', _zoomControls: 'Zoom Controls', _narrativeWidth: 'Narrative Width', _imgContainerHeight: 'Media Container Height', diff --git a/scripts/storymap.js b/scripts/storymap.js index 2bb49b38..724ef293 100644 --- a/scripts/storymap.js +++ b/scripts/storymap.js @@ -85,7 +85,13 @@ $(window).on('load', function() { function addBaseMap() { var basemap = trySetting('_tileProvider', 'Stamen.TonerLite'); L.tileLayer.provider(basemap, { - maxZoom: 18 + maxZoom: 18, + + // Pass the api key to most commonly used parameters + apiKey: trySetting('_tileProviderApiKey', ''), + apikey: trySetting('_tileProviderApiKey', ''), + key: trySetting('_tileProviderApiKey', ''), + accessToken: trySetting('_tileProviderApiKey', '') }).addTo(map); }