Use String#startsWith instead of String#indexOf
This commit is contained in:
@@ -27,7 +27,7 @@ function getKMLImage(href) {
|
||||
let url = href;
|
||||
let path = window.location.href;
|
||||
path = path.slice(0, path.lastIndexOf('/') + 1);
|
||||
if (href.indexOf(path) === 0) {
|
||||
if (href.startsWith(path)) {
|
||||
const regexp = new RegExp(href.replace(path, '') + '$', 'i');
|
||||
const kmlFile = zip.file(regexp)[0];
|
||||
if (kmlFile) {
|
||||
|
||||
@@ -86,7 +86,7 @@ map.on(['click', 'pointermove'], function (event) {
|
||||
}
|
||||
const fid = feature.getId();
|
||||
|
||||
if (selectElement.value.indexOf('singleselect') === 0) {
|
||||
if (selectElement.value.startsWith('singleselect')) {
|
||||
selection = {};
|
||||
}
|
||||
// add selected feature to lookup
|
||||
|
||||
Reference in New Issue
Block a user