Skip to content

Commit

Permalink
fix: discord invite javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkrzyskow committed Sep 25, 2024
1 parent 4d45cbc commit 9c6092e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions mkdocs_nype/templates/assets/javascripts/nype-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ document.addEventListener("DOMContentLoaded", async () => {
const allMembersElement = document.querySelector(".nype-discord-invite-stats .all-members");
const buttonElement = document.querySelector(".nype-discord-invite-join");

if (!headerElement.innerText.trim()) {
headerElement.innerText = `${renderData["global_username"]} (${renderData["raw_username"]}) invites you to join`;
if (!headerElement.innerHTML.trim()) {
headerElement.innerHTML = `${renderData["global_username"]} (${renderData["raw_username"]}) invites you to join`;
}
if (!logoElement.innerHTML.trim()) {
logoElement.insertAdjacentElement("afterbegin", logoImage);
Expand All @@ -336,16 +336,15 @@ document.addEventListener("DOMContentLoaded", async () => {
titleElement.insertAdjacentElement("afterbegin", titleAnchor);
}
if (!onlineMembersElement.innerHTML.trim()) {
onlineMembersElement.innerText = renderData["online_count"];
onlineMembersElement.innerHTML = renderData["online_count"];
}
if (!allMembersElement.innerHTML.trim()) {
allMembersElement.innerText = renderData["member_count"];
}
if (!buttonElement.innerHTML.trim()) {
buttonElement.insertAdjacentElement("beforebegin", buttonAnchor);
buttonAnchor.insertAdjacentElement("afterbegin", buttonElement);
allMembersElement.innerHTML = renderData["member_count"];
}

buttonElement.insertAdjacentElement("beforebegin", buttonAnchor);
buttonAnchor.insertAdjacentElement("afterbegin", buttonElement);

__md_set(cacheKey, renderData, sessionStorage);
inviteElement.classList.remove("not-loaded");

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "hatchling.build"

[project]
name = "mkdocs-nype"
version = "0.16.4"
version = "0.16.5"
description = "MkDocs theme for Nype MkDocs projects, extends the Material for MkDocs theme"
authors = [
{ name = "Kamil Krzyśków", email = "kk@npe.cm" }
Expand Down

0 comments on commit 9c6092e

Please sign in to comment.