From 376c0e25f74c967242b860a740fb4d509bae7ee9 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 17 Aug 2023 00:12:40 +0200 Subject: Remove fomantic transition module (#26469) Removes all dropdown and dimmer animations. Works everywhere as far as I can tell, but need to give this thorough testing. Removes around 70kb JS/CSS. Note, I'm not 100% sure regarding the various callbacks, those will need more investigation, but it appears to work nonetheless. Fixes: https://github.com/go-gitea/gitea/issues/15709 --- web_src/js/modules/fomantic.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'web_src/js') diff --git a/web_src/js/modules/fomantic.js b/web_src/js/modules/fomantic.js index b78a5fbf95..ab5f842bc6 100644 --- a/web_src/js/modules/fomantic.js +++ b/web_src/js/modules/fomantic.js @@ -22,6 +22,43 @@ export function initGiteaFomantic() { return escape(text, preserveHTML) + svg('octicon-x', 16, `${className.delete} icon`); }; + // stand-in for removed transition module + $.fn.transition = function (arg) { + if (arg === 'is supported') return true; + if (arg === 'is animating') return false; + if (arg === 'is inward') return false; + if (arg === 'is outward') return false; + if (arg === 'stop all') return; + + const isIn = arg?.animation?.endsWith(' in'); + const isOut = arg?.animation?.endsWith(' out'); + + let ret; + if (arg === 'show' || isIn) { + arg?.onStart?.(this); + ret = this.each((_, el) => { + el.classList.remove('hidden'); + el.classList.add('visible'); + if (isIn) el.classList.add('transition'); + if (arg?.displayType) el.style.setProperty('display', arg.displayType, 'important'); + arg?.onShow?.(this); + }); + arg?.onComplete?.(this); + } else if (arg === 'hide' || isOut) { + arg?.onStart?.(this); + ret = this.each((_, el) => { + el.classList.add('hidden'); + el.classList.remove('visible'); + // don't remove the transition class because fomantic didn't do it either + el.style.removeProperty('display'); + arg?.onHidden?.(this); + }); + arg?.onComplete?.(this); + } + + return ret; + }; + initFomanticApiPatch(); // 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. -- cgit v1.2.3