+ var name = $(e.target).attr("name");
+ var ajaxSettings = {
+ url: data.url,
+ type: data.method,
+ oauth: true,
+ success: () => {
+ OSM.loadSidebarContent(path, () => {
+ initialize(path, id);
+ moveToNote();
+ });
+ },
+ error: (xhr) => {
+ content.find("#comment-error")
+ .text(xhr.responseText)
+ .prop("hidden", false)
+ .get(0).scrollIntoView({ block: "nearest" });
+ updateButtons();
+ }
+ };
+
+ if (name !== "subscribe" && name !== "unsubscribe" && name !== "reopen") {
+ ajaxSettings.data = { text: $("textarea").val() };
+ }
+
+ content.find("button[name]").prop("disabled", true);
+ $.ajax(ajaxSettings);