commento.js: do not set href if link is undefined

Fixes https://gitlab.com/commento/commento/issues/156
This commit is contained in:
Adhityaa Chandrasekar 2019-04-20 21:05:23 -04:00
parent eec10491d6
commit 30772ec720

View File

@ -237,7 +237,12 @@
var loggedContainer = create("div"); var loggedContainer = create("div");
var loggedInAs = create("div"); var loggedInAs = create("div");
var name = create("a"); var name;
if (commenter.link !== "undefined") {
name = create("a");
} else {
name = create("div");
}
var avatar; var avatar;
var logout = create("div"); var logout = create("div");
var color = colorGet(commenter.commenterHex + "-" + commenter.name); var color = colorGet(commenter.commenterHex + "-" + commenter.name);
@ -255,7 +260,9 @@
onclick(logout, global.logout); onclick(logout, global.logout);
attrSet(loggedContainer, "style", "display: none"); attrSet(loggedContainer, "style", "display: none");
attrSet(name, "href", commenter.link); if (commenter.link !== "undefined") {
attrSet(name, "href", commenter.link);
}
if (commenter.photo === "undefined") { if (commenter.photo === "undefined") {
avatar = create("div"); avatar = create("div");
avatar.style["background"] = color; avatar.style["background"] = color;