/*! * jquery-confirm v3.3.4 (http://craftpip.github.io/jquery-confirm/) * Author: Boniface Pereira * Website: www.craftpip.com * Contact: hey@craftpip.com * * Copyright 2013-2019 jquery-confirm * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE) */ !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(i,n){return void 0===n&&(n="undefined"!=typeof window?require("jquery"):require("jquery")(i)),t(n),n}:t(jQuery)}(function(t){"use strict";var i=window;t.fn.confirm=function(n,o){return void 0===n&&(n={}),"string"==typeof n&&(n={content:n,title:!!o&&o}),t(this).each(function(){var o=t(this);if(o.attr("jc-attached")){console.warn("jConfirm has already been attached to this element ",o[0]);return}o.on("click",function(s){s.preventDefault();var e=t.extend({},n);if(o.attr("data-title")&&(e.title=o.attr("data-title")),o.attr("data-content")&&(e.content=o.attr("data-content")),void 0===e.buttons&&(e.buttons={}),e.$target=o,o.attr("href")&&0===Object.keys(e.buttons).length){var a=t.extend(!0,{},i.jconfirm.pluginDefaults.defaultButtons,(i.jconfirm.defaults||{}).defaultButtons||{}),c=Object.keys(a)[0];e.buttons=a,e.buttons[c].action=function(){location.href=o.attr("href")}}e.closeIcon=!1,t.confirm(e)}),o.attr("jc-attached",!0)}),t(this)},t.confirm=function(n,o){void 0===n&&(n={}),"string"==typeof n&&(n={content:n,title:!!o&&o});var s=!1!==n.buttons;if("object"!=typeof n.buttons&&(n.buttons={}),0===Object.keys(n.buttons).length&&s){var e=t.extend(!0,{},i.jconfirm.pluginDefaults.defaultButtons,(i.jconfirm.defaults||{}).defaultButtons||{});n.buttons=e}return i.jconfirm(n)},t.alert=function(n,o){void 0===n&&(n={}),"string"==typeof n&&(n={content:n,title:!!o&&o});var s=!1!==n.buttons;if("object"!=typeof n.buttons&&(n.buttons={}),0===Object.keys(n.buttons).length&&s){var e=t.extend(!0,{},i.jconfirm.pluginDefaults.defaultButtons,(i.jconfirm.defaults||{}).defaultButtons||{}),a=Object.keys(e)[0];n.buttons[a]=e[a]}return i.jconfirm(n)},t.dialog=function(t,n){return void 0===t&&(t={}),"string"==typeof t&&(t={content:t,title:!!n&&n,closeIcon:function(){}}),t.buttons={},void 0===t.closeIcon&&(t.closeIcon=function(){}),t.confirmKeys=[13],i.jconfirm(t)},i.jconfirm=function(n){void 0===n&&(n={});var o=t.extend(!0,{},i.jconfirm.pluginDefaults);i.jconfirm.defaults&&(o=t.extend(!0,o,i.jconfirm.defaults)),o=t.extend(!0,{},o,n);var s=new i.Jconfirm(o);return i.jconfirm.instances.push(s),s},i.Jconfirm=function(i){t.extend(this,i),this._init()},i.Jconfirm.prototype={_init:function(){var n=this;i.jconfirm.instances.length||(i.jconfirm.lastFocused=t("body").find(":focus")),this._id=Math.round(99999*Math.random()),this.contentParsed=t(document.createElement("div")),this.lazyOpen||setTimeout(function(){n.open()},0)},_buildHTML:function(){var i=this;this._parseAnimation(this.animation,"o"),this._parseAnimation(this.closeAnimation,"c"),this._parseBgDismissAnimation(this.backgroundDismissAnimation),this._parseColumnClass(this.columnClass),this._parseTheme(this.theme),this._parseType(this.type);var n=t(this.template);n.find(".jconfirm-box").addClass(this.animationParsed).addClass(this.backgroundDismissAnimationParsed).addClass(this.typeParsed),this.typeAnimated&&n.find(".jconfirm-box").addClass("jconfirm-type-animated"),this.useBootstrap?(n.find(".jc-bs3-row").addClass(this.bootstrapClasses.row),n.find(".jc-bs3-row").addClass("justify-content-md-center justify-content-sm-center justify-content-xs-center justify-content-lg-center"),n.find(".jconfirm-box-container").addClass(this.columnClassParsed),this.containerFluid?n.find(".jc-bs3-container").addClass(this.bootstrapClasses.containerFluid):n.find(".jc-bs3-container").addClass(this.bootstrapClasses.container)):n.find(".jconfirm-box").css("width",this.boxWidth),this.titleClass&&n.find(".jconfirm-title-c").addClass(this.titleClass),n.addClass(this.themeParsed);var o="jconfirm-box"+this._id;n.find(".jconfirm-box").attr("aria-labelledby",o).attr("tabindex",-1),n.find(".jconfirm-content").attr("id",o),null!==this.bgOpacity&&n.find(".jconfirm-bg").css("opacity",this.bgOpacity),this.rtl&&n.addClass("jconfirm-rtl"),this.$el=n.appendTo(this.container),this.$jconfirmBoxContainer=this.$el.find(".jconfirm-box-container"),this.$jconfirmBox=this.$body=this.$el.find(".jconfirm-box"),this.$jconfirmBg=this.$el.find(".jconfirm-bg"),this.$title=this.$el.find(".jconfirm-title"),this.$titleContainer=this.$el.find(".jconfirm-title-c"),this.$content=this.$el.find("div.jconfirm-content"),this.$contentPane=this.$el.find(".jconfirm-content-pane"),this.$icon=this.$el.find(".jconfirm-icon-c"),this.$closeIcon=this.$el.find(".jconfirm-closeIcon"),this.$holder=this.$el.find(".jconfirm-holder"),this.$btnc=this.$el.find(".jconfirm-buttons"),this.$scrollPane=this.$el.find(".jconfirm-scrollpane"),i.setStartingPoint(),this._contentReady=t.Deferred(),this._modalReady=t.Deferred(),this.$holder.css({"padding-top":this.offsetTop,"padding-bottom":this.offsetBottom}),this.setTitle(),this.setIcon(),this._setButtons(),this._parseContent(),this.initDraggable(),this.isAjax&&this.showLoading(!1),t.when(this._contentReady,this._modalReady).then(function(){i.isAjaxLoading?setTimeout(function(){i.isAjaxLoading=!1,i.setContent(),i.setTitle(),i.setIcon(),setTimeout(function(){i.hideLoading(!1),i._updateContentMaxHeight()},100),"function"==typeof i.onContentReady&&i.onContentReady()},50):(i._updateContentMaxHeight(),i.setTitle(),i.setIcon(),"function"==typeof i.onContentReady&&i.onContentReady()),i.autoClose&&i._startCountDown()}).then(function(){i._watchContent()}),"none"===this.animation&&(this.animationSpeed=1,this.animationBounce=1),this.$body.css(this._getCSS(this.animationSpeed,this.animationBounce)),this.$contentPane.css(this._getCSS(this.animationSpeed,1)),this.$jconfirmBg.css(this._getCSS(this.animationSpeed,1)),this.$jconfirmBoxContainer.css(this._getCSS(this.animationSpeed,1))},_typePrefix:"jconfirm-type-",typeParsed:"",_parseType:function(t){this.typeParsed=this._typePrefix+t},setType:function(t){var i=this.typeParsed;this._parseType(t),this.$jconfirmBox.removeClass(i).addClass(this.typeParsed)},themeParsed:"",_themePrefix:"jconfirm-",setTheme:function(t){var i=this.theme;this.theme=t||this.theme,this._parseTheme(this.theme),i&&this.$el.removeClass(i),this.$el.addClass(this.themeParsed),this.theme=t},_parseTheme:function(i){var n=this;i=i.split(","),t.each(i,function(o,s){-1===s.indexOf(n._themePrefix)&&(i[o]=n._themePrefix+t.trim(s))}),this.themeParsed=i.join(" ").toLowerCase()},backgroundDismissAnimationParsed:"",_bgDismissPrefix:"jconfirm-hilight-",_parseBgDismissAnimation:function(i){var n=i.split(","),o=this;t.each(n,function(i,s){-1===s.indexOf(o._bgDismissPrefix)&&(n[i]=o._bgDismissPrefix+t.trim(s))}),this.backgroundDismissAnimationParsed=n.join(" ").toLowerCase()},animationParsed:"",closeAnimationParsed:"",_animationPrefix:"jconfirm-animation-",setAnimation:function(t){this.animation=t||this.animation,this._parseAnimation(this.animation,"o")},_parseAnimation:function(i,n){n=n||"o";var o=i.split(","),s=this;t.each(o,function(i,n){-1===n.indexOf(s._animationPrefix)&&(o[i]=s._animationPrefix+t.trim(n))});var e=o.join(" ").toLowerCase();return"o"===n?this.animationParsed=e:this.closeAnimationParsed=e,e},setCloseAnimation:function(t){this.closeAnimation=t||this.closeAnimation,this._parseAnimation(this.closeAnimation,"c")},setAnimationSpeed:function(t){this.animationSpeed=t||this.animationSpeed},columnClassParsed:"",setColumnClass:function(t){if(!this.useBootstrap){console.warn("cannot set columnClass, useBootstrap is set to false");return}this.columnClass=t||this.columnClass,this._parseColumnClass(this.columnClass),this.$jconfirmBoxContainer.addClass(this.columnClassParsed)},_updateContentMaxHeight:function(){var i=t(window).height()-(this.$jconfirmBox.outerHeight()-this.$contentPane.outerHeight())-(this.offsetTop+this.offsetBottom);this.$contentPane.css({"max-height":i+"px"})},setBoxWidth:function(t){if(this.useBootstrap){console.warn("cannot set boxWidth, useBootstrap is set to true");return}this.boxWidth=t,this.$jconfirmBox.css("width",t)},_parseColumnClass:function(t){var i;switch(t=t.toLowerCase()){case"xl":case"xlarge":i="col-md-12";break;case"l":case"large":i="col-md-8 col-md-offset-2";break;case"m":case"medium":i="col-md-6 col-md-offset-3";break;case"s":case"small":i="col-md-4 col-md-offset-4";break;case"xs":case"xsmall":i="col-md-2 col-md-offset-5";break;default:i=t}this.columnClassParsed=i},initDraggable:function(){var i=this,n=this.$titleContainer;this.resetDrag(),this.draggable&&(n.on("mousedown",function(t){n.addClass("jconfirm-hand"),i.mouseX=t.clientX,i.mouseY=t.clientY,i.isDrag=!0}),t(window).on("mousemove."+this._id,function(t){i.isDrag&&(i.movingX=t.clientX-i.mouseX+i.initialX,i.movingY=t.clientY-i.mouseY+i.initialY,i.setDrag())}),t(window).on("mouseup."+this._id,function(){n.removeClass("jconfirm-hand"),i.isDrag&&(i.isDrag=!1,i.initialX=i.movingX,i.initialY=i.movingY)}))},resetDrag:function(){this.isDrag=!1,this.initialX=0,this.initialY=0,this.movingX=0,this.movingY=0,this.mouseX=0,this.mouseY=0,this.$jconfirmBoxContainer.css("transform","translate(0px, 0px)")},setDrag:function(){if(this.draggable){this.alignMiddle=!1;var i=this.$jconfirmBox.outerWidth(),n=this.$jconfirmBox.outerHeight(),o=t(window).width(),s=t(window).height(),e=this;if(e.movingX%1==0||e.movingY%1==0){if(e.dragWindowBorder){var a=o/2-i/2,c=s/2-n/2;c-=e.dragWindowGap,(a-=e.dragWindowGap)+e.movingX<0?e.movingX=-a:a-e.movingX<0&&(e.movingX=a),c+e.movingY<0?e.movingY=-c:c-e.movingY<0&&(e.movingY=c)}e.$jconfirmBoxContainer.css("transform","translate("+e.movingX+"px, "+e.movingY+"px)")}}},_scrollTop:function(){if("undefined"!=typeof pageYOffset)return pageYOffset;var t=document.body,i=document.documentElement;return(i=i.clientHeight?i:t).scrollTop},_watchContent:function(){var i=this;this._timer&&clearInterval(this._timer);var n=0;this._timer=setInterval(function(){if(i.smoothContent){var o=i.$content.outerHeight()||0;o!==n&&(n=o);var s=t(window).height();i.offsetTop+i.offsetBottom+i.$jconfirmBox.height()-i.$contentPane.height()+i.$content.height()').html(i.buttons[o].text).addClass(i.buttons[o].btnClass).prop("disabled",i.buttons[o].isDisabled).css("display",i.buttons[o].isHidden?"none":"").click(function(t){t.preventDefault();var n=i.buttons[o].action.apply(i,[i.buttons[o]]);i.onAction.apply(i,[o,i.buttons[o]]),i._stopCountDown(),(void 0===n||n)&&i.close()});i.buttons[o].el=e,i.buttons[o].setText=function(t){e.html(t)},i.buttons[o].addClass=function(t){e.addClass(t)},i.buttons[o].removeClass=function(t){e.removeClass(t)},i.buttons[o].disable=function(){i.buttons[o].isDisabled=!0,e.prop("disabled",!0)},i.buttons[o].enable=function(){i.buttons[o].isDisabled=!1,e.prop("disabled",!1)},i.buttons[o].show=function(){i.buttons[o].isHidden=!1,e.css("display","")},i.buttons[o].hide=function(){i.buttons[o].isHidden=!0,e.css("display","none")},i["$_"+o]=i["$$"+o]=e,i.$btnc.append(e)}),0===n&&this.$btnc.hide(),null===this.closeIcon&&0===n&&(this.closeIcon=!0),this.closeIcon){if(this.closeIconClass){var o='';this.$closeIcon.html(o)}this.$closeIcon.click(function(t){t.preventDefault();var n,o=!1,s=!1;if("string"==typeof(n="function"==typeof i.closeIcon?i.closeIcon():i.closeIcon)&&void 0!==i.buttons[n]?(o=n,s=!1):s=void 0===n||!0==!!n,o){var e=i.buttons[o].action.apply(i);s=void 0===e||!!e}s&&i.close()}),this.$closeIcon.show()}else this.$closeIcon.hide()},setTitle:function(t,i){if(i=i||!1,void 0!==t){if("string"==typeof t)this.title=t;else if("function"==typeof t){"function"==typeof t.promise&&console.error("Promise was returned from title function, this is not supported.");var n=t();"string"==typeof n?this.title=n:this.title=!1}else this.title=!1}(!this.isAjaxLoading||i)&&(this.$title.html(this.title||""),this.updateTitleContainer())},setIcon:function(t,i){if(i=i||!1,void 0!==t){if("string"==typeof t)this.icon=t;else if("function"==typeof t){var n=t();"string"==typeof n?this.icon=n:this.icon=!1}else this.icon=!1}(!this.isAjaxLoading||i)&&(this.$icon.html(this.icon?'':""),this.updateTitleContainer())},updateTitleContainer:function(){this.title||this.icon?this.$titleContainer.show():this.$titleContainer.hide()},setContentPrepend:function(t,i){t&&this.contentParsed.prepend(t)},setContentAppend:function(t){t&&this.contentParsed.append(t)},setContent:function(t,i){i=!!i;var n=this;t&&this.contentParsed.html("").append(t),(!this.isAjaxLoading||i)&&(this.$content.html(""),this.$content.append(this.contentParsed),setTimeout(function(){n.$body.find("input[autofocus]:visible:first").focus()},100))},loadingSpinner:!1,showLoading:function(t){this.loadingSpinner=!0,this.$jconfirmBox.addClass("loading"),t&&this.$btnc.find("button").prop("disabled",!0)},hideLoading:function(t){this.loadingSpinner=!1,this.$jconfirmBox.removeClass("loading"),t&&this.$btnc.find("button").prop("disabled",!1)},ajaxResponse:!1,contentParsed:"",isAjax:!1,isAjaxLoading:!1,_parseContent:function(){var i=this,n=" ";if("function"==typeof this.content){var o=this.content.apply(this);"string"==typeof o?this.content=o:("object"==typeof o&&"function"==typeof o.always&&(this.isAjax=!0,this.isAjaxLoading=!0,o.always(function(t,n,o){i.ajaxResponse={data:t,status:n,xhr:o},i._contentReady.resolve(t,n,o),"function"==typeof i.contentLoaded&&i.contentLoaded(t,n,o)})),this.content=n)}if("string"==typeof this.content&&"url:"===this.content.substr(0,4).toLowerCase()){this.isAjax=!0,this.isAjaxLoading=!0;var s=this.content.substring(4,this.content.length);t.get(s).done(function(t){i.contentParsed.html(t)}).always(function(t,n,o){i.ajaxResponse={data:t,status:n,xhr:o},i._contentReady.resolve(t,n,o),"function"==typeof i.contentLoaded&&i.contentLoaded(t,n,o)})}this.content||(this.content=n),this.isAjax||(this.contentParsed.html(this.content),this.setContent(),i._contentReady.resolve())},_stopCountDown:function(){clearInterval(this.autoCloseInterval),this.$cd&&this.$cd.remove()},_startCountDown:function(){var i=this,n=this.autoClose.split("|");if(2!==n.length)return console.error("Invalid option for autoClose. example 'close|10000'"),!1;var o=n[0],s=parseInt(n[1]);if(void 0===this.buttons[o])return console.error("Invalid button key '"+o+"' for autoClose"),!1;var e=Math.ceil(s/1e3);this.$cd=t(' ('+e+")").appendTo(this["$_"+o]),this.autoCloseInterval=setInterval(function(){i.$cd.html(" ("+(e-=1)+") "),e<=0&&(i["$$"+o].trigger("click"),i._stopCountDown())},1e3)},_getKey:function(t){switch(t){case 192:return"tilde";case 13:return"enter";case 16:return"shift";case 9:return"tab";case 20:return"capslock";case 17:return"ctrl";case 91:return"win";case 18:return"alt";case 27:return"esc";case 32:return"space"}var i=String.fromCharCode(t);return!!/^[A-z0-9]+$/.test(i)&&i.toLowerCase()},reactOnKey:function(i){var n,o=this,s=t(".jconfirm");if(s.eq(s.length-1)[0]!==this.$el[0])return!1;var e=i.which;if(this.$content.find(":input").is(":focus")&&/13|32/.test(e))return!1;var a=this._getKey(e);"esc"===a&&this.escapeKey&&(!0===this.escapeKey?this.$scrollPane.trigger("click"):("string"==typeof this.escapeKey||"function"==typeof this.escapeKey)&&(n="function"==typeof this.escapeKey?this.escapeKey():this.escapeKey)&&(void 0===this.buttons[n]?console.warn("Invalid escapeKey, no buttons found with key "+n):this["$_"+n].trigger("click"))),t.each(this.buttons,function(t,i){-1!==i.keys.indexOf(a)&&o["$_"+t].trigger("click")})},setDialogCenter:function(){console.info("setDialogCenter is deprecated, dialogs are centered with CSS3 tables")},_unwatchContent:function(){clearInterval(this._timer)},close:function(n){var o=this;return"function"==typeof this.onClose&&this.onClose(n),this._unwatchContent(),t(window).unbind("resize."+this._id),t(window).unbind("keyup."+this._id),t(window).unbind("jcKeyDown."+this._id),this.draggable&&(t(window).unbind("mousemove."+this._id),t(window).unbind("mouseup."+this._id),this.$titleContainer.unbind("mousedown")),o.$el.removeClass(o.loadedClass),t("body").removeClass("jconfirm-no-scroll-"+o._id),o.$jconfirmBoxContainer.removeClass("jconfirm-no-transition"),setTimeout(function(){o.$body.addClass(o.closeAnimationParsed),o.$jconfirmBg.addClass("jconfirm-bg-h"),setTimeout(function(){o.$el.remove(),i.jconfirm.instances;for(var n=i.jconfirm.instances.length-1;n>=0;n--)i.jconfirm.instances[n]._id===o._id&&i.jconfirm.instances.splice(n,1);if(!i.jconfirm.instances.length&&o.scrollToPreviousElement&&i.jconfirm.lastFocused&&i.jconfirm.lastFocused.length&&t.contains(document,i.jconfirm.lastFocused[0])){var s=i.jconfirm.lastFocused;if(o.scrollToPreviousElementAnimate){var e=t(window).scrollTop(),a=i.jconfirm.lastFocused.offset().top,c=t(window).height();a>e&&ar||Math.abs(c)>l)return!1;this.$jconfirmBoxContainer.css("transform","translate("+c+"px, "+a+"px)")},_open:function(){var t=this;"function"==typeof t.onOpenBefore&&t.onOpenBefore(),this.$body.removeClass(this.animationParsed),this.$jconfirmBg.removeClass("jconfirm-bg-h"),this.$body.focus(),t.$jconfirmBoxContainer.css("transform","translate(0px, 0px)"),setTimeout(function(){t.$body.css(t._getCSS(t.animationSpeed,1)),t.$body.css({"transition-property":t.$body.css("transition-property")+", margin"}),t.$jconfirmBoxContainer.addClass("jconfirm-no-transition"),t._modalReady.resolve(),"function"==typeof t.onOpen&&t.onOpen(),t.$el.addClass(t.loadedClass)},this.animationSpeed)},loadedClass:"jconfirm-open",isClosed:function(){return!this.$el||0===this.$el.parent().length},isOpen:function(){return!this.isClosed()},toggle:function(){this.isOpen()?this.close():this.open()}},i.jconfirm.instances=[],i.jconfirm.lastFocused=!1,i.jconfirm.pluginDefaults={template:'
',title:"Hello",titleClass:"",type:"default",typeAnimated:!0,draggable:!0,dragWindowGap:15,dragWindowBorder:!0,animateFromElement:!0,alignMiddle:!0,smoothContent:!0,content:"Are you sure to continue?",buttons:{},defaultButtons:{ok:{action:function(){}},close:{action:function(){}}},contentLoaded:function(){},icon:"",lazyOpen:!1,bgOpacity:null,theme:"light",animation:"scale",closeAnimation:"scale",animationSpeed:400,animationBounce:1,escapeKey:!0,rtl:!1,container:"body",containerFluid:!1,backgroundDismiss:!1,backgroundDismissAnimation:"shake",autoClose:!1,closeIcon:null,closeIconClass:!1,watchInterval:100,columnClass:"col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1",boxWidth:"50%",scrollToPreviousElement:!0,scrollToPreviousElementAnimate:!0,useBootstrap:!0,offsetTop:40,offsetBottom:40,bootstrapClasses:{container:"container",containerFluid:"container-fluid",row:"row"},onContentReady:function(){},onOpenBefore:function(){},onOpen:function(){},onClose:function(){},onDestroy:function(){},onAction:function(){}};var n=!1;t(window).on("keydown",function(i){if(!n){var o=t(i.target),s=!1;o.closest(".jconfirm-box").length&&(s=!0),s&&t(window).trigger("jcKeyDown"),n=!0}}),t(window).on("keyup",function(){n=!1}),i.jconfirm.lastClicked=!1,t(document).on("mousedown","button, a, [jc-source]",function(){i.jconfirm.lastClicked=t(this)})});