2022-08-09 21:37:34 +09:00
|
|
|
import {createTippy} from '../modules/tippy.js';
|
2023-02-19 13:06:14 +09:00
|
|
|
import {toggleElem} from '../utils/dom.js';
|
2021-11-09 18:27:25 +09:00
|
|
|
|
2021-11-23 11:44:38 +09:00
|
|
|
export function initRepoEllipsisButton() {
|
2024-02-23 02:13:25 +09:00
|
|
|
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-17 02:28:04 +09:00
|
|
|
}
|
2021-11-09 18:27:25 +09:00
|
|
|
|
2022-04-27 04:09:46 +09:00
|
|
|
export function initCommitStatuses() {
|
2024-02-23 02:13:25 +09:00
|
|
|
for (const element of document.querySelectorAll('[data-tippy="commit-statuses"]')) {
|
|
|
|
const top = document.querySelector('.repository.file.list') || document.querySelector('.repository.diff');
|
2022-08-09 21:37:34 +09:00
|
|
|
|
2024-02-23 02:13:25 +09:00
|
|
|
createTippy(element, {
|
|
|
|
content: element.nextElementSibling,
|
2022-08-10 06:55:29 +09:00
|
|
|
placement: top ? 'top-start' : 'bottom-start',
|
2022-08-09 21:37:34 +09:00
|
|
|
interactive: true,
|
2023-06-15 17:09:16 +09:00
|
|
|
role: 'dialog',
|
2023-11-02 23:49:02 +09:00
|
|
|
theme: 'box-with-header',
|
2022-08-09 21:37:34 +09:00
|
|
|
});
|
2024-02-23 02:13:25 +09:00
|
|
|
}
|
2022-04-27 04:09:46 +09:00
|
|
|
}
|