"use strict";
/*!
 * jquery-confirm v1.5.1 (http://craftpip.github.io/jquery-confirm/)
 * Author: Boniface Pereira
 * Website: www.craftpip.com
 * Contact: hey@craftpip.com
 *
 * Copyright 2013-2015 jquery-confirm
 * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE)
 */
if(typeof jQuery==="undefined"){throw new Error("jquery-confirm requires jQuery")}var jconfirm,Jconfirm;(function(b){b.confirm=function(c){return jconfirm(c)};b.alert=function(c){c.cancelButton=false;return jconfirm(c)};b.dialog=function(c){c.cancelButton=false;c.confirmButton=false;return jconfirm(c)};jconfirm=function(c){if(jconfirm.defaults){b.extend(jconfirm.pluginDefaults,jconfirm.defaults)}var c=b.extend({},jconfirm.pluginDefaults,c);return new Jconfirm(c)};Jconfirm=function(c){b.extend(this,c);this._init()};Jconfirm.prototype={_init:function(){var c=this;this._rand=Math.round(Math.random()*99999);this._buildHTML();this._bindEvents();setTimeout(function(){c.open()},0)},animations:["anim-scale","anim-top","anim-bottom","anim-left","anim-right","anim-zoom","anim-opacity","anim-none","anim-rotate","anim-rotatex","anim-rotatey","anim-scalex","anim-scaley"],_buildHTML:function(){var e=this;this.animation="anim-"+this.animation.toLowerCase();if(this.animation==="none"){this.animationSpeed=0}this.$el=b(this.template).appendTo(this.container).addClass(this.theme);this.$b=this.$el.find(".jconfirm-box").css({"-webkit-transition-duration":this.animationSpeed/1000+"s","transition-duration":this.animationSpeed/1000+"s"});this.$b=this.$el.find(".jconfirm-box");this.$b.addClass(this.animation);this.$el.find("div.title").html('<i class="'+this.icon+'"></i> '+this.title);var d=this.$el.find("div.content");var f=this.$el.find(".buttons");if(this.confirmButton&&this.confirmButton.trim()!==""){this.$confirmButton=b('<button class="btn">'+this.confirmButton+"</button>").appendTo(f);this.$confirmButton.addClass(this.confirmButtonClass)}if(this.cancelButton&&this.cancelButton.trim()!==""){this.$cancelButton=b('<button class="btn">'+this.cancelButton+"</button>").appendTo(f);this.$cancelButton.addClass(this.cancelButtonClass)}if(!this.confirmButton&&!this.cancelButton){f.remove();if(this.closeIcon){this.$closeButton=this.$b.find(".closeIcon").show()}}if(this.content.substr(0,4).toLowerCase()==="url:"){d.html("");f.find("button").attr("disabled","disabled");var c=this.content.substring(4,this.content.length);setTimeout(function(){b.get(c,function(g){d.html(g);f.find("button").removeAttr("disabled");e.setDialogCenter()})},1)}else{d.html(this.content)}if(this.autoClose){this._startCountDown()}},_startCountDown:function(){var c=this.autoClose.split("|");if(/cancel/.test(c[0])&&this.type==="alert"){return false}if(/confirm|cancel/.test(c[0])){this.$cd=b(' <span class="countdown"></span>').appendTo(this["$"+c[0]+"Button"]);var d=this;d.$cd.parent().click();var e=c[1]/1000;this.interval=setInterval(function(){d.$cd.html(" ["+(e-=1)+"]");if(e===0){d.$cd.parent().trigger("click");clearInterval(d.interval)}},1000)}},_bindEvents:function(){var c=this;this.$el.find(".jconfirm-bg").click(function(d){if(c.backgroundDismiss){c.cancel();c.close()}else{c.$b.addClass("hilight");setTimeout(function(){c.$b.removeClass("hilight")},400)}});if(this.$confirmButton){this.$confirmButton.click(function(f){f.preventDefault();var d=c.confirm(c.$b);if(typeof d==="undefined"||d){c.close()}})}if(this.$cancelButton){this.$cancelButton.click(function(f){f.preventDefault();var d=c.cancel(c.$b);if(typeof d==="undefined"||d){c.close()}})}if(this.$closeButton){this.$closeButton.click(function(d){d.preventDefault();c.cancel();c.close()})}if(this.keyboardEnabled){setTimeout(function(){b(window).on("keyup."+this._rand,function(d){c.reactOnKey(d)})},500)}b(window).on("resize."+this._rand,function(){c.setDialogCenter()});this.setDialogCenter()},reactOnKey:function a(f){var c=b(".jconfirm");if(c.eq(c.length-1)[0]!==this.$el[0]){return false}var d=f.which;console.log(f);if(d===27){if(!this.backgroundDismiss){this.$el.find(".jconfirm-bg").click();return false}if(this.$cancelButton){this.$cancelButton.click()}else{this.close()}}if(d===13){if(this.$confirmButton){this.$confirmButton.click()}else{}}},setDialogCenter:function(){var d=b(window).height(),c=this.$b.height(),e=(d-c)/2;this.$b.find(".content").css({"max-height":d-200+"px"});this.$b.css({"margin-top":e})},close:function(){var c=this;b(window).unbind("resize."+this._rand);if(this.keyboardEnabled){b(window).unbind("keyup."+this._rand)}this.$b.addClass(this.animation);b("body").removeClass("jconfirm-noscroll");setTimeout(function(){c.$el.remove()},this.animationSpeed)},open:function(){var c=this;b("body").addClass("jconfirm-noscroll");this.$b.removeClass(this.animations.join(" "));b("body :focus").trigger("blur")}};jconfirm.pluginDefaults={template:'<div class="jconfirm"><div class="jconfirm-bg"></div><div class="container"><div class="row"><div class="col-md-6 col-md-offset-3 span6 offset3"><div class="jconfirm-box"><div class="closeIcon"><span class="glyphicon glyphicon-remove"></span></div><div class="title"></div><div class="content"></div><div class="buttons pull-right"></div><div class="jquery-clear"></div></div></div></div></div></div>',title:"Hello",content:"Are you sure to continue?",icon:"",confirmButton:"Okay",cancelButton:"Cancel",confirmButtonClass:"btn-default",cancelButtonClass:"btn-default",theme:"white",animation:"scale",animationSpeed:400,keyboardEnabled:false,container:"body",confirm:function(){},cancel:function(){},backgroundDismiss:true,autoClose:false,closeIcon:true,}})(jQuery);