Changeset 1525:c30081595436 for admin/js
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_categories.js
r0 r1525 1 1 /* TODO: Some nice drag and drop on categories */ 2 2 $(function() { 3 $('form#delete-category').submit(function() { 4 var c_id = $('#del_cat').val(); 5 var c_name = $('#del_cat option[value='+c_id+']').text(); 6 return window.confirm(dotclear.msg.confirm_delete_category.replace('%s',c_name)); 3 $('.checkboxes-helpers').each(function() { 4 dotclear.checkboxesHelpers(this); 7 5 }); 8 });9 6 10 $(function() { 7 dotclear.categoriesActionsHelper(); 8 9 11 10 $('form#reset-order').submit(function() { 12 11 return window.confirm(dotclear.msg.confirm_reorder_categories); -
admin/js/_post.js
r1518 r1525 1 1 dotclear.commentExpander = function(line) { 2 2 var td = line.firstChild; 3 3 4 4 var img = document.createElement('img'); 5 5 img.src = dotclear.img_plus_src; … … 9 9 img.line = line; 10 10 img.onclick = function() { dotclear.viewCommentContent(this,this.line); }; 11 11 12 12 td.insertBefore(img,td.firstChild); 13 13 }; … … 15 15 dotclear.viewCommentContent = function(img,line) { 16 16 var commentId = line.id.substr(1); 17 17 18 18 var tr = document.getElementById('ce'+commentId); 19 19 20 20 if (!tr) { 21 21 tr = document.createElement('tr'); … … 25 25 td.className = 'expand'; 26 26 tr.appendChild(td); 27 27 28 28 img.src = dotclear.img_minus_src; 29 29 img.alt = dotclear.img_minus_alt; 30 30 31 31 // Get comment content 32 32 $.get('services.php',{f:'getCommentById',id: commentId},function(data) { 33 33 var rsp = $(data).children('rsp')[0]; 34 34 35 35 if (rsp.attributes[0].value == 'ok') { 36 36 var comment = $(rsp).find('comment_display_content').text(); 37 37 38 38 if (comment) { 39 39 $(td).append(comment); … … 42 42 var comment_ip = $(rsp).find('comment_ip').text(); 43 43 var comment_spam_disp = $(rsp).find('comment_spam_disp').text(); 44 44 45 45 $(td).append('<p><strong>' + dotclear.msg.website + 46 46 '</strong> ' + comment_site + '<br />' + … … 52 52 } 53 53 }); 54 54 55 55 $(line).toggleClass('expand'); 56 56 line.parentNode.insertBefore(tr,line.nextSibling); … … 74 74 $(function() { 75 75 if (!document.getElementById) { return; } 76 76 77 77 if (document.getElementById('edit-entry')) 78 78 { … … 83 83 contentTb.switchMode(this.value); 84 84 }); 85 85 86 86 var excerptTb = new jsToolBar(document.getElementById('post_excerpt')); 87 87 var contentTb = new jsToolBar(document.getElementById('post_content')); 88 88 excerptTb.context = contentTb.context = 'post'; 89 89 } 90 90 91 91 if (document.getElementById('comment_content')) { 92 92 var commentTb = new jsToolBar(document.getElementById('comment_content')); 93 93 } 94 94 95 95 // Post preview 96 96 $('#post-preview').modalWeb($(window).width()-40,$(window).height()-40); 97 97 98 98 // Tabs events 99 99 $('#edit-entry').onetabload(function() { 100 100 dotclear.hideLockable(); 101 101 102 102 // Add date picker 103 103 var post_dtPick = new datePicker($('#post_dt').get(0)); 104 104 post_dtPick.img_top = '1.5em'; 105 105 post_dtPick.draw(); 106 106 107 107 // Confirm post deletion 108 108 $('input[name="delete"]').click(function() { 109 110 }); 111 109 return window.confirm(dotclear.msg.confirm_delete_post); 110 }); 111 112 112 // Hide some fields 113 113 $('#notes-area label').toggleWithLegend($('#notes-area').children().not('label'),{ 114 114 cookie: 'dcx_post_notes', 115 hide: $('#post_notes').val() == '' 115 hide: $('#post_notes').val() == '', 116 legend_click: true 116 117 }); 117 118 $('#new_cat').toggleWithLegend( 118 119 $('#new_cat').parent().children().not('#new_cat'), 119 { } // no cookie on new category as we don't use this every day120 {legend_click: true} // no cookie on new category as we don't use this every day 120 121 ); 121 122 $('#post_lang').parent().toggleWithLegend($('#post_lang'),{ 122 cookie: 'dcx_post_lang' 123 cookie: 'dcx_post_lang', 124 legend_click: true 123 125 }); 124 126 $('#post_password').parent().toggleWithLegend($('#post_password'),{ 125 127 cookie: 'dcx_post_password', 126 hide: $('#post_password').val() == '' 128 hide: $('#post_password').val() == '', 129 legend_click: true 127 130 }); 128 131 $('#post_status').parent().toggleWithLegend($('#post_status'),{ 129 cookie: 'dcx_post_status' 132 cookie: 'dcx_post_status', 133 legend_click: true 130 134 }); 131 135 $('#post_dt').parent().toggleWithLegend($('#post_dt').parent().children().not('label'),{ 132 cookie: 'dcx_post_dt' 136 cookie: 'dcx_post_dt', 137 legend_click: true 133 138 }); 134 139 $('#post_format').parent().toggleWithLegend($('#post_format').parent().children().not('label').add($('#post_format').parents('p').next()),{ 135 cookie: 'dcx_post_format' 140 cookie: 'dcx_post_format', 141 legend_click: true 136 142 }); 137 143 $('#cat_id').parent().toggleWithLegend($('#cat_id'),{ 138 cookie: 'cat_id' 144 cookie: 'cat_id', 145 legend_click: true 139 146 }); 140 147 $('#post_url').parent().toggleWithLegend($('#post_url').parent().children().not('label'),{ 141 cookie: 'post_url' 148 cookie: 'post_url', 149 legend_click: true 142 150 }); 143 151 // We load toolbar on excerpt only when it's ready … … 147 155 hide: $('#post_excerpt').val() == '' 148 156 }); 149 157 150 158 // Load toolbars 151 159 contentTb.switchMode(formatField.value); 152 160 153 161 // Replace attachment remove links by a POST form submit 154 162 $('a.attachment-remove').click(function() { … … 162 170 return false; 163 171 }); 164 172 165 173 // Markup validator 166 174 var h = document.createElement('h4'); … … 177 185 lang: $('#post_lang').get(0).value 178 186 }; 179 187 180 188 $.post('services.php',params,function(data) { 181 189 if ($(data).find('rsp').attr('status') != 'ok') { … … 183 191 return false; 184 192 } 185 193 186 194 if ($(data).find('valid').text() == 1) { 187 195 var p = document.createElement('p'); 188 196 p.id = 'markup-validator'; 189 197 190 198 if ($('#markup-validator').length > 0) { 191 199 $('#markup-validator').remove(); 192 200 } 193 201 194 202 $(p).addClass('message'); 195 203 $(p).text(dotclear.msg.xhtml_valid); … … 201 209 var div = document.createElement('div'); 202 210 div.id = 'markup-validator'; 203 211 204 212 if ($('#markup-validator').length > 0) { 205 213 $('#markup-validator').remove(); 206 214 } 207 215 208 216 $(div).addClass('error'); 209 217 $(div).html('<p><strong>' + dotclear.msg.xhtml_not_valid + '</strong></p>' + $(data).find('errors').text()); … … 213 221 }); 214 222 } 215 223 216 224 return false; 217 225 }); 218 226 219 227 return false; 220 228 }); 221 229 222 230 a.appendChild(document.createTextNode(dotclear.msg.xhtml_validator)); 223 231 h.appendChild(a); 224 232 $(h).appendTo('#entry-content'); 225 233 226 234 // Check unsaved changes before XHTML conversion 227 235 var excerpt = $('#post_excerpt').val(); … … 230 238 if (excerpt != $('#post_excerpt').val() || content != $('#post_content').val()) { 231 239 return window.confirm(dotclear.msg.confirm_change_post_format); 232 } 240 } 233 241 }); 234 242 }); 235 243 236 244 $('#comments').onetabload(function() { 237 245 $('.comments-list tr.line').each(function() { … … 241 249 dotclear.checkboxesHelpers(this); 242 250 }); 243 251 244 252 dotclear.commentsActionsHelper(); 245 253 }); 246 254 247 255 $('#add-comment').onetabload(function() { 248 256 commentTb.draw('xhtml'); -
admin/js/common.js
r1516 r1525 121 121 122 122 $(ctarget).css('cursor','pointer'); 123 if (p.legend_click) { 124 $(ctarget).find('label').css('cursor','pointer'); 125 } 123 126 $(ctarget).click(function() { 124 127 toggle(i,p.speed); … … 290 293 if (action == 'delete') { 291 294 return window.confirm(dotclear.msg.confirm_delete_posts.replace('%s',$('input[name="entries[]"]:checked').size())); 295 } 296 297 return true; 298 }); 299 }, 300 301 categoriesActionsHelper: function() { 302 $('#form-categories').submit(function() { 303 var action = $(this).find('select[name="action"]').val(); 304 var checked = false; 305 306 $(this).find('input[name="categories[]"]').each(function() { 307 if (this.checked) { 308 checked = true; 309 } 310 }); 311 312 if (!checked) { return false; } 313 314 if (action == 'delete') { 315 return window.confirm(dotclear.msg.confirm_delete_categories.replace('%s',$('input[name="categories[]"]:checked').size())); 292 316 } 293 317
Note: See TracChangeset
for help on using the changeset viewer.