2013-06-21 09:44:21 +10:00
|
|
|
(function(t,i,e,n){"use strict";var o,r,s,a,l,h,c,p,u,d,A,f,m,w,g,y,b,v,x,C,E,S,H,M,D=[].indexOf||function(t){for(var i=0,e=this.length;e>i;i++)if(i in this&&this[i]===t)return i;return-1};v="notify",b=v+"js",C={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},d=["l","c","r"],M=["t","m","b"],w=["t","b","l","r"],g={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},y=function(t){var i;return i=[],e.each(t.split(/\W+/),function(t,e){var o;return o=e.toLowerCase().charAt(0),C[o]?i.push(o):n}),i},H={},s={name:"core",html:'<div class="'+b+'-wrapper">\n <div class="'+b+'-arrow"></div>\n <div class="'+b+'-container"></div>\n</div>',css:"."+b+"-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n."+b+"-corner ."+b+"-wrapper,\n."+b+"-corner ."+b+"-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n."+b+"-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n."+b+"-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n."+b+"-text {\n position: relative;\n}\n\n."+b+"-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"},S={"border-radius":["-webkit-","-moz-"]},p=function(t){return H[t]},r=function(i,o){var r,s;if(!i)throw"Missing Style name";if(!o)throw"Missing Style definition";return(null!=(s=H[i])?s.cssElem:void 0)&&(t.console&&console.warn(""+v+": overwriting style '"+i+"'"),H[i].cssElem.remove()),o.name=i,H[i]=o,r="",o.classes&&e.each(o.classes,function(t,i){return r+="."+b+"-"+o.name+"-"+t+" {\n",e.each(i,function(t,i){return S[t]&&e.each(S[t],function(e,n){return r+=" "+n+t+": "+i+";\n"}),r+=" "+t+": "+i+";\n"}),r+="}\n"}),o.css&&(r+="/* styles for "+o.name+" */\n"+o.css),r?(o.cssElem=m(r),o.cssElem.attr("id","notify-"+o.name)):n},m=function(t){var i;i=a("style"),i.attr("type","text/css"),e("head").append(i);try{i.html(t)}catch(n){i[0].styleSheet.cssText=t}return i},x={clickToHide:!0,autoHide:!0,autoHideDelay:5e3,arrowShow:!0,arrowSize:5,breakNewLines:!0,elementPosition:"bottom",globalPosition:"top right",style:"bootstrap",className:"error",showAnimation:"slideDown",showDuration:400,hideAnimation:"slideUp",hideDuration:200,gap:5},f=function(t,i){var n;return n=function(){},n.prototype=t,e.extend(!0,new n,i)},l=function(t){return e.extend(x,t)},a=function(t){return e("<"+t+"></"+t+">")},u={},c=function(t){var i;return t.is("[type=radio]")&&(i=t.parents("form:first").find("[type=radio]").filter(function(i,n){return e(n).attr("name")===t.attr("name")}),t=i.first()),t},A=function(t,i,e){var o,r;if("string"==typeof e)e=parseInt(e,10);else if("number"!=typeof e)return;if(!isNaN(e))return o=C[g[i.charAt(0)]],r=i,t[o]!==n&&(i=C[o.charAt(0)],e=-e),t[i]===n?t[i]=e:t[i]+=e,null},E=function(t,i,e){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return e/2-i/2;if("r"===t||"b"===t)return e-i;throw"Invalid alignment"},h=function(t){return h.e=h.e||a("div"),h.e.text(t).html()},o=function(){function t(t,i,n){"string"==typeof n&&(n={className:n}),this.options=f(x,e.isPlainObject(n)?n:{}),this.loadHTML(),this.wrapper=e(s.html),this.wrapper.data(b,this),this.arrow=this.wrapper.find("."+b+"-arrow"),this.container=this.wrapper.find("."+b+"-container"),this.container.append(this.userContainer),t&&t.length&&(this.elementType=t.attr("type"),this.originalElement=t,this.elem=c(t),this.elem.data(b,this),this.elem.before(this.wrapper)),this.container.hide(),this.run(i)}return t.prototype.loadHTML=function(){var t;if(t=this.getStyle(),this.userContainer=e(t.html),this.text=this.userContainer.find("[data-notify-text]"),0===this.text.length&&(this.text=this.userContainer.find("[data-notify-html]"),this.rawHTML=!0),0===this.text.length)throw"style: '"+name+"' HTML is missing a: 'data-notify-text' or 'data-notify-html' attribute";return this.text.addClass(""+b+"-text")},t.prototype.show=function(t,i){var e,o,r,s,a,l=this;if(o=function(){return t||l.elem||l.destroy(),i?i():n},a=this.container.parent().parents(":hidden").length>0,r=this.container.add(this.arr
|