Skip to content

Commit 157c165

Browse files
author
Andy Townsend
committed
Cut down and commented the JS
1 parent 5ffb45c commit 157c165

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

resources/svwd01_index_debug_langswitch.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,12 @@
118118
attributionControl: false
119119
});
120120

121+
// The language styles are either blank or a two letter language code that can be included in the json path
121122
var styleList = document.getElementById('styles');
123+
// When then selection dropdown changes, the map style is changed, which causes a reload.
122124
styleList.addEventListener('change', function(e) {
123125
var langId = e.target.value;
124126
map.setStyle( window.location.protocol+'//'+window.location.host+'/vector/style_svwd01' + langId + '.json' );
125-
var url = new URL(window.location.href);
126-
url.searchParams.set('style', langId);
127-
window.history.replaceState(null, null, url);
128127
});
129128

130129
// Add default OSM attribution

resources/svwd01_index_nodebug_langswitch.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,12 @@
118118
attributionControl: false
119119
});
120120

121+
// The language styles are either blank or a two letter language code that can be included in the json path
121122
var styleList = document.getElementById('styles');
123+
// When then selection dropdown changes, the map style is changed, which causes a reload.
122124
styleList.addEventListener('change', function(e) {
123125
var langId = e.target.value;
124126
map.setStyle( window.location.protocol+'//'+window.location.host+'/vector/style_svwd01' + langId + '.json' );
125-
var url = new URL(window.location.href);
126-
url.searchParams.set('style', langId);
127-
window.history.replaceState(null, null, url);
128127
});
129128

130129
// Add default OSM attribution

0 commit comments

Comments
 (0)