feat(profile): add character count for biography

This commit is contained in:
Shreyas Mayya 2022-02-02 13:49:03 -05:00
parent 5d58bb68a0
commit fcf78a0f9b
No known key found for this signature in database
GPG Key ID: 42522E3641BA2E31
2 changed files with 15 additions and 6 deletions

View File

@ -97,3 +97,8 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
.codehilite .vi { color: #19177C } /* Name.Variable.Instance */
.codehilite .vm { color: #19177C } /* Name.Variable.Magic */
.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */
small#count {
float: right;
text-align: right;
}

View File

@ -16,10 +16,14 @@ $(document).ready(function(){
}
})
/* Hide "Use nickname" checkbox if person doesn't have a nickname
The box won't do anything if they don't have a nickname,
but it's nice to just get it out of the way, you know? */
if ($("#without-nickname").length) {
$("#div_id_use_nickname").hide();
}
function characterCount() {
return $("#id_biography").val().length.toString() + "/1500 characters";
}
$("#div_id_biography").append("<small id=\"count\" class=\"form-text text-muted\"></small>");
$("#count").text(characterCount());
$("#id_biography").keyup(function(){
$("#count").text(characterCount());
});
})