Fix: not removing old readme before adding new one

This commit is contained in:
Aroy-Art 2024-11-28 10:45:50 +01:00
parent 6aa044cf9b
commit cdceca576f
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -204,16 +204,16 @@ $(document).ready(function () {
history.replaceState(null, path, '#' + path); history.replaceState(null, path, '#' + path);
if (path) { if (path) {
var zeroMdElement = document.querySelector("zero-md");
if (zeroMdElement) {
document.querySelector("body > div.container").removeChild(zeroMdElement);
}
var readmePath = getREADMEmdFile(filesData, path); var readmePath = getREADMEmdFile(filesData, path);
if (readmePath) { if (readmePath) {
var zeroMdElement = document.createElement("zero-md"); zeroMdElement = document.createElement("zero-md");
zeroMdElement.setAttribute("src", filesBaseUrl + readmePath); zeroMdElement.setAttribute("src", filesBaseUrl + readmePath);
document.querySelector("body > div.container").appendChild(zeroMdElement); document.querySelector("body > div.container").appendChild(zeroMdElement);
} else {
var zeroMdElement = document.querySelector("zero-md");
if (zeroMdElement) {
document.querySelector("body > div.container").removeChild(zeroMdElement);
}
} }
} }