- else
- {
- markerPosition = [mapSize.x / 2, mapSize.y];
- }
-
- var marker = L.marker(map.containerPointToLatLng(markerPosition), {
- icon: noteIcons["new"],
- opacity: 0.7,
- draggable: true
- });
-
- var popupContent = $(JST["templates/notes/new"]({ create_url: $(e.target).attr("href") }));
-
- popupContent.find("textarea").on("input", function (e) {
- var form = e.target.form;
-
- if ($(e.target).val() == "") {
- $(form.add).prop("disabled", true);
- } else {
- $(form.add).prop("disabled", false);
- }
- });
-
- popupContent.find("input[type=submit]").on("click", function (e) {
- e.preventDefault();
- createNote(marker, e.target.form, $(e.target).data("url"));
- });
-
- marker.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
-
- $(".leaflet-popup-close-button").on("click.close", function (e) {
- map.removeLayer(marker);
-
- $("#createnoteanchor").removeClass("disabled").addClass("geolink");
- });
-
- marker.on("dragend", function (e) {
- e.target.openPopup();
- });
- });
-});