Changeset 2531:2daf216ff255
- Timestamp:
- 11/09/13 11:40:06 (12 years ago)
- Branch:
- 2.6
- Files:
-
- 6 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() { -
admin/js/_post.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.toggleArrow = function(link,action) {12 action = action || '';13 var img = $(link).children().get(0);14 if (action=='') {15 if (img.alt==dotclear.img_plus_alt) {16 action = 'open';17 } else {18 action = 'close';19 }20 }21 22 if (action=='open') {23 img.src = dotclear.img_minus_src;24 img.alt = dotclear.img_minus_alt;25 } else {26 img.src = dotclear.img_plus_src;27 img.alt = dotclear.img_plus_alt;28 }29 30 return action;31 }32 33 1 dotclear.viewCommentContent = function(line,action) { 34 2 var commentId = $(line).attr('id').substr(1); … … 140 108 141 109 excerpt_content = $('#post_excerpt').css('display') != 'none' ? $('#post_excerpt').val() : $('#excerpt-area iframe').contents().find('body').html(); 142 post_content 110 post_content = $('#post_content').css('display') != 'none' ? $('#post_content').val() : $('#content-area iframe').contents().find('body').html(); 143 111 144 112 var params = { … … 276 244 277 245 $('#comments').onetabload(function() { 278 $('#form-comments .comments-list tr.line').each(function() { 279 dotclear.commentExpander(this); 246 $.expandContent({ 247 lines:$('#form-comments .comments-list tr.line'), 248 callback:dotclear.viewCommentContent 280 249 }); 281 250 $('#form-comments .checkboxes-helpers').each(function() { … … 287 256 288 257 $('#trackbacks').onetabload(function() { 289 $('#form-trackbacks .comments-list tr.line').each(function() { 290 dotclear.commentExpander(this); 258 $.expandContent({ 259 lines:$('#form-trackbacks .comments-list tr.line'), 260 callback:dotclear.viewCommentContent 291 261 }); 292 262 $('#form-trackbacks .checkboxes-helpers').each(function() { -
admin/js/_posts_list.js
r2527 r2531 1 dotclear.postExpander = 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.viewPostContent(line);6 e.preventDefault();7 })8 .prependTo($(line).children().get(0)); // first td9 };10 11 dotclear.postsExpander = 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.viewPostContent(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 47 1 dotclear.viewPostContent = function(line,action) { 48 2 var action = action || 'toggle'; … … 92 46 $(line).removeClass('expand'); 93 47 } 94 95 parentTable = $(line).parents('table');96 if( parentTable.find('tr.expand').length == parentTable.find('tr.line').length ) {97 img = parentTable.find('tr:not(.line) th:first img');98 }99 100 if( parentTable.find('tr.expand').length == 0 ) {101 img = parentTable.find('tr:not(.line) th:first img');102 }103 48 }; 104 49 … … 109 54 }); 110 55 111 $('#form-entries tr:not(.line)').each(function() { 112 dotclear.postsExpander(this,$('#form-entries tr.line')); 113 }); 114 $('#form-entries tr.line').each(function() { 115 dotclear.postExpander(this); 56 $.expandContent({ 57 line:$('#form-entries tr:not(.line)'), 58 lines:$('#form-entries tr.line'), 59 callback:dotclear.viewPostContent 116 60 }); 117 61 $('.checkboxes-helpers').each(function() { -
admin/js/common.js
r2486 r2531 150 150 }); 151 151 }; 152 153 (function($) { 154 'use strict'; 155 156 $.expandContent = function(opts) { 157 var defaults = {}; 158 $.expandContent.options = $.extend({},defaults,opts); 159 160 if (opts==undefined || opts.callback==undefined || !$.isFunction(opts.callback)) { 161 return; 162 } 163 if (opts.line!=undefined) { 164 multipleExpander(opts.line,opts.lines); 165 } 166 opts.lines.each(function() { 167 singleExpander(this); 168 }); 169 } 170 171 var singleExpander = function singleExpander(line) { 172 $('<input type="image" src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/>') 173 .click(function(e) { 174 toggleArrow(this); 175 $.expandContent.options.callback.call(this,line); 176 e.preventDefault(); 177 }) 178 .prependTo($(line).children().get(0)); // first td 179 }; 180 181 var multipleExpander = function multipleExpander(line,lines) { 182 $('<input type="image" src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/>') 183 .click(function(e) { 184 var that = this; 185 var action = toggleArrow(this); 186 lines.each(function() { 187 toggleArrow(this.firstChild.firstChild,action); 188 $.expandContent.options.callback.call(that,this,action); 189 190 }); 191 e.preventDefault(); 192 }) 193 .prependTo($(line).children().get(0)); // first td 194 }; 195 196 var toggleArrow = function toggleArrow(button,action) { 197 action = action || ''; 198 if (action=='') { 199 if (button.alt==dotclear.img_plus_alt) { 200 action = 'open'; 201 } else { 202 action = 'close'; 203 } 204 } 205 206 if (action=='open') { 207 button.src = dotclear.img_minus_src; 208 button.alt = dotclear.img_minus_alt; 209 } else { 210 button.src = dotclear.img_plus_src; 211 button.alt = dotclear.img_plus_alt; 212 } 213 214 return action; 215 } 216 })(jQuery); 152 217 153 218 jQuery.fn.helpViewer = function() { -
admin/style/default.css
r2530 r2531 1292 1292 padding-right: 1.5em; 1293 1293 } 1294 th.first i mg{1294 th.first input { 1295 1295 padding-right: 34px; 1296 1296 } -
plugins/pages/list.js
r2527 r2531 1 dotclear.postExpander = 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.viewPostContent(line);6 e.preventDefault();7 })8 .prependTo($(line).children().get(0)); // first td9 };10 11 dotclear.postsExpander = 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.viewPostContent(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.viewPostContent = function(line,action) { 47 2 var action = action || 'toggle'; … … 91 46 $(line).removeClass('expand'); 92 47 } 93 94 parentTable = $(line).parents('table');95 if( parentTable.find('tr.expand').length == parentTable.find('tr.line').length ) {96 img = parentTable.find('tr:not(.line) th:first img');97 }98 99 if( parentTable.find('tr.expand').length == 0 ) {100 img = parentTable.find('tr:not(.line) th:first img');101 }102 103 48 }; 104 49 105 50 $(function() { 106 107 51 $('#pageslist tr.line').prepend('<td class="expander"></td>'); 108 52 $('#form-entries tr:not(.line) th:first').attr('colspan',4); 109 $('#form-entries tr:not(.line)').each(function() { 110 dotclear.postsExpander(this,$('#form-entries tr.line')); 111 }); 112 $('#pageslist tr.line').each(function() { 113 dotclear.postExpander(this); 53 $.expandContent({ 54 line:$('#form-entries tr:not(.line)'), 55 lines:$('#form-entries tr.line'), 56 callback:dotclear.viewPostContent 114 57 }); 115 58 $('.checkboxes-helpers').each(function() {
Note: See TracChangeset
for help on using the changeset viewer.