Total Complexity | 6 |
Complexity/F | 1.5 |
Lines of Code | 23 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | $(document).ready(function() { |
||
2 | $('#net_nehmer_comments_admin').on('click', '.net_nehmer_comments_comment_toolbar .moderate-ajax', function(event) { |
||
3 | event.preventDefault(); |
||
4 | var comment = $(this).closest('.net_nehmer_comments_comment'), |
||
5 | toolbar = comment.find('.net_nehmer_comments_comment_toolbar'); |
||
6 | |||
7 | if (toolbar.hasClass('net_nehmer_comments_comment_toolbar_busy')) { |
||
8 | return; |
||
9 | } |
||
10 | toolbar.addClass('net_nehmer_comments_comment_toolbar_busy'); |
||
11 | $.post(this.href, {guid: this.dataset.guid, action: this.dataset.action}, function(data) { |
||
12 | var container = comment.parent(); |
||
13 | comment.slideUp('fast', function() { |
||
14 | $(this).remove(); |
||
15 | }); |
||
16 | if ($('.net_nehmer_comments_comment').length > 0) { |
||
17 | $('.net_nehmer_comments_comment').last().after($(data)); |
||
18 | } else { |
||
19 | container.append($(data)); |
||
20 | } |
||
21 | }); |
||
22 | }); |
||
23 | }); |
||
24 |