* Create and add the co-authors button. * @param {HTMLElement} root Element to search within and add the co-authors button to.
(root)
| 510 | * @param {HTMLElement} root Element to search within and add the co-authors button to. |
| 511 | */ |
| 512 | function 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. |
no test coverage detected