visrecall/WebInterface/Front-end/assets/lib/semantic/components/modal.min.js

10 lines
11 KiB
JavaScript
Raw Permalink Normal View History

2022-07-29 14:22:57 +02:00
/*!
* # Semantic UI 2.2.9 - Modal
* http://github.com/semantic-org/semantic-ui/
*
*
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(e,n,i,t){"use strict";n="undefined"!=typeof n&&n.Math==Math?n:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.modal=function(o){var a,r=e(this),s=e(n),c=e(i),l=e("body"),d=r.selector||"",u=(new Date).getTime(),m=[],f=arguments[0],g="string"==typeof f,h=[].slice.call(arguments,1),v=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,0)};return r.each(function(){var r,b,p,y,k,w,M,S,C,F=e.isPlainObject(o)?e.extend(!0,{},e.fn.modal.settings,o):e.extend({},e.fn.modal.settings),A=F.selector,D=F.className,H=F.namespace,T=F.error,x="."+H,z="module-"+H,O=e(this),q=e(F.context),E=O.find(A.close),j=this,P=O.data(z);C={initialize:function(){C.verbose("Initializing dimmer",q),C.create.id(),C.create.dimmer(),C.refreshModals(),C.bind.events(),F.observeChanges&&C.observeChanges(),C.instantiate()},instantiate:function(){C.verbose("Storing instance of modal"),P=C,O.data(z,P)},create:{dimmer:function(){var n={debug:F.debug,dimmerName:"modals",duration:{show:F.duration,hide:F.duration}},i=e.extend(!0,n,F.dimmerSettings);return F.inverted&&(i.variation=i.variation!==t?i.variation+" inverted":"inverted"),e.fn.dimmer===t?void C.error(T.dimmer):(C.debug("Creating dimmer with settings",i),y=q.dimmer(i),F.detachable?(C.verbose("Modal is detachable, moving content into dimmer"),y.dimmer("add content",O)):C.set.undetached(),F.blurring&&y.addClass(D.blurring),void(k=y.dimmer("get dimmer")))},id:function(){M=(Math.random().toString(16)+"000000000").substr(2,8),w="."+M,C.verbose("Creating unique id for element",M)}},destroy:function(){C.verbose("Destroying previous modal"),O.removeData(z).off(x),s.off(w),k.off(w),E.off(x),q.dimmer("destroy")},observeChanges:function(){"MutationObserver"in n&&(S=new MutationObserver(function(e){C.debug("DOM tree modified, refreshing"),C.refresh()}),S.observe(j,{childList:!0,subtree:!0}),C.debug("Setting up mutation observer",S))},refresh:function(){C.remove.scrolling(),C.cacheSizes(),C.set.screenHeight(),C.set.type(),C.set.position()},refreshModals:function(){b=O.siblings(A.modal),r=b.add(O)},attachEvents:function(n,i){var t=e(n);i=e.isFunction(C[i])?C[i]:C.toggle,t.length>0?(C.debug("Attaching modal events to element",n,i),t.off(x).on("click"+x,i)):C.error(T.notFound,n)},bind:{events:function(){C.verbose("Attaching events"),O.on("click"+x,A.close,C.event.close).on("click"+x,A.approve,C.event.approve).on("click"+x,A.deny,C.event.deny),s.on("resize"+w,C.event.resize)}},get:{id:function(){return(Math.random().toString(16)+"000000000").substr(2,8)}},event:{approve:function(){return F.onApprove.call(j,e(this))===!1?void C.verbose("Approve callback returned false cancelling hide"):void C.hide()},deny:function(){return F.onDeny.call(j,e(this))===!1?void C.verbose("Deny callback returned false cancelling hide"):void C.hide()},close:function(){C.hide()},click:function(n){var t=e(n.target),o=t.closest(A.modal).length>0,a=e.contains(i.documentElement,n.target);!o&&a&&(C.debug("Dimmer clicked, hiding all modals"),C.is.active()&&(C.remove.clickaway(),F.allowMultiple?C.hide():C.hideAll()))},debounce:function(e,n){clearTimeout(C.timer),C.timer=setTimeout(e,n)},keyboard:function(e){var n=e.which,i=27;n==i&&(F.closable?(C.debug("Escape key pressed hiding modal"),C.hide()):C.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){y.dimmer("is active")&&v(C.refresh)}},toggle:function(){C.is.active()||C.is.animating()?C.hide():C.show()},show:function(n){n=e.isFunction(n)?n:function(){},C.refreshModals(),C.showModal(n)},hide:function(n){n=e.isFunction(n)?n:function(){},C.refreshModals(),C.hideModal(n)},showModal:function(n){n=e.isFunction(n)?n:function(){},C.is.animating()||!C.is.active()?(C.showDimmer(),C.cacheSizes(),C.set.position(),C.set.screenHeight(),C.set.type(),C.set.clickaway(),!F.allowMultiple&&C.others.active()?C.hideOthers(C.showModal):(F.onShow.call(j),F.transition&&e.fn.transition!==t&&O.transition("is supported")?(C.debug("Showing modal with css animations"),O.