You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo-commit.js 961B

123456789101112131415161718192021222324252627
  1. import {createTippy} from '../modules/tippy.js';
  2. import {toggleElem} from '../utils/dom.js';
  3. export function initRepoEllipsisButton() {
  4. for (const button of document.querySelectorAll('.js-toggle-commit-body')) {
  5. button.addEventListener('click', function (e) {
  6. e.preventDefault();
  7. const expanded = this.getAttribute('aria-expanded') === 'true';
  8. toggleElem(this.parentElement.querySelector('.commit-body'));
  9. this.setAttribute('aria-expanded', String(!expanded));
  10. });
  11. }
  12. }
  13. export function initCommitStatuses() {
  14. for (const element of document.querySelectorAll('[data-tippy="commit-statuses"]')) {
  15. const top = document.querySelector('.repository.file.list') || document.querySelector('.repository.diff');
  16. createTippy(element, {
  17. content: element.nextElementSibling,
  18. placement: top ? 'top-start' : 'bottom-start',
  19. interactive: true,
  20. role: 'dialog',
  21. theme: 'box-with-header',
  22. });
  23. }
  24. }