$(document).ready(function() { var new_comment = $('#open-comment.comment.hidden.new_line_comment'); $(document).on('click', '.buttons a.edit_comment', function() { $(this).parents('div.activity').hide() .next().show(); return false; }); $(document).on('click', '.cancel_edit_comment.button', function() { $(this).parents('#open-comment.comment').hide() .prev().show(); return false; }); $(document).on('submit', 'form.edit_comment', function() { var form = $(this); form.parent().find('.flash').remove(); $.ajax({ type: 'POST', url: form.attr("action"), data: form.serialize(), success: function(data){ var cancel_button = form.find('.cancel_edit_comment.button'); var id = cancel_button.attr('id').match(/\d+$/)[0]; cancel_button.click(); $('#comment'+id+', #diff-comment'+id).find('.cm-s-default.md_and_cm').html(data).find('code').each(function (code) { CodeMirrorRun(this); }) }, error: function(data){ form.before(data.responseText); } }); return false; }); $('.new_inline_comment.button').on('click', function() { $(this).parents('tr').prev('tr').find("a[href='"+$(this).attr('href')+"']").click(); return false; }); $('.add_line-comment').on('click', function() { function ProcessData(data) { if(yield) { var str = "