]> git.openstreetmap.org Git - rails.git/blob - app/assets/javascripts/leaflet.locate.js
Merge remote-tracking branch 'upstream/pull/5217'
[rails.git] / app / assets / javascripts / leaflet.locate.js
1 L.OSM.locate = function (options) {
2   var control = L.control.locate(Object.assign({
3     icon: "icon geolocate",
4     iconLoading: "icon geolocate",
5     strings: {
6       title: I18n.t("javascripts.map.locate.title"),
7       popup: function (options) {
8         return I18n.t("javascripts.map.locate." + options.unit + "Popup", { count: options.distance });
9       }
10     }
11   }, options));
12
13   control.onAdd = function (map) {
14     var container = Object.getPrototypeOf(this).onAdd.apply(this, [map]);
15     $(container)
16       .removeClass("leaflet-control-locate leaflet-bar")
17       .addClass("control-locate")
18       .children("a")
19       .attr("href", "#")
20       .removeClass("leaflet-bar-part leaflet-bar-part-single")
21       .addClass("control-button");
22     return container;
23   };
24
25   return control;
26 };