From cdceca576fbb52983dc2cd334501835df3cd8587 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Thu, 28 Nov 2024 10:45:50 +0100 Subject: [PATCH] Fix: not removing old readme before adding new one --- js/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index ae5f154..290ed65 100644 --- a/js/main.js +++ b/js/main.js @@ -204,16 +204,16 @@ $(document).ready(function () { history.replaceState(null, path, '#' + path); if (path) { + var zeroMdElement = document.querySelector("zero-md"); + if (zeroMdElement) { + document.querySelector("body > div.container").removeChild(zeroMdElement); + } + var readmePath = getREADMEmdFile(filesData, path); if (readmePath) { - var zeroMdElement = document.createElement("zero-md"); + zeroMdElement = document.createElement("zero-md"); zeroMdElement.setAttribute("src", filesBaseUrl + readmePath); document.querySelector("body > div.container").appendChild(zeroMdElement); - } else { - var zeroMdElement = document.querySelector("zero-md"); - if (zeroMdElement) { - document.querySelector("body > div.container").removeChild(zeroMdElement); - } } }