/** Notify.js - v0.0.1 - 2013/05/30 * http://notifyjs.com/ * Copyright (c) 2013 Jaime Pillora - MIT */(function(t,n,o){"use strict";var e,i,r,s,a,p,h,l,u,d,c,f,w,y;c="notify",i="__"+c,w={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},u={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},d=function(t){var n;return n=[],$.each(t.split(/\W+/),function(t,e){var i;return i=e.toLowerCase().charAt(0),w[i]?n.push(i):o}),n},y={core:{html:'
\n
\n
\n
',css:"."+i+"Corner {\n position: fixed;\n top: 0;\n right: 0;\n margin: 5px;\n z-index: 1050;\n}\n\n."+i+"Corner ."+i+"Wrapper,\n."+i+"Corner ."+i+"Container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n}\n\n."+i+"Wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n border: thin solid red;\n}\n\n."+i+"Container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n."+i+"Text {\n position: relative;\n}\n\n."+i+"Arrow {\n margin-top: 2px;\n position: absolute;\n z-index: 2;\n margin-left: 10px;\n width: 0;\n height: 0;\n}\n"},user:{"default":{html:'
\n \n
',css:"."+i+"Default {\n background: #fff;\n font-size: 11px;\n box-shadow: 0 0 6px #000;\n -moz-box-shadow: 0 0 6px #000;\n -webkit-box-shadow: 0 0 6px #000;\n padding: 4px 10px 4px 8px;\n border-radius: 6px;\n border-style: solid;\n border-width: 2px;\n -moz-border-radius: 6px;\n -webkit-border-radius: 6px;\n white-space: nowrap;\n}"},bootstrap:{html:'
\n \n
',css:"."+i+"Bootstrap {\n white-space: nowrap;\n margin: 5px !important;\n padding-left: 25px !important;\n background-repeat: no-repeat;\n background-position: 3px 7px;\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=);\n}",colors:{red:"#eed3d7"}}}},f={autoHide:!1,autoHideDelay:2e3,arrowShow:!1,arrowSize:5,position:"bottom",style:"default",color:"red",colors:{red:"#b94a48",green:"#33be40",black:"#393939",blue:"#00f"},showAnimation:"slideDown",showDuration:400,hideAnimation:"slideUp",hideDuration:200,offsetY:2,offsetX:0},s=function(t){return $("<"+t+">")},h=function(t,n){var o;return o=function(){},o.prototype=t,$.extend(!0,new o,n)},r=s("div").addClass(""+i+"Corner"),a=function(t){var n;return t.is("[type=radio]")&&(n=t.parents("form:first").find("[type=radio]").filter(function(n,o){return $(o).attr("name")===t.attr("name")}),t=n.first()),t},p=function(t,n,e,i){var r,s;if(null==i&&(i=!0),"string"==typeof e)e=parseInt(e,10);else if("number"!=typeof e)return;if(!isNaN(e)){if(r=w[u[n.charAt(0)]],s=n,t[r]!==o){if(!i)return;n=w[r.charAt(0)],e*=-1}return t[n]===o?t[n]=e:t[n]+=e,console.log("incr ("+r+">>"+s+") "+n+" by "+e),null}},l=function(t){var n;if(t&&t.css&&(n=t.cssElem,!n)){n=s("style"),$("head").append(n),t.cssElem=n;try{return n.html(t.css)}catch(o){return n[0].styleSheet.cssText=t.css}}},e=function(){function t(t,n,o){"string"==typeof o&&(o={color:o}),this.options=h(f,$.isPlainObject(o)?o:{}),this.loadCSS(),this.loadHTML(),this.wrapper=$(y.core.html),this.wrapper.data(i,this),this.arrow=this.wrapper.find("."+i+"Arrow"),this.container=this.wrapper.find("."+i+"Container"),this.container.append(this.userContainer),t&&t.length?(this.elementType=t.attr("type"),this.originalElement=t,this.elem=a(t),this.elem.data(i,this),this.elem.before(this.wrapper)):(this.options.arrowShow=!1,r.prepend(this.wrapper)),this.container.hide(),this.run(n)}return t.prototype.loadCSS=function(t){var n;return t||(n=this.options.style,t=this.getStyle(n)),l(t)},t.prototype.loadHTML=function(){var t;if(t=this.getStyle(),this.userContainer=$(t.html),this.text=this.userContainer.find("[data-notify-text]"),0===this.text.length)throw"style: "+name+" HTML is missing the: 'data-notify-text' attribute";return this.text.addClass(""+i+"Text")},t.prototype.show=function(t,n){var o,e,i,r;return null==n&&(n=$.noop),r=this.container.parent().parents(":hidden").length>0,e=this.container.add(this.arrow),o=[],r&&t?i="show":r&&!t?i="hide":!r&&t?(i=this.options.showAnimation,o.push(this.options.showDuration)):r||t||(i=this.options.hideAnimation,o.push(this.options.hideDuration)),o.push(n),e[i].apply(e,o)},t.prototype.updatePosition=function(){var t,n,o,e;if(this.elem){switch(t=this.elem.position(),e=this.wrapper.position(),o=this.getPosition(),console.log(this.elem[0]),console.log("update position",o," elem ",t," main ",e),n={},o[0]){case"b":p(n,"top",this.elem.outerHeight());break;case"t":p(n,"bottom",0);break;case"l":p(n,"right",0);break;case"r":p(n,"left",this.elem.outerWidth());break;default:throw"Unknown position: "+o}return navigator.userAgent.match(/MSIE/)||p(n,"top",t.top-e.top),p(n,"left",t.left-e.left),this.container.css(n)}},t.prototype.updateArrow=function(t,n){var e,i,r;if(!this.options.arrowShow||"radio"===this.elementType)return this.arrow.hide(),o;i=arrowDirs[n],r=this.options.arrowSize,this.arrow.css("border-"+n,r+"px solid "+this.getColor()),this.arrow.css(t);for(e in arrowDirs)e!==i&&e!==n&&this.arrow.css("border-"+e,r+"px solid transparent");switch(n){case"bottom":t.top+=r;break;case"right":t.left+=r}return this.arrow.show()},t.prototype.getPosition=function(){var t,n;if(n=this.options.position,t=d(n),0===t.length&&t.push("b"),(1===t.length&&"l"===t[0]||"r"===t[0])&&t.push("m"),1===t.length&&t.push("l"),!this.options.autoReposition)return t;throw"Not implemented"},t.prototype.getColor=function(){var t;return t=this.getStyle().colors,t&&t[this.options.color]||this.options.colors[this.options.color]||this.options.color},t.prototype.getStyle=function(t){var n;if(t||(t=this.options.style),t||(t="default"),n=y.user[t],!n)throw"Missing style: "+t;return n},t.prototype.updateStyle=function(){var t=this;return this.wrapper.find("[data-notify-style]").each(function(n,o){return $(o).attr("style",$(o).attr("data-notify-style").replace(/\{\{\s*color\s*\}\}/gi,t.getColor()))})},t.prototype.run=function(t,n){var e,i=this;return $.isPlainObject(n)?$.extend(this.options,n):"string"===$.type(n)&&(this.options.color=n),this.container&&!t?(this.show(!1),o):this.container||t?("string"===$.type(t)?this.text.html(t.replace("\n","
")):this.text.empty().append(t),this.updatePosition(),this.show(!0),this.options.autoHide?(clearTimeout(this.autohideTimer),e=setTimeout(function(){return i.show(!1)},this.options.autoHideDelay)):o):o},t.prototype.destroy=function(){var t=this;return this.show(!1,function(){return t.wrapper.remove()})},t}(),$(function(){return $("body").append(r),$("link").each(function(){var t,n;return n=$(this).attr("href"),n.match(/bootstrap/)?(t=!0,!1):o}),l(y.core),$(n).on("click","."+i+"Wrapper",function(){var t;return(t=$(this).data(i))?t.elem?t.show(!1):t.destroy():o})}),$[c]=function(t,n,o){return t&&t.nodeName||t.jquery?$(t)[c](n,o):(o=n,n=t,new e(null,n,o)),t},$[c].options=function(t){return $.extend(f,t)},$[c].styles=function(t){return $.extend(!0,y.user,t)},$[c].insertCSS=l,$.fn[c]=function(t,n){return $(this).each(function(){var o;return o=a($(this)).data(i),o?o.run(t,n):new e($(this),t,n)}),this}})(window,document);