From e75d60b0c82085591e1360326f88c69b9b916a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 6 Dec 2018 21:18:35 +0100 Subject: [PATCH] Load alternative main repo when 'repo=' parameter is used initially --- src/index.js | 9 ++++++++- src/state.js | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index ebf7bff7..e005829f 100644 --- a/src/index.js +++ b/src/index.js @@ -18,6 +18,7 @@ global.baseCategory = null global.overpassUrl = null global.overpassFrontend = null global.currentPath = null +global.mainRepo = '' global.tabs = null var lastPopupClose = 0 @@ -109,7 +110,13 @@ function onload2 (initState) { state.apply(newState) - OpenStreetBrowserLoader.getCategory('index', function (err, category) { + let repo = '' + if ('repo' in newState) { + mainRepo = newState.repo + repo = mainRepo + '/' + } + + OpenStreetBrowserLoader.getCategory(repo + 'index', function (err, category) { if (err) { alert(err) return diff --git a/src/state.js b/src/state.js index 3eb0a8d1..fb19bc2d 100644 --- a/src/state.js +++ b/src/state.js @@ -5,6 +5,11 @@ var queryString = require('query-string') function get () { var state = {} + // repo + if (mainRepo !== '') { + state.repo = mainRepo + } + // path if (currentPath) { state.path = currentPath