tijiao
This commit is contained in:
90
getHtmlUrl.html
Normal file
90
getHtmlUrl.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>从链接中提取 a_id 并跳转</title>
|
||||
<style>
|
||||
#tmrUrl {
|
||||
width: 90%;
|
||||
height: 30px;
|
||||
font-size: 20px;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<p>请输入期刊官网文章链接:</p>
|
||||
<input type="text" id="tmrUrl" placeholder="https://www.tmrjournals.com/article.html?J_num=2&a_id=3578">
|
||||
<button onclick="getHtml()" style="background-color: #20558a;color: #fff;">跳转</button>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<script src="./js/jquery.min.js"></script>
|
||||
<script>
|
||||
var apiUrl = "/";
|
||||
// 从一个完整链接中提取某个参数
|
||||
function extractParamFromUrl(url, paramName) {
|
||||
try {
|
||||
const urlObj = new URL(url);
|
||||
return urlObj.searchParams.get(paramName);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function getHtml() {
|
||||
const url = document.getElementById('tmrUrl').value.trim();
|
||||
if (!url) {
|
||||
alert('请输入文章链接')
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const a_ID = extractParamFromUrl(url, 'a_id');
|
||||
if (!a_ID) {
|
||||
alert('链接中缺少 a_id 参数')
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'post', url: apiUrl + 'api/Article/getArticleDetail',
|
||||
data: {
|
||||
"article_id": a_ID
|
||||
},
|
||||
success: function (result) {
|
||||
console.log('result at line 39:', result)
|
||||
if (result.code == 0) {
|
||||
|
||||
if (result.data.articleInfo.html_type == 2) {
|
||||
|
||||
$.ajax({
|
||||
type: 'post', url: apiUrl + 'api/Article/getArticleDetailHtmlFor2',
|
||||
data: {
|
||||
"article_id": a_ID
|
||||
},
|
||||
success: function (result) {
|
||||
if (result.code == 0) {
|
||||
var article_id = result.data.mains[0].article_id;
|
||||
window.open(`https://submission.tmrjournals.com/GenerateCharts?id=${article_id}`, '_blank');
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
alert('该文章不是自动化排版文章')
|
||||
}
|
||||
|
||||
} else {
|
||||
alert('获取不到该文章信息,请稍后重试')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -7804,8 +7804,24 @@ function article_con() {
|
||||
strongElements.forEach(function (element) {
|
||||
// 检查 <strong> 标签内的文本内容是否为 "Background:", "Methods:", "Results:", "Conclusion:"
|
||||
|
||||
if (element.textContent.includes("Background:") || element.textContent.includes("Methods:") ||
|
||||
element.textContent.includes("Results:") || element.textContent.includes("Conclusion:") || element.textContent.includes("Conclusions:")) {
|
||||
if (element.textContent.includes("Background:") ||
|
||||
element.textContent.includes("Methods:") ||
|
||||
element.textContent.includes("Method:") ||
|
||||
element.textContent.includes("Results:") ||
|
||||
element.textContent.includes("Result:") ||
|
||||
element.textContent.includes("Conclusion:") ||
|
||||
element.textContent.includes("Conclusions:") ||
|
||||
element.textContent.includes("Background") ||
|
||||
element.textContent.includes("Methods") ||
|
||||
element.textContent.includes("Method") ||
|
||||
element.textContent.includes("Results") ||
|
||||
element.textContent.includes("Result") ||
|
||||
element.textContent.includes("Conclusion") ||
|
||||
element.textContent.includes("Conclusions")
|
||||
|
||||
|
||||
|
||||
) {
|
||||
// 修改该 <strong> 标签的样式,改变颜色
|
||||
element.style.color = commonSupColor; // 设置颜色为黑色(你可以修改为其他颜色)
|
||||
}
|
||||
@@ -8768,16 +8784,16 @@ function initArticleHtml(htmlData, refs, type) {
|
||||
});
|
||||
|
||||
// 从 Abstract 段落之后开始查找并高亮标题词
|
||||
if (abstractEndIndex !== -1) {
|
||||
for (let i = abstractEndIndex + 1; i < allParagraphs.length; i++) {
|
||||
const elements = allParagraphs[i].querySelectorAll('strong, b');
|
||||
elements.forEach((element) => {
|
||||
const text = element.textContent.trim();
|
||||
if (["Background:", "Methods:", "Results:", "Conclusion:", "Conclusions:"].includes(text)) {
|
||||
element.style.color = commonSupColor;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (abstractEndIndex !== -1 && abstractEndIndex + 1 < allParagraphs.length) {
|
||||
const nextParagraph = allParagraphs[abstractEndIndex + 1];
|
||||
const elements = nextParagraph.querySelectorAll('strong, b');
|
||||
elements.forEach((element) => {
|
||||
const text = element.textContent.trim();
|
||||
if (["Background:", "Methods:", "Method:", "Results:", "Result:", "Conclusion:", "Conclusions:"].includes(text) ||
|
||||
["Background", "Methods", "Method", "Results", "Result", "Conclusion", "Conclusions"].includes(text)) {
|
||||
element.style.color = commonSupColor;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (citationEndIndex !== -1 && citationEndIndex + 1 < allParagraphs.length) {
|
||||
const nextParagraph = allParagraphs[citationEndIndex + 1];
|
||||
|
||||
Reference in New Issue
Block a user