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.
bazarr/static/semantic/components/dimmer.min.js

1 line
7.8 KiB

!function(e,i,n,t){"use strict";i=void 0!==i&&i.Math==Math?i:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.dimmer=function(i){var o,a=e(this),r=(new Date).getTime(),s=[],m=arguments[0],d="string"==typeof m,c=[].slice.call(arguments,1);return a.each(function(){var l,u,f,g=e.isPlainObject(i)?e.extend(!0,{},e.fn.dimmer.settings,i):e.extend({},e.fn.dimmer.settings),p=g.selector,v=g.namespace,h=g.className,b=g.error,y="."+v,C="module-"+v,w=a.selector||"",S="ontouchstart"in n.documentElement?"touchstart":"click",D=e(this),T=this,N=D.data(C);(f={preinitialize:function(){f.is.dimmer()?(u=D.parent(),l=D):(u=D,l=f.has.dimmer()?g.dimmerName?u.find(p.dimmer).filter("."+g.dimmerName):u.find(p.dimmer):f.create(),f.set.variation())},initialize:function(){f.debug("Initializing dimmer",g),f.bind.events(),f.set.dimmable(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of module",f),N=f,D.data(C,N)},destroy:function(){f.verbose("Destroying previous module",l),f.unbind.events(),f.remove.variation(),u.off(y)},bind:{events:function(){f.is.page()&&u.get(0).addEventListener("touchmove",f.event.preventScroll,{passive:!1}),"hover"==g.on?u.on("mouseenter"+y,f.show).on("mouseleave"+y,f.hide):"click"==g.on&&u.on(S+y,f.toggle),f.is.page()&&(f.debug("Setting as a page dimmer",u),f.set.pageDimmer()),f.is.closable()&&(f.verbose("Adding dimmer close event",l),u.on(S+y,p.dimmer,f.event.click))}},unbind:{events:function(){f.is.page()&&u.get(0).removeEventListener("touchmove",f.event.preventScroll,{passive:!1}),D.removeData(C),u.off(y)}},event:{click:function(i){f.verbose("Determining if event occured on dimmer",i),(0===l.find(i.target).length||e(i.target).is(p.content))&&(f.hide(),i.stopImmediatePropagation())},preventScroll:function(e){e.preventDefault()}},addContent:function(i){var n=e(i);f.debug("Add content to dimmer",n),n.parent()[0]!==l[0]&&n.detach().appendTo(l)},create:function(){var i=e(g.template.dimmer());return g.dimmerName&&(f.debug("Creating named dimmer",g.dimmerName),i.addClass(g.dimmerName)),i.appendTo(u),i},show:function(i){i=e.isFunction(i)?i:function(){},f.debug("Showing dimmer",l,g),f.is.dimmed()&&!f.is.animating()||!f.is.enabled()?f.debug("Dimmer is already shown or disabled"):(f.animate.show(i),g.onShow.call(T),g.onChange.call(T))},hide:function(i){i=e.isFunction(i)?i:function(){},f.is.dimmed()||f.is.animating()?(f.debug("Hiding dimmer",l),f.animate.hide(i),g.onHide.call(T),g.onChange.call(T)):f.debug("Dimmer is not visible")},toggle:function(){f.verbose("Toggling dimmer visibility",l),f.is.dimmed()?f.hide():f.show()},animate:{show:function(i){i=e.isFunction(i)?i:function(){},g.useCSS&&e.fn.transition!==t&&l.transition("is supported")?("auto"!==g.opacity&&f.set.opacity(),l.transition({displayType:"flex",animation:g.transition+" in",queue:!1,duration:f.get.duration(),useFailSafe:!0,onStart:function(){f.set.dimmed()},onComplete:function(){f.set.active(),i()}})):(f.verbose("Showing dimmer animation with javascript"),f.set.dimmed(),"auto"==g.opacity&&(g.opacity=.8),l.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(f.get.duration(),g.opacity,function(){l.removeAttr("style"),f.set.active(),i()}))},hide:function(i){i=e.isFunction(i)?i:function(){},g.useCSS&&e.fn.transition!==t&&l.transition("is supported")?(f.verbose("Hiding dimmer with css"),l.transition({displayType:"flex",animation:g.transition+" out",queue:!1,duration:f.get.duration(),useFailSafe:!0,onStart:function(){f.remove.dimmed()},onComplete:function(){f.remove.active(),i()}})):(f.verbose("Hiding dimmer with javascript"),f.remove.dimmed(),l.stop().fadeOut(f.get.duration(),function(){f.remove.active(),l.removeAttr("style"),i()}))}},get:{dimmer:function(){return l},duration:function(){return"object"==typeof g.duration?f.is.active()?g.duration.hide:g.duration.show:g.duration}},has:{dimmer:function(){return g.dimmerName?D.find(p.dimmer).filter("."+g.dimmerName).length>0:D.find(p.dimmer).length>0}},is:{active:function(){return l.hasClass(h.active)},animating:function(){return l.is(":animated")||l.hasClass(h.animating)},clo