| Current Path : /home/jeromecohp/www/aesecure/third/alertify/lib/ |
| Current File : /home/jeromecohp/www/aesecure/third/alertify/lib/alertify.min.js |
!function(t,e){"use strict";var n,i=t.document;n=function(){var n,s,o,r,a,l,c,u,f,d,y,p,h,b={},m={},v=!1,g={ENTER:13,ESC:27,SPACE:32},k=[];return m={buttons:{holder:'<nav class="alertify-buttons">{{buttons}}</nav>',submit:'<button type="submit" class="alertify-button alertify-button-ok" id="alertify-ok">{{ok}}</button>',ok:'<button class="alertify-button alertify-button-ok" id="alertify-ok">{{ok}}</button>',cancel:'<button class="alertify-button alertify-button-cancel" id="alertify-cancel">{{cancel}}</button>'},input:'<div class="alertify-text-wrapper"><input type="text" class="alertify-text" id="alertify-text"></div>',message:'<p class="alertify-message">{{message}}</p>',log:'<article class="alertify-log{{class}}">{{message}}</article>'},h=function(){var t,n,s=!1,o=i.createElement("fakeelement"),r={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"};for(t in r)if(o.style[t]!==e){n=r[t],s=!0;break}return{type:n,supported:s}},n=function(t){return i.getElementById(t)},b={labels:{ok:"OK",cancel:"Cancel"},delay:5e3,buttonReverse:!1,buttonFocus:"ok",transition:e,addListeners:function(t){var e,n,l,c,u,f="undefined"!=typeof o,d="undefined"!=typeof s,y="undefined"!=typeof p,h="",b=this;e=function(e){return"undefined"!=typeof e.preventDefault&&e.preventDefault(),l(e),"undefined"!=typeof p&&(h=p.value),"function"==typeof t&&("undefined"!=typeof p?t(!0,h):t(!0)),!1},n=function(e){return"undefined"!=typeof e.preventDefault&&e.preventDefault(),l(e),"function"==typeof t&&t(!1),!1},l=function(){b.hide(),b.unbind(i.body,"keyup",c),b.unbind(r,"focus",u),f&&b.unbind(o,"click",e),d&&b.unbind(s,"click",n)},c=function(t){var i=t.keyCode;(i===g.SPACE&&!y||y&&i===g.ENTER)&&e(t),i===g.ESC&&d&&n(t)},u=function(){y?p.focus():!d||b.buttonReverse?o.focus():s.focus()},this.bind(r,"focus",u),this.bind(a,"focus",u),f&&this.bind(o,"click",e),d&&this.bind(s,"click",n),this.bind(i.body,"keyup",c),this.transition.supported||this.setFocus()},bind:function(t,e,n){"function"==typeof t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n)},handleErrors:function(){if("undefined"!=typeof t.onerror){var e=this;return t.onerror=function(t,n,i){e.error("["+t+" on line "+i+" of "+n+"]",0)},!0}return!1},appendButtons:function(t,e){return this.buttonReverse?e+t:t+e},build:function(t){var e="",n=t.type,i=t.message,s=t.cssClass||"";switch(e+='<div class="alertify-dialog">',e+='<a id="alertify-resetFocusBack" class="alertify-resetFocus" href="#">Reset Focus</a>',"none"===b.buttonFocus&&(e+='<a href="#" id="alertify-noneFocus" class="alertify-hidden"></a>'),"prompt"===n&&(e+='<div id="alertify-form">'),e+='<article class="alertify-inner">',e+=m.message.replace("{{message}}",i),"prompt"===n&&(e+=m.input),e+=m.buttons.holder,e+="</article>","prompt"===n&&(e+="</div>"),e+='<a id="alertify-resetFocus" class="alertify-resetFocus" href="#">Reset Focus</a>',e+="</div>",n){case"confirm":e=e.replace("{{buttons}}",this.appendButtons(m.buttons.cancel,m.buttons.ok)),e=e.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"prompt":e=e.replace("{{buttons}}",this.appendButtons(m.buttons.cancel,m.buttons.submit)),e=e.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"alert":e=e.replace("{{buttons}}",m.buttons.ok),e=e.replace("{{ok}}",this.labels.ok)}return f.className="alertify alertify-"+n+" "+s,u.className="alertify-cover",e},close:function(t,e){var n,i,s=e&&!isNaN(e)?+e:this.delay,o=this;this.bind(t,"click",function(){n(t)}),i=function(t){t.stopPropagation(),o.unbind(this,o.transition.type,i),d.removeChild(this),d.hasChildNodes()||(d.className+=" alertify-logs-hidden")},n=function(t){"undefined"!=typeof t&&t.parentNode===d&&(o.transition.supported?(o.bind(t,o.transition.type,i),t.className+=" alertify-log-hide"):(d.removeChild(t),d.hasChildNodes()||(d.className+=" alertify-logs-hidden")))},0!==e&&setTimeout(function(){n(t)},s)},dialog:function(t,e,n,s,o){c=i.activeElement;var r=function(){d&&null!==d.scrollTop&&u&&null!==u.scrollTop||r()};if("string"!=typeof t)throw new Error("message must be a string");if("string"!=typeof e)throw new Error("type must be a string");if("undefined"!=typeof n&&"function"!=typeof n)throw new Error("fn must be a function");return this.init(),r(),k.push({type:e,message:t,callback:n,placeholder:s,cssClass:o}),v||this.setup(),this},extend:function(t){if("string"!=typeof t)throw new Error("extend method must have exactly one paramter");return function(e,n){return this.log(e,t,n),this}},hide:function(){var t,e=this;k.splice(0,1),k.length>0?this.setup(!0):(v=!1,t=function(n){n.stopPropagation(),e.unbind(f,e.transition.type,t)},this.transition.supported?(this.bind(f,this.transition.type,t),f.className="alertify alertify-hide alertify-hidden"):f.className="alertify alertify-hide alertify-hidden alertify-isHidden",u.className="alertify-cover alertify-cover-hidden",c.focus())},init:function(){i.createElement("nav"),i.createElement("article"),i.createElement("section"),null==n("alertify-cover")&&(u=i.createElement("div"),u.setAttribute("id","alertify-cover"),u.className="alertify-cover alertify-cover-hidden",i.body.appendChild(u)),null==n("alertify")&&(v=!1,k=[],f=i.createElement("section"),f.setAttribute("id","alertify"),f.className="alertify alertify-hidden",i.body.appendChild(f)),null==n("alertify-logs")&&(d=i.createElement("section"),d.setAttribute("id","alertify-logs"),d.className="alertify-logs alertify-logs-hidden",i.body.appendChild(d)),i.body.setAttribute("tabindex","0"),this.transition=h()},log:function(t,e,n){var i=function(){d&&null!==d.scrollTop||i()};return this.init(),i(),d.className="alertify-logs",this.notify(t,e,n),this},notify:function(t,e,n){var s=i.createElement("article");s.className="alertify-log"+("string"==typeof e&&""!==e?" alertify-log-"+e:""),s.innerHTML=t,d.appendChild(s),setTimeout(function(){s.className=s.className+" alertify-log-show"},50),this.close(s,n)},set:function(t){var e;if("object"!=typeof t&&t instanceof Array)throw new Error("args must be an object");for(e in t)t.hasOwnProperty(e)&&(this[e]=t[e])},setFocus:function(){p?(p.focus(),p.select()):l.focus()},setup:function(t){var i,c=k[0],u=this;v=!0,i=function(t){t.stopPropagation(),u.setFocus(),u.unbind(f,u.transition.type,i)},this.transition.supported&&!t&&this.bind(f,this.transition.type,i),f.innerHTML=this.build(c),r=n("alertify-resetFocus"),a=n("alertify-resetFocusBack"),o=n("alertify-ok")||e,s=n("alertify-cancel")||e,l="cancel"===b.buttonFocus?s:"none"===b.buttonFocus?n("alertify-noneFocus"):o,p=n("alertify-text")||e,y=n("alertify-form")||e,"string"==typeof c.placeholder&&""!==c.placeholder&&(p.value=c.placeholder),t&&this.setFocus(),this.addListeners(c.callback)},unbind:function(t,e,n){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&t.detachEvent("on"+e,n)}},{alert:function(t,e,n){return b.dialog(t,"alert",e,"",n),this},confirm:function(t,e,n){return b.dialog(t,"confirm",e,"",n),this},extend:b.extend,init:b.init,log:function(t,e,n){return b.log(t,e,n),this},prompt:function(t,e,n,i){return b.dialog(t,"prompt",e,n,i),this},success:function(t,e){return b.log(t,"success",e),this},error:function(t,e){return b.log(t,"error",e),this},set:function(t){b.set(t)},labels:b.labels,debug:b.handleErrors}},"function"==typeof define?define([],function(){return new n}):"undefined"==typeof t.alertify&&(t.alertify=new n)}(this);