2022-08-09 18:07:34 +05:30
|
|
|
import {createTippy} from '../modules/tippy.js';
|
2023-02-19 09:36:14 +05:30
|
|
|
import {toggleElem} from '../utils/dom.js';
|
2021-11-09 14:57:25 +05:30
|
|
|
|
2021-11-23 08:14:38 +05:30
|
|
|
export function initRepoEllipsisButton() {
|
2024-02-22 22:43:25 +05:30
|
|
|
for (const button of document.querySelectorAll('.js-toggle-commit-body')) {
|
|
|
|
button.addEventListener('click', function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
const expanded = this.getAttribute('aria-expanded') === 'true';
|
|
|
|
toggleElem(this.parentElement.querySelector('.commit-body'));
|
|
|
|
this.setAttribute('aria-expanded', String(!expanded));
|
|
|
|
});
|
|
|
|
}
|
2021-10-16 22:58:04 +05:30
|
|
|
}
|
2021-11-09 14:57:25 +05:30
|
|
|
|
2022-04-27 00:39:46 +05:30
|
|
|
export function initCommitStatuses() {
|
2024-02-22 22:43:25 +05:30
|
|
|
for (const element of document.querySelectorAll('[data-tippy="commit-statuses"]')) {
|
|
|
|
const top = document.querySelector('.repository.file.list') || document.querySelector('.repository.diff');
|
2022-08-09 18:07:34 +05:30
|
|
|
|
2024-02-22 22:43:25 +05:30
|
|
|
createTippy(element, {
|
|
|
|
content: element.nextElementSibling,
|
2022-08-10 03:25:29 +05:30
|
|
|
placement: top ? 'top-start' : 'bottom-start',
|
2022-08-09 18:07:34 +05:30
|
|
|
interactive: true,
|
2023-06-15 13:39:16 +05:30
|
|
|
role: 'dialog',
|
2023-11-02 20:19:02 +05:30
|
|
|
theme: 'box-with-header',
|
2022-08-09 18:07:34 +05:30
|
|
|
});
|
2024-02-22 22:43:25 +05:30
|
|
|
}
|
2022-04-27 00:39:46 +05:30
|
|
|
}
|