Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when username starts with a lowercase letter #194

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

mrsrec
Copy link
Contributor

@mrsrec mrsrec commented Dec 6, 2023

Warning for people who select a username starting with a lowercase letter

Warning for people who select a username starting with a lowercase letter
@mrsrec mrsrec changed the title add username warning Add warning when username starts with a lowercase letter Dec 6, 2023
@mrsrec
Copy link
Contributor Author

mrsrec commented Dec 6, 2023

Closes #193

resources/main.js Outdated Show resolved Hide resolved
resources/main.js Outdated Show resolved Hide resolved
resources/main.js Outdated Show resolved Hide resolved
extension.json Show resolved Hide resolved
Copy link
Member

@jacob-g jacob-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good by looking at the code, will validate when I get the chance.


elem.onblur = function() {
var currentname = elem.value || "";
var usernameblock = new OO.ui.infuse(elem.parentElement.parentElement.parentElement.parentElement);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use .closest instead of this? This seems janky and likely to break with some OOUI update.

Copy link
Member

@jacob-g jacob-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the one issue I mentioned about repeated calls to .parentElement this looks good. Please look into using .closest for a more robust solution or let me know if you can't find anything.

@mrsrec
Copy link
Contributor Author

mrsrec commented Mar 12, 2024

@jacob-g I'm not familiar with .closest but I don't think it's likely to break. Generally the only thing that can break is hardcoding element names (like "ooui-php-1"), but just the number of elements is fine. I will look into .closest more if it's important.

@jacob-g
Copy link
Member

jacob-g commented Mar 12, 2024

You can use this:

document.getElementsByName("scratchusername")[0].closest('.oo-ui-layout')

This both is less likely to break if OOUI introduces any change and more properly conveys the abstraction of trying to find the wrapping layout.

@mrsrec
Copy link
Contributor Author

mrsrec commented Mar 13, 2024

@jacob-g OK. Added but not tested.

@mrsrec
Copy link
Contributor Author

mrsrec commented Mar 14, 2024

Seems to be working now.

image

Copy link
Member

@jacob-g jacob-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now.

@jacob-g jacob-g merged commit c7f995e into InternationalScratchWiki:master Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants