2015-03-14 20:00:03 +00:00
|
|
|
!function(e,t,n){function o(e){var t=x(),n=t.querySelector("h2"),o=t.querySelector("p"),a=t.querySelector("button.cancel"),r=t.querySelector("button.confirm");if(n.innerHTML=e.html?e.title:E(e.title).split("\n").join("<br>"),o.innerHTML=e.html?e.text:E(e.text||"").split("\n").join("<br>"),e.text&&A(o),e.customClass)T(t,e.customClass),t.setAttribute("data-custom-class",e.customClass);else{var s=t.getAttribute("data-custom-class");B(t,s),t.setAttribute("data-custom-class","")}if(O(t.querySelectorAll(".sa-icon")),e.type&&!u()){for(var c=!1,l=0;l<h.length;l++)if(e.type===h[l]){c=!0;break}if(!c)return f("Unknown alert type: "+e.type),!1;var d=t.querySelector(".sa-icon.sa-"+e.type);switch(A(d),e.type){case"success":T(d,"animate"),T(d.querySelector(".sa-tip"),"animateSuccessTip"),T(d.querySelector(".sa-long"),"animateSuccessLong");break;case"error":T(d,"animateErrorIcon"),T(d.querySelector(".sa-x-mark"),"animateXMark");break;case"warning":T(d,"pulseWarning"),T(d.querySelector(".sa-body"),"pulseWarningIns"),T(d.querySelector(".sa-dot"),"pulseWarningIns")}}if(e.imageUrl){var m=t.querySelector(".sa-icon.sa-custom");m.style.backgroundImage="url("+e.imageUrl+")",A(m);var p=80,y=80;if(e.imageSize){var v=e.imageSize.toString().split("x"),b=v[0],g=v[1];b&&g?(p=b,y=g):f("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+e.imageSize)}m.setAttribute("style",m.getAttribute("style")+"width:"+p+"px; height:"+y+"px")}t.setAttribute("data-has-cancel-button",e.showCancelButton),e.showCancelButton?a.style.display="inline-block":O(a),t.setAttribute("data-has-confirm-button",e.showConfirmButton),e.showConfirmButton?r.style.display="inline-block":O(r),e.cancelButtonText&&(a.innerHTML=E(e.cancelButtonText)),e.confirmButtonText&&(r.innerHTML=E(e.confirmButtonText)),r.style.backgroundColor=e.confirmButtonColor,i(r,e.confirmButtonColor),t.setAttribute("data-allow-ouside-click",e.allowOutsideClick);var w=e.doneFunction?!0:!1;t.setAttribute("data-has-done-function",w),e.animation?t.setAttribute("data-animation","pop"):t.setAttribute("data-animation","none"),t.setAttribute("data-timer",e.timer)}function a(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;var n,o,a="#";for(o=0;3>o;o++)n=parseInt(e.substr(2*o,2),16),n=Math.round(Math.min(Math.max(0,n+n*t),255)).toString(16),a+=("00"+n).substr(n.length);return a}function r(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function s(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16):null}function i(e,t){var n=s(t);e.style.boxShadow="0 0 2px rgba("+n+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"}function c(){var e=x();H(k(),10),A(e),T(e,"showSweetAlert"),B(e,"hideSweetAlert"),d=t.activeElement;var n=e.querySelector("button.confirm");n.focus(),setTimeout(function(){T(e,"visible")},500);var o=e.getAttribute("data-timer");"null"!==o&&""!==o&&(e.timeout=setTimeout(function(){v.close()},o))}function l(){var e=x();e.style.marginTop=D(x())}function u(){return e.attachEvent&&!e.addEventListener?!0:!1}function f(t){e.console&&e.console.log("SweetAlert: "+t)}var d,m,p,y,v,b,g=".sweet-alert",w=".sweet-overlay",h=["error","warning","info","success"],S={title:"",text:"",type:null,allowOutsideClick:!1,showConfirmButton:!0,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#AEDEF4",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null,customClass:"",html:!1,animation:!0,allowEscapeKey:!0},x=function(){var e=t.querySelector(g);return e||(j(),e=x()),e},k=function(){return t.querySelector(w)},C=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},T=function(e,t){C(e,t)||(e.className+=" "+t)},B=function(e,t){var n=" "+e.className.replace(/[\t\r\n]/g," ")+" ";if(C(e,t)){for(;n.indexOf(" "+t+" ")>=0;)n=n.replace(" "+t+" "," ");e.className=n.replace(/^\s+|\s+$/g,"")}},E=function(e){var n=t.createElement("div");return n.appendChild(t.createTextNode(e)),n.innerHTML},q=function(e){e.style.opacity="",e.st
|