mirror of
https://github.com/go-gitea/gitea
synced 2025-07-07 11:07:20 +00:00
Drop fomantic build (#33845)
We would never update or build fomantic again, we have forked it as a private library long time ago. So just put the JS and CSS files in "fomantic/build" into git. And use "import" to use them. Remove "form.js", rewrite "tab" component. All source code is from official Fomantic UI build. Will apply patches in separate PRs.
This commit is contained in:
19
web_src/js/modules/fomantic/tab.ts
Normal file
19
web_src/js/modules/fomantic/tab.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import $ from 'jquery';
|
||||
import {queryElemSiblings} from '../../utils/dom.ts';
|
||||
|
||||
export function initFomanticTab() {
|
||||
$.fn.tab = function (this: any) {
|
||||
for (const elBtn of this) {
|
||||
const tabName = elBtn.getAttribute('data-tab');
|
||||
if (!tabName) continue;
|
||||
elBtn.addEventListener('click', () => {
|
||||
const elTab = document.querySelector(`.ui.tab[data-tab="${tabName}"]`);
|
||||
queryElemSiblings(elTab, `.ui.tab`, (el) => el.classList.remove('active'));
|
||||
queryElemSiblings(elBtn, `[data-tab]`, (el) => el.classList.remove('active'));
|
||||
elBtn.classList.add('active');
|
||||
elTab.classList.add('active');
|
||||
});
|
||||
}
|
||||
return this;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user