Fix Javascript error when reading time option is disabled

This commit is contained in:
Frédéric Guillot 2023-10-06 17:15:09 -07:00
parent fe21f6a8c4
commit d0377d5d9d

View file

@ -336,7 +336,10 @@ function handleFetchOriginalContent() {
response.json().then((data) => {
if (data.hasOwnProperty("content") && data.hasOwnProperty("reading_time")) {
document.querySelector(".entry-content").innerHTML = data.content;
document.querySelector(".entry-reading-time").innerHTML = data.reading_time;
let entryReadingtimeElement = document.querySelector(".entry-reading-time");
if (entryReadingtimeElement) {
entryReadingtimeElement.innerHTML = data.reading_time;
}
}
});
});