不再使用markdown编译html,而是直接markdown源文件,前端进行渲染
This commit is contained in:
1
Html/apps/static/cdnback/js/tex-mml-chtml.js
Normal file
1
Html/apps/static/cdnback/js/tex-mml-chtml.js
Normal file
File diff suppressed because one or more lines are too long
@@ -424,14 +424,12 @@ window.addEventListener('beforeunload', () => {
|
||||
|
||||
let currentChapterIndex = -1;
|
||||
function next_chapter(data) {
|
||||
// 获取所有的 h3 元素
|
||||
var iframe = document.getElementById('markdown-content-iframe');
|
||||
|
||||
// 访问 iframe 的文档对象
|
||||
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
||||
var titles = []
|
||||
var h3Elements = iframeDocument.querySelectorAll('h3');
|
||||
console.log("h3Elements next")
|
||||
// 直接获取页面中的 h3 元素(不再使用 iframe)
|
||||
var container = document.getElementById('markdown-content-container');
|
||||
var titles = [];
|
||||
var h3Elements = container.querySelectorAll('h3');
|
||||
console.log("h3Elements next");
|
||||
|
||||
if (currentChapterIndex >= h3Elements.length) {
|
||||
return; // 如果已经到了最后一个章节,则不进行任何操作
|
||||
}
|
||||
@@ -439,7 +437,7 @@ function next_chapter(data) {
|
||||
// 隐藏当前章节及其后的内容
|
||||
for (let i = 0; i < h3Elements.length; i++) {
|
||||
h3Elements[i].style.display = 'none';
|
||||
titles.push(h3Elements[i].innerText)
|
||||
titles.push(h3Elements[i].innerText);
|
||||
let nextSibling = h3Elements[i].nextElementSibling;
|
||||
while (nextSibling && nextSibling.tagName !== 'H3') {
|
||||
nextSibling.style.display = 'none';
|
||||
|
||||
Reference in New Issue
Block a user