Dotclear

Changeset 2650:aef6139b7445 for admin/js


Ignore:
Timestamp:
02/05/14 16:06:00 (12 years ago)
Author:
Dsls
Branch:
twig
Parents:
2613:014098e27ea0 (diff), 2648:87707433da37 (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.
Message:

Merge with default

Location:
admin/js
Files:
6 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_post.js

    r2593 r2650  
    5151 
    5252$(function() { 
    53      if (!document.getElementById) { return; } 
    54  
    55      if (document.getElementById('edit-entry')) 
    56      { 
    57           // Get document format and prepare toolbars 
    58           var formatField = $('#post_format').get(0); 
    59           var last_post_format = $(formatField).val(); 
    60           $(formatField).change(function() { 
    61                // Confirm post format change 
    62                if(window.confirm(dotclear.msg.confirm_change_post_format_noconvert)){ 
    63                     excerptTb.switchMode(this.value); 
    64                     contentTb.switchMode(this.value); 
    65                     last_post_format = $(this).val(); 
    66                }else{ 
    67                     // Restore last format if change cancelled 
    68                     $(this).val(last_post_format); 
    69                } 
    70  
    71                $('.format_control > *').addClass('hide'); 
    72                $('.format_control:not(.control_no_'+$(this).val()+') > *').removeClass('hide'); 
    73           }); 
    74  
    75           var excerptTb = new jsToolBar(document.getElementById('post_excerpt')); 
    76           var contentTb = new jsToolBar(document.getElementById('post_content')); 
    77           excerptTb.context = contentTb.context = 'post'; 
    78      } 
    79  
    80      if (document.getElementById('comment_content')) { 
    81           var commentTb = new jsToolBar(document.getElementById('comment_content')); 
    82           commentTb.draw('xhtml'); 
    83      } 
    84  
    8553     // Post preview 
    8654     $('#post-preview').modalWeb($(window).width()-40,$(window).height()-40); 
     
    9967               return window.confirm(dotclear.msg.confirm_delete_post); 
    10068          }); 
    101  
    102           // Markup validator 
    103           var v = $('<div class="format_control"><p><a id="a-validator"></a></p><div/>').get(0); 
    104           $('.format_control').before(v); 
    105           var a = $('#a-validator').get(0); 
    106           a.href = '#'; 
    107           a.className = 'button '; 
    108           $(a).click(function() { 
    109  
    110                excerpt_content = $('#post_excerpt').css('display') != 'none' ? $('#post_excerpt').val() : $('#excerpt-area iframe').contents().find('body').html(); 
    111                post_content   = $('#post_content').css('display') != 'none' ? $('#post_content').val() : $('#content-area iframe').contents().find('body').html(); 
    112  
    113                var params = { 
    114                     xd_check: dotclear.nonce, 
    115                     f: 'validatePostMarkup', 
    116                     excerpt: excerpt_content, 
    117                     content: post_content, 
    118                     format: $('#post_format').get(0).value, 
    119                     lang: $('#post_lang').get(0).value 
    120                }; 
    121  
    122                $.post('services.php',params,function(data) { 
    123                     if ($(data).find('rsp').attr('status') != 'ok') { 
    124                          alert($(data).find('rsp message').text()); 
    125                          return false; 
    126                     } 
    127  
    128                     $('.message, .success, .error, .warning-msg').remove(); 
    129  
    130                     if ($(data).find('valid').text() == 1) { 
    131                          var p = document.createElement('p'); 
    132                          p.id = 'markup-validator'; 
    133  
    134                          $(p).addClass('success'); 
    135                          $(p).text(dotclear.msg.xhtml_valid); 
    136                          $('#entry-content h3').after(p); 
    137                          $(p).backgroundFade({sColor: dotclear.fadeColor.beginValidatorMsg, eColor: dotclear.fadeColor.endValidatorMsg, steps: 50},function() { 
    138                                    $(this).backgroundFade({sColor: dotclear.fadeColor.endValidatorMsg, eColor: dotclear.fadeColor.beginValidatorMsg}); 
    139                          }); 
    140                     } else { 
    141                          var div = document.createElement('div'); 
    142                          div.id = 'markup-validator'; 
    143  
    144                          $(div).addClass('error'); 
    145                          $(div).html('<p><strong>' + dotclear.msg.xhtml_not_valid + '</strong></p>' + $(data).find('errors').text()); 
    146                          $('#entry-content h3').after(div); 
    147                          $(div).backgroundFade({sColor: dotclear.fadeColor.beginValidatorErr,eColor: dotclear.fadeColor.endValidatorErr, steps: 50},function() { 
    148                                    $(this).backgroundFade({sColor: dotclear.fadeColor.endValidatorErr, eColor: dotclear.fadeColor.beginValidatorErr}); 
    149                          }); 
    150                     } 
    151  
    152                     if ( $('#post_excerpt').text() != excerpt_content || $('#post_content').text() != post_content ) { 
    153                          var pn = document.createElement('p'); 
    154                          $(pn).addClass('warning-msg'); 
    155                          $(pn).text(dotclear.msg.warning_validate_no_save_content); 
    156                          $('#entry-content h3').after(pn); 
    157                     } 
    158  
    159                     return false; 
    160                }); 
    161  
    162                return false; 
    163           }); 
    164  
    165           a.appendChild(document.createTextNode(dotclear.msg.xhtml_validator)); 
    166  
    167           $('.format_control > *').addClass('hide'); 
    168           $('.format_control:not(.control_no_'+last_post_format+') > *').removeClass('hide'); 
    16969 
    17070          // Hide some fields 
     
    218118          }); 
    219119 
    220           // Load toolbars 
    221           contentTb.switchMode(formatField.value); 
    222           excerptTb.switchMode(formatField.value); 
    223  
    224120          // Replace attachment remove links by a POST form submit 
    225121          $('a.attachment-remove').click(function() { 
     
    232128               } 
    233129               return false; 
    234           }); 
    235  
    236           // Check unsaved changes before XHTML conversion 
    237           var excerpt = $('#post_excerpt').val(); 
    238           var content = $('#post_content').val(); 
    239           $('#convert-xhtml').click(function() { 
    240                if (excerpt != $('#post_excerpt').val() || content != $('#post_content').val()) { 
    241                     return window.confirm(dotclear.msg.confirm_change_post_format); 
    242                } 
    243130          }); 
    244131     }); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map