Skip to content

Commit

Permalink
Show hidden map if it's requested by URL wtracks?map=...
Browse files Browse the repository at this point in the history
It is only shown transiently:
* since right now map is remembered, it will still be shown on next refresh (could be changed)
* but as soon as user changes it, it will be hidden again
  • Loading branch information
eddy-geek committed Dec 23, 2021
1 parent 563ad52 commit 4d3e92d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/wtracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ $(function(){
} else {
input = undefined;
}
if (!input || (prunedist === undefined) || isNaN(prunedist)) {
if (!input || (prunedist === undefined) || isNaN(prunedist)) {
alert("Enter distance in meters");
prunedistelt.focus();
return;
Expand Down Expand Up @@ -2059,8 +2059,10 @@ $(function(){
// Add maps and overlays
var baseLayers = {};
var overlays = {};
var baseLayer = getVal("wt.baseLayer", config.display.map);
var requestedMap = getParameterByName("map")
mapsForEach(function(name, props) {
if (props.on) {
if (props.on || name === requestedMap || name == baseLayer) {
var inList = props.in == MAP_MY ? mymaps : config.maps;
var tile = getProvider(inList[name]);
if (tile) {
Expand All @@ -2080,7 +2082,6 @@ $(function(){

// ----------------------

var baseLayer = getVal("wt.baseLayer", config.display.map);
var initialLayer = baseLayers[baseLayer] || baseLayers[config.display.map];
if (!initialLayer) {
//var availableLayerNames = "";
Expand Down Expand Up @@ -2890,7 +2891,7 @@ $(function(){
setStatus("Loading..", { spinner: true });
$("#edit-tools").hide();
var bounds;
var merge = loadCount > 0 ||  isChecked("#merge");
var merge = loadCount > 0 || isChecked("#merge");
loadCount++;
if (!merge) {
newTrack();
Expand Down Expand Up @@ -3954,8 +3955,7 @@ $(function(){
newTrack();

// map parameter
var mapname = getParameterByName("map");
if (mapname) {
if (requestedMap) {
ga('send', 'event', 'file', 'load-mapparam');
changeBaseLayer(mapname);
}
Expand Down

0 comments on commit 4d3e92d

Please sign in to comment.