]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/media/js/osqa.main.js
change the order in which comments are ordered
[osqa.git] / forum / skins / default / media / js / osqa.main.js
index 8f785e30a294593747f900bbf79de0c3c5736413..17de7942e67d666488cf075db457c3dda5135154 100644 (file)
@@ -116,7 +116,7 @@ var response_commands = {
                 .replace(new RegExp('%EDIT_URL%', 'g'), edit_url)\r
                 .replace(new RegExp('%CONVERT_URL%', 'g'), convert_url);\r
 \r
-        $container.append(skeleton);\r
+        $container.prepend(skeleton);\r
 \r
         // Show the convert comment to answer tool only if the current comment can be converted\r
         if (can_convert == true) {\r
@@ -331,7 +331,8 @@ function process_ajax_response(data, evt, callback) {
     if (!data.success && data['error_message'] != undefined) {\r
         show_message(evt, data.error_message, function() {if (callback) callback(true);});\r
         end_command(false);\r
-    } else if (typeof data['commands'] != undefined){\r
+    }\r
+    if (typeof data['commands'] != undefined){\r
         for (var command in data.commands) {\r
             response_commands[command].apply(null, data.commands[command])\r
 \r
@@ -609,6 +610,14 @@ $(function() {
                 return false;\r
             });\r
 \r
+            // Submit comment with CTRL + Enter\r
+            $textarea.keydown(function(e) {\r
+                if (e.ctrlKey && e.keyCode == 13 && !$button.attr('disabled')) {\r
+                    // console.log('submit');\r
+                    $(this).parent().find('input.comment-submit').click();\r
+                }\r
+            });\r
+\r
             $cancel.click(function(event) {\r
                 if (confirm("You will lose all of your changes in this comment.  Do you still wish to proceed?")){\r
                     if (comment_in_form) {\r