上标离子不变色

This commit is contained in:
2026-04-27 14:18:34 +08:00
parent d83e8659ba
commit b19445a771

View File

@@ -1583,7 +1583,7 @@ text-align:left;color:#333;" >${item.table.note ? item.table.note : ''
'pMain', 'pMain',
item.is_h1 ? 'Ptitle' : null, item.is_h1 ? 'Ptitle' : null,
item.is_h2 ? 'Subtitle' : 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}</p>`; ].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}</p>`;
} }
@@ -1688,7 +1688,7 @@ async function initContentHtml(content, arr, refers, html_type, ArticleData) {
'<div>Supplementary Material for doi: ' + j_artc.doi + '<a class="download" target="_blank" href="' + apiUrl + 'public/articleSUBTAB/' + j_artc.file_sub_table + '"><i class="fa fa-download"></i>Download</a></div></li>'; '<div>Supplementary Material for doi: ' + j_artc.doi + '<a class="download" target="_blank" href="' + apiUrl + 'public/articleSUBTAB/' + j_artc.file_sub_table + '"><i class="fa fa-download"></i>Download</a></div></li>';
} }
if (pdf_list != '') { if (pdf_list != '') {
pdfStr = `<div id="ArticlePdfBox" style="" class="ArticlePdfBox"><p id="ArticlePdf" class="Ptitle " style="margin-bottom:22px;"><b>Supplementary Material</b></p>${pdf_list}</div>` pdfStr = `<div id="ArticlePdfBox" style="" class="ArticlePdfBox"><p id="ArticlePdf" class="Ptitle " style="margin-bottom:22px;"><b>Supplementary Material</b></p>${pdf_list}</div>`
} }
@@ -1965,12 +1965,29 @@ function initArticleHtml(htmlData, refs, type, otherList) {
nextParagraph.style.color = commonSupColor; nextParagraph.style.color = commonSupColor;
} }
$('.wen_rong .content-box .conthtmn sup').each(function () { $('.wen_rong .content-box .conthtmn sup').each(function () {
var $this = $(this);
var textContent = $(this).text().trim(); // 获取并清理文本内容 var textContent = $(this).text().trim(); // 获取并清理文本内容
// 如果包含 + 或 - (离子的特征),直接跳过,不执行后面的标蓝逻辑 // 如果包含 + 或 - (离子的特征),直接跳过,不执行后面的标蓝逻辑
if (/[+\-]/.test(textContent)) { // if (/[+\-]/.test(textContent)) {
return; // 结束当前循环,进入下一个 sup // 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)) { if (/^\d+$/.test(textContent)) {
this.style.setProperty('color', commonSupColor, 'important'); this.style.setProperty('color', commonSupColor, 'important');
@@ -2484,7 +2501,7 @@ function showComments(num) {
, btnAlign: 'c' , btnAlign: 'c'
, moveType: 1 //拖拽模式0或者1 , moveType: 1 //拖拽模式0或者1
, content: shenCode[num], , content: shenCode[num],
success: function(layero, index) { success: function (layero, index) {
// success 会在弹窗 DOM 准备就绪后立即触发 // success 会在弹窗 DOM 准备就绪后立即触发
const wmathElements = layero[0].querySelectorAll('wmath'); const wmathElements = layero[0].querySelectorAll('wmath');
wmathElements.forEach(el => { wmathElements.forEach(el => {