()
| 519 | } |
| 520 | |
| 521 | async function init() { |
| 522 | const hasEmailInProfile = isEmailInDOM(document) |
| 523 | |
| 524 | if (!hasEmailInProfile) { |
| 525 | const username = getGitHubUsernameFromURL(location) |
| 526 | const userEventData = await fetchGitHubUserEventData(username) |
| 527 | const email = getEmailFromGitHubEventData(userEventData) |
| 528 | if (email) { |
| 529 | insertEmailIntoDOM(document, email) |
| 530 | } else { |
| 531 | console.warn( |
| 532 | '[GitHub Email Extension]: Could not find email in user\'s latest public event data.' |
| 533 | ) |
| 534 | return |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | insertClipboardSVGIntoDOM(document) |
| 539 | |
| 540 | const divElement = document.querySelector('#github-email-extension_copy-clipboard-svg') |
| 541 | |
| 542 | if (divElement) { |
| 543 | registerCopyToClipboardEventListener( |
| 544 | window, |
| 545 | document, |
| 546 | navigator, |
| 547 | divElement |
| 548 | ) |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | (async function () { |
| 553 | await init() |
no test coverage detected