mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user