Changeset 2531:2daf216ff255 for admin/js/_comments.js
- Timestamp:
- 11/09/13 11:40:06 (12 years ago)
- Branch:
- 2.6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_comments.js
r2527 r2531 1 dotclear.commentExpander = function(line) {2 $('<a href="#"><img src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/></a>')3 .click(function(e) {4 dotclear.toggleArrow(this);5 dotclear.viewCommentContent(line);6 e.preventDefault();7 })8 .prependTo($(line).children().get(0)); // first td9 };10 11 dotclear.commentsExpander = function(line,lines) {12 $('<a href="#"><img src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/></a>')13 .click(function(e) {14 dotclear.toggleArrow(this);15 lines.each(function() {16 var action = dotclear.toggleArrow(this.firstChild.firstChild);17 dotclear.viewCommentContent(this,action);18 });19 e.preventDefault();20 })21 .prependTo($(line).children().get(0)); // first td22 };23 24 dotclear.toggleArrow = function(link,action) {25 action = action || '';26 var img = $(link).children().get(0);27 if (action=='') {28 if (img.alt==dotclear.img_plus_alt) {29 action = 'open';30 } else {31 action = 'close';32 }33 }34 35 if (action=='open') {36 img.src = dotclear.img_minus_src;37 img.alt = dotclear.img_minus_alt;38 } else {39 img.src = dotclear.img_plus_src;40 img.alt = dotclear.img_plus_alt;41 }42 43 return action;44 }45 46 1 dotclear.viewCommentContent = function(line,action) { 2 var action = action || 'toggle'; 47 3 var commentId = $(line).attr('id').substr(1); 48 4 var tr = document.getElementById('ce'+commentId); 49 50 if ( !tr) {5 6 if ( !tr && ( action == 'toggle' || action == 'open' ) ) { 51 7 tr = document.createElement('tr'); 52 8 tr.id = 'ce'+commentId; … … 85 41 line.parentNode.insertBefore(tr,line.nextSibling); 86 42 } 87 else if (tr .style.display == 'none')43 else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) 88 44 { 89 $(tr). toggle();90 $(line). toggleClass('expand');45 $(tr).css('display', 'table-row'); 46 $(line).addClass('expand'); 91 47 } 92 else 48 else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) 93 49 { 94 $(tr). toggle();95 $(line). toggleClass('expand');50 $(tr).css('display', 'none'); 51 $(line).removeClass('expand'); 96 52 } 97 53 }; 98 54 99 55 $(function() { 100 $('#form-comments tr:not(.line)').each(function() { 101 dotclear.commentsExpander(this,$('#form-comments tr.line')); 102 }); 103 $('#form-comments tr.line').each(function() { 104 dotclear.commentExpander(this); 56 $.expandContent({ 57 line:$('#form-comments tr:not(.line)'), 58 lines:$('#form-comments tr.line'), 59 callback:dotclear.viewCommentContent 105 60 }); 106 61 $('.checkboxes-helpers').each(function() {
Note: See TracChangeset
for help on using the changeset viewer.