From fcf78a0f9bc589d3d59df2fee1d38588b7f0b626 Mon Sep 17 00:00:00 2001 From: Shreyas Mayya <2022smayya@tjhsst.edu> Date: Wed, 2 Feb 2022 13:49:03 -0500 Subject: [PATCH] feat(profile): add character count for biography --- tjdests/static/bios.css | 5 +++++ tjdests/static/main.js | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tjdests/static/bios.css b/tjdests/static/bios.css index 1191f34..6075dd3 100644 --- a/tjdests/static/bios.css +++ b/tjdests/static/bios.css @@ -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; +} diff --git a/tjdests/static/main.js b/tjdests/static/main.js index 90791a9..3315ad1 100644 --- a/tjdests/static/main.js +++ b/tjdests/static/main.js @@ -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(""); + $("#count").text(characterCount()); + + $("#id_biography").keyup(function(){ + $("#count").text(characterCount()); + }); }) \ No newline at end of file