mirror of
https://github.com/go-gitea/gitea.git
synced 2026-06-26 08:57:39 +02:00
- Upgrade `typescript-eslint` to 8.61 and `eslint-plugin-unicorn` to 65, configuring the rules introduced in unicorn 65. - Remove `eslint-plugin-github` and its workarounds: rules, the type-stub module declaration, the pnpm peer-dependency override, and the in-code `eslint-disable` comments that referenced its rules. - Remove rules deprecated or deleted in their plugins and switch to their replacements (e.g. `prefer-single-call`, `no-object-constructor`, `id-denylist`, `no-unnecessary-slice-end`). - Apply the resulting autofixes, mainly wrapping interpolated values in CSS selectors with `CSS.escape()`. Assisted-by: claude-code:opus-4.8
19 lines
960 B
TypeScript
19 lines
960 B
TypeScript
import {queryElemSiblings} from '../../utils/dom.ts';
|
|
|
|
export function initTabSwitcher(tabItemContainer: Element) {
|
|
// Clicking a `.item[data-tab]` menu item activates the matching `.ui.tab[data-tab=...]` panel
|
|
// This design is from Fomantic UI, and it has problems like :
|
|
// * The panel selector is global, callers should make sure the "data-tab" values don't conflict on the same page
|
|
const tabItems = tabItemContainer.querySelectorAll('.item[data-tab]');
|
|
for (const elItem of tabItems) {
|
|
const tabName = elItem.getAttribute('data-tab')!;
|
|
elItem.addEventListener('click', () => {
|
|
const elPanel = document.querySelector(`.ui.tab[data-tab="${CSS.escape(tabName)}"]`)!;
|
|
queryElemSiblings(elPanel, '.ui.tab', (el) => el.classList.remove('active'));
|
|
queryElemSiblings(elItem, '.item[data-tab]', (el) => el.classList.remove('active'));
|
|
elItem.classList.add('active');
|
|
elPanel.classList.add('active');
|
|
});
|
|
}
|
|
}
|