commento.js: add login button

This commit is contained in:
Adhityaa Chandrasekar 2019-02-18 16:54:13 -05:00
parent 63c4da0b8d
commit 2e2d022c9b
2 changed files with 32 additions and 0 deletions

View File

@ -21,6 +21,7 @@
var ID_ROOT = "commento"; var ID_ROOT = "commento";
var ID_MAIN_AREA = "commento-main-area"; var ID_MAIN_AREA = "commento-main-area";
var ID_LOGIN = "commento-login";
var ID_LOGIN_BOX_CONTAINER = "commento-login-box-container"; var ID_LOGIN_BOX_CONTAINER = "commento-login-box-container";
var ID_LOGIN_BOX = "commento-login-box"; var ID_LOGIN_BOX = "commento-login-box";
var ID_LOGIN_BOX_EMAIL_SUBTITLE = "commento-login-box-email-subtitle"; var ID_LOGIN_BOX_EMAIL_SUBTITLE = "commento-login-box-email-subtitle";
@ -451,22 +452,39 @@
function rootCreate(callback) { function rootCreate(callback) {
var login = create("div");
var loginText = create("div");
var mainArea = $(ID_MAIN_AREA); var mainArea = $(ID_MAIN_AREA);
var commentsArea = create("div"); var commentsArea = create("div");
login.id = ID_LOGIN;
commentsArea.id = ID_COMMENTS_AREA; commentsArea.id = ID_COMMENTS_AREA;
classAdd(login, "login");
classAdd(loginText, "login-text");
classAdd(commentsArea, "comments"); classAdd(commentsArea, "comments");
loginText.innerText = "Login";
commentsArea.innerHTML = ""; commentsArea.innerHTML = "";
onclick(loginText, global.loginBoxShow, null);
append(login, loginText);
if (isLocked || isFrozen) { if (isLocked || isFrozen) {
if (isAuthenticated || chosenAnonymous) { if (isAuthenticated || chosenAnonymous) {
append(mainArea, messageCreate("This thread is locked. You cannot add new comments.")); append(mainArea, messageCreate("This thread is locked. You cannot add new comments."));
remove($(ID_LOGIN));
} else { } else {
append(mainArea, login);
append(mainArea, textareaCreate("root")); append(mainArea, textareaCreate("root"));
} }
} else { } else {
if (!isAuthenticated) {
append(mainArea, login);
} else {
remove($(ID_LOGIN));
}
append(mainArea, textareaCreate("root")); append(mainArea, textareaCreate("root"));
} }

View File

@ -1,5 +1,19 @@
@import "colors-main.scss"; @import "colors-main.scss";
.commento-login {
width: 100%;
.commento-login-text {
text-align: right;
margin-right: 16px;
height: 38px;
color: $gray-6;
font-weight: bold;
cursor: pointer;
display: block;
}
}
.commento-logged-container { .commento-logged-container {
width: 100%; width: 100%;
text-align: left; text-align: left;