mirror of
https://github.com/go-gitea/gitea
synced 2025-01-22 07:34:26 +00:00
4b21a6c792
- Enable https://www.typescriptlang.org/tsconfig/#noImplicitThis - Wrap Vue Template-Syntax SFCs in [`defineComponent`](https://vuejs.org/api/general#definecomponent) which makes type inference and linter work better - Move `createApp` calls outside the SFCs into separate files - Use [`PropType`](https://vuejs.org/api/utility-types#proptype-t) where appropriate - Some top-level component properties changed order as dictated by the linter - Fix all tsc and lint issues that popped up during these refactors
28 lines
980 B
TypeScript
28 lines
980 B
TypeScript
import {createTippy} from '../modules/tippy.ts';
|
|
import {toggleElem} from '../utils/dom.ts';
|
|
|
|
export function initRepoEllipsisButton() {
|
|
for (const button of document.querySelectorAll<HTMLButtonElement>('.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));
|
|
});
|
|
}
|
|
}
|
|
|
|
export function initCommitStatuses() {
|
|
for (const element of document.querySelectorAll('[data-tippy="commit-statuses"]')) {
|
|
const top = document.querySelector('.repository.file.list') || document.querySelector('.repository.diff');
|
|
|
|
createTippy(element, {
|
|
content: element.nextElementSibling,
|
|
placement: top ? 'top-start' : 'bottom-start',
|
|
interactive: true,
|
|
role: 'dialog',
|
|
theme: 'box-with-header',
|
|
});
|
|
}
|
|
}
|