diff --git a/source/scripts/autocomplete.ts b/source/scripts/autocomplete.ts index 18429b7..bf58de3 100644 --- a/source/scripts/autocomplete.ts +++ b/source/scripts/autocomplete.ts @@ -30,11 +30,16 @@ export class AutocompleteFeature extends Component { ); // Get all the usernames on the page without their leading @s, and get - // all the username from the saved user labels. + // all the usernames from the saved user labels. + const usernameElements = querySelectorAll('.link-user'); const usernames = [ - ...querySelectorAll('.link-user').map((value) => - value.textContent!.replace(/^@/, '').toLowerCase(), - ), + ...usernameElements.map((value) => { + if (props.settings.features.anonymizeUsernames) { + return (value.dataset.trxUsername ?? '').toLowerCase(); + } + + return value.textContent!.replace(/^@/, '').toLowerCase(); + }), ...props.settings.data.userLabels.map((value) => value.username), ].sort((a, b) => a.localeCompare(b));