';
}else{
document.title=news.title+' — 人才网';
document.getElementById('breadcrumb').innerHTML=`
首页 ›
新闻资讯 › ${news.title.slice(0,20)}...`;
const coverUrl = fmt.newsImage(news.image, news.title, news.category);
// Description is either (a) sanitized HTML from content enrichment, or
// (b) plain text from RSS snippet. For plain-text we must decode HTML
// entities (like “ ” —) FIRST, then xmlEsc the result —
// otherwise xmlEsc turns ” into ” which renders as literal text.
const ENT = {amp:'&',lt:'<',gt:'>',quot:'"',apos:"'",nbsp:' ',ldquo:'“',rdquo:'”',lsquo:'‘',rsquo:'’',laquo:'«',raquo:'»',mdash:'—',ndash:'–',hellip:'…',bull:'•',middot:'·',copy:'©',reg:'®',trade:'™',times:'×',divide:'÷',deg:'°'};
const decodeEnts = s => String(s||'')
.replace(/&(amp|lt|gt|quot|apos|nbsp|ldquo|rdquo|lsquo|rsquo|laquo|raquo|mdash|ndash|hellip|bull|middot|copy|reg|trade|times|divide|deg);/g, (_, n) => ENT[n])
.replace(/(\d+);/g, (_, n) => String.fromCharCode(+n))
.replace(/([0-9a-fA-F]+);/g, (_, n) => String.fromCharCode(parseInt(n, 16)));
const xmlEsc = s => String(s||'').replace(/[<>&]/g, c => ({'<':'<','>':'>','&':'&'}[c]));
const desc = String(news.description || '');
const looksLikeHtml = /<(p|div|span|h[2-6]|img|ul|ol|li|strong|em|b|i|blockquote|table|figure)\b/i.test(desc);
const body = looksLikeHtml
? desc
: decodeEnts(desc).split(/\n{2,}/).map(p => `
${xmlEsc(p).replace(/\n/g, '
')}
`).join('');
document.getElementById('article').innerHTML=`
${news.category}
${news.title}
${news.source_key?'🤖 ':'✍ '}${news.author || '人才网'}
📅 ${fmt.date(news.created_date)}
👁 ${(news.click||0)} 次阅读
${body || '
暂无正文摘要
'}
${news.source_url ? '' : `
菲律宾华人社区近年来持续壮大,据最新统计,在菲华人已超过150万人,分布于马尼拉、宿务、达沃等主要城市。人才网作为菲律宾最大的华人招聘平台,持续关注华人就业市场动态,为广大华人求职者和企业提供信息服务。
`}
来源:
${news.author || '人才网'}
${news.source_url ? '
本文摘要由人才网聚合自互联网公开渠道,版权归原作者所有。如涉及版权问题,请联系平台 7 日内删除。
' : ''}
`;
const related=(await DB.getNews({display:1})).filter(n=>n.id!==id&&n.category===news.category).slice(0,4);
document.getElementById('related').innerHTML=related.map(n=>{
const thumb=fmt.newsImage(n.image, n.title, n.category);
return `
${n.title}
${fmt.timeAgo(n.created_date)}
`;
}).join('')||'
暂无相关资讯
';
}
})();
window.shareArticle=function(){if(navigator.clipboard)navigator.clipboard.writeText(location.href);toast.info('链接已复制');};