code.gitea.io/gitea@v1.21.7/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 {initAriaDropdownPatch} from './fomantic/dropdown.js'; 5 import {initAriaModalPatch} from './fomantic/modal.js'; 6 import {initFomanticTransition} from './fomantic/transition.js'; 7 import {svg} from '../svg.js'; 8 9 export const fomanticMobileScreen = window.matchMedia('only screen and (max-width: 767.98px)'); 10 11 export function initGiteaFomantic() { 12 // Silence fomantic's error logging when tabs are used without a target content element 13 $.fn.tab.settings.silent = true; 14 // Disable the behavior of fomantic to toggle the checkbox when you press enter on a checkbox element. 15 $.fn.checkbox.settings.enableEnterKey = false; 16 17 // By default, use "exact match" for full text search 18 $.fn.dropdown.settings.fullTextSearch = 'exact'; 19 // Do not use "cursor: pointer" for dropdown labels 20 $.fn.dropdown.settings.className.label += ' gt-cursor-default'; 21 // Always use Gitea's SVG icons 22 $.fn.dropdown.settings.templates.label = function(_value, text, preserveHTML, className) { 23 const escape = $.fn.dropdown.settings.templates.escape; 24 return escape(text, preserveHTML) + svg('octicon-x', 16, `${className.delete} icon`); 25 }; 26 27 initFomanticTransition(); 28 initFomanticApiPatch(); 29 30 // 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. 31 initAriaCheckboxPatch(); 32 initAriaDropdownPatch(); 33 initAriaModalPatch(); 34 }