X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/0ba16baba0615dd405486c7d87f943d71518375c..6d48df570d9b759d0fd18001fbcacc5c5a36a7e0:/forum/skins/default/media/js/osqa.main.js diff --git a/forum/skins/default/media/js/osqa.main.js b/forum/skins/default/media/js/osqa.main.js index af80421..8326eb0 100644 --- a/forum/skins/default/media/js/osqa.main.js +++ b/forum/skins/default/media/js/osqa.main.js @@ -294,6 +294,24 @@ $(function() { if (el.is('.withprompt')) { load_prompt(evt, el.attr('href')); + } else if(el.is('.confirm')) { + $dialog = show_dialog({ + html: messages.confirm, + extra_class: 'confirm', + event: evt, + yes_callback: function() { + start_command(); + $.getJSON(el.attr('href'), function(data) { + process_ajax_response(data, evt); + $dialog.fadeOut('fast', function() { + $dialog.remove(); + }); + }); + }, + yes_text: messages.yes, + show_no: true, + no_text: messages.no + }); } else { start_command(); $.getJSON(el.attr('href'), function(data) { @@ -372,7 +390,7 @@ $(function() { cleanup_form(); function process_form_changes() { - var length = $textarea.val().length; + var length = $textarea.val().replace(/[ ]{2,}/g," ").length; if (current_length == length) return; @@ -388,6 +406,7 @@ $(function() { $chars_togo_message.show(); $chars_counter.html(min_length - length); } else { + length = $textarea.val().length; $chars_togo_message.hide(); $chars_left_message.show(); $chars_counter.html(max_length - length);