'use strict';dotclear.getEntryContent=function(postId,callback,options){let res='';const opt=$.extend({type:'',alert:true,clean:false,length:-1,},options);if(!$.isFunction(callback)){return;} $.get('services.php',{f:'getPostById',id:postId,post_type:opt.type,xd_check:dotclear.nonce}).done(function(data){const rsp=$(data).children('rsp')[0];if(rsp.attributes[0].value=='ok'){let excerpt=$(rsp).find('post_display_excerpt').text();let content=$(rsp).find('post_display_content').text();if(excerpt||content){if(opt.clean){const text=document.createElement('textarea');if(excerpt){text.textContent=excerpt;excerpt=text.innerHTML;} if(content){text.textContent=content;content=text.innerHTML;}} if(!opt.clean){content=(excerpt?`${excerpt}
`:'')+content;} if(opt.length>-1){content=trimHtml(content,{limit:opt.length}).html;} if(opt.clean&&content){content=`
${content}
`;} res=content;}}else{if(opt.alert){window.alert($(rsp).find('message').text());}}}).fail(function(jqXHR,textStatus,errorThrown){window.console.log(`AJAX ${textStatus} (status: ${jqXHR.status} ${errorThrown})`);if(opt.alert){window.alert('Server error');}}).always(function(){callback(res);});};dotclear.getCommentContent=function(commentId,callback,options){let res='';const opt=$.extend({metadata:true,ip:true,alert:true,clean:false,length:-1,},options);if(!$.isFunction(callback)){return;} $.get('services.php',{f:'getCommentById',id:commentId,xd_check:dotclear.nonce}).done(function(data){const rsp=$(data).children('rsp')[0];if(rsp.attributes[0].value=='ok'){let content=$(rsp).find('comment_display_content').text();if(content){if(opt.clean){const text=document.createElement('textarea');text.textContent=content;content=text.innerHTML;} if(opt.length>-1){content=trimHtml(content,{limit:opt.length}).html;} if(opt.clean&&content){content=`
${content}
`;} if(opt.metadata){const comment_email=$(rsp).find('comment_email').text();const comment_site=$(rsp).find('comment_site').text();const comment_ip=$(rsp).find('comment_ip').text();const comment_spam_disp=$(rsp).find('comment_spam_disp').text();content+=`

${dotclear.msg.website} ${comment_site}
${dotclear.msg.email} ${comment_email}`;if(opt.ip){content+=`
${dotclear.msg.ip_address} ${comment_ip}`;} content+=`

${comment_spam_disp}`;} res=content;}}else{if(opt.alert){window.alert($(rsp).find('message').text());}}}).fail(function(jqXHR,textStatus,errorThrown){window.console.log(`AJAX ${textStatus} (status: ${jqXHR.status} ${errorThrown})`);if(opt.alert){window.alert('Server error');}}).always(function(){callback(res);});};