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