mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-29 18:27:33 +08:00
showing website name instead of full url
This commit is contained in:
parent
90ae4938c4
commit
b2cab171b8
1 changed files with 6 additions and 1 deletions
|
|
@ -119,9 +119,14 @@ export async function update(
|
|||
}
|
||||
|
||||
const website = profile.details?.socialProfiles.website;
|
||||
|
||||
//regular expression to get website name from url
|
||||
const regex = /^https?:\/\/(?:www\.)?([^/]+)/;
|
||||
const websiteName = website?.match(regex)?.[1] ?? website;
|
||||
|
||||
if (website) {
|
||||
socialsEl.append(
|
||||
`<a href='${website}' aria-label="${website}" data-balloon-pos="up"><i class="fas fa-fw fa-globe"></i></a>`
|
||||
`<a href='${website}' aria-label="${websiteName}" data-balloon-pos="up"><i class="fas fa-fw fa-globe"></i></a>`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue