' + content + '
' + externalLink + '(function (root, factory) { if (typeof module === 'object' && module.exports) { module.exports = factory(root); return; } root.SiteNewsPages = factory(root); if (root.document) { root.document.addEventListener('DOMContentLoaded', function () { root.SiteNewsPages.init(); }); } })(typeof globalThis !== 'undefined' ? globalThis : window, function (root) { 'use strict'; var ARTICLE_TYPE_LABELS = { news: '新闻', notice: '公告', download: '下载' }; function escapeHtml(value) { return String(value === undefined || value === null ? '' : value) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function text(value) { return value === undefined || value === null ? '' : String(value).trim(); } function normalizeId(value) { var normalized; if (typeof value === 'number' && !Number.isSafeInteger(value)) return ''; if (value === undefined || value === null) return ''; normalized = String(value).trim(); return /^[1-9][0-9]*$/.test(normalized) ? normalized : ''; } function normalizeArticleType(value) { var normalized = text(value); return Object.prototype.hasOwnProperty.call(ARTICLE_TYPE_LABELS, normalized) ? normalized : ''; } function normalizeExternalUrl(value) { var normalized = text(value); var parsed; if (!normalized) return ''; try { parsed = new URL(normalized); } catch (error) { return ''; } return parsed.protocol === 'http:' || parsed.protocol === 'https:' ? parsed.href : ''; } function normalizeArticle(item) { var source = item || {}; var articleId = normalizeId(source.articleId); var articleType = normalizeArticleType(source.articleType); var articleTitle = text(source.articleTitle); if (!articleId || !articleType || !articleTitle || String(source.status) !== '0') { return null; } return { articleId: articleId, articleType: articleType, articleTitle: articleTitle, articleSummary: text(source.articleSummary), articleContent: text(source.articleContent), externalUrl: normalizeExternalUrl(source.externalUrl), publishTime: text(source.publishTime) }; } function normalizeArticleList(data) { var items; if (!Array.isArray(data)) return []; items = data.map(normalizeArticle); return items.some(function (item) { return !item; }) ? [] : items; } function renderNormalizedArticleList(items) { if (!items.length) return '
' + escapeHtml(item.articleSummary) + '
' + '' + escapeHtml(item.publishTime) + ''; }).join(''); } function renderArticleList(data) { return renderNormalizedArticleList(normalizeArticleList(data)); } function renderNormalizedArticleDetail(item) { var externalLink = item.externalUrl ? '查看外部内容' : ''; var content = escapeHtml(item.articleContent).replace(/\r?\n/g, '' + escapeHtml(item.articleSummary) + '
' + escapeHtml(item.articleSummary) + '
' + content + '
' + externalLink + '