11 lines
No EOL
13 KiB
JavaScript
11 lines
No EOL
13 KiB
JavaScript
/*
|
|
* # Fomantic UI - 2.9.3
|
|
* https://github.com/fomantic/Fomantic-UI
|
|
* https://fomantic-ui.com/
|
|
*
|
|
* Copyright 2023 Contributors
|
|
* Released under the MIT license
|
|
* https://opensource.org/licenses/MIT
|
|
*
|
|
*/
|
|
!function(h,n){"use strict";n=void 0!==n&&n.Math===Math?n:globalThis,h.fn.transition=function(){var p,o=h(this),r=Date.now(),s=[],g=arguments,v=g[0],b=[].slice.call(arguments,1),y="string"==typeof v;return o.each(function(i){var l,d,e,c,t,n,a,u=h(this),m=this,f={initialize:function(){l=f.get.settings.apply(m,g),c=l.className,e=l.error,t=l.metadata,a="."+l.namespace,n="module-"+l.namespace,d=u.data(n)||f,!1===(y=y&&f.invoke(v))&&(f.verbose("Converted arguments into settings object",l),l.interval?f.delay(l.interval):f.animate(),f.instantiate())},instantiate:function(){f.verbose("Storing instance of module",f),d=f,u.data(n,d)},destroy:function(){f.verbose("Destroying previous module for",m),u.removeData(n)},refresh:function(){f.verbose("Refreshing display type on next animation"),delete f.displayType},forceRepaint:function(){f.verbose("Forcing element repaint");var n=u.parent(),e=u.next();0===e.length?u.detach().appendTo(n):u.detach().insertBefore(e)},repaint:function(){f.verbose("Repainting element");m.offsetWidth},delay:function(n){var e=(e=f.get.animationDirection())||(f.can.transition()?f.get.direction():"static");n=void 0!==n?n:l.interval,e="auto"===l.reverse&&e===c.outward||!0===l.reverse?(o.length-i)*n:i*n,f.debug("Delaying animation by",e),setTimeout(function(){f.animate()},e)},animate:function(n){if(l=n||l,f.debug("Preparing animation",l.animation),f.is.animating()){if(l.queue)return!l.allowRepeats&&f.has.direction()&&f.is.occurring()&&!0!==f.queuing?f.debug("Animation is currently occurring, preventing queueing same animation",l.animation):f.queue(l.animation),!1;if(!l.allowRepeats&&f.is.occurring())return f.debug("Animation is already occurring, will not execute repeated animation",l.animation),!1;f.debug("New animation started, completing previous early",l.animation),d.complete()}f.can.animate()?f.set.animating(l.animation):f.error(e.noAnimation,l.animation,m)},reset:function(){f.debug("Resetting animation to beginning conditions"),f.remove.animationCallbacks(),f.restore.conditions(),f.remove.animating()},queue:function(n){f.debug("Queueing animation of",n),f.queuing=!0,u.one("animationend.queue"+a,function(){f.queuing=!1,f.repaint(),f.animate.apply(this,l)})},complete:function(n){n&&n.target===m&&n.stopPropagation(),f.debug("Animation complete",l.animation),f.remove.completeCallback(),f.remove.failSafe(),f.is.looping()||(f.is.outward()?(f.verbose("Animation is outward, hiding element"),f.restore.conditions(),f.hide()):f.is.inward()?(f.verbose("Animation is inward, showing element"),f.restore.conditions(),f.show()):(f.verbose("Static animation completed"),f.restore.conditions(),l.onComplete.call(m)))},force:{visible:function(){var n=u.attr("style"),n=f.get.userStyle(n),e=f.get.displayType(),n=n+"display: "+e+" !important;",i=u[0].style.display;return!e||"none"===i&&l.skipInlineHidden||u[0].tagName.match(/(script|link|style)/i)?(f.remove.transition(),!1):(f.verbose("Overriding default display to show element",e),u.attr("style",n),!0)},hidden:function(){var n=u.attr("style"),n=void 0===n||""===n;"none"===u.css("display")||f.is.hidden()?n&&u.removeAttr("style"):(f.verbose("Overriding default display to hide element"),u.css("display","none"))}},has:{direction:function(n){var i=!1;return"string"==typeof(n=n||l.animation)&&(n=n.split(" "),h.each(n,function(n,e){e!==c.inward&&e!==c.outward||(i=!0)})),i},inlineDisplay:function(){var n=u.attr("style")||"";return Array.isArray(n.match(/display.*?;/,""))}},set:{animating:function(n){f.remove.completeCallback(),n=n||l.animation;n=f.get.animationClass(n);f.save.animation(n),f.force.visible()&&(f.remove.hidden(),f.remove.direction(),f.start.animation(n))},duration:function(n,e){!(e="number"==typeof(e=e||l.duration)?e+"ms":e)&&0!==e||(f.verbose("Setting animation duration",e),u.css({"animation-duration":e}))},direction:function(n){(n=n||f.get.direction())===c.inward?f.set.inward():f.set.outward()},looping:function(){f.debug("Transition set to loop"),u.addClass(c.looping)},hidden:function(){u.addClass(c.transition).addClass(c.hidden)},inward:function(){f.debug("Setting direction to inward"),u.removeClass(c.outward).addClass(c.inward)},outward:function(){f.debug("Setting direction to outward"),u.removeClass(c.inward).addClass(c.outward)},visible:function(){u.addClass(c.transition).addClass(c.visible)}},start:{animation:function(n){n=n||f.get.animationClass(),f.debug("Starting tween",n),u.addClass(n).one("animationend.complete"+a,f.complete),l.useFailSafe&&f.add.failSafe(),f.set.duration(l.duration),l.onStart.call(m)}},save:{animation:function(n){f.cache||(f.cache={}),f.cache.animation=n},displayType:function(n){"none"!==n&&u.data(t.displayType,n)},transitionExists:function(n,e){h.fn.transition.exists[n]=e,f.verbose("Saving existence of transition",n,e)}},restore:{conditions:function(){var n=f.get.currentAnimation();n&&(u.removeClass(n),f.verbose("Removing animation class",f.cache)),f.remove.duration()}},add:{failSafe:function(){var n=f.get.duration();f.timer=setTimeout(function(){u.triggerHandler("animationend")},n+l.failSafeDelay),f.verbose("Adding fail safe timer",f.timer)}},remove:{animating:function(){u.removeClass(c.animating)},animationCallbacks:function(){f.remove.queueCallback(),f.remove.completeCallback()},queueCallback:function(){u.off(".queue"+a)},completeCallback:function(){u.off(".complete"+a)},display:function(){u.css("display","")},direction:function(){u.removeClass(c.inward).removeClass(c.outward)},duration:function(){u.css("animation-duration","")},failSafe:function(){f.verbose("Removing fail safe timer",f.timer),f.timer&&clearTimeout(f.timer)},hidden:function(){u.removeClass(c.hidden)},visible:function(){u.removeClass(c.visible)},looping:function(){f.debug("Transitions are no longer looping"),f.is.looping()&&(f.reset(),u.removeClass(c.looping))},transition:function(){u.removeClass(c.transition).removeClass(c.visible).removeClass(c.hidden)}},get:{settings:function(n,e,i){return"object"==typeof n?h.extend(!0,{},h.fn.transition.settings,n):"function"==typeof i?h.extend({},h.fn.transition.settings,{animation:n,onComplete:i,duration:e}):"string"==typeof e||"number"==typeof e?h.extend({},h.fn.transition.settings,{animation:n,duration:e}):"object"==typeof e?h.extend({},h.fn.transition.settings,e,{animation:n}):"function"==typeof e?h.extend({},h.fn.transition.settings,{animation:n,onComplete:e}):h.extend({},h.fn.transition.settings,{animation:n})},animationClass:function(n){var n=n||l.animation,e=f.can.transition()&&!f.has.direction()?f.get.direction()+" ":"";return c.animating+" "+c.transition+" "+e+n},currentAnimation:function(){return!(!f.cache||void 0===f.cache.animation)&&f.cache.animation},currentDirection:function(){return f.is.inward()?c.inward:c.outward},direction:function(){return f.is.hidden()||!f.is.visible()?c.inward:c.outward},animationDirection:function(n){var i;return"string"==typeof(n=n||l.animation)&&(n=n.split(" "),h.each(n,function(n,e){e===c.inward?i=c.inward:e===c.outward&&(i=c.outward)})),i||!1},duration:function(n){return"string"==typeof(n=!1===(n=n||l.duration)?u.css("animation-duration")||0:n)?-1<n.indexOf("ms")?parseFloat(n):1e3*parseFloat(n):n},displayType:function(n){return l.displayType||((n=void 0===n||n)&&void 0===u.data(t.displayType)&&(""===(n=u.css("display"))||"none"===n?f.can.transition(!0):f.save.displayType(n)),u.data(t.displayType))},userStyle:function(n){return(n=n||u.attr("style")||"").replace(/display.*?;/,"")},transitionExists:function(n){return h.fn.transition.exists[n]}},can:{transition:function(n){var e,i,t,a,o=l.animation,r=f.get.transitionExists(o),s=f.get.displayType(!1);if(void 0===r||n){if(f.verbose("Determining whether animation exists"),n=u.attr("class"),e=u.prop("tagName"),i=(e=h("<"+e+" />").addClass(n).insertAfter(u)).addClass(o).removeClass(c.inward).removeClass(c.outward).addClass(c.animating).addClass(c.transition).css("animationName"),e.detach().insertAfter(u),t=e.addClass(c.inward).css("animationName"),s||(e.detach().insertAfter(u),s=e.attr("class",n).removeAttr("style").removeClass(c.hidden).removeClass(c.visible).show().css("display"),f.verbose("Determining final display state",s),f.save.displayType(s)),e.remove(),i!==t)f.debug("Direction exists for animation",o),a=!0;else{if("none"===i||!i)return void f.debug("No animation defined in css",o);f.debug("Static animation found",o,s),a=!1}f.save.transitionExists(o,a)}return void 0!==r?r:a},animate:function(){return void 0!==f.can.transition()}},is:{animating:function(){return u.hasClass(c.animating)},inward:function(){return u.hasClass(c.inward)},outward:function(){return u.hasClass(c.outward)},looping:function(){return u.hasClass(c.looping)},occurring:function(n){return n="."+(n=n||l.animation).replace(" ","."),0<u.filter(n).length},visible:function(){return u.is(":visible")},hidden:function(){return"hidden"===u.css("visibility")},supported:function(){return!0}},hide:function(){if(!1===l.onHide.call(m))return f.verbose("Hide callback returned false cancelling hide"),!1;f.verbose("Hiding element"),f.is.animating()&&f.reset(),m.blur(),f.remove.display(),f.remove.visible(),l.onBeforeHide.call(m,f.hideNow)},hideNow:function(){f.set.hidden(),f.force.hidden(),l.onHidden.call(m),l.onComplete.call(m)},show:function(n){f.force.visible()&&!1!==l.onShow.call(m)&&(f.verbose("Showing element",n),f.remove.hidden(),l.onBeforeShow.call(m,f.showNow))},showNow:function(){f.set.visible(),l.onVisible.call(m),l.onComplete.call(m)},toggle:function(){f.is.visible()?f.hide():f.show()},stop:function(){f.debug("Stopping current animation"),u.triggerHandler("animationend")},stopAll:function(){f.debug("Stopping all animation"),f.remove.queueCallback(),u.triggerHandler("animationend")},clear:{queue:function(){f.debug("Clearing animation queue"),f.remove.queueCallback()}},enable:function(){f.verbose("Starting animation"),u.removeClass(c.disabled)},disable:function(){f.debug("Stopping animation"),u.addClass(c.disabled)},setting:function(n,e){if(f.debug("Changing setting",n,e),h.isPlainObject(n))h.extend(!0,l,n);else{if(void 0===e)return l[n];h.isPlainObject(l[n])?h.extend(!0,l[n],e):l[n]=e}},internal:function(n,e){if(h.isPlainObject(n))h.extend(!0,f,n);else{if(void 0===e)return f[n];f[n]=e}},debug:function(){!l.silent&&l.debug&&(l.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,l.name+":"),f.debug.apply(console,arguments)))},verbose:function(){!l.silent&&l.verbose&&l.debug&&(l.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),f.verbose.apply(console,arguments)))},error:function(){l.silent||(f.error=Function.prototype.bind.call(console.error,console,l.name+":"),f.error.apply(console,arguments))},performance:{log:function(n){var e,i;l.performance&&(i=(e=Date.now())-(r||e),r=e,s.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:m,"Execution Time":i})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(function(){f.performance.display()},500)},display:function(){var n=l.name+":",i=0;r=!1,clearTimeout(f.performance.timer),h.each(s,function(n,e){i+=e["Execution Time"]}),n+=" "+i+"ms",1<o.length&&(n+=" ("+o.length+")"),0<s.length&&(console.groupCollapsed(n),console.table?console.table(s):h.each(s,function(n,e){console.log(e.Name+": "+e["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,e){var a,o,i,r,s=d;return n=n||b,e=e||m,"string"==typeof t&&void 0!==s&&(t=t.split(/[ .]/),a=t.length-1,h.each(t,function(n,e){var i=n!==a?e+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(h.isPlainObject(s[i])&&n!==a)s=s[i];else{if(void 0!==s[i])return o=s[i],!1;{if(!h.isPlainObject(s[e])||n===a)return void 0!==s[e]&&(o=s[e]),!1;s=s[e]}}})),"function"==typeof(r=o)&&"number"!=typeof r.nodeType?i=o.apply(e,n):void 0!==o&&(i=o),Array.isArray(p)?p.push(i):void 0!==p?p=[p,i]:void 0!==i&&(p=i),void 0!==o&&o}};f.initialize()}),void 0!==p?p:this},h.fn.transition.exists={},h.fn.transition.settings={name:"Transition",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"transition",interval:0,reverse:"auto",onStart:function(){},onComplete:function(){},onShow:function(){},onBeforeShow:function(n){n.call(this)},onVisible:function(){},onHide:function(){},onHidden:function(){},onBeforeHide:function(n){n.call(this)},useFailSafe:!0,failSafeDelay:100,allowRepeats:!1,displayType:!1,animation:"fade",duration:!1,queue:!0,skipInlineHidden:!1,metadata:{displayType:"display"},className:{animating:"animating",disabled:"disabled",hidden:"hidden",inward:"in",loading:"loading",looping:"looping",outward:"out",transition:"transition",visible:"visible"},error:{noAnimation:"Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production."}}}(jQuery,window,document); |