Dotclear


Ignore:
Timestamp:
09/17/18 16:46:35 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Harmonize scripts used to display entries/comments/trackbacks content in lists - Spam content is displayed as HTML code only, meta key may be used to display other content HTML code (meta key = cmd key on MacOS, windows key on Windows, ...) - Server errors are now basically reported (more info in console log, as timeout, offline, …) to the user

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/pages/js/list.js

    r3709 r3878  
    22'use strict'; 
    33 
    4 dotclear.viewPostContent = function(line, action) { 
     4dotclear.viewPostContent = function(line, action, e) { 
    55  action = action || 'toggle'; 
    66  if ($(line).attr('id') == undefined) { 
     
    1111  var tr = document.getElementById('pe' + postId); 
    1212 
    13   if (!tr && (action == 'toggle' || action == 'open')) { 
    14     tr = document.createElement('tr'); 
    15     tr.id = 'pe' + postId; 
    16     var td = document.createElement('td'); 
    17     td.colSpan = 8; 
    18     td.className = 'expand'; 
    19     tr.appendChild(td); 
    20  
    21     // Get post content 
    22     $.get('services.php', { 
    23       f: 'getPostById', 
    24       id: postId, 
    25       post_type: '' 
    26     }, function(data) { 
    27       var rsp = $(data).children('rsp')[0]; 
    28  
    29       if (rsp.attributes[0].value == 'ok') { 
    30         var post = $(rsp).find('post_display_content').text(); 
    31         var post_excerpt = $(rsp).find('post_display_excerpt').text(); 
    32         var res = ''; 
    33  
    34         if (post) { 
    35           if (post_excerpt) { 
    36             res += post_excerpt + '<hr />'; 
    37           } 
    38           res += post; 
    39           $(td).append(res); 
    40         } 
     13  if (!tr) { 
     14    // Get post content if possible 
     15    dotclear.getEntryContent(postId, function(content) { 
     16      if (content) { 
     17        // Content found 
     18        tr = document.createElement('tr'); 
     19        tr.id = 'pe' + postId; 
     20        var td = document.createElement('td'); 
     21        td.colSpan = $(line).children('td').length; 
     22        td.className = 'expand'; 
     23        tr.appendChild(td); 
     24        $(td).append(content); 
     25        $(line).addClass('expand'); 
     26        line.parentNode.insertBefore(tr, line.nextSibling); 
    4127      } else { 
    42         window.alert($(rsp).find('message').text()); 
     28        $(line).toggleClass('expand'); 
    4329      } 
     30    }, { 
     31      type: 'page', 
     32      clean: (e.metaKey) 
    4433    }); 
    45  
    46     $(line).addClass('expand'); 
    47     line.parentNode.insertBefore(tr, line.nextSibling); 
    48   } else if (tr && tr.style.display == 'none' && (action == 'toggle' || action == 'open')) { 
    49     $(tr).css('display', 'table-row'); 
    50     $(line).addClass('expand'); 
    51   } else if (tr && tr.style.display != 'none' && (action == 'toggle' || action == 'close')) { 
    52     $(tr).css('display', 'none'); 
    53     $(line).removeClass('expand'); 
     34  } else { 
     35    $(tr).toggle(); 
     36    $(line).toggleClass('expand'); 
    5437  } 
    5538}; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map