mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 19:15:23 +01:00 
			
		
		
		
	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.
		
			
				
	
	
		
			20 lines
		
	
	
		
			682 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			682 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 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;
 | |
|   };
 | |
| }
 |