MCPcopy Create free account
hub / github.com/ChinaGodMan/UserScripts / init

Function init

github-email-finder/github-email-finder.user.js:521–550  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

519}
520
521async 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()

Calls 7

isEmailInDOMFunction · 0.85
getGitHubUsernameFromURLFunction · 0.85
fetchGitHubUserEventDataFunction · 0.85
insertEmailIntoDOMFunction · 0.85

Tested by

no test coverage detected