From b19445a7715ec9594aa5a4b5c315c9b753760e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Mon, 27 Apr 2026 14:18:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E6=A0=87=E7=A6=BB=E5=AD=90=E4=B8=8D?= =?UTF-8?q?=E5=8F=98=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/article_v2.js | 57 +++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/js/article_v2.js b/js/article_v2.js index 5217dd3..1376556 100644 --- a/js/article_v2.js +++ b/js/article_v2.js @@ -1530,12 +1530,12 @@ ${header // 1. 判断是否是 Base64 图片 (用于点击预览逻辑) const isBase64Image = /^]*src=["']data:image\//i.test(content); - + // 2. 判断是否是服务器特定的图片路径 (用于拼接域名) const isServerPathImage = /src=["']\/public\/articleTableImage/i.test(content); - + let finalContent = content; - + if (isBase64Image) { // 处理 Base64:注入点击预览 picPreview finalContent = content.replace( @@ -1583,7 +1583,7 @@ text-align:left;color:#333;" >${item.table.note ? item.table.note : '' 'pMain', item.is_h1 ? 'Ptitle' : null, item.is_h2 ? 'Subtitle' : null - ].filter(Boolean).join(' ')}" style="font-family: 'Charis SIL';min-height:12px;" main-state="${item.state}" contenteditable="false" data-id="${item.am_id}" main-id="${item.am_id}" id="${sectionId}">${item.content}

`; + ].filter(Boolean).join(' ')}" style="font-family: 'Charis SIL';min-height:12px;" main-state="${item.state}" contenteditable="false" data-id="${item.am_id}" main-id="${item.am_id}" id="${sectionId}">${item.content}

`; } @@ -1688,7 +1688,7 @@ async function initContentHtml(content, arr, refers, html_type, ArticleData) { '
Supplementary Material for doi: ' + j_artc.doi + 'Download
'; } - if (pdf_list != '') { + if (pdf_list != '') { pdfStr = `

Supplementary Material

${pdf_list}
` } @@ -1870,7 +1870,7 @@ async function initContentHtml(content, arr, refers, html_type, ArticleData) { await initArticleHtml(arr, refers, html_type, { OriginalDataStr: OriginalDataStr, pdfStr: pdfStr, trackStr: trackStr, mhooStr: mhooStr }) - + await initRelatedArticles(ArticleData.a_ID) await initTopics(ArticleData.a_ID) @@ -1965,12 +1965,29 @@ function initArticleHtml(htmlData, refs, type, otherList) { nextParagraph.style.color = commonSupColor; } $('.wen_rong .content-box .conthtmn sup').each(function () { + var $this = $(this); var textContent = $(this).text().trim(); // 获取并清理文本内容 - // 如果包含 + 或 - (离子的特征),直接跳过,不执行后面的标蓝逻辑 - if (/[+\-]/.test(textContent)) { - return; // 结束当前循环,进入下一个 sup - } + // 如果包含 + 或 - (离子的特征),直接跳过,不执行后面的标蓝逻辑 + // if (/[+\-]/.test(textContent)) { + // return; // 结束当前循环,进入下一个 sup + // } + + var isSign = /[+\--—]/.test(textContent); + + if (isSign) { + return; // 只要是这类符号,直接跳过不染色 + } + + // 2. 检查邻居(防止离子里的数字被误伤) + // 同时也检查邻居是否有这些全角/半角的正负号 + var prevText = $this.prev('sup').text().trim(); + var nextText = $this.next('sup').text().trim(); + var hasSignNeighbor = /[+\--—]/.test(prevText) || /[+\--—]/.test(nextText); + + if (hasSignNeighbor && /^\d+$/.test(textContent)) { + return; // 邻居是正负号,判定为离子价态,放行 + } // 判断文本是否是纯数字 if (/^\d+$/.test(textContent)) { this.style.setProperty('color', commonSupColor, 'important'); @@ -2382,31 +2399,31 @@ function initArticleHtml(htmlData, refs, type, otherList) { triggerElements.forEach(el => { // 1. 获取当前触发元素的 data-id (对应 nav-data-id) const dataIndex = el.getAttribute('data-id'); - + if (dataIndex) { // 2. 查找中间导航元素 const navElement = document.querySelector(`[nav-data-id="${dataIndex}"]`); - + if (navElement) { // 3. 从导航元素中提取目标 section 的 ID const targetSectionId = navElement.getAttribute('data-section'); - + // 4. 绑定点击事件 el.addEventListener('click', (e) => { e.preventDefault(); - + if (targetSectionId) { // 5. 查找最终跳转的目标段落 (假设 data-section 的值就是元素的 ID) const finalTarget = document.getElementById(targetSectionId); - + if (finalTarget) { console.log(`正在跳转至: #${targetSectionId}`); - + finalTarget.scrollIntoView({ behavior: 'smooth', block: 'start' }); - + // 可选:添加临时高亮提示用户 // highlightElement(finalTarget); } else { @@ -2421,7 +2438,7 @@ function initArticleHtml(htmlData, refs, type, otherList) { }); }); - + } @@ -2484,7 +2501,7 @@ function showComments(num) { , btnAlign: 'c' , moveType: 1 //拖拽模式,0或者1 , content: shenCode[num], - success: function(layero, index) { + success: function (layero, index) { // success 会在弹窗 DOM 准备就绪后立即触发 const wmathElements = layero[0].querySelectorAll('wmath'); wmathElements.forEach(el => { @@ -2500,7 +2517,7 @@ function showComments(num) { } } }); - + } function getCiteList(a_ID) { $('.cite_box .export_cite').html('
');