From 9d706ff912121bbeb544187045300077f50189c0 Mon Sep 17 00:00:00 2001 From: Evgeny Kuznetsov Date: Tue, 31 Jan 2023 11:43:32 +0300 Subject: feat: show nicknames and notes in h-cards --- hovercard.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hovercard.js b/hovercard.js index c20220f..d71de4a 100644 --- a/hovercard.js +++ b/hovercard.js @@ -14,7 +14,12 @@ var hovercards = { var new_box = document.createElement("div"); new_box.classList.add("hovercard"); if (hovercard_data["pname"]) { - new_box.innerHTML = "" + hovercard_data["pname"] + "" + console.log(hovercard_data); + var nick = "" + if (hovercard_data["nickname"]) { + nick = " (" + hovercard_data["nickname"] + ")" + } + new_box.innerHTML = "" + hovercard_data["pname"] + nick + "" } else { if (hovercard_data["title"]) { new_box.innerHTML = "" + hovercard_data["title"] + "" @@ -23,6 +28,9 @@ var hovercards = { if (hovercard_data["description"]) { new_box.innerHTML = new_box.innerHTML + "

" + hovercard_data["description"] + "

"; } + if (hovercard_data["note"]) { + new_box.innerHTML = new_box.innerHTML + "

" + hovercard_data["note"] + "

"; + } // if image available, add it if (hovercard_data["uphoto"]) { new_box.innerHTML = "" + hovercard_data["pname"] + "
" + new_box.innerHTML; -- cgit v1.2.3