You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fomantic.js 1.4KB

1234567891011121314151617181920212223242526272829303132
  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. export const fomanticMobileScreen = window.matchMedia('only screen and (max-width: 767.98px)');
  9. export function initGiteaFomantic() {
  10. // Silence fomantic's error logging when tabs are used without a target content element
  11. $.fn.tab.settings.silent = true;
  12. // By default, use "exact match" for full text search
  13. $.fn.dropdown.settings.fullTextSearch = 'exact';
  14. // Do not use "cursor: pointer" for dropdown labels
  15. $.fn.dropdown.settings.className.label += ' tw-cursor-default';
  16. // Always use Gitea's SVG icons
  17. $.fn.dropdown.settings.templates.label = function(_value, text, preserveHTML, className) {
  18. const escape = $.fn.dropdown.settings.templates.escape;
  19. return escape(text, preserveHTML) + svg('octicon-x', 16, `${className.delete} icon`);
  20. };
  21. initFomanticTransition();
  22. initFomanticApiPatch();
  23. // 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.
  24. initAriaCheckboxPatch();
  25. initAriaDropdownPatch();
  26. initAriaModalPatch();
  27. }