loading up the forgejo repo on tangled to test page performance
at forgejo 44 lines 1.6 kB view raw
1import {createTippy} from '../modules/tippy.js'; 2import {toggleElem} from '../utils/dom.js'; 3 4export function initRepoEllipsisButton() { 5 for (const button of document.querySelectorAll('.js-toggle-commit-body')) { 6 button.addEventListener('click', function (e) { 7 e.preventDefault(); 8 const expanded = this.getAttribute('aria-expanded') === 'true'; 9 toggleElem(this.parentElement.querySelector('.commit-body')); 10 this.setAttribute('aria-expanded', String(!expanded)); 11 }); 12 } 13} 14 15export function initCommitStatuses() { 16 for (const element of document.querySelectorAll('[data-tippy="commit-statuses"]')) { 17 const top = document.querySelector('.repository.file.list') || document.querySelector('.repository.diff'); 18 19 createTippy(element, { 20 content: element.nextElementSibling, 21 placement: top ? 'top-start' : 'bottom-start', 22 interactive: true, 23 role: 'dialog', 24 theme: 'box-with-header', 25 }); 26 } 27} 28 29export function initCommitNotes() { 30 const notesEditButton = document.getElementById('commit-notes-edit-button'); 31 if (notesEditButton !== null) { 32 notesEditButton.addEventListener('click', () => { 33 document.getElementById('commit-notes-display-area').classList.add('tw-hidden'); 34 document.getElementById('commit-notes-edit-area').classList.remove('tw-hidden'); 35 }); 36 } 37 38 const notesAddButton = document.getElementById('commit-notes-add-button'); 39 if (notesAddButton !== null) { 40 notesAddButton.addEventListener('click', () => { 41 document.getElementById('commit-notes-add-area').classList.remove('tw-hidden'); 42 }); 43 } 44}