Changeset 1827:38ac207ff0ba for admin/js
- Timestamp:
- 09/09/13 15:49:13 (12 years ago)
- Branch:
- Ticket #1539
- Parents:
- 1826:fd4a45d891a9 (diff), 1766:a3e16ad9e270 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- admin/js
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_post.js
r1760 r1827 90 90 $(this).val(last_post_format); 91 91 } 92 93 $('.format_control > *').addClass('hide'); 94 if( $(this).val() == 'xhtml' ) { 95 $('.control_xhtml > *').removeClass('hide'); 96 } else if ( $(this).val() == 'wiki' ) { 97 $('.control_wiki > *').removeClass('hide'); 98 } 92 99 }); 93 100 … … 117 124 return window.confirm(dotclear.msg.confirm_delete_post); 118 125 }); 126 127 // Markup validator 128 var v = $('<div class="format_control control_xhtml control_wiki"><p><a id="a-validator"></a></p><div/>').get(0); 129 $('.control_wiki').before(v); 130 var a = $('#a-validator').get(0); 131 a.href = '#'; 132 a.className = 'button '; 133 $(a).click(function() { 134 135 excerpt_content = $('#post_excerpt').css('display') != 'none' ? $('#post_excerpt').val() : $('#excerpt-area iframe').contents().find('body').html(); 136 post_content = $('#post_content').css('display') != 'none' ? $('#post_content').val() : $('#content-area iframe').contents().find('body').html(); 137 138 var params = { 139 xd_check: dotclear.nonce, 140 f: 'validatePostMarkup', 141 excerpt: excerpt_content, 142 content: post_content, 143 format: $('#post_format').get(0).value, 144 lang: $('#post_lang').get(0).value 145 }; 146 147 $.post('services.php',params,function(data) { 148 if ($(data).find('rsp').attr('status') != 'ok') { 149 alert($(data).find('rsp message').text()); 150 return false; 151 } 152 153 if ($(data).find('valid').text() == 1) { 154 var p = document.createElement('p'); 155 p.id = 'markup-validator'; 156 157 if ($('#markup-validator').length > 0) { 158 $('#markup-validator').remove(); 159 } 160 161 $(p).addClass('message'); 162 $(p).text(dotclear.msg.xhtml_valid); 163 $('#entry-content h3').after(p); 164 $(p).backgroundFade({sColor:'#666666',eColor:'#ffcc00',steps:50},function() { 165 $(this).backgroundFade({sColor:'#ffcc00',eColor:'#666666'}); 166 }); 167 } else { 168 var div = document.createElement('div'); 169 div.id = 'markup-validator'; 170 171 if ($('#markup-validator').length > 0) { 172 $('#markup-validator').remove(); 173 } 174 175 $(div).addClass('error'); 176 $(div).html('<p><strong>' + dotclear.msg.xhtml_not_valid + '</strong></p>' + $(data).find('errors').text()); 177 $('#entry-content h3').after(div); 178 $(div).backgroundFade({sColor:'#ffffff',eColor:'#FFBABA',steps:50},function() { 179 $(this).backgroundFade({sColor:'#ffbaba',eColor:'#ffffff'}); 180 }); 181 } 182 183 return false; 184 }); 185 186 return false; 187 }); 188 189 a.appendChild(document.createTextNode(dotclear.msg.xhtml_validator)); 190 191 $('.format_control > *').addClass('hide'); 192 if ( last_post_format == 'xhtml' ) { 193 $('.control_xhtml > *').removeClass('hide'); 194 } else if ( last_post_format == 'wiki' ) { 195 $('.control_wiki > *').removeClass('hide'); 196 } 119 197 120 198 // Hide some fields … … 184 262 }); 185 263 186 // Markup validator187 var h = document.createElement('h4');188 var a = document.createElement('a');189 a.href = '#';190 a.className = 'button';191 $(a).click(function() {192 var params = {193 xd_check: dotclear.nonce,194 f: 'validatePostMarkup',195 excerpt: $('#post_excerpt').text(),196 content: $('#post_content').text(),197 format: $('#post_format').get(0).value,198 lang: $('#post_lang').get(0).value199 };200 201 $.post('services.php',params,function(data) {202 if ($(data).find('rsp').attr('status') != 'ok') {203 alert($(data).find('rsp message').text());204 return false;205 }206 207 if ($(data).find('valid').text() == 1) {208 var p = document.createElement('p');209 p.id = 'markup-validator';210 211 if ($('#markup-validator').length > 0) {212 $('#markup-validator').remove();213 }214 215 $(p).addClass('message');216 $(p).text(dotclear.msg.xhtml_valid);217 $(p).insertAfter(h);218 $(p).backgroundFade({sColor:'#676e78',eColor:'#ffcc00',steps:50},function() {219 $(this).backgroundFade({sColor:'#ffcc00',eColor:'#676e78'});220 });221 } else {222 var div = document.createElement('div');223 div.id = 'markup-validator';224 225 if ($('#markup-validator').length > 0) {226 $('#markup-validator').remove();227 }228 229 $(div).addClass('error');230 $(div).html('<p><strong>' + dotclear.msg.xhtml_not_valid + '</strong></p>' + $(data).find('errors').text());231 $(div).insertAfter(h);232 $(div).backgroundFade({sColor:'#ffffff',eColor:'#FFBABA',steps:50},function() {233 $(this).backgroundFade({sColor:'#ffbaba',eColor:'#ffffff'});234 });235 }236 237 return false;238 });239 240 return false;241 });242 243 a.appendChild(document.createTextNode(dotclear.msg.xhtml_validator));244 h.appendChild(a);245 $(h).appendTo('#entry-content');246 247 264 // Check unsaved changes before XHTML conversion 248 265 var excerpt = $('#post_excerpt').val(); -
admin/js/common.js
r1761 r1827 263 263 }, 264 264 265 checkboxesHelpers: function(e ) {265 checkboxesHelpers: function(e, target) { 266 266 $(e).append(document.createTextNode(dotclear.msg.to_select)); 267 267 $(e).append(document.createTextNode(' ')); 268 268 269 target = target || $(e).parents('form').find('input[type="checkbox"]'); 270 269 271 var a = document.createElement('a'); 270 272 a.href='#'; 271 273 $(a).append(document.createTextNode(dotclear.msg.select_all)); 272 274 a.onclick = function() { 273 $(this).parents('form').find('input[type="checkbox"]').check();275 target.check(); 274 276 return false; 275 277 }; … … 282 284 $(a).append(document.createTextNode(dotclear.msg.no_selection)); 283 285 a.onclick = function() { 284 $(this).parents('form').find('input[type="checkbox"]').unCheck();286 target.unCheck(); 285 287 return false; 286 288 }; … … 293 295 $(a).append(document.createTextNode(dotclear.msg.invert_sel)); 294 296 a.onclick = function() { 295 $(this).parents('form').find('input[type="checkbox"]').toggleCheck();297 target.toggleCheck(); 296 298 return false; 297 299 }; -
admin/js/common.js
r1818 r1827 244 244 imgE.style.position = 'absolute'; 245 245 imgE.style.top = '1.7em'; 246 imgE.style.left = ($(this).width()+ 4)+'px';246 imgE.style.left = ($(this).width()+12)+'px'; 247 247 imgE.alt=dotclear.msg.click_to_unlock; 248 248 $(imgE).css('cursor','pointer'); … … 382 382 $('#help').helpViewer(); 383 383 384 $('.message').backgroundFade({sColor:'#cccccc',eColor:'#6 66666',steps:20});384 $('.message').backgroundFade({sColor:'#cccccc',eColor:'#676e78',steps:20}); 385 385 $('.error').backgroundFade({sColor:'#ffdec8',eColor:'#ffbaba',steps:20}); 386 386 $('.success').backgroundFade({sColor:'#9BCA1C',eColor:'#bee74b',steps:20});
Note: See TracChangeset
for help on using the changeset viewer.