| [3706] | 1 | /*global $, dotclear */ | 
|---|
|  | 2 | 'use strict'; | 
|---|
| [2531] | 3 |  | 
|---|
| [3878] | 4 | dotclear.viewCommentContent = function(line, action, e) { | 
|---|
| [3706] | 5 | action = action || 'toggle'; | 
|---|
| [3878] | 6 | if ($(line).attr('id') == undefined) { | 
|---|
|  | 7 | return; | 
|---|
|  | 8 | } | 
|---|
|  | 9 |  | 
|---|
| [3880] | 10 | const commentId = $(line).attr('id').substr(1); | 
|---|
|  | 11 | const lineId = `ce${commentId}`; | 
|---|
|  | 12 | let tr = document.getElementById(lineId); | 
|---|
|  | 13 |  | 
|---|
|  | 14 | // If meta key down or it's a spam then display content HTML code | 
|---|
|  | 15 | const clean = (e.metaKey || $(line).hasClass('sts-junk')); | 
|---|
| [2566] | 16 |  | 
|---|
| [3878] | 17 | if (!tr) { | 
|---|
|  | 18 | // Get comment content if possible | 
|---|
|  | 19 | dotclear.getCommentContent(commentId, function(content) { | 
|---|
|  | 20 | if (content) { | 
|---|
|  | 21 | // Content found | 
|---|
|  | 22 | tr = document.createElement('tr'); | 
|---|
| [3880] | 23 | tr.id = lineId; | 
|---|
|  | 24 | const td = document.createElement('td'); | 
|---|
| [3878] | 25 | td.colSpan = $(line).children('td').length; | 
|---|
|  | 26 | td.className = 'expand'; | 
|---|
|  | 27 | tr.appendChild(td); | 
|---|
|  | 28 | $(td).append(content); | 
|---|
|  | 29 | $(line).addClass('expand'); | 
|---|
|  | 30 | line.parentNode.insertBefore(tr, line.nextSibling); | 
|---|
| [3706] | 31 | } else { | 
|---|
| [3878] | 32 | // No content, content not found or server error | 
|---|
|  | 33 | $(line).removeClass('expand'); | 
|---|
| [3706] | 34 | } | 
|---|
| [3878] | 35 | }, { | 
|---|
| [3880] | 36 | clean: clean | 
|---|
| [3706] | 37 | }); | 
|---|
| [3878] | 38 | } else { | 
|---|
|  | 39 | $(tr).toggle(); | 
|---|
| [3706] | 40 | $(line).toggleClass('expand'); | 
|---|
|  | 41 | } | 
|---|
| [0] | 42 | }; | 
|---|
|  | 43 |  | 
|---|
|  | 44 | $(function() { | 
|---|
| [3706] | 45 | $.expandContent({ | 
|---|
|  | 46 | line: $('#form-comments tr:not(.line)'), | 
|---|
|  | 47 | lines: $('#form-comments tr.line'), | 
|---|
|  | 48 | callback: dotclear.viewCommentContent | 
|---|
|  | 49 | }); | 
|---|
|  | 50 | $('.checkboxes-helpers').each(function() { | 
|---|
|  | 51 | dotclear.checkboxesHelpers(this, undefined, '#form-comments td input[type=checkbox]', '#form-comments #do-action'); | 
|---|
|  | 52 | }); | 
|---|
|  | 53 | $('#form-comments td input[type=checkbox]').enableShiftClick(); | 
|---|
|  | 54 | dotclear.commentsActionsHelper(); | 
|---|
|  | 55 | dotclear.condSubmit('#form-comments td input[type=checkbox]', '#form-comments #do-action'); | 
|---|
|  | 56 | $('form input[type=submit][name=delete_all_spam]').click(function() { | 
|---|
|  | 57 | return window.confirm(dotclear.msg.confirm_spam_delete); | 
|---|
|  | 58 | }); | 
|---|
| [0] | 59 | }); | 
|---|