From f1ede5e1a04e957c8d1750450800fb6739efba05 Mon Sep 17 00:00:00 2001 From: mrsrec <6236968+mrsrec@users.noreply.github.com> Date: Wed, 6 Dec 2023 12:09:25 -0800 Subject: [PATCH] Update main.js --- resources/main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/main.js b/resources/main.js index 182fd42..0438427 100644 --- a/resources/main.js +++ b/resources/main.js @@ -59,12 +59,13 @@ $(function () { elem.onblur = function() { var currentname = elem.value || ""; - var usernameblock = new OO.ui.infuse(elem.parentElement.parentElement.parentElement.parentElement);// Pain + var usernameblock = new OO.ui.infuse(elem.parentElement.parentElement.parentElement.parentElement); + // Start with username input field, and go up 4 levels, to the entire username container that OOUI will infuse onto var noticebox = []; - if(currentname.length > 0 && currentname[0].match("[a-z]")){ + if(currentname.length > 0 && currentname[0].match("[a-z]")){// Compare first letter to a regex, to check if it starts with a lowercase letter noticebox[0] = new mw.message("createacct-normalization", "", currentname[0].toUpperCase() + currentname.slice(1)).text(); + // If it'd change, add a notice with the first letter captialized } - console.log(noticebox); - usernameblock.setNotices(noticebox); + usernameblock.setNotices(noticebox);// Save out any notices (importantly, this will *remove* a notice if it no longer applies) } -}); \ No newline at end of file +});