2013-06-21 09:44:21 +10:00
|
|
|
(function(t,i,e,n){"use strict";var o,r,s,a,h,l,c,p,u,d,f,m,w,y,g,b,v,x,S,C,H,P,T,N,k=[].indexOf||function(t){for(var i=0,e=this.length;e>i;i++)if(i in this&&this[i]===t)return i;return-1};x="notify",v=x+"js",C={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},d=["l","c","r"],N=["t","m","b"],y=["t","b","l","r"],g={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},b=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},T={},s={name:"core",html:'<div class="'+v+'-wrapper">\n <div class="'+v+'-arrow"></div>\n <div class="'+v+'-container"></div>\n</div>',css:"."+v+"-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n."+v+"-corner ."+v+"-wrapper,\n."+v+"-corner ."+v+"-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n."+v+"-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n."+v+"-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n."+v+"-text {\n position: relative;\n}\n\n."+v+"-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"},P={"border-radius":["-webkit-","-moz-"]},p=function(t){return T[t]},r=function(i,o){var r,s;if(!i)throw"Missing Style name";if(!o)throw"Missing Style definition";return(null!=(s=T[i])?s.cssElem:void 0)&&(t.console&&console.warn(""+x+": overwriting style '"+i+"'"),T[i].cssElem.remove()),o.name=i,T[i]=o,r="",o.classes&&e.each(o.classes,function(t,i){return r+="."+v+"-"+o.name+"-"+t+" {\n",e.each(i,function(t,i){return P[t]&&e.each(P[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=w(r),o.cssElem.attr("id","notify-"+o.name)):n},w=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},S={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},m=function(t,i){var n;return n=function(){},n.prototype=t,e.extend(!0,new n,i)},h=function(t){return e.extend(S,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},f=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},H=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"},l=function(t){return l.e=l.e||a("div"),l.e.text(t).html()},o=function(){function t(t,i,n){"string"==typeof n&&(n={className:n}),this.options=m(S,e.isPlainObject(n)?n:{}),this.loadHTML(),this.wrapper=e(s.html),this.wrapper.data(v,this),this.arrow=this.wrapper.find("."+v+"-arrow"),this.container=this.wrapper.find("."+v+"-container"),this.container.append(this.userContainer),t&&t.length&&(this.elementType=t.attr("type"),this.originalElement=t,this.elem=c(t),this.elem.data(v,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(""+v+"-text")},t.prototype.show=function(t,i){var e,o,r,s,a,h=this;if(o=function(){return t||h.elem||h.destroy(),i?i():n},a=this.container.parent().parents(":hidden").length>0,r=this.container.add(this.arr
|