'use strict';dotclear.getEntryContent=(postId,callback,options)=>{if(typeof callback!=='function'){return;}
let res='';const config={type:'',alert:true,clean:false,length:-1,};const opt={...config,...options};dotclear.jsonServicesGet('getPostById',(data)=>{let excerpt=data.post_display_excerpt;let content=data.post_display_content;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}<hr>`:'')+content;}
if(opt.length>-1){content=dotclear.trimHtml(content,{limit:opt.length}).html;}
if(opt.clean&&content){content=`<pre>${content}</pre>`;}
res=content;}
callback(res);},{id:postId,post_type:opt.type,},(error)=>{if(opt.alert)globalThis.alert(error);callback(res);},);};dotclear.getCommentContent=(commentId,callback,options)=>{if(typeof callback!=='function'){return;}
let res='';const config={metadata:true,ip:true,alert:true,clean:false,length:-1,};const opt={...config,...options};dotclear.jsonServicesGet('getCommentById',(data)=>{let content=data.comment_display_content;if(content){if(opt.clean){const text=document.createElement('textarea');text.textContent=content;content=text.innerHTML;}
if(opt.length>-1){content=dotclear.trimHtml(content,{limit:opt.length}).html;}
if(opt.clean&&content){content=`<pre>${content}</pre>`;}
if(opt.metadata){content+=`<p>
              <strong>${dotclear.msg.website}</strong> ${data.comment_site}<br>
              <strong>${dotclear.msg.email}</strong> ${data.comment_email}`;if(opt.ip&&dotclear.data.showIp){content+=`<br>
                <strong>${dotclear.msg.ip_address}</strong> <a href="index.php?process=Comments&ip=${data.comment_ip}">${data.comment_ip}</a>`;}
content+=`</p>${data.comment_spam_disp}`;}
res=content;}
callback(res);},{id:commentId,},(error)=>{if(opt.alert)globalThis.alert(error);callback(res);},);};