code.gitea.io/gitea@v1.22.3/web_src/js/modules/fomantic.js (about) 1 import $ from 'jquery'; 2 import {initFomanticApiPatch} from './fomantic/api.js'; 3 import {initAriaCheckboxPatch} from './fomantic/checkbox.js'; 4 import {initAriaFormFieldPatch} from './fomantic/form.js'; 5 import {initAriaDropdownPatch} from './fomantic/dropdown.js'; 6 import {initAriaModalPatch} from './fomantic/modal.js'; 7 import {initFomanticTransition} from './fomantic/transition.js'; 8 import {svg} from '../svg.js'; 9 10 export const fomanticMobileScreen = window.matchMedia('only screen and (max-width: 767.98px)'); 11 12 export function initGiteaFomantic() { 13 // Silence fomantic's error logging when tabs are used without a target content element 14 $.fn.tab.settings.silent = true; 15 16 // By default, use "exact match" for full text search 17 $.fn.dropdown.settings.fullTextSearch = 'exact'; 18 // Do not use "cursor: pointer" for dropdown labels 19 $.fn.dropdown.settings.className.label += ' tw-cursor-default'; 20 // Always use Gitea's SVG icons 21 $.fn.dropdown.settings.templates.label = function(_value, text, preserveHTML, className) { 22 const escape = $.fn.dropdown.settings.templates.escape; 23 return escape(text, preserveHTML) + svg('octicon-x', 16, `${className.delete} icon`); 24 }; 25 26 initFomanticTransition(); 27 initFomanticApiPatch(); 28 29 // Use the patches to improve accessibility, these patches are designed to be as independent as possible, make it easy to modify or remove in the future. 30 initAriaCheckboxPatch(); 31 initAriaFormFieldPatch(); 32 initAriaDropdownPatch(); 33 initAriaModalPatch(); 34 }