diff --git a/dist/notify-combined.js b/dist/notify-combined.js
index 30454fd..f25b3a5 100644
--- a/dist/notify-combined.js
+++ b/dist/notify-combined.js
@@ -1,11 +1,11 @@
-/** Notify.js - v0.0.1 - 2013/06/12
+/** Notify.js - v0.0.1 - 2013/06/14
* http://notifyjs.com/
* Copyright (c) 2013 Jaime Pillora - MIT
*/
(function(window,document,undefined) {
'use strict';
-var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
+var Notification, addStyle, coreStyle, createElem, defaults, encode, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
pluginName = 'notify';
@@ -125,6 +125,7 @@ pluginOptions = {
autoHideDelay: 5000,
arrowShow: true,
arrowSize: 5,
+ breakNewLines: true,
elementPosition: 'bottom',
globalPosition: 'top right',
style: 'bootstrap',
@@ -199,6 +200,11 @@ realign = function(alignment, inner, outer) {
throw "Invalid alignment";
};
+encode = function(text) {
+ encode.e = encode.e || createElem("div");
+ return encode.e.text(text).html();
+};
+
Notification = (function() {
function Notification(elem, data, options) {
@@ -427,7 +433,13 @@ Notification = (function() {
} else if (!this.container && !data) {
return;
}
- this.text[this.rawHTML ? 'html' : 'text'](data);
+ if (!this.rawHTML) {
+ data = encode(data);
+ if (this.options.breakNewLines) {
+ data = data.replace(/\n/, '
');
+ }
+ }
+ this.text.html(data);
this.updateClasses();
if (this.elem) {
this.setElementPosition();
diff --git a/dist/notify-combined.min.js b/dist/notify-combined.min.js
index ae3bc88..41a6ea7 100644
--- a/dist/notify-combined.min.js
+++ b/dist/notify-combined.min.js
@@ -1,5 +1,5 @@
-/** Notify.js - v0.0.1 - 2013/06/12
+/** Notify.js - v0.0.1 - 2013/06/14
* http://notifyjs.com/
* Copyright (c) 2013 Jaime Pillora - MIT
*/
-(function(t,i,n){"use strict";var e,o,r,s,a,l,h,c,p,u,d,A,f,m,w,g,y,b,v,x,C,E,S,H=[].indexOf||function(t){for(var i=0,n=this.length;n>i;i++)if(i in this&&this[i]===t)return i;return-1};y="notify",g=y+"js",v={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},p=["l","c","r"],S=["t","m","b"],f=["t","b","l","r"],m={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},w=function(t){var i;return i=[],$.each(t.split(/\W+/),function(t,e){var o;return o=e.toLowerCase().charAt(0),v[o]?i.push(o):n}),i},E={},r={name:"core",html:'
',css:"."+g+"-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n."+g+"-corner ."+g+"-wrapper,\n."+g+"-corner ."+g+"-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n."+g+"-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n."+g+"-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n."+g+"-text {\n position: relative;\n}\n\n."+g+"-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"},C={"border-radius":["-webkit-","-moz-"]},h=function(t){return E[t]},o=function(i,e){var o,r;if(!i)throw"Missing Style name";if(!e)throw"Missing Style definition";return(null!=(r=E[i])?r.cssElem:void 0)&&(t.console&&console.warn(""+y+": overwriting style '"+i+"'"),E[i].cssElem.remove()),e.name=i,E[i]=e,o="",e.classes&&$.each(e.classes,function(t,i){return o+="."+g+"-"+e.name+"-"+t+" {\n",$.each(i,function(t,i){return C[t]&&$.each(C[t],function(n,e){return o+=" "+e+t+": "+i+";\n"}),o+=" "+t+": "+i+";\n"}),o+="}\n"}),e.css&&(o+="/* styles for "+e.name+" */\n"+e.css),o?(e.cssElem=A(o),e.cssElem.attr("id","notify-"+e.name)):n},A=function(t){var i;i=s("style"),i.attr("type","text/css"),$("head").append(i);try{i.html(t)}catch(n){i[0].styleSheet.cssText=t}return i},b={clickToHide:!0,autoHide:!0,autoHideDelay:5e3,arrowShow:!0,arrowSize:5,elementPosition:"bottom",globalPosition:"top right",style:"bootstrap",className:"error",showAnimation:"slideDown",showDuration:400,hideAnimation:"slideUp",hideDuration:200,gap:5},d=function(t,i){var n;return n=function(){},n.prototype=t,$.extend(!0,new n,i)},a=function(t){return $.extend(b,t)},s=function(t){return $("<"+t+">"+t+">")},c={},l=function(t){var i;return t.is("[type=radio]")&&(i=t.parents("form:first").find("[type=radio]").filter(function(i,n){return $(n).attr("name")===t.attr("name")}),t=i.first()),t},u=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=v[m[i.charAt(0)]],r=i,t[o]!==n&&(i=v[o.charAt(0)],e=-e),t[i]===n?t[i]=e:t[i]+=e,null},x=function(t,i,n){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return n/2-i/2;if("r"===t||"b"===t)return n-i;throw"Invalid alignment"},e=function(){function t(t,i,n){"string"==typeof n&&(n={className:n}),this.options=d(b,$.isPlainObject(n)?n:{}),this.loadHTML(),this.wrapper=$(r.html),this.wrapper.data(g,this),this.arrow=this.wrapper.find("."+g+"-arrow"),this.container=this.wrapper.find("."+g+"-container"),this.container.append(this.userContainer),t&&t.length&&(this.elementType=t.attr("type"),this.originalElement=t,this.elem=l(t),this.elem.data(g,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=$(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(""+g+"-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.arrow),e=[],a&&t)s="show";else if(a&&!t)s="hide";else if(!a&&t)s=this.options.showAnimation,e.push(this.options.showDuration);else{if(a||t)return o();s=this.options.hideAnimation,e.push(this.options.hideDuration)}return e.push(o),r[s].apply(r,e)},t.prototype.setGlobalPosition=function(){var t,i,n,e,o,r,a,l;return l=this.getPosition(),a=l[0],r=l[1],o=v[a],t=v[r],e=a+"|"+r,i=c[e],i||(i=c[e]=s("div"),n={},n[o]=0,"middle"===t?n.top="45%":"center"===t?n.left="45%":n[t]=0,i.css(n).addClass(""+g+"-corner"),$("body").append(i)),i.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,i,e,o,r,s,a,l,h,c,d,A,w,g,y,b,C,E,M,D,T,k,F,z,B,Q,R,U,P;for(F=this.getPosition(),D=F[0],E=F[1],M=F[2],d=this.elem.position(),l=this.elem.outerHeight(),A=this.elem.outerWidth(),h=this.elem.innerHeight(),c=this.elem.innerWidth(),z=this.wrapper.position(),r=this.container.height(),s=this.container.width(),g=v[D],b=m[D],C=v[b],a={},a[C]="b"===D?l:"r"===D?A:0,u(a,"top",d.top-z.top),u(a,"left",d.left-z.left),P=["top","left"],B=0,R=P.length;R>B;B++)T=P[B],y=parseInt(this.elem.css("margin-"+T),10),y&&u(a,T,y);if(w=Math.max(0,this.options.gap-(this.options.arrowShow?e:0)),u(a,C,w),this.options.arrowShow){for(e=this.options.arrowSize,i=$.extend({},a),t=this.userContainer.css("border-color")||this.userContainer.css("background-color")||"white",Q=0,U=f.length;U>Q;Q++)T=f[Q],k=v[T],T!==b&&(o=k===g?t:"transparent",i["border-"+k]=""+e+"px solid "+o);u(a,v[b],e),H.call(f,E)>=0&&u(i,v[E],2*e)}else this.arrow.hide();return H.call(S,D)>=0?(u(a,"left",x(E,s,A)),i&&u(i,"left",x(E,e,c))):H.call(p,D)>=0&&(u(a,"top",x(E,r,l)),i&&u(i,"top",x(E,e,h))),this.container.is(":visible")&&(a.display="block"),this.container.removeAttr("style").css(a),i?this.arrow.removeAttr("style").css(i):n},t.prototype.getPosition=function(){var t,i,n,e,o,r,s,a;if(i=this.options.position||(this.elem?this.options.elementPosition:this.options.globalPosition),t=w(i),0===t.length&&(t[0]="b"),n=t[0],0>H.call(f,n))throw"Must be one of ["+f+"]";return(1===t.length||(e=t[0],H.call(S,e)>=0&&(o=t[1],0>H.call(p,o)))||(r=t[0],H.call(p,r)>=0&&(s=t[1],0>H.call(S,s))))&&(t[1]=(a=t[0],H.call(p,a)>=0?"m":"l")),2===t.length&&(t[2]=t[1]),t},t.prototype.getStyle=function(t){var i;if(t||(t=this.options.style),t||(t="default"),i=E[t],!i)throw"Missing style: "+t;return i},t.prototype.updateClasses=function(){var t,i;return t=["base"],$.isArray(this.options.className)?t=t.concat(this.options.className):this.options.className&&t.push(this.options.className),i=this.getStyle(),t=$.map(t,function(t){return""+g+"-"+i.name+"-"+t}).join(" "),this.userContainer.attr("class",t)},t.prototype.run=function(t,i){var e=this;return $.isPlainObject(i)?$.extend(this.options,i):"string"===$.type(i)&&(this.options.color=i),this.container&&!t?(this.show(!1),n):this.container||t?(this.text[this.rawHTML?"html":"text"](t),this.updateClasses(),this.elem?this.setElementPosition():this.setGlobalPosition(),this.show(!0),this.options.autoHide?(clearTimeout(this.autohideTimer),this.autohideTimer=setTimeout(function(){return e.show(!1)},this.options.autoHideDelay)):n):n},t.prototype.destroy=function(){return this.wrapper.remove()},t}(),$[y]=function(t,i,n){return t&&t.nodeName||t.jquery?$(t)[y](i,n):(n=i,i=t,new e(null,i,n)),t},$.fn[y]=function(t,i){return $(this).each(function(){var n;return n=l($(this)).data(g),n?n.run(t,i):new e($(this),t,i)}),this},$.extend($[y],{defaults:a,addStyle:o,pluginOptions:b,getStyle:h,insertCSS:A}),$(function(){return A(r.css).attr("id","core-notify"),$(i).on("click notify-hide","."+g+"-wrapper",function(t){var i;return i=$(this).data(g),i&&(i.options.clickToHide||"notify-hide"===t.type)?i.show(!1):n})})})(window,document),$.notify.addStyle("bootstrap",{html:"\n\n
",classes:{base:{"font-weight":"bold",padding:"8px 15px 8px 14px","text-shadow":"0 1px 0 rgba(255, 255, 255, 0.5)","background-color":"#fcf8e3",border:"1px solid #fbeed5","border-radius":"4px","white-space":"nowrap","padding-left":"25px","background-repeat":"no-repeat","background-position":"3px 7px"},error:{color:"#B94A48","background-color":"#F2DEDE","border-color":"#EED3D7","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=)"},success:{color:"#468847","background-color":"#DFF0D8","border-color":"#D6E9C6","background-image":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"},info:{color:"#3A87AD","background-color":"#D9EDF7","border-color":"#BCE8F1","background-image":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"},warn:{color:"#C09853","background-color":"#FCF8E3","border-color":"#FBEED5","background-image":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"}}});
\ No newline at end of file
+(function(t,i,e){"use strict";var n,o,r,s,a,l,h,c,p,u,d,A,f,m,w,g,y,b,v,x,C,E,S,H,M=[].indexOf||function(t){for(var i=0,e=this.length;e>i;i++)if(i in this&&this[i]===t)return i;return-1};b="notify",y=b+"js",x={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},u=["l","c","r"],H=["t","m","b"],m=["t","b","l","r"],w={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},g=function(t){var i;return i=[],$.each(t.split(/\W+/),function(t,n){var o;return o=n.toLowerCase().charAt(0),x[o]?i.push(o):e}),i},S={},r={name:"core",html:'',css:"."+y+"-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n."+y+"-corner ."+y+"-wrapper,\n."+y+"-corner ."+y+"-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n."+y+"-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n."+y+"-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n."+y+"-text {\n position: relative;\n}\n\n."+y+"-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"},E={"border-radius":["-webkit-","-moz-"]},c=function(t){return S[t]},o=function(i,n){var o,r;if(!i)throw"Missing Style name";if(!n)throw"Missing Style definition";return(null!=(r=S[i])?r.cssElem:void 0)&&(t.console&&console.warn(""+b+": overwriting style '"+i+"'"),S[i].cssElem.remove()),n.name=i,S[i]=n,o="",n.classes&&$.each(n.classes,function(t,i){return o+="."+y+"-"+n.name+"-"+t+" {\n",$.each(i,function(t,i){return E[t]&&$.each(E[t],function(e,n){return o+=" "+n+t+": "+i+";\n"}),o+=" "+t+": "+i+";\n"}),o+="}\n"}),n.css&&(o+="/* styles for "+n.name+" */\n"+n.css),o?(n.cssElem=f(o),n.cssElem.attr("id","notify-"+n.name)):e},f=function(t){var i;i=s("style"),i.attr("type","text/css"),$("head").append(i);try{i.html(t)}catch(e){i[0].styleSheet.cssText=t}return i},v={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},A=function(t,i){var e;return e=function(){},e.prototype=t,$.extend(!0,new e,i)},a=function(t){return $.extend(v,t)},s=function(t){return $("<"+t+">"+t+">")},p={},h=function(t){var i;return t.is("[type=radio]")&&(i=t.parents("form:first").find("[type=radio]").filter(function(i,e){return $(e).attr("name")===t.attr("name")}),t=i.first()),t},d=function(t,i,n){var o,r;if("string"==typeof n)n=parseInt(n,10);else if("number"!=typeof n)return;if(!isNaN(n))return o=x[w[i.charAt(0)]],r=i,t[o]!==e&&(i=x[o.charAt(0)],n=-n),t[i]===e?t[i]=n:t[i]+=n,null},C=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||s("div"),l.e.text(t).html()},n=function(){function t(t,i,e){"string"==typeof e&&(e={className:e}),this.options=A(v,$.isPlainObject(e)?e:{}),this.loadHTML(),this.wrapper=$(r.html),this.wrapper.data(y,this),this.arrow=this.wrapper.find("."+y+"-arrow"),this.container=this.wrapper.find("."+y+"-container"),this.container.append(this.userContainer),t&&t.length&&(this.elementType=t.attr("type"),this.originalElement=t,this.elem=h(t),this.elem.data(y,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=$(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(""+y+"-text")},t.prototype.show=function(t,i){var n,o,r,s,a,l=this;if(o=function(){return t||l.elem||l.destroy(),i?i():e},a=this.container.parent().parents(":hidden").length>0,r=this.container.add(this.arrow),n=[],a&&t)s="show";else if(a&&!t)s="hide";else if(!a&&t)s=this.options.showAnimation,n.push(this.options.showDuration);else{if(a||t)return o();s=this.options.hideAnimation,n.push(this.options.hideDuration)}return n.push(o),r[s].apply(r,n)},t.prototype.setGlobalPosition=function(){var t,i,e,n,o,r,a,l;return l=this.getPosition(),a=l[0],r=l[1],o=x[a],t=x[r],n=a+"|"+r,i=p[n],i||(i=p[n]=s("div"),e={},e[o]=0,"middle"===t?e.top="45%":"center"===t?e.left="45%":e[t]=0,i.css(e).addClass(""+y+"-corner"),$("body").append(i)),i.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,i,n,o,r,s,a,l,h,c,p,A,f,g,y,b,v,E,S,D,k,T,F,z,B,Q,R,U,N;for(F=this.getPosition(),D=F[0],E=F[1],S=F[2],p=this.elem.position(),l=this.elem.outerHeight(),A=this.elem.outerWidth(),h=this.elem.innerHeight(),c=this.elem.innerWidth(),z=this.wrapper.position(),r=this.container.height(),s=this.container.width(),g=x[D],b=w[D],v=x[b],a={},a[v]="b"===D?l:"r"===D?A:0,d(a,"top",p.top-z.top),d(a,"left",p.left-z.left),N=["top","left"],B=0,R=N.length;R>B;B++)k=N[B],y=parseInt(this.elem.css("margin-"+k),10),y&&d(a,k,y);if(f=Math.max(0,this.options.gap-(this.options.arrowShow?n:0)),d(a,v,f),this.options.arrowShow){for(n=this.options.arrowSize,i=$.extend({},a),t=this.userContainer.css("border-color")||this.userContainer.css("background-color")||"white",Q=0,U=m.length;U>Q;Q++)k=m[Q],T=x[k],k!==b&&(o=T===g?t:"transparent",i["border-"+T]=""+n+"px solid "+o);d(a,x[b],n),M.call(m,E)>=0&&d(i,x[E],2*n)}else this.arrow.hide();return M.call(H,D)>=0?(d(a,"left",C(E,s,A)),i&&d(i,"left",C(E,n,c))):M.call(u,D)>=0&&(d(a,"top",C(E,r,l)),i&&d(i,"top",C(E,n,h))),this.container.is(":visible")&&(a.display="block"),this.container.removeAttr("style").css(a),i?this.arrow.removeAttr("style").css(i):e},t.prototype.getPosition=function(){var t,i,e,n,o,r,s,a;if(i=this.options.position||(this.elem?this.options.elementPosition:this.options.globalPosition),t=g(i),0===t.length&&(t[0]="b"),e=t[0],0>M.call(m,e))throw"Must be one of ["+m+"]";return(1===t.length||(n=t[0],M.call(H,n)>=0&&(o=t[1],0>M.call(u,o)))||(r=t[0],M.call(u,r)>=0&&(s=t[1],0>M.call(H,s))))&&(t[1]=(a=t[0],M.call(u,a)>=0?"m":"l")),2===t.length&&(t[2]=t[1]),t},t.prototype.getStyle=function(t){var i;if(t||(t=this.options.style),t||(t="default"),i=S[t],!i)throw"Missing style: "+t;return i},t.prototype.updateClasses=function(){var t,i;return t=["base"],$.isArray(this.options.className)?t=t.concat(this.options.className):this.options.className&&t.push(this.options.className),i=this.getStyle(),t=$.map(t,function(t){return""+y+"-"+i.name+"-"+t}).join(" "),this.userContainer.attr("class",t)},t.prototype.run=function(t,i){var n=this;return $.isPlainObject(i)?$.extend(this.options,i):"string"===$.type(i)&&(this.options.color=i),this.container&&!t?(this.show(!1),e):this.container||t?(this.rawHTML||(t=l(t),this.options.breakNewLines&&(t=t.replace(/\n/,"
"))),this.text.html(t),this.updateClasses(),this.elem?this.setElementPosition():this.setGlobalPosition(),this.show(!0),this.options.autoHide?(clearTimeout(this.autohideTimer),this.autohideTimer=setTimeout(function(){return n.show(!1)},this.options.autoHideDelay)):e):e},t.prototype.destroy=function(){return this.wrapper.remove()},t}(),$[b]=function(t,i,e){return t&&t.nodeName||t.jquery?$(t)[b](i,e):(e=i,i=t,new n(null,i,e)),t},$.fn[b]=function(t,i){return $(this).each(function(){var e;return e=h($(this)).data(y),e?e.run(t,i):new n($(this),t,i)}),this},$.extend($[b],{defaults:a,addStyle:o,pluginOptions:v,getStyle:c,insertCSS:f}),$(function(){return f(r.css).attr("id","core-notify"),$(i).on("click notify-hide","."+y+"-wrapper",function(t){var i;return i=$(this).data(y),i&&(i.options.clickToHide||"notify-hide"===t.type)?i.show(!1):e})})})(window,document),$.notify.addStyle("bootstrap",{html:"\n\n
",classes:{base:{"font-weight":"bold",padding:"8px 15px 8px 14px","text-shadow":"0 1px 0 rgba(255, 255, 255, 0.5)","background-color":"#fcf8e3",border:"1px solid #fbeed5","border-radius":"4px","white-space":"nowrap","padding-left":"25px","background-repeat":"no-repeat","background-position":"3px 7px"},error:{color:"#B94A48","background-color":"#F2DEDE","border-color":"#EED3D7","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=)"},success:{color:"#468847","background-color":"#DFF0D8","border-color":"#D6E9C6","background-image":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"},info:{color:"#3A87AD","background-color":"#D9EDF7","border-color":"#BCE8F1","background-image":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"},warn:{color:"#C09853","background-color":"#FCF8E3","border-color":"#FBEED5","background-image":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"}}});
\ No newline at end of file
diff --git a/dist/notify.js b/dist/notify.js
index f75369f..d5b95a3 100644
--- a/dist/notify.js
+++ b/dist/notify.js
@@ -1,11 +1,11 @@
-/** Notify.js - v0.0.1 - 2013/06/12
+/** Notify.js - v0.0.1 - 2013/06/14
* http://notifyjs.com/
* Copyright (c) 2013 Jaime Pillora - MIT
*/
(function(window,document,undefined) {
'use strict';
-var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
+var Notification, addStyle, coreStyle, createElem, defaults, encode, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
pluginName = 'notify';
@@ -125,6 +125,7 @@ pluginOptions = {
autoHideDelay: 5000,
arrowShow: true,
arrowSize: 5,
+ breakNewLines: true,
elementPosition: 'bottom',
globalPosition: 'top right',
style: 'bootstrap',
@@ -199,6 +200,11 @@ realign = function(alignment, inner, outer) {
throw "Invalid alignment";
};
+encode = function(text) {
+ encode.e = encode.e || createElem("div");
+ return encode.e.text(text).html();
+};
+
Notification = (function() {
function Notification(elem, data, options) {
@@ -427,7 +433,13 @@ Notification = (function() {
} else if (!this.container && !data) {
return;
}
- this.text[this.rawHTML ? 'html' : 'text'](data);
+ if (!this.rawHTML) {
+ data = encode(data);
+ if (this.options.breakNewLines) {
+ data = data.replace(/\n/, '
');
+ }
+ }
+ this.text.html(data);
this.updateClasses();
if (this.elem) {
this.setElementPosition();
diff --git a/dist/notify.min.js b/dist/notify.min.js
index 88493ac..6f91db8 100644
--- a/dist/notify.min.js
+++ b/dist/notify.min.js
@@ -1,5 +1,5 @@
-/** Notify.js - v0.0.1 - 2013/06/12
+/** Notify.js - v0.0.1 - 2013/06/14
* http://notifyjs.com/
* Copyright (c) 2013 Jaime Pillora - MIT
*/
-(function(t,i,n){"use strict";var e,o,r,s,a,h,l,c,p,u,d,f,m,w,y,g,v,b,x,S,C,H,P,T=[].indexOf||function(t){for(var i=0,n=this.length;n>i;i++)if(i in this&&this[i]===t)return i;return-1};v="notify",g=v+"js",x={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},p=["l","c","r"],P=["t","m","b"],m=["t","b","l","r"],w={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},y=function(t){var i;return i=[],$.each(t.split(/\W+/),function(t,e){var o;return o=e.toLowerCase().charAt(0),x[o]?i.push(o):n}),i},H={},r={name:"core",html:'',css:"."+g+"-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n."+g+"-corner ."+g+"-wrapper,\n."+g+"-corner ."+g+"-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n."+g+"-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n."+g+"-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n."+g+"-text {\n position: relative;\n}\n\n."+g+"-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"},C={"border-radius":["-webkit-","-moz-"]},l=function(t){return H[t]},o=function(i,e){var o,r;if(!i)throw"Missing Style name";if(!e)throw"Missing Style definition";return(null!=(r=H[i])?r.cssElem:void 0)&&(t.console&&console.warn(""+v+": overwriting style '"+i+"'"),H[i].cssElem.remove()),e.name=i,H[i]=e,o="",e.classes&&$.each(e.classes,function(t,i){return o+="."+g+"-"+e.name+"-"+t+" {\n",$.each(i,function(t,i){return C[t]&&$.each(C[t],function(n,e){return o+=" "+e+t+": "+i+";\n"}),o+=" "+t+": "+i+";\n"}),o+="}\n"}),e.css&&(o+="/* styles for "+e.name+" */\n"+e.css),o?(e.cssElem=f(o),e.cssElem.attr("id","notify-"+e.name)):n},f=function(t){var i;i=s("style"),i.attr("type","text/css"),$("head").append(i);try{i.html(t)}catch(n){i[0].styleSheet.cssText=t}return i},b={clickToHide:!0,autoHide:!0,autoHideDelay:5e3,arrowShow:!0,arrowSize:5,elementPosition:"bottom",globalPosition:"top right",style:"bootstrap",className:"error",showAnimation:"slideDown",showDuration:400,hideAnimation:"slideUp",hideDuration:200,gap:5},d=function(t,i){var n;return n=function(){},n.prototype=t,$.extend(!0,new n,i)},a=function(t){return $.extend(b,t)},s=function(t){return $("<"+t+">"+t+">")},c={},h=function(t){var i;return t.is("[type=radio]")&&(i=t.parents("form:first").find("[type=radio]").filter(function(i,n){return $(n).attr("name")===t.attr("name")}),t=i.first()),t},u=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=x[w[i.charAt(0)]],r=i,t[o]!==n&&(i=x[o.charAt(0)],e=-e),t[i]===n?t[i]=e:t[i]+=e,null},S=function(t,i,n){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return n/2-i/2;if("r"===t||"b"===t)return n-i;throw"Invalid alignment"},e=function(){function t(t,i,n){"string"==typeof n&&(n={className:n}),this.options=d(b,$.isPlainObject(n)?n:{}),this.loadHTML(),this.wrapper=$(r.html),this.wrapper.data(g,this),this.arrow=this.wrapper.find("."+g+"-arrow"),this.container=this.wrapper.find("."+g+"-container"),this.container.append(this.userContainer),t&&t.length&&(this.elementType=t.attr("type"),this.originalElement=t,this.elem=h(t),this.elem.data(g,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=$(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(""+g+"-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.arrow),e=[],a&&t)s="show";else if(a&&!t)s="hide";else if(!a&&t)s=this.options.showAnimation,e.push(this.options.showDuration);else{if(a||t)return o();s=this.options.hideAnimation,e.push(this.options.hideDuration)}return e.push(o),r[s].apply(r,e)},t.prototype.setGlobalPosition=function(){var t,i,n,e,o,r,a,h;return h=this.getPosition(),a=h[0],r=h[1],o=x[a],t=x[r],e=a+"|"+r,i=c[e],i||(i=c[e]=s("div"),n={},n[o]=0,"middle"===t?n.top="45%":"center"===t?n.left="45%":n[t]=0,i.css(n).addClass(""+g+"-corner"),$("body").append(i)),i.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,i,e,o,r,s,a,h,l,c,d,f,y,g,v,b,C,H,A,M,N,k,z,D,E,L,j,O,I;for(z=this.getPosition(),M=z[0],H=z[1],A=z[2],d=this.elem.position(),h=this.elem.outerHeight(),f=this.elem.outerWidth(),l=this.elem.innerHeight(),c=this.elem.innerWidth(),D=this.wrapper.position(),r=this.container.height(),s=this.container.width(),g=x[M],b=w[M],C=x[b],a={},a[C]="b"===M?h:"r"===M?f:0,u(a,"top",d.top-D.top),u(a,"left",d.left-D.left),I=["top","left"],E=0,j=I.length;j>E;E++)N=I[E],v=parseInt(this.elem.css("margin-"+N),10),v&&u(a,N,v);if(y=Math.max(0,this.options.gap-(this.options.arrowShow?e:0)),u(a,C,y),this.options.arrowShow){for(e=this.options.arrowSize,i=$.extend({},a),t=this.userContainer.css("border-color")||this.userContainer.css("background-color")||"white",L=0,O=m.length;O>L;L++)N=m[L],k=x[N],N!==b&&(o=k===g?t:"transparent",i["border-"+k]=""+e+"px solid "+o);u(a,x[b],e),T.call(m,H)>=0&&u(i,x[H],2*e)}else this.arrow.hide();return T.call(P,M)>=0?(u(a,"left",S(H,s,f)),i&&u(i,"left",S(H,e,c))):T.call(p,M)>=0&&(u(a,"top",S(H,r,h)),i&&u(i,"top",S(H,e,l))),this.container.is(":visible")&&(a.display="block"),this.container.removeAttr("style").css(a),i?this.arrow.removeAttr("style").css(i):n},t.prototype.getPosition=function(){var t,i,n,e,o,r,s,a;if(i=this.options.position||(this.elem?this.options.elementPosition:this.options.globalPosition),t=y(i),0===t.length&&(t[0]="b"),n=t[0],0>T.call(m,n))throw"Must be one of ["+m+"]";return(1===t.length||(e=t[0],T.call(P,e)>=0&&(o=t[1],0>T.call(p,o)))||(r=t[0],T.call(p,r)>=0&&(s=t[1],0>T.call(P,s))))&&(t[1]=(a=t[0],T.call(p,a)>=0?"m":"l")),2===t.length&&(t[2]=t[1]),t},t.prototype.getStyle=function(t){var i;if(t||(t=this.options.style),t||(t="default"),i=H[t],!i)throw"Missing style: "+t;return i},t.prototype.updateClasses=function(){var t,i;return t=["base"],$.isArray(this.options.className)?t=t.concat(this.options.className):this.options.className&&t.push(this.options.className),i=this.getStyle(),t=$.map(t,function(t){return""+g+"-"+i.name+"-"+t}).join(" "),this.userContainer.attr("class",t)},t.prototype.run=function(t,i){var e=this;return $.isPlainObject(i)?$.extend(this.options,i):"string"===$.type(i)&&(this.options.color=i),this.container&&!t?(this.show(!1),n):this.container||t?(this.text[this.rawHTML?"html":"text"](t),this.updateClasses(),this.elem?this.setElementPosition():this.setGlobalPosition(),this.show(!0),this.options.autoHide?(clearTimeout(this.autohideTimer),this.autohideTimer=setTimeout(function(){return e.show(!1)},this.options.autoHideDelay)):n):n},t.prototype.destroy=function(){return this.wrapper.remove()},t}(),$[v]=function(t,i,n){return t&&t.nodeName||t.jquery?$(t)[v](i,n):(n=i,i=t,new e(null,i,n)),t},$.fn[v]=function(t,i){return $(this).each(function(){var n;return n=h($(this)).data(g),n?n.run(t,i):new e($(this),t,i)}),this},$.extend($[v],{defaults:a,addStyle:o,pluginOptions:b,getStyle:l,insertCSS:f}),$(function(){return f(r.css).attr("id","core-notify"),$(i).on("click notify-hide","."+g+"-wrapper",function(t){var i;return i=$(this).data(g),i&&(i.options.clickToHide||"notify-hide"===t.type)?i.show(!1):n})})})(window,document);
\ No newline at end of file
+(function(t,i,n){"use strict";var e,o,r,s,a,h,l,c,p,u,d,f,m,w,y,g,b,v,x,S,C,H,P,T,N=[].indexOf||function(t){for(var i=0,n=this.length;n>i;i++)if(i in this&&this[i]===t)return i;return-1};v="notify",b=v+"js",S={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},u=["l","c","r"],T=["t","m","b"],w=["t","b","l","r"],y={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},g=function(t){var i;return i=[],$.each(t.split(/\W+/),function(t,e){var o;return o=e.toLowerCase().charAt(0),S[o]?i.push(o):n}),i},P={},r={name:"core",html:'',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}"},H={"border-radius":["-webkit-","-moz-"]},c=function(t){return P[t]},o=function(i,e){var o,r;if(!i)throw"Missing Style name";if(!e)throw"Missing Style definition";return(null!=(r=P[i])?r.cssElem:void 0)&&(t.console&&console.warn(""+v+": overwriting style '"+i+"'"),P[i].cssElem.remove()),e.name=i,P[i]=e,o="",e.classes&&$.each(e.classes,function(t,i){return o+="."+b+"-"+e.name+"-"+t+" {\n",$.each(i,function(t,i){return H[t]&&$.each(H[t],function(n,e){return o+=" "+e+t+": "+i+";\n"}),o+=" "+t+": "+i+";\n"}),o+="}\n"}),e.css&&(o+="/* styles for "+e.name+" */\n"+e.css),o?(e.cssElem=m(o),e.cssElem.attr("id","notify-"+e.name)):n},m=function(t){var i;i=s("style"),i.attr("type","text/css"),$("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,$.extend(!0,new n,i)},a=function(t){return $.extend(x,t)},s=function(t){return $("<"+t+">"+t+">")},p={},l=function(t){var i;return t.is("[type=radio]")&&(i=t.parents("form:first").find("[type=radio]").filter(function(i,n){return $(n).attr("name")===t.attr("name")}),t=i.first()),t},d=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=S[y[i.charAt(0)]],r=i,t[o]!==n&&(i=S[o.charAt(0)],e=-e),t[i]===n?t[i]=e:t[i]+=e,null},C=function(t,i,n){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return n/2-i/2;if("r"===t||"b"===t)return n-i;throw"Invalid alignment"},h=function(t){return h.e=h.e||s("div"),h.e.text(t).html()},e=function(){function t(t,i,n){"string"==typeof n&&(n={className:n}),this.options=f(x,$.isPlainObject(n)?n:{}),this.loadHTML(),this.wrapper=$(r.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=l(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=$(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,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.arrow),e=[],a&&t)s="show";else if(a&&!t)s="hide";else if(!a&&t)s=this.options.showAnimation,e.push(this.options.showDuration);else{if(a||t)return o();s=this.options.hideAnimation,e.push(this.options.hideDuration)}return e.push(o),r[s].apply(r,e)},t.prototype.setGlobalPosition=function(){var t,i,n,e,o,r,a,h;return h=this.getPosition(),a=h[0],r=h[1],o=S[a],t=S[r],e=a+"|"+r,i=p[e],i||(i=p[e]=s("div"),n={},n[o]=0,"middle"===t?n.top="45%":"center"===t?n.left="45%":n[t]=0,i.css(n).addClass(""+b+"-corner"),$("body").append(i)),i.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,i,e,o,r,s,a,h,l,c,p,f,m,g,b,v,x,H,P,k,A,M,L,z,D,E,j,O,I;for(L=this.getPosition(),k=L[0],H=L[1],P=L[2],p=this.elem.position(),h=this.elem.outerHeight(),f=this.elem.outerWidth(),l=this.elem.innerHeight(),c=this.elem.innerWidth(),z=this.wrapper.position(),r=this.container.height(),s=this.container.width(),g=S[k],v=y[k],x=S[v],a={},a[x]="b"===k?h:"r"===k?f:0,d(a,"top",p.top-z.top),d(a,"left",p.left-z.left),I=["top","left"],D=0,j=I.length;j>D;D++)A=I[D],b=parseInt(this.elem.css("margin-"+A),10),b&&d(a,A,b);if(m=Math.max(0,this.options.gap-(this.options.arrowShow?e:0)),d(a,x,m),this.options.arrowShow){for(e=this.options.arrowSize,i=$.extend({},a),t=this.userContainer.css("border-color")||this.userContainer.css("background-color")||"white",E=0,O=w.length;O>E;E++)A=w[E],M=S[A],A!==v&&(o=M===g?t:"transparent",i["border-"+M]=""+e+"px solid "+o);d(a,S[v],e),N.call(w,H)>=0&&d(i,S[H],2*e)}else this.arrow.hide();return N.call(T,k)>=0?(d(a,"left",C(H,s,f)),i&&d(i,"left",C(H,e,c))):N.call(u,k)>=0&&(d(a,"top",C(H,r,h)),i&&d(i,"top",C(H,e,l))),this.container.is(":visible")&&(a.display="block"),this.container.removeAttr("style").css(a),i?this.arrow.removeAttr("style").css(i):n},t.prototype.getPosition=function(){var t,i,n,e,o,r,s,a;if(i=this.options.position||(this.elem?this.options.elementPosition:this.options.globalPosition),t=g(i),0===t.length&&(t[0]="b"),n=t[0],0>N.call(w,n))throw"Must be one of ["+w+"]";return(1===t.length||(e=t[0],N.call(T,e)>=0&&(o=t[1],0>N.call(u,o)))||(r=t[0],N.call(u,r)>=0&&(s=t[1],0>N.call(T,s))))&&(t[1]=(a=t[0],N.call(u,a)>=0?"m":"l")),2===t.length&&(t[2]=t[1]),t},t.prototype.getStyle=function(t){var i;if(t||(t=this.options.style),t||(t="default"),i=P[t],!i)throw"Missing style: "+t;return i},t.prototype.updateClasses=function(){var t,i;return t=["base"],$.isArray(this.options.className)?t=t.concat(this.options.className):this.options.className&&t.push(this.options.className),i=this.getStyle(),t=$.map(t,function(t){return""+b+"-"+i.name+"-"+t}).join(" "),this.userContainer.attr("class",t)},t.prototype.run=function(t,i){var e=this;return $.isPlainObject(i)?$.extend(this.options,i):"string"===$.type(i)&&(this.options.color=i),this.container&&!t?(this.show(!1),n):this.container||t?(this.rawHTML||(t=h(t),this.options.breakNewLines&&(t=t.replace(/\n/,"
"))),this.text.html(t),this.updateClasses(),this.elem?this.setElementPosition():this.setGlobalPosition(),this.show(!0),this.options.autoHide?(clearTimeout(this.autohideTimer),this.autohideTimer=setTimeout(function(){return e.show(!1)},this.options.autoHideDelay)):n):n},t.prototype.destroy=function(){return this.wrapper.remove()},t}(),$[v]=function(t,i,n){return t&&t.nodeName||t.jquery?$(t)[v](i,n):(n=i,i=t,new e(null,i,n)),t},$.fn[v]=function(t,i){return $(this).each(function(){var n;return n=l($(this)).data(b),n?n.run(t,i):new e($(this),t,i)}),this},$.extend($[v],{defaults:a,addStyle:o,pluginOptions:x,getStyle:c,insertCSS:m}),$(function(){return m(r.css).attr("id","core-notify"),$(i).on("click notify-hide","."+b+"-wrapper",function(t){var i;return i=$(this).data(b),i&&(i.options.clickToHide||"notify-hide"===t.type)?i.show(!1):n})})})(window,document);
\ No newline at end of file
diff --git a/src/notify.coffee b/src/notify.coffee
index 5ed6acd..f0f0cca 100644
--- a/src/notify.coffee
+++ b/src/notify.coffee
@@ -164,6 +164,7 @@ pluginOptions =
autoHideDelay: 5000
arrowShow: true
arrowSize: 5
+ breakNewLines: true
elementPosition: 'bottom'
globalPosition: 'top right'
style: 'bootstrap'
@@ -236,6 +237,9 @@ realign = (alignment, inner, outer) ->
outer - inner
throw "Invalid alignment"
+encode = (text) ->
+ encode.e = encode.e or createElem "div"
+ encode.e.text(text).html()
# ================================
# NOTIFY CLASS
@@ -471,8 +475,12 @@ class Notification
else if not @container and not data
return
+ #escape
+ unless @rawHTML
+ data = encode(data)
+ data = data.replace(/\n/,'
') if @options.breakNewLines
#update content
- @text[if @rawHTML then 'html' else 'text'](data)
+ @text.html(data)
#set styles
@updateClasses()