")
.attr("class", "share-geo-uri p-3 border-bottom border-secondary-subtle")
.appendTo($ui);
@@ -119,7 +119,7 @@ L.OSM.share = function (options) {
// Image
- var $imageSection = $("
")
+ const $imageSection = $("
")
.attr("class", "share-image p-3")
.appendTo($ui);
@@ -227,8 +227,8 @@ L.OSM.share = function (options) {
.appendTo($form);
}
- var csrf_param = $("meta[name=csrf-param]").attr("content"),
- csrf_token = $("meta[name=csrf-token]").attr("content");
+ const csrf_param = $("meta[name=csrf-param]").attr("content"),
+ csrf_token = $("meta[name=csrf-token]").attr("content");
$("")
.attr("name", csrf_param)
@@ -236,7 +236,7 @@ L.OSM.share = function (options) {
.attr("type", "hidden")
.appendTo($form);
- var args = {
+ const args = {
layer: "",
width: "",
height: ""
@@ -319,7 +319,7 @@ L.OSM.share = function (options) {
}
function escapeHTML(string) {
- var htmlEscapes = {
+ const htmlEscapes = {
"&": "&",
"<": "<",
">": ">",
@@ -333,8 +333,8 @@ L.OSM.share = function (options) {
function update() {
const layer = map.getMapBaseLayer();
- var canEmbed = Boolean(layer && layer.options.canEmbed);
- var bounds = map.getBounds();
+ const canEmbed = Boolean(layer && layer.options.canEmbed);
+ let bounds = map.getBounds();
$("#link_marker")
.prop("checked", map.hasLayer(marker));
@@ -355,7 +355,7 @@ L.OSM.share = function (options) {
});
if (map.hasLayer(marker)) {
- var latLng = marker.getLatLng().wrap();
+ const latLng = marker.getLatLng().wrap();
params.set("marker", latLng.lat + "," + latLng.lng);
}
@@ -386,10 +386,10 @@ L.OSM.share = function (options) {
bounds = locationFilter.getBounds();
}
- var scale = $("#mapnik_scale").val(),
- size = L.bounds(L.CRS.EPSG3857.project(bounds.getSouthWest()),
- L.CRS.EPSG3857.project(bounds.getNorthEast())).getSize(),
- maxScale = Math.floor(Math.sqrt(size.x * size.y / 0.3136));
+ let scale = $("#mapnik_scale").val();
+ const size = L.bounds(L.CRS.EPSG3857.project(bounds.getSouthWest()),
+ L.CRS.EPSG3857.project(bounds.getNorthEast())).getSize(),
+ maxScale = Math.floor(Math.sqrt(size.x * size.y / 0.3136));
$("#mapnik_minlon").val(bounds.getWest());
$("#mapnik_minlat").val(bounds.getSouth());
@@ -427,17 +427,17 @@ L.OSM.share = function (options) {
}
function getScale() {
- var bounds = map.getBounds(),
- centerLat = bounds.getCenter().lat,
- halfWorldMeters = 6378137 * Math.PI * Math.cos(centerLat * Math.PI / 180),
- meters = halfWorldMeters * (bounds.getEast() - bounds.getWest()) / 180,
- pixelsPerMeter = map.getSize().x / meters,
- metersPerPixel = 1 / (92 * 39.3701);
+ const bounds = map.getBounds(),
+ centerLat = bounds.getCenter().lat,
+ halfWorldMeters = 6378137 * Math.PI * Math.cos(centerLat * Math.PI / 180),
+ meters = halfWorldMeters * (bounds.getEast() - bounds.getWest()) / 180,
+ pixelsPerMeter = map.getSize().x / meters,
+ metersPerPixel = 1 / (92 * 39.3701);
return Math.round(1 / (pixelsPerMeter * metersPerPixel));
}
function roundScale(scale) {
- var precision = 5 * Math.pow(10, Math.floor(Math.LOG10E * Math.log(scale)) - 2);
+ const precision = 5 * Math.pow(10, Math.floor(Math.LOG10E * Math.log(scale)) - 2);
return precision * Math.ceil(scale / precision);
}
};