minor fixes
This commit is contained in:
1 parent
74c55d476e
commit
00013d1865
6 files changed
+17
-17
No files matched your search
+3
-3
@@ -28,8 +28,8 @@ module.exports = (grunt) ->
|
||||
src: 'dist/<%= pkg.name %>.js'
|
||||
dest: '.'
|
||||
wrapper: [
|
||||
"<%= banner %>(function(window,document,undefined) {\n"
|
||||
"\n}(window,document));"
|
||||
"<%= banner %>(function(window,document,$,undefined) {\n"
|
||||
"\n}(window,document,jQuery));"
|
||||
]
|
||||
|
||||
concat:
|
||||
@@ -58,7 +58,7 @@ module.exports = (grunt) ->
|
||||
grunt.loadNpmTasks "grunt-contrib-concat"
|
||||
grunt.loadNpmTasks "grunt-contrib-watch"
|
||||
grunt.loadNpmTasks "grunt-contrib-uglify"
|
||||
grunt.loadTasks "./node_modules/grunt-contrib-coffee/tasks"
|
||||
grunt.loadNpmTasks "grunt-contrib-coffee"
|
||||
grunt.loadNpmTasks "grunt-wrap"
|
||||
|
||||
# Default task.
|
||||
|
||||
Vendored
+4
-4
@@ -1,8 +1,8 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/14
|
||||
/** Notify.js - v0.0.1 - 2013/06/21
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(window,document,undefined) {
|
||||
(function(window,document,$,undefined) {
|
||||
'use strict';
|
||||
|
||||
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,
|
||||
@@ -436,7 +436,7 @@ Notification = (function() {
|
||||
if (!this.rawHTML) {
|
||||
data = encode(data);
|
||||
if (this.options.breakNewLines) {
|
||||
data = data.replace(/\n/, '<br/>');
|
||||
data = data.replace(/\n/g, '<br/>');
|
||||
}
|
||||
}
|
||||
this.text.html(data);
|
||||
@@ -506,7 +506,7 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
}(window,document));
|
||||
}(window,document,jQuery));
|
||||
|
||||
$.notify.addStyle("bootstrap", {
|
||||
html: "<div>\n<span data-notify-text></span>\n</div>",
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/14
|
||||
/** Notify.js - v0.0.1 - 2013/06/21
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(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:'<div class="'+y+'-wrapper">\n <div class="'+y+'-arrow"></div>\n <div class="'+y+'-container"></div>\n</div>',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]Line truncated
|
||||
(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.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,o,r,s,l,h;return h=this.getPosition(),l=h[0],s=h[1],r=C[l],t=C[s],o=l+"|"+s,i=u[o],i||(i=u[o]=a("div"),n={},n[r]=0,"middle"===t?n.top="45%":"center"===t?n.left="45%":n[t]=0,i.css(n).addClass(""+b+"-corner"),e("body").append(i)),i.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,i,o,r,s,a,l,h,c,p,u,f,m,y,b,v,x,S,H,k,T,F,z,Q,B,R,U,N,P;for(z=this.getPosition(),k=z[0],S=z[1],H=z[2],u=this.elem.position(),h=this.elem.outerHeight(),f=this.elem.outerWidth(),c=this.elem.innerHeight(),p=this.elem.innerWidth(),Q=this.wrapper.position(),s=this.container.height(),a=this.container.width(),y=C[Line truncated
|
||||
Vendored
+4
-4
@@ -1,8 +1,8 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/14
|
||||
/** Notify.js - v0.0.1 - 2013/06/21
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(window,document,undefined) {
|
||||
(function(window,document,$,undefined) {
|
||||
'use strict';
|
||||
|
||||
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,
|
||||
@@ -436,7 +436,7 @@ Notification = (function() {
|
||||
if (!this.rawHTML) {
|
||||
data = encode(data);
|
||||
if (this.options.breakNewLines) {
|
||||
data = data.replace(/\n/, '<br/>');
|
||||
data = data.replace(/\n/g, '<br/>');
|
||||
}
|
||||
}
|
||||
this.text.html(data);
|
||||
@@ -506,4 +506,4 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
}(window,document));
|
||||
}(window,document,jQuery));
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/14
|
||||
/** Notify.js - v0.0.1 - 2013/06/21
|
||||
* 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,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:'<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}"},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]Line truncated
|
||||
(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.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,o,r,s,h,l;return l=this.getPosition(),h=l[0],s=l[1],r=C[h],t=C[s],o=h+"|"+s,i=u[o],i||(i=u[o]=a("div"),n={},n[r]=0,"middle"===t?n.top="45%":"center"===t?n.left="45%":n[t]=0,i.css(n).addClass(""+v+"-corner"),e("body").append(i)),i.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,i,o,r,s,a,h,l,c,p,u,m,w,b,v,x,S,P,T,A,M,L,z,D,E,j,O,I,W;for(z=this.getPosition(),A=z[0],P=z[1],T=z[2],u=this.elem.position(),l=this.elem.outerHeight(),m=this.elem.outerWidth(),c=this.elem.innerHeight(),p=this.elem.innerWidth(),D=this.wrapper.position(),s=this.container.height(),a=this.container.width(),b=C[Line truncated
|
||||
+2
-2
@@ -165,6 +165,7 @@ pluginOptions =
|
||||
arrowShow: true
|
||||
arrowSize: 5
|
||||
breakNewLines: true
|
||||
# autoReposition: true
|
||||
elementPosition: 'bottom'
|
||||
globalPosition: 'top right'
|
||||
style: 'bootstrap'
|
||||
@@ -191,7 +192,6 @@ defaults = (opts) ->
|
||||
createElem = (tag) ->
|
||||
$ "<#{tag}></#{tag}>"
|
||||
|
||||
|
||||
# references to global anchor positions
|
||||
globalAnchors = {}
|
||||
|
||||
@@ -478,7 +478,7 @@ class Notification
|
||||
#escape
|
||||
unless @rawHTML
|
||||
data = encode(data)
|
||||
data = data.replace(/\n/,'<br/>') if @options.breakNewLines
|
||||
data = data.replace(/\n/g,'<br/>') if @options.breakNewLines
|
||||
#update content
|
||||
@text.html(data)
|
||||
|
||||
|
||||
Reference in new issue
Block a user