Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsrec authored Dec 6, 2023
1 parent d93f0dc commit f1ede5e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions resources/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
});
});

0 comments on commit f1ede5e

Please sign in to comment.