worldmap/worldmap.js
function doSearch() {
    var value = document.getElementById('search').value;
    marks = [];
    marksIndex = 0;
    for (var key in markers) {
        if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) {
            marks.push(markers[key]);
        }
        if (markers[key].icon === value) {
            marks.push(markers[key]);
        }
    }
    moveToMarks();
    if (marks.length === 0) {
        // If no markers found let's try a geolookup...
        var protocol = location.protocol;
        if (protocol == "file:") { protocol = "https:"; }
        var searchUrl = protocol + "//nominatim.openstreetmap.org/search?format=json&limit=1&q=";

        fetch(searchUrl + value) // Call the fetch function passing the url of the API as a parameter
        .then(function(resp) { return resp.json(); })
        .then(function(data) {
            if (data.length > 0) {
                var bb = data[0].boundingbox;
                map.fitBounds([ [bb[0],bb[2]], [bb[1],bb[3]] ]);
                map.panTo([data[0].lat, data[0].lon]);
            }
            else {
                document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>";
            }
        })
        .catch(function(err) {
            if (err.toString() === "TypeError: Failed to fetch") {
                document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>";
            }
        });
    }
    else {
        if (lockit) {
            document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Found "+marks.length+" results within bounds.</font>";
        } else {
            document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Found "+marks.length+" results.</font>";
        }
    }
}
function doSearch() {
    var value = document.getElementById('search').value;
    marks = [];
    marksIndex = 0;
    for (var key in markers) {
        if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) {
            marks.push(markers[key]);
        }
        if (markers[key].icon === value) {
            marks.push(markers[key]);
        }
    }
    moveToMarks();
    if (marks.length === 0) {
        // If no markers found let's try a geolookup...
        var protocol = location.protocol;
        if (protocol == "file:") { protocol = "https:"; }
        var searchUrl = protocol + "//nominatim.openstreetmap.org/search?format=json&limit=1&q=";

        fetch(searchUrl + value) // Call the fetch function passing the url of the API as a parameter
        .then(function(resp) { return resp.json(); })
        .then(function(data) {
            if (data.length > 0) {
                var bb = data[0].boundingbox;
                map.fitBounds([ [bb[0],bb[2]], [bb[1],bb[3]] ]);
                map.panTo([data[0].lat, data[0].lon]);
            }
            else {
                document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>";
            }
        })
        .catch(function(err) {
            if (err.toString() === "TypeError: Failed to fetch") {
                document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>";
            }
        });
    }
    else {
        if (lockit) {
            document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Found "+marks.length+" results within bounds.</font>";
        } else {
            document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Found "+marks.length+" results.</font>";
        }
    }
}
function doSearch ( ) { var value = document . getElementById ( 'search' ) . value ; marks = [ ] ; marksIndex = 0 ; for ( var key in markers ) { if ( ( ~ ( key . toLowerCase ( ) ) . indexOf ( value . toLowerCase ( ) ) ) && ( mb . contains ( markers [ key ] . getLatLng ( ) ) ) ) { marks . push ( markers [ key ] ) ; } if ( markers [ key ] . icon === value ) { marks . push ( markers [ key ] ) ; } } moveToMarks ( ) ; if ( marks . length === 0 ) { // If no markers found let's try a geolookup... var protocol = location . protocol ; if ( protocol == "file:" ) { protocol = "https:" ; } var searchUrl = protocol + "//nominatim.openstreetmap.org/search?format=json&limit=1&q=" ; fetch ( searchUrl + value ) // Call the fetch function passing the url of the API as a parameter . then ( function ( resp ) { return resp . json ( ) ; } ) . then ( function ( data ) { if ( data . length > 0 ) { var bb = data [ 0 ] . boundingbox ; map . fitBounds ( [ [ bb [ 0 ] , bb [ 2 ] ] , [ bb [ 1 ] , bb [ 3 ] ] ] ) ; map . panTo ( [ data [ 0 ] . lat , data [ 0 ] . lon ] ) ; } else { document . getElementById ( 'searchResult' ) . innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>" ; } } ) . catch ( function ( err ) { if ( err . toString ( ) === "TypeError: Failed to fetch" ) { document . getElementById ( 'searchResult' ) . innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>" ; } } ) ; } else { if ( lockit ) { document . getElementById ( 'searchResult' ) . innerHTML = "&nbsp;<font color='#ff0'>Found " + marks . length + " results within bounds.</font>" ; } else { document . getElementById ( 'searchResult' ) . innerHTML = "&nbsp;<font color='#ff0'>Found " + marks . length + " results.</font>" ; } } }
Search for markers with names of ... or icons of ...
Search for markers with names of ... or icons of ...