Plugin Directory

Changeset 2481988


Ignore:
Timestamp:
02/26/2021 05:59:33 AM (5 years ago)
Author:
intelchip
Message:

Default to San Francisco on map creation. ipinfo has a limit on requests to get current coordinates

Location:
osm-map-elementor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • osm-map-elementor/tags/1.0.6/osm-map.php

    r2481795 r2481988  
    16121612                } else {
    16131613
    1614                     // get current user's coordinates for default render
    1615                     jQuery.get("https://ipinfo.io/json", function (response) {
    1616                         let [lat, lng] = response.loc.split(',');
    1617 
    1618                         // update the markers with default coordinates
    1619                         markers.push({
    1620                             lat: lat,
    1621                             lng: lng,
    1622                             marker: {
    1623                                 button_text: "",
    1624                                 button_url: "",
    1625                                 marker_coords: response.loc,
    1626                                 marker_description: "",
    1627                                 marker_location: "",
    1628                                 marker_title: "",
    1629                                 show_button: "no"
    1630                             }
    1631                         });
    1632 
    1633                         // set center coordinates
    1634                         map.setView([lat, lng], zoom);
    1635 
    1636                         // build our markers
    1637                         buildMarkers(markers);
    1638 
    1639                     }, "jsonp");
     1614                    // set our default coordinates to San Francisco
     1615                    let lat = 37.7749295;
     1616                    let lng = -122.4194155;
     1617
     1618                    // update the markers with default coordinates
     1619                    markers.push({
     1620                        lat: lat,
     1621                        lng: lng,
     1622                        marker: {
     1623                            button_text: "",
     1624                            button_url: "",
     1625                            marker_coords: {
     1626                                lat,
     1627                                lng
     1628                            },
     1629                            marker_description: "",
     1630                            marker_location: "",
     1631                            marker_title: "",
     1632                            show_button: "no"
     1633                        }
     1634                    });
     1635
     1636                    // set center coordinates
     1637                    map.setView([lat, lng], zoom);
     1638
     1639                    // build our markers
     1640                    buildMarkers(markers);
    16401641                }
    16411642
  • osm-map-elementor/trunk/osm-map.php

    r2481787 r2481988  
    16121612                } else {
    16131613
    1614                     // get current user's coordinates for default render
    1615                     jQuery.get("https://ipinfo.io/json", function (response) {
    1616                         let [lat, lng] = response.loc.split(',');
    1617 
    1618                         // update the markers with default coordinates
    1619                         markers.push({
    1620                             lat: lat,
    1621                             lng: lng,
    1622                             marker: {
    1623                                 button_text: "",
    1624                                 button_url: "",
    1625                                 marker_coords: response.loc,
    1626                                 marker_description: "",
    1627                                 marker_location: "",
    1628                                 marker_title: "",
    1629                                 show_button: "no"
    1630                             }
    1631                         });
    1632 
    1633                         // set center coordinates
    1634                         map.setView([lat, lng], zoom);
    1635 
    1636                         // build our markers
    1637                         buildMarkers(markers);
    1638 
    1639                     }, "jsonp");
     1614                    // set our default coordinates to San Francisco
     1615                    let lat = 37.7749295;
     1616                    let lng = -122.4194155;
     1617
     1618                    // update the markers with default coordinates
     1619                    markers.push({
     1620                        lat: lat,
     1621                        lng: lng,
     1622                        marker: {
     1623                            button_text: "",
     1624                            button_url: "",
     1625                            marker_coords: {
     1626                                lat,
     1627                                lng
     1628                            },
     1629                            marker_description: "",
     1630                            marker_location: "",
     1631                            marker_title: "",
     1632                            show_button: "no"
     1633                        }
     1634                    });
     1635
     1636                    // set center coordinates
     1637                    map.setView([lat, lng], zoom);
     1638
     1639                    // build our markers
     1640                    buildMarkers(markers);
    16401641                }
    16411642
Note: See TracChangeset for help on using the changeset viewer.