diff options
author | silverwind <me@silverwind.io> | 2023-08-17 00:12:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-16 22:12:40 +0000 |
commit | 376c0e25f74c967242b860a740fb4d509bae7ee9 (patch) | |
tree | 5092c5232cb7d37a31917b39c10c2f3e9e114a31 /web_src/js | |
parent | 3b129aaa80e752dd2e0e007fc28c0db652af6b5c (diff) | |
download | gitea-376c0e25f74c967242b860a740fb4d509bae7ee9.tar.gz gitea-376c0e25f74c967242b860a740fb4d509bae7ee9.zip |
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
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/modules/fomantic.js | 37 |
1 files changed, 37 insertions, 0 deletions
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. |