1(function ($) { 2 3 var Commenting = { 4 5 handleReply: function(event) { 6 //first make tinyMCE go away so it is safe to move around in the DOM 7 event.preventDefault(); 8 tinyMCE.EditorManager.execCommand('mceRemoveEditor', false, 'comment-form-body'); 9 var currentComment = $(event.target).closest('.comment'); 10 $('#comment-form').appendTo(currentComment); 11 commentId = Commenting.getCommentId(currentComment); 12 console.log(commentId); 13 $('#parent-id').val(commentId); 14 tinyMCE.EditorManager.execCommand('mceAddEditor', false, 'comment-form-body'); 15 }, 16 17 finalizeMove: function() { 18 $('#comment-form-body_parent').attr('style', '') 19 }, 20 21 flagToggle: function(event) { 22 event.preventDefault(); 23 var commentRow = $(event.target).closest('.comment'); 24 commentRow.toggleClass('flagged'); 25 var commentId = Commenting.getCommentId(commentRow); 26 var json = {'id': commentId }; 27 var flagAction = (commentRow.hasClass('flagged')) ? 'flag' : 'unflag'; 28 $.post(Commenting.pluginRoot + flagAction, json, Commenting.flagResponseHandler); 29 }, 30 31 flagResponseHandler: function(response, status, jqxhr) { 32 var comment = $('#comment-' + response.id); 33 if(response.action == 'flagged') { 34 comment.addClass('flagged').removeClass('unflagged'); 35 } else { 36 comment.addClass('unflagged').removeClass('flagged'); 37 } 38 }, 39 40 getCommentId: function(el) { 41 return el.attr('id').substring(8); 42 }, 43 44 wysiwyg: function (params) { 45 // Default parameters 46 initParams = { 47 convert_urls: false, 48 selector: "#comment-form-body", 49 menubar: false, 50 statusbar: false, 51 toolbar_items_size: "small", 52 toolbar: "bold italic | bullist numlist | link code", 53 plugins: "lists,link,code,paste,media,autoresize", 54 autoresize_max_height: 500, 55 entities: "160,nbsp,173,shy,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm", 56 verify_html: false, 57 add_unload_trigger: false 58 }; 59 60 tinyMCE.init($.extend(initParams, params)); 61 } 62 }; 63 64 $(document).ready(function() { 65 $("a.action").click(function(e) { e.preventDefault() }); 66 $('.reply-action').click(Commenting.handleReply); 67 $('.flag-action').click(Commenting.flagToggle); 68 Commenting.wysiwyg(); 69 Commenting.pluginRoot = $('.comments').data('commentUrlBase'); 70 }); 71})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.