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

Function addCoAuthorsButton

github-co-authors/github-co-authors.user.js:512–522  ·  view source on GitHub ↗

* Create and add the co-authors button. * @param {HTMLElement} root Element to search within and add the co-authors button to.

(root)

Source from the content-addressed store, hash-verified

510 * @param {HTMLElement} root Element to search within and add the co-authors button to.
511 */
512function addCoAuthorsButton(root) {
513 const newMergeExperienceContainer = root.querySelector('react-partial[partial-name="mergebox-partial"]')
514 const commitTitleInput = newMergeExperienceContainer?.querySelector('div:has(> label):nth-child(1)') ??
515 root.querySelector('input[name="commit_title"]')
516 if (!commitTitleInput || root.querySelector('[data-coauthors-button]')) {
517 return
518 }
519 const button = createCoAuthorsUI(root, newMergeExperienceContainer)
520 button.setAttribute('data-coauthors-button', '')
521 commitTitleInput.insertAdjacentElement('afterend', button)
522}
523
524/**
525 * Look for the PR merge form and add monitor it to add the co-authors button when possible.

Callers 1

Calls 1

createCoAuthorsUIFunction · 0.85

Tested by

no test coverage detected