Skip to content

Commit 41d4dee

Browse files
committed
Stop hardcoding time-enabled layer IDs
1 parent f36db72 commit 41d4dee

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

app/assets/javascripts/index/timeslider.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
function addOpenHistoricalMapTimeSlider(map) {
77
if (map.timeslider) return;
88

9-
const historicalLayerKeys = ['historical', 'woodblock', 'japanesescroll', 'railway'];
10-
119
// Same options as the _osm_location cookie in index.js.
1210
const expiry = new Date();
1311
expiry.setYear(expiry.getFullYear() + 10);
@@ -76,7 +74,7 @@ function addOpenHistoricalMapTimeSlider(map) {
7674
function getHistoryLayerIfShowing () {
7775
let ohmlayer;
7876
map.eachLayer(function (layer) { // there's only 1 or 0 time layers at a time, so this works
79-
if (historicalLayerKeys.indexOf(layer.options.layerId) !== -1) ohmlayer = layer;
77+
if (layer instanceof L.OSM.OHM) ohmlayer = layer;
8078
});
8179
return ohmlayer;
8280
}

0 commit comments

Comments
 (0)