X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/1548ff6a501118dbc311465306b009888fcc31a9..d3b0d0f597e0f84246dd755c6de3f29770134b44:/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 0c16eea..89a59ef 100644 --- a/forum/skins/default/media/js/osqa.main.js +++ b/forum/skins/default/media/js/osqa.main.js @@ -104,7 +104,7 @@ var response_commands = { alert('ok'); }, - insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url, can_convert) { + insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url, can_convert, show_latest_comments_first) { var $container = $('#comments-container-' + post_id); var skeleton = $('#new-comment-skeleton-' + post_id).html().toString(); @@ -115,8 +115,11 @@ var response_commands = { .replace(new RegExp('%DELETE_URL%', 'g'), delete_url) .replace(new RegExp('%EDIT_URL%', 'g'), edit_url) .replace(new RegExp('%CONVERT_URL%', 'g'), convert_url); - - $container.append(skeleton); + if (show_latest_comments_first) { + $container.prepend(skeleton); + } else { + $container.append(skeleton); + } // Show the convert comment to answer tool only if the current comment can be converted if (can_convert == true) { @@ -331,7 +334,8 @@ function process_ajax_response(data, evt, callback) { if (!data.success && data['error_message'] != undefined) { show_message(evt, data.error_message, function() {if (callback) callback(true);}); end_command(false); - } else if (typeof data['commands'] != undefined){ + } + if (typeof data['commands'] != undefined){ for (var command in data.commands) { response_commands[command].apply(null, data.commands[command])