11 lines
No EOL
23 KiB
JavaScript
11 lines
No EOL
23 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(R,U,V){"use strict";function _(e){return"function"==typeof e&&"number"!=typeof e.nodeType}U=void 0!==U&&U.Math===Math?U:globalThis,R.fn.modal=function(N){var I,e=R(this),j=R(U),z=R(V),q=R("body"),B=Date.now(),W=[],P=N,K="string"==typeof P,Q=[].slice.call(arguments,1),X=function(e,t){var i;return 0<=[U,V].indexOf(e)?i=q:0===(i=R(t.document).find(e)).length&&(i=t.frameElement?X(e,t.parent):q),i};return e.each(function(){var i,o,a,e,n,t,s,r,c,l,d,u=R.isPlainObject(N)?R.extend(!0,{},R.fn.modal.settings,N):R.extend({},R.fn.modal.settings),f=u.selector,m=u.className,h=u.namespace,g=u.fields,v=u.error,p="."+h,b="module-"+h,y=R(this),x=X(u.context,U),k=x[0]===q[0],w=y.find(f.closeIcon),C=y.hasClass("modal"),S=this,M=C?y.data(b):void 0,A=!1,D="",T="",H=!1,F=!1,E=!1,O=!1,L={initialize:function(){var a;L.create.id(),C||(L.create.modal(),_(u.onHidden)||(u.onHidden=function(){L.destroy(),y.remove()})),y.addClass(u.class),""!==u.title&&y.find(f.title).html(L.helpers.escape(u.title,u.preserveHTML)).addClass(u.classTitle),""!==u.content&&y.find(f.content).html(L.helpers.escape(u.content,u.preserveHTML)).addClass(u.classContent),L.has.configActions()&&(0===(a=y.find(f.actions).addClass(u.classActions)).length?a=R("<div/>",{class:m.actions+" "+(u.classActions||"")}).appendTo(y):a.empty(),u.actions.forEach(function(e){var t=e[g.icon]?"<i "+(e[g.text]?'aria-hidden="true"':"")+' class="'+L.helpers.deQuote(e[g.icon])+' icon"></i>':"",i=L.helpers.escape(e[g.text]||"",u.preserveHTML),n=L.helpers.deQuote(e[g.class]||""),o=e[g.click]&&_(e[g.click])?e[g.click]:function(){};a.append(R("<button/>",{html:t+i,"aria-label":(e[g.text]||e[g.icon]||"").replace(/<[^>]+(>|$)/g,""),class:m.button+" "+n,on:{click:function(){var e=R(this);e.is(f.approve)||e.is(f.deny)||!1===o.call(S,y)||L.hide()}}}))})),L.cache={},L.verbose("Initializing dimmer",x),L.create.dimmer(),u.allowMultiple&&L.create.innerDimmer(),u.centered||y.addClass("top aligned"),L.refreshModals(),L.bind.events(),L.observeChanges(),L.instantiate(),u.autoShow&&L.show()},instantiate:function(){L.verbose("Storing instance of modal"),M=L,y.data(b,M)},create:{modal:function(){var e;y=R("<div/>",{class:m.modal,role:"dialog","aria-modal":!0}),u.closeIcon&&(w=R("<i/>",{class:m.close,role:"button",tabindex:0,"aria-label":u.text.close}),y.append(w)),""!==u.title&&(e="_"+L.get.id()+"title",y.attr("aria-labelledby",e),R("<div/>",{class:m.title,id:e}).appendTo(y)),""!==u.content&&(e="_"+L.get.id()+"desc",y.attr("aria-describedby",e),R("<div/>",{class:m.content,id:e}).appendTo(y)),L.has.configActions()&&R("<div/>",{class:m.actions}).appendTo(y),x.append(y),S=y[0]},dimmer:function(){var e={debug:u.debug,dimmerName:"modals"},e=R.extend(!0,e,u.dimmerSettings);void 0===R.fn.dimmer?L.error(v.dimmer):(L.debug("Creating dimmer"),n=x.dimmer(e),H=L.is.scrolling(),u.detachable?(L.verbose("Modal is detachable, moving content into dimmer"),n.dimmer("add content",y)):L.set.undetached(),t=n.dimmer("get dimmer"))},id:function(){l=(Math.random().toString(16)+"000000000").slice(2,10),c="."+l,L.verbose("Creating unique id for element",l)},innerDimmer:function(){0===y.find(f.dimmer).length&&R("<div/>",{class:m.innerDimmer}).prependTo(y)}},destroy:function(){d&&d.disconnect(),L.verbose("Destroying previous modal"),y.removeData(b).off(p),j.off(c),x.off(c),t.off(c),w.off(c),i&&i.off(c),x.dimmer("destroy")},observeChanges:function(){"MutationObserver"in U&&((d=new MutationObserver(function(e){function o(e){for(var t=[],i=0,n=e.length;i<n;i++)Array.prototype.push.apply(t,o(e[i].childNodes)),t.push(e[i]);return t}var i=!1,n=!1,a=!0;e.every(function(e){var t;return"attributes"===e.type?O&&("disabled"===e.attributeName||0<R(e.target).find(":input").addBack(":input").filter(":visible").length)&&(n=!0):(i=!0,t=R(o(e.addedNodes)).filter("a[href], [tabindex], :input:enabled").filter(":visible"),e=R(o(e.removedNodes)).filter("a[href], [tabindex], :input"),(0<t.length||0<e.length)&&(n=!0,(0<t.filter(":input").length||0<e.filter(":input").length)&&(a=!1))),!n}),i&&u.observeChanges&&(L.debug("DOM tree modified, refreshing"),L.refresh()),n&&L.refreshInputs(a)})).observe(S,{attributeFilter:["class","disabled"],attributes:!0,childList:!0,subtree:!0}),L.debug("Setting up mutation observer",d))},refresh:function(){L.remove.scrolling(),L.cacheSizes(),L.can.useFlex()||L.set.modalOffset(),L.set.screenHeight(),L.set.type()},refreshModals:function(){a=y.siblings(f.modal),o=a.add(y)},refreshInputs:function(e){i&&i.off("keydown"+c),0===(i=y.find("a[href], [tabindex], :input:enabled").filter(":visible").filter(function(){return 0===R(this).closest(".disabled").length})).filter(":input").length?(i=y.add(i),y.attr("tabindex",-1)):y.removeAttr("tabindex"),i.first().on("keydown"+c,L.event.inputKeyDown.first),i.last().on("keydown"+c,L.event.inputKeyDown.last),!e&&u.autofocus&&0===i.filter(":focus").length&&L.set.autofocus()},attachEvents:function(e,t){var i=R(e);t=_(L[t])?L[t]:L.toggle,0<i.length?(L.debug("Attaching modal events to element",e,t),i.off(p).on("click"+p,t)):L.error(v.notFound,e)},bind:{events:function(){L.verbose("Attaching events"),y.on("click"+p,f.close,L.event.close).on("click"+p,f.approve,L.event.approve).on("click"+p,f.deny,L.event.deny),w.on("keyup"+c,L.event.closeKeyUp),j.on("resize"+c,L.event.resize).on("focus"+c,L.event.focus),x.on("click"+c,L.event.click)},scrollLock:function(){n[0].addEventListener("touchmove",L.event.preventScroll,{passive:!1})}},unbind:{scrollLock:function(){n[0].removeEventListener("touchmove",L.event.preventScroll,{passive:!1})}},get:{id:function(){return l},element:function(){return y},settings:function(){return u}},event:{approve:function(){A||!1===u.onApprove.call(S,R(this))?L.verbose("Approve callback returned false cancelling hide"):(A=!0,L.hide(function(){A=!1}))},preventScroll:function(e){-1!==e.target.className.indexOf("dimmer")&&e.preventDefault()},deny:function(){A||!1===u.onDeny.call(S,R(this))?L.verbose("Deny callback returned false cancelling hide"):(A=!0,L.hide(function(){A=!1}))},close:function(){L.hide()},closeKeyUp:function(e){e=e.which;e!==u.keys.enter&&e!==u.keys.space||!y.hasClass(m.front)||L.hide()},inputKeyDown:{first:function(e){e.which===u.keys.tab&&e.shiftKey&&(i.last().trigger("focus"),e.preventDefault())},last:function(e){e.which!==u.keys.tab||e.shiftKey||(i.first().trigger("focus"),e.preventDefault())}},mousedown:function(e){var t=R(e.target),i=L.is.rtl();(s=0<t.closest(f.modal).length)&&L.verbose("Mouse down event registered inside the modal"),(r=L.is.scrolling()&&(!i&&j.outerWidth()-u.scrollbarWidth<=e.clientX||i&&u.scrollbarWidth>=e.clientX))&&L.verbose("Mouse down event registered inside the scrollbar")},mouseup:function(e){if(u.closable)if(s)L.debug("Dimmer clicked but mouse down was initially registered inside the modal");else if(r)L.debug("Dimmer clicked but mouse down was initially registered inside the scrollbar");else{var t=0<R(e.target).closest(f.modal).length,e=R.contains(V.documentElement,e.target);if(!t&&e&&L.is.active()&&y.hasClass(m.front)){if(L.debug("Dimmer clicked, hiding all modals"),u.allowMultiple){if(!L.hideAll())return}else if(!L.hide())return;L.remove.clickaway()}}else L.verbose("Dimmer clicked but closable setting is disabled")},debounce:function(e,t){clearTimeout(L.timer),L.timer=setTimeout(function(){e()},t)},keyboard:function(e){e.which===u.keys.escape&&(u.closable?(L.debug("Escape key pressed hiding modal"),y.hasClass(m.front)&&L.hide()):L.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){n.dimmer("is active")&&(L.is.animating()||L.is.active())&&requestAnimationFrame(L.refresh)},focus:function(){E=!0},click:function(e){E&&V.activeElement!==e.target&&n.dimmer("is active")&&L.is.active()&&u.autofocus&&0===R(V.activeElement).closest(f.modal).length&&requestAnimationFrame(L.set.autofocus),E=!1}},toggle:function(){L.is.active()||L.is.animating()?L.hide():L.show()},show:function(e){e=_(e)?e:function(){},L.refreshModals(),L.set.dimmerSettings(),L.set.dimmerStyles(),L.showModal(e)},hide:function(e){return e=_(e)?e:function(){},L.refreshModals(),L.hideModal(e)},showModal:function(e){e=_(e)?e:function(){},L.is.animating()||!L.is.active()?!1===u.onShow.call(S)?L.verbose("Show callback returned false cancelling show"):(F=L.has.scrollbar(),L.showDimmer(),L.cacheSizes(),F&&L.set.bodyMargin(),L.can.useFlex()?L.remove.legacy():(L.set.legacy(),L.set.modalOffset(),L.debug("Using non-flex legacy modal positioning.")),L.set.screenHeight(),L.set.type(),L.set.clickaway(),!u.allowMultiple&&L.others.active()?L.hideOthers(L.showModal):(A=!1,u.allowMultiple&&(L.others.active()&&a.filter("."+m.active).find(f.dimmer).removeClass("out").addClass("transition fade in active"),u.detachable&&y.detach().appendTo(t)),u.transition&&void 0!==R.fn.transition?(L.debug("Showing modal with css animations"),L.set.observeAttributes(!1),y.transition({debug:u.debug,verbose:u.verbose,silent:u.silent,animation:(u.transition.showMethod||u.transition)+" in",queue:u.queue,duration:u.transition.showDuration||u.duration,useFailSafe:!0,onComplete:function(){u.onVisible.apply(S),u.keyboardShortcuts&&L.add.keyboardShortcuts(),L.save.focus(),L.set.active(),L.refreshInputs(),requestAnimationFrame(L.set.observeAttributes),e()}})):L.error(v.noTransition))):L.debug("Modal is already visible")},hideModal:function(e,t,i){var n=a.filter("."+m.active).last();if(e=_(e)?e:function(){},!1===u.onHide.call(S,R(this)))return L.verbose("Hide callback returned false cancelling hide"),A=!1;(L.is.animating()||L.is.active())&&(L.debug("Hiding modal"),u.transition&&void 0!==R.fn.transition?(L.remove.active(),L.set.observeAttributes(!1),y.transition({debug:u.debug,verbose:u.verbose,silent:u.silent,animation:(u.transition.hideMethod||u.transition)+" out",queue:u.queue,duration:u.transition.hideDuration||u.duration,useFailSafe:!0,onStart:function(){L.others.active()||L.others.animating()||t?u.allowMultiple&&(i?o:n).find(f.dimmer).removeClass("in").addClass("out"):L.hideDimmer(),u.keyboardShortcuts&&!L.others.active()&&L.remove.keyboardShortcuts()},onComplete:function(){L.unbind.scrollLock(),L.remove.active(),u.allowMultiple&&(n.addClass(m.front),y.removeClass(m.front),(i?o:n).find(f.dimmer).removeClass("active")),_(u.onHidden)&&u.onHidden.call(S),L.remove.dimmerStyles(),L.restore.focus(),e()}})):L.error(v.noTransition))},showDimmer:function(){n.dimmer("is animating")||!n.dimmer("is active")?(F&&(k||t.css("top",n.scrollTop()),L.save.bodyMargin()),L.debug("Showing dimmer"),n.dimmer("show")):L.debug("Dimmer already visible")},hideDimmer:function(){n.dimmer("is animating")||n.dimmer("is active")?(L.unbind.scrollLock(),n.dimmer("hide",function(){F&&L.restore.bodyMargin(),L.remove.clickaway(),L.remove.screenHeight()})):L.debug("Dimmer is not visible cannot hide")},hideAll:function(i){var n,e=o.filter("."+m.active+", ."+m.animating);if(i=_(i)?i:function(){},0<e.length)return L.debug("Hiding all visible modals"),n=!0,R(e.get().reverse()).each(function(e,t){n=n&&R(t).modal("hide modal",i,!1,!0)}),n&&L.hideDimmer(),n},hideOthers:function(e){var t=a.filter("."+m.active+", ."+m.animating);e=_(e)?e:function(){},0<t.length&&(L.debug("Hiding other modals",a),t.modal("hide modal",e,!0))},others:{active:function(){return 0<a.filter("."+m.active).length},animating:function(){return 0<a.filter("."+m.animating).length}},add:{keyboardShortcuts:function(){L.verbose("Adding keyboard shortcuts"),z.on("keydown"+p,L.event.keyboard)}},save:{focus:function(){0<R(V.activeElement).closest(y).length||(e=R(V.activeElement).trigger("blur"))},bodyMargin:function(){D=x.css((k?"margin-":"padding-")+(L.can.leftBodyScrollbar()?"left":"right"));var e=parseInt(D.replace(/[^\d.]/g,""),10),t=k?U.innerWidth-V.documentElement.clientWidth:x[0].offsetWidth-x[0].clientWidth;T=e+t}},restore:{focus:function(){e&&0<e.length&&u.restoreFocus&&e.trigger("focus")},bodyMargin:function(){var i=L.can.leftBodyScrollbar()?"left":"right";x.css((k?"margin-":"padding-")+i,D),x.find(f.bodyFixed.replace("right",i)).each(function(){var e=R(this),t="fixed"===e.css("position")?"padding-"+i:i;e.css(t,"")})}},remove:{active:function(){y.removeClass(m.active)},legacy:function(){y.removeClass(m.legacy)},clickaway:function(){u.detachable||y.off("mousedown"+c),t.off("mousedown"+c),t.off("mouseup"+c)},dimmerStyles:function(){t.removeClass(m.inverted),n.removeClass(m.blurring)},bodyStyle:function(){""===x.attr("style")&&(L.verbose("Removing style attribute"),x.removeAttr("style"))},screenHeight:function(){L.debug("Removing page height"),x.css("height",""),L.remove.bodyStyle()},keyboardShortcuts:function(){L.verbose("Removing keyboard shortcuts"),z.off("keydown"+p)},scrolling:function(){H||n.removeClass(m.scrolling),y.removeClass(m.scrolling)}},cacheSizes:function(){y.addClass(m.loading);var e=y.prop("scrollHeight"),t=y.outerWidth(),i=y.outerHeight();void 0!==L.cache.pageHeight&&0===i||(R.extend(L.cache,{pageHeight:z.outerHeight(),width:t,height:i+u.offset,scrollHeight:e+u.offset,contextHeight:(k?j:n).height()}),L.cache.topOffset=-L.cache.height/2),y.removeClass(m.loading),L.debug("Caching modal and container sizes",L.cache)},helpers:{deQuote:function(e){return String(e).replace(/"/g,"")},escape:function(e,t){if(t)return e;var i={"<":"<",">":">",'"':""","'":"'","`":"`"};return/["&'<>`]/.test(e)?(e=e.replace(/&(?![\d#a-z]{1,12};)/gi,"&")).replace(/["'<>`]/g,function(e){return i[e]}):e}},can:{leftBodyScrollbar:function(){return void 0===L.cache.leftBodyScrollbar&&(L.cache.leftBodyScrollbar=L.is.rtl()&&(L.is.iframe&&!L.is.firefox()||L.is.safari()||L.is.edge()||L.is.ie())),L.cache.leftBodyScrollbar},useFlex:function(){return"auto"===u.useFlex?u.detachable&&!L.is.ie():(u.useFlex&&L.is.ie()?L.debug("useFlex true is not supported in IE"):u.useFlex&&!u.detachable&&L.debug("useFlex true in combination with detachable false is not supported"),u.useFlex)},fit:function(){var e=L.cache.contextHeight,t=L.cache.contextHeight/2,i=L.cache.topOffset,n=L.cache.scrollHeight,o=L.cache.height,a=u.padding;return o<n?t+i+n+a<e:o+2*a<e}},has:{configActions:function(){return Array.isArray(u.actions)&&0<u.actions.length},scrollbar:function(){return k||"hidden"!==x.css("overflow-y")}},is:{active:function(){return y.hasClass(m.active)},ie:function(){var e,t;return void 0===L.cache.isIE&&(e=!U.ActiveXObject&&"ActiveXObject"in U,t="ActiveXObject"in U,L.cache.isIE=e||t),L.cache.isIE},animating:function(){return y.transition("is animating")},scrolling:function(){return n.hasClass(m.scrolling)},modernBrowser:function(){return!(U.ActiveXObject||"ActiveXObject"in U)},rtl:function(){return void 0===L.cache.isRTL&&(L.cache.isRTL="rtl"===y.attr("dir")||"rtl"===y.css("direction")||"rtl"===q.attr("dir")||"rtl"===q.css("direction")||"rtl"===x.attr("dir")||"rtl"===x.css("direction")),L.cache.isRTL},safari:function(){return void 0===L.cache.isSafari&&(L.cache.isSafari=/constructor/i.test(U.HTMLElement)||!!U.ApplePaySession),L.cache.isSafari},edge:function(){return void 0===L.cache.isEdge&&(L.cache.isEdge=!!U.setImmediate&&!L.is.ie()),L.cache.isEdge},firefox:function(){return void 0===L.cache.isFirefox&&(L.cache.isFirefox=!!U.InstallTrigger),L.cache.isFirefox},iframe:function(){return!(self===top)}},set:{observeAttributes:function(e){O=!1!==e},autofocus:function(){var e=i.filter("[autofocus]"),t=i.filter(":input");(0<e.length?e:0<t.length?t:y).first().trigger("focus")},bodyMargin:function(){var i=L.can.leftBodyScrollbar()?"left":"right";(u.detachable||L.can.fit())&&x.css((k?"margin-":"padding-")+i,T+"px"),x.find(f.bodyFixed.replace("right",i)).each(function(){var e=R(this),t="fixed"===e.css("position")?"padding-"+i:i;e.css(t,"calc("+e.css(t)+" + "+T+"px)")})},clickaway:function(){u.detachable||y.on("mousedown"+c,L.event.mousedown),t.on("mousedown"+c,L.event.mousedown),t.on("mouseup"+c,L.event.mouseup)},dimmerSettings:function(){var e;void 0===R.fn.dimmer?L.error(v.dimmer):(e={debug:u.debug,dimmerName:"modals",closable:"auto",useFlex:L.can.useFlex(),duration:{show:u.transition.showDuration||u.duration,hide:u.transition.hideDuration||u.duration}},e=R.extend(!0,e,u.dimmerSettings),u.inverted&&(e.variation=void 0!==e.variation?e.variation+" inverted":"inverted"),x.dimmer("setting",e))},dimmerStyles:function(){u.inverted?t.addClass(m.inverted):t.removeClass(m.inverted),u.blurring?n.addClass(m.blurring):n.removeClass(m.blurring)},modalOffset:function(){var e;u.detachable?y.css({marginTop:!y.hasClass("aligned")&&L.can.fit()?-L.cache.height/2:u.padding/2,marginLeft:-L.cache.width/2}):(e=L.can.fit(),y.css({top:!y.hasClass("aligned")&&e?z.scrollTop()+(L.cache.contextHeight-L.cache.height)/2:!e||y.hasClass("top")?z.scrollTop()+u.padding:z.scrollTop()+(L.cache.contextHeight-L.cache.height-u.padding),marginLeft:-L.cache.width/2})),L.verbose("Setting modal offset for legacy mode")},screenHeight:function(){L.can.fit()?x.css("height",""):y.hasClass("bottom")||(L.debug("Modal is taller than page content, resizing page height"),x.css("height",L.cache.height+2*u.padding+"px"))},active:function(){y.addClass(m.active+" "+m.front),a.filter("."+m.active).removeClass(m.front)},scrolling:function(){n.addClass(m.scrolling),y.addClass(m.scrolling),L.unbind.scrollLock()},legacy:function(){y.addClass(m.legacy)},type:function(){L.can.fit()?(L.verbose("Modal fits on screen"),L.others.active()||L.others.animating()||(L.remove.scrolling(),L.bind.scrollLock())):y.hasClass("bottom")?L.verbose("Bottom aligned modal not fitting on screen is unsupported for scrolling"):(L.verbose("Modal cannot fit on screen setting to scrolling"),L.set.scrolling())},undetached:function(){n.addClass(m.undetached)}},setting:function(e,t){if(L.debug("Changing setting",e,t),R.isPlainObject(e))R.extend(!0,u,e);else{if(void 0===t)return u[e];R.isPlainObject(u[e])?R.extend(!0,u[e],t):u[e]=t}},internal:function(e,t){if(R.isPlainObject(e))R.extend(!0,L,e);else{if(void 0===t)return L[e];L[e]=t}},debug:function(){!u.silent&&u.debug&&(u.performance?L.performance.log(arguments):(L.debug=Function.prototype.bind.call(console.info,console,u.name+":"),L.debug.apply(console,arguments)))},verbose:function(){!u.silent&&u.verbose&&u.debug&&(u.performance?L.performance.log(arguments):(L.verbose=Function.prototype.bind.call(console.info,console,u.name+":"),L.verbose.apply(console,arguments)))},error:function(){u.silent||(L.error=Function.prototype.bind.call(console.error,console,u.name+":"),L.error.apply(console,arguments))},performance:{log:function(e){var t,i;u.performance&&(i=(t=Date.now())-(B||t),B=t,W.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":i})),clearTimeout(L.performance.timer),L.performance.timer=setTimeout(function(){L.performance.display()},500)},display:function(){var e=u.name+":",i=0;B=!1,clearTimeout(L.performance.timer),R.each(W,function(e,t){i+=t["Execution Time"]}),e+=" "+i+"ms",0<W.length&&(console.groupCollapsed(e),console.table?console.table(W):R.each(W,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),W=[]}},invoke:function(n,e,t){var o,a,i,s=M;return e=e||Q,t=t||S,"string"==typeof n&&void 0!==s&&(n=n.split(/[ .]/),o=n.length-1,R.each(n,function(e,t){var i=e!==o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(R.isPlainObject(s[i])&&e!==o)s=s[i];else{if(void 0!==s[i])return a=s[i],!1;{if(!R.isPlainObject(s[t])||e===o)return void 0!==s[t]?a=s[t]:L.error(v.method,n),!1;s=s[t]}}})),_(a)?i=a.apply(t,e):void 0!==a&&(i=a),Array.isArray(I)?I.push(i):void 0!==I?I=[I,i]:void 0!==i&&(I=i),a}};K?(void 0===M&&(_(u.templates[P])&&(u.autoShow=!0,u.className.modal=u.className.template,u=R.extend(!0,{},u,u.templates[P].apply(L,Q)),m=u.className,u.namespace,g=u.fields,v=u.error),L.initialize()),_(u.templates[P])||L.invoke(P)):(void 0!==M&&M.invoke("destroy"),L.initialize(),I=y)}),void 0!==I?I:this},R.modal=R.fn.modal,R.fn.modal.settings={name:"Modal",namespace:"modal",useFlex:"auto",offset:0,silent:!1,debug:!1,verbose:!1,performance:!0,observeChanges:!1,allowMultiple:!1,detachable:!0,closable:!0,autofocus:!0,restoreFocus:!0,autoShow:!1,inverted:!1,blurring:!1,centered:!0,dimmerSettings:{closable:!1,useCSS:!0},keyboardShortcuts:!0,context:"body",queue:!1,duration:500,transition:"scale",padding:50,scrollbarWidth:10,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!0,fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onHide:function(){return!0},onHidden:!1,onApprove:function(){return!0},onDeny:function(){return!0},keys:{space:32,enter:13,escape:27,tab:9},selector:{title:"> .header",content:"> .content",actions:"> .actions",close:"> .close",closeIcon:"> .close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel",modal:".ui.modal",dimmer:"> .ui.dimmer",bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close",prompt:".ui.input > input"},error:{dimmer:"UI Dimmer, a required component is not included in this page",method:"The method you called is not defined.",notFound:"The element you specified could not be found"},className:{active:"active",animating:"animating",blurring:"blurring",inverted:"inverted",legacy:"legacy",loading:"loading",scrolling:"scrolling",undetached:"undetached",front:"front",close:"close icon",button:"ui button",modal:"ui modal",title:"header",content:"content",actions:"actions",template:"ui tiny modal",ok:"positive",cancel:"negative",prompt:"ui fluid input",innerDimmer:"ui inverted dimmer"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},R.fn.modal.settings.templates={getArguments:function(e){e=[].slice.call(e);return R.isPlainObject(e[0])?R.extend({handler:function(){},content:"",title:""},e[0]):(_(e[e.length-1])||e.push(function(){}),{handler:e.pop(),content:e.pop()||"",title:e.pop()||""})},alert:function(){var e=this.get.settings(),t=e.templates.getArguments(arguments),i=t.handler;return{title:t.title,content:t.content,onApprove:i,actions:[{text:e.text.ok,class:e.className.ok,click:i}]}},confirm:function(){function e(){n.handler(!0)}function t(){n.handler(!1)}var i=this.get.settings(),n=i.templates.getArguments(arguments);return{title:n.title,content:n.content,onApprove:e,onDeny:t,actions:[{text:i.text.ok,class:i.className.ok,click:e},{text:i.text.cancel,class:i.className.cancel,click:t}]}},prompt:function(){function e(){var e=i.get.settings(),e=i.get.element().find(e.selector.prompt)[0];o.handler(R(e).val())}function t(){o.handler(null)}var i=this,n=this.get.settings(),o=n.templates.getArguments(arguments);return 0===R(R.parseHTML(o.content)).filter(".ui.input").length&&(o.content+='<p><div class="'+this.helpers.deQuote(n.className.prompt)+'"><input placeholder="'+this.helpers.deQuote(o.placeholder||"")+'" type="text" value="'+this.helpers.deQuote(o.defaultValue||"")+'"></div></p>'),{title:o.title,content:o.content,onApprove:e,onDeny:t,actions:[{text:n.text.ok,class:n.className.ok,click:e},{text:n.text.cancel,class:n.className.cancel,click:t}]}}}}(jQuery,window,document); |