- var control = L.control(options);
-
- control.onAdd = function (map) {
- var $container = $('<div>')
- .attr('class', 'control-share');
-
- $('<a>')
- .attr('class', 'control-button')
- .attr('href', '#')
- .attr('title', 'Share')
- .html('<span class="icon share"></span>')
- .on('click', toggle)
- .appendTo($container);
-
- var $ui = $('<div>')
- .attr('class', 'share-ui');
-
- $('<div>')
- .attr('class', 'sidebar_heading')
- .appendTo($ui)
+ var control = L.OSM.sidebarPane(options, "share", "javascripts.share.title", "javascripts.share.title"),
+ marker = L.marker([0, 0], { draggable: true }),
+ locationFilter = new L.LocationFilter({
+ enableButton: false,
+ adjustButton: false
+ });
+
+ control.onAddPane = function (map, button, $ui) {
+ // Link / Embed
+
+ var $linkSection = $("<div>")
+ .attr("class", "section share-link")
+ .appendTo($ui);
+
+ $("<h4>")
+ .text(I18n.t("javascripts.share.link"))
+ .appendTo($linkSection);
+
+ var $form = $("<form>")
+ .appendTo($linkSection);
+
+ $("<div>")
+ .attr("class", "form-check mb-3")
+ .appendTo($form)
+ .append(
+ $("<label>")
+ .attr("for", "link_marker")
+ .attr("class", "form-check-label")
+ .append(
+ $("<input>")
+ .attr("id", "link_marker")
+ .attr("type", "checkbox")
+ .attr("class", "form-check-input")
+ .bind("change", toggleMarker))
+ .append(I18n.t("javascripts.share.include_marker")));
+
+ $("<div>")
+ .attr("class", "share-tabs")
+ .appendTo($form)
+ .append($("<a>")
+ .attr("class", "active")
+ .attr("for", "long_input")
+ .attr("id", "long_link")
+ .text(I18n.t("javascripts.share.long_link")))
+ .append($("<a>")
+ .attr("for", "short_input")
+ .attr("id", "short_link")
+ .text(I18n.t("javascripts.share.short_link")))
+ .append($("<a>")
+ .attr("for", "embed_html")
+ .attr("href", "#")
+ .text(I18n.t("javascripts.share.embed")))
+ .on("click", "a", function (e) {
+ e.preventDefault();
+ var id = "#" + $(this).attr("for");
+ $linkSection.find(".share-tabs a")
+ .removeClass("active");
+ $(this).addClass("active");
+ $linkSection.find(".share-tab")
+ .hide();
+ $linkSection.find(".share-tab:has(" + id + ")")
+ .show()
+ .find("input, textarea")
+ .select();
+ });
+
+ $("<div>")
+ .attr("class", "share-tab")
+ .css("display", "block")
+ .appendTo($form)
+ .append($("<input>")
+ .attr("id", "long_input")
+ .attr("type", "text")
+ .on("click", select));
+
+ $("<div>")
+ .attr("class", "share-tab")
+ .appendTo($form)
+ .append($("<input>")
+ .attr("id", "short_input")
+ .attr("type", "text")
+ .on("click", select));
+
+ $("<div>")
+ .attr("class", "share-tab")
+ .appendTo($form)