diff --git a/js/control/RoutingOptions.js b/js/control/RoutingOptions.js index 2305b9e..69770e3 100644 --- a/js/control/RoutingOptions.js +++ b/js/control/RoutingOptions.js @@ -58,11 +58,9 @@ BR.RoutingOptions = L.Evented.extend({ $('.selectpicker').selectpicker('val', values); this.refreshUI(); - if (options.profile) { - // profile got not selected = not in option values -> custom profile passed with permalink - if (L.DomUtil.get('profile').value != options.profile) { - this.setCustomProfile(options.profile, true); - } + if (options.profile && L.BRouter.isCustomProfile(options.profile)) { + // custom profile passed with permalink + this.setCustomProfile(options.profile, true); } }, diff --git a/js/router/BRouter.js b/js/router/BRouter.js index dec5ed9..9f39e18 100644 --- a/js/router/BRouter.js +++ b/js/router/BRouter.js @@ -8,7 +8,11 @@ L.BRouter = L.Class.extend({ PRECISION: 6, NUMBER_SEPARATOR: ',', GROUP_SEPARATOR: '|', - ABORTED_ERROR: 'aborted' + ABORTED_ERROR: 'aborted', + CUSTOM_PREFIX: 'custom_', + isCustomProfile: function(profileName) { + return profileName && profileName.substring(0, 7) === L.BRouter.CUSTOM_PREFIX; + } }, options: {}, @@ -65,7 +69,7 @@ L.BRouter = L.Class.extend({ if (params.alternativeidx == 0) delete params.alternativeidx; // don't add custom profile, as these are only stored temporarily - if (params.profile && params.profile.substring(0, 7) === 'custom_') { + if (params.profile && L.BRouter.isCustomProfile(params.profile)) { delete params.profile; } }