[0] | 1 | dotclear.commentExpander = function(line) { |
---|
| 2 | var td = line.firstChild; |
---|
| 3 | |
---|
| 4 | var img = document.createElement('img'); |
---|
| 5 | img.src = dotclear.img_plus_src; |
---|
| 6 | img.alt = dotclear.img_plus_alt; |
---|
| 7 | img.className = 'expand'; |
---|
| 8 | $(img).css('cursor','pointer'); |
---|
| 9 | img.line = line; |
---|
| 10 | img.onclick = function() { dotclear.viewCommentContent(this,this.line); }; |
---|
| 11 | |
---|
| 12 | td.insertBefore(img,td.firstChild); |
---|
| 13 | }; |
---|
| 14 | |
---|
| 15 | dotclear.viewCommentContent = function(img,line) { |
---|
| 16 | var commentId = line.id.substr(1); |
---|
| 17 | |
---|
| 18 | var tr = document.getElementById('ce'+commentId); |
---|
| 19 | |
---|
| 20 | if (!tr) { |
---|
| 21 | tr = document.createElement('tr'); |
---|
| 22 | tr.id = 'ce'+commentId; |
---|
| 23 | var td = document.createElement('td'); |
---|
| 24 | td.colSpan = 6; |
---|
| 25 | td.className = 'expand'; |
---|
| 26 | tr.appendChild(td); |
---|
| 27 | |
---|
| 28 | img.src = dotclear.img_minus_src; |
---|
| 29 | img.alt = dotclear.img_minus_alt; |
---|
| 30 | |
---|
| 31 | // Get comment content |
---|
| 32 | $.get('services.php',{f:'getCommentById',id: commentId},function(data) { |
---|
| 33 | var rsp = $(data).children('rsp')[0]; |
---|
| 34 | |
---|
| 35 | if (rsp.attributes[0].value == 'ok') { |
---|
| 36 | var comment = $(rsp).find('comment_display_content').text(); |
---|
| 37 | |
---|
| 38 | if (comment) { |
---|
| 39 | $(td).append(comment); |
---|
| 40 | var comment_email = $(rsp).find('comment_email').text(); |
---|
| 41 | var comment_site = $(rsp).find('comment_site').text(); |
---|
| 42 | var comment_ip = $(rsp).find('comment_ip').text(); |
---|
| 43 | var comment_spam_disp = $(rsp).find('comment_spam_disp').text(); |
---|
| 44 | |
---|
| 45 | $(td).append('<p><strong>' + dotclear.msg.website + |
---|
| 46 | '</strong> ' + comment_site + '<br />' + |
---|
| 47 | '<strong>' + dotclear.msg.email + '</strong> ' + comment_email + '<br />' + |
---|
| 48 | '<strong>' + dotclear.msg.ip_address + |
---|
| 49 | '</strong> <a href="comments.php?ip=' + comment_ip + '">' + comment_ip + '</a>' + |
---|
| 50 | '<br />' + comment_spam_disp + '</p>'); |
---|
| 51 | } |
---|
| 52 | } else { |
---|
| 53 | alert($(rsp).find('message').text()); |
---|
| 54 | } |
---|
| 55 | }); |
---|
| 56 | |
---|
| 57 | $(line).toggleClass('expand'); |
---|
| 58 | line.parentNode.insertBefore(tr,line.nextSibling); |
---|
| 59 | } |
---|
| 60 | else if (tr.style.display == 'none') |
---|
| 61 | { |
---|
| 62 | $(tr).toggle(); |
---|
| 63 | $(line).toggleClass('expand'); |
---|
| 64 | img.src = dotclear.img_minus_src; |
---|
| 65 | img.alt = dotclear.img_minus_alt; |
---|
| 66 | } |
---|
| 67 | else |
---|
| 68 | { |
---|
| 69 | $(tr).toggle(); |
---|
| 70 | $(line).toggleClass('expand'); |
---|
| 71 | img.src = dotclear.img_plus_src; |
---|
| 72 | img.alt = dotclear.img_plus_alt; |
---|
| 73 | } |
---|
| 74 | }; |
---|
| 75 | |
---|
| 76 | $(function() { |
---|
| 77 | $('#form-comments tr.line').each(function() { |
---|
| 78 | dotclear.commentExpander(this); |
---|
| 79 | }); |
---|
| 80 | $('.checkboxes-helpers').each(function() { |
---|
| 81 | dotclear.checkboxesHelpers(this); |
---|
| 82 | }); |
---|
| 83 | $('#form-comments td input[type=checkbox]').enableShiftClick(); |
---|
| 84 | dotclear.commentsActionsHelper(); |
---|
| 85 | }); |
---|