Code Duplication    Length = 61-61 lines in 2 locations

ol6/script.js 1 location

@@ 121-181 (lines=61) @@
118
 * @type {Boolean}
119
 */
120
osmEnable = true;
121
if (osmEnable) {
122
    baseLyrGroup.getLayers().push(
123
        new ol.layer.Tile({
124
            visible: true,
125
            title:   'OSM',
126
            type:    'base',
127
            source:  new ol.source.OSM()
128
        }));
129
130
    baseLyrGroup.getLayers().push(
131
        new ol.layer.Tile({
132
            visible: mapOpts.baselyr === "cycle map",
133
            title:   'cycle map',
134
            type:    'base',
135
            source:  new ol.source.OSM({
136
                url:          'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + tfApiKey,
137
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
138
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
139
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
140
            })
141
        }));
142
143
    baseLyrGroup.getLayers().push(
144
        new ol.layer.Tile({
145
            visible: mapOpts.baselyr === "transport",
146
            title:   'transport',
147
            type:    'base',
148
            source:  new ol.source.OSM({
149
                url:          'https://{a-c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=' + tfApiKey,
150
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
151
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
152
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
153
            })
154
        }));
155
156
    baseLyrGroup.getLayers().push(
157
        new ol.layer.Tile({
158
            visible: mapOpts.baselyr === "landscape",
159
            title:   'landscape',
160
            type:    'base',
161
            source:  new ol.source.OSM({
162
                url:          'https://{a-c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + tfApiKey,
163
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
164
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
165
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
166
            })
167
        }));
168
169
    baseLyrGroup.getLayers().push(
170
        new ol.layer.Tile({
171
            visible: mapOpts.baselyr === "outdoors",
172
            title:   'outdoors',
173
            type:    'base',
174
            source:  new ol.source.OSM({
175
                url:          'https://{a-c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + tfApiKey,
176
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
177
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
178
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
179
            })
180
        }));
181
}
182
183
let /**
184
 * Bing tiles flag.

script.js 1 location

@@ 108-168 (lines=61) @@
105
        })
106
    });
107
108
    if (osmEnable) {
109
        baseLyrGroup.getLayers().push(
110
            new ol.layer.Tile({
111
                visible: true,
112
                title:   'OSM',
113
                type:    'base',
114
                source:  new ol.source.OSM()
115
            }));
116
117
        baseLyrGroup.getLayers().push(
118
            new ol.layer.Tile({
119
                visible: mapOpts.baselyr === "cycle map",
120
                title:   'cycle map',
121
                type:    'base',
122
                source:  new ol.source.OSM({
123
                    url:          'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + tfApiKey,
124
                    attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
125
                                      + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
126
                                      + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
127
                })
128
            }));
129
130
        baseLyrGroup.getLayers().push(
131
            new ol.layer.Tile({
132
                visible: mapOpts.baselyr === "transport",
133
                title:   'transport',
134
                type:    'base',
135
                source:  new ol.source.OSM({
136
                    url:          'https://{a-c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=' + tfApiKey,
137
                    attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
138
                                      + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
139
                                      + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
140
                })
141
            }));
142
143
        baseLyrGroup.getLayers().push(
144
            new ol.layer.Tile({
145
                visible: mapOpts.baselyr === "landscape",
146
                title:   'landscape',
147
                type:    'base',
148
                source:  new ol.source.OSM({
149
                    url:          'https://{a-c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + tfApiKey,
150
                    attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
151
                                      + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
152
                                      + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
153
                })
154
            }));
155
156
        baseLyrGroup.getLayers().push(
157
            new ol.layer.Tile({
158
                visible: mapOpts.baselyr === "outdoors",
159
                title:   'outdoors',
160
                type:    'base',
161
                source:  new ol.source.OSM({
162
                    url:          'https://{a-c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + tfApiKey,
163
                    attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
164
                                      + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
165
                                      + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
166
                })
167
            }));
168
    }
169
170
    if (bEnable && bApiKey !== '') {
171
        baseLyrGroup.getLayers().push(