update
This commit is contained in:
parent
d7bac542af
commit
2822442979
|
|
@ -432,7 +432,32 @@
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', code_path, false); // The third parameter is set to false for synchronous request
|
xhr.open('GET', code_path, false); // The third parameter is set to false for synchronous request
|
||||||
xhr.send(null);
|
xhr.send(null);
|
||||||
|
if (xhr.status == 200) {
|
||||||
code_elem.textContent = xhr.responseText;
|
code_elem.textContent = xhr.responseText;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
// TODO: mitigate this evil hack by passing more info of the original project.
|
||||||
|
var newLink = `https://raw.githubusercontent.com/James4Ever0/${project_name}/main/docs/` + code_path
|
||||||
|
xhr.open('GET', newLink, false); // The third parameter is set to false for synchronous request
|
||||||
|
xhr.send(null);
|
||||||
|
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
code_elem.textContent = xhr.responseText;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
// TODO: mitigate this evil hack by passing more info of the original project.
|
||||||
|
var newLink = `https://raw.githubusercontent.com/James4Ever0/${project_name}/master/docs/` + code_path
|
||||||
|
xhr.open('GET', newLink, false); // The third parameter is set to false for synchronous request
|
||||||
|
xhr.send(null);
|
||||||
|
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
code_elem.textContent = xhr.responseText;
|
||||||
|
} else { code_elem.textContent = "Failed to load code." }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pre_elem.appendChild(code_elem);
|
pre_elem.appendChild(code_elem);
|
||||||
// pre_elem.setAttribute("data-src", code_path);
|
// pre_elem.setAttribute("data-src", code_path);
|
||||||
section_elem.appendChild(pre_elem)
|
section_elem.appendChild(pre_elem)
|
||||||
|
|
@ -584,11 +609,13 @@
|
||||||
<body class="line-numbers">
|
<body class="line-numbers">
|
||||||
<header class="container" data-plugin-header="line-numbers">
|
<header class="container" data-plugin-header="line-numbers">
|
||||||
<p id="code-path" class="monospace-text">Code Preview</p>
|
<p id="code-path" class="monospace-text">Code Preview</p>
|
||||||
</header><div id="code-div">
|
</header>
|
||||||
|
<div id="code-div">
|
||||||
<section id="code-section">
|
<section id="code-section">
|
||||||
<!-- <pre id="mycode" class="language-python" data-src="code_view_demo.py">
|
<!-- <pre id="mycode" class="language-python" data-src="code_view_demo.py">
|
||||||
</pre> -->
|
</pre> -->
|
||||||
</section></div>
|
</section>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"0": {
|
"0": {
|
||||||
"filepath": "/README.md",
|
"filepath": "/README.md",
|
||||||
"entry_id": 0,
|
"entry_id": 0,
|
||||||
"language_id": "markdown"
|
"language_id": "plain-text"
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
"filepath": "/hubconf.py",
|
"filepath": "/hubconf.py",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue