minor fixes, doc updates
This commit is contained in:
1 parent
9bd9e58fec
commit
9275312b03
6 files changed
+49
-33
No files matched your search
Vendored
+8
-10
@@ -1,4 +1,4 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
/** Notify.js - v0.0.1 - 2013/06/12
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
@@ -109,6 +109,7 @@ addStyle = function(name, def) {
|
||||
insertCSS = function(cssText) {
|
||||
var elem;
|
||||
elem = createElem("style");
|
||||
elem.attr('type', 'text/css');
|
||||
$("head").append(elem);
|
||||
try {
|
||||
elem.html(cssText);
|
||||
@@ -119,6 +120,7 @@ insertCSS = function(cssText) {
|
||||
};
|
||||
|
||||
pluginOptions = {
|
||||
clickToHide: true,
|
||||
autoHide: true,
|
||||
autoHideDelay: 5000,
|
||||
arrowShow: true,
|
||||
@@ -477,21 +479,17 @@ $.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle,
|
||||
pluginOptions: pluginOptions,
|
||||
getStyle: getStyle
|
||||
getStyle: getStyle,
|
||||
insertCSS: insertCSS
|
||||
});
|
||||
|
||||
$(function() {
|
||||
insertCSS(coreStyle.css).attr('data-notify-style', 'core');
|
||||
return $(document).on('click', "." + pluginClassName + "-wrapper", function() {
|
||||
insertCSS(coreStyle.css).attr('id', 'core-notify');
|
||||
return $(document).on('click notify-hide', "." + pluginClassName + "-wrapper", function(e) {
|
||||
var inst;
|
||||
inst = $(this).data(pluginClassName);
|
||||
if (!inst) {
|
||||
return;
|
||||
}
|
||||
if (inst.elem) {
|
||||
if (inst && (inst.options.clickToHide || e.type === 'notify-hide')) {
|
||||
return inst.show(false);
|
||||
} else {
|
||||
return inst.destroy();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
/** Notify.js - v0.0.1 - 2013/06/12
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(t,n,i){"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,M=[].indexOf||function(t){for(var n=0,i=this.length;i>n;n++)if(n in this&&this[n]===t)return n;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 n;return n=[],$.each(t.split(/\W+/),function(t,e){var o;return o=e.toLowerCase().charAt(0),v[o]?n.push(o):i}),n},E={},r={name:"core",html:'<div class="'+g+'-wrapper">\n <div class="'+g+'-arrow"></div>\n <div class="'+g+'-container"></div>\n</div>',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(n,e){var o,r;if(!n)throw"Missing Style name";if(!e)throw"Missing Style definition";return(null!=(r=E[n])?r.cssElem:void 0)&&(t.console&&console.warn(""+y+": overwriting style '"+n+"'"),E[n].cssElem.remove()),e.name=n,E[n]=e,o="",e.classes&&$.each(e.classes,function(t,n){return o+="."+g+"-"+e.name+"-"+t+" {\n",$.each(n,function(t,n){return C[t]&&$.each(C[t],function(i,e){return o+=" "+e+t+": "+n+";\n"}),o+=" "+t+": "+n+";\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)):i},A=function(t){var n;n=s("style"),$("head").append(n);try{n.html(t)}catch(i){n[0].styleSheet.cssText=t}return n},b={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,n){var i;return i=function(){},i.prototype=t,$.extend(!0,new i,n)},a=function(t){return $.extend(b,t)},s=function(t){return $("<"+t+"></"+t+">")},c={},l=function(t){var n;return t.is("[type=radio]")&&(n=t.parents("form:first").find("[type=radio]").filter(function(n,i){return $(i).attr("name")===t.attr("name")}),t=n.first()),t},u=function(t,n,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[n.charAt(0)]],r=n,t[o]!==i&&(n=v[o.charAt(0)],e=-e),t[n]===i?t[n]=e:t[n]+=e,null},x=function(t,n,i){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return i/2-n/2;if("r"===t||"b"===t)return i-n;throw"Invalid alignment"},e=function(){function t(t,n,i){"string"==typeof i&&(i={className:i}),this.options=d(b,$.isPlainObject(i)?i:{}),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(n)}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,n){var e,o,r,s,a,l=this;if(o=function(){return t||l.elem||l.destroy(),n?n():i},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,n,i,e,o,r,a,l;return l=this.getPosition(),a=l[0],r=l[1],o=v[a],t=v[r],e=a+"|"+r,n=c[e],n||(n=c[e]=s("div"),i={},i[o]=0,"middle"===t?i.top="45%":"center"===t?i.left="45%":i[t]=0,n.css(i).addClass(""+g+"-corner"),$("body").append(n)),n.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,n,e,o,r,s,a,l,h,c,d,A,w,g,y,b,C,E,H,D,T,F,z,k,B,Q,R,U,P;for(z=this.getPosition(),D=z[0],E=z[1],H=z[2],d=this.elem.position(),l=this.elem.outerHeight(),A=this.elem.outerWidth(),h=this.elem.innerHeight(),c=this.elem.innerWidth(),k=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-k.top),u(a,"left",d.left-k.left),P=["top","left"],B=0,R=Line truncated
|
||||
(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:'<div class="'+g+'-wrapper">\n <div class="'+g+'-arrow"></div>\n <div class="'+g+'-container"></div>\n</div>',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,"lefLine truncated
|
||||
Vendored
+8
-10
@@ -1,4 +1,4 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
/** Notify.js - v0.0.1 - 2013/06/12
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
@@ -109,6 +109,7 @@ addStyle = function(name, def) {
|
||||
insertCSS = function(cssText) {
|
||||
var elem;
|
||||
elem = createElem("style");
|
||||
elem.attr('type', 'text/css');
|
||||
$("head").append(elem);
|
||||
try {
|
||||
elem.html(cssText);
|
||||
@@ -119,6 +120,7 @@ insertCSS = function(cssText) {
|
||||
};
|
||||
|
||||
pluginOptions = {
|
||||
clickToHide: true,
|
||||
autoHide: true,
|
||||
autoHideDelay: 5000,
|
||||
arrowShow: true,
|
||||
@@ -477,21 +479,17 @@ $.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle,
|
||||
pluginOptions: pluginOptions,
|
||||
getStyle: getStyle
|
||||
getStyle: getStyle,
|
||||
insertCSS: insertCSS
|
||||
});
|
||||
|
||||
$(function() {
|
||||
insertCSS(coreStyle.css).attr('data-notify-style', 'core');
|
||||
return $(document).on('click', "." + pluginClassName + "-wrapper", function() {
|
||||
insertCSS(coreStyle.css).attr('id', 'core-notify');
|
||||
return $(document).on('click notify-hide', "." + pluginClassName + "-wrapper", function(e) {
|
||||
var inst;
|
||||
inst = $(this).data(pluginClassName);
|
||||
if (!inst) {
|
||||
return;
|
||||
}
|
||||
if (inst.elem) {
|
||||
if (inst && (inst.options.clickToHide || e.type === 'notify-hide')) {
|
||||
return inst.show(false);
|
||||
} else {
|
||||
return inst.destroy();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
/** Notify.js - v0.0.1 - 2013/06/12
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(t,n,i){"use strict";var e,o,r,s,a,h,l,p,c,u,d,f,m,w,y,g,v,b,x,P,S,C,H,T=[].indexOf||function(t){for(var n=0,i=this.length;i>n;n++)if(n in this&&this[n]===t)return n;return-1};v="notify",g=v+"js",x={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},c=["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"},y=function(t){var n;return n=[],$.each(t.split(/\W+/),function(t,e){var o;return o=e.toLowerCase().charAt(0),x[o]?n.push(o):i}),n},C={},r={name:"core",html:'<div class="'+g+'-wrapper">\n <div class="'+g+'-arrow"></div>\n <div class="'+g+'-container"></div>\n</div>',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}"},S={"border-radius":["-webkit-","-moz-"]},l=function(t){return C[t]},o=function(n,e){var o,r;if(!n)throw"Missing Style name";if(!e)throw"Missing Style definition";return(null!=(r=C[n])?r.cssElem:void 0)&&(t.console&&console.warn(""+v+": overwriting style '"+n+"'"),C[n].cssElem.remove()),e.name=n,C[n]=e,o="",e.classes&&$.each(e.classes,function(t,n){return o+="."+g+"-"+e.name+"-"+t+" {\n",$.each(n,function(t,n){return S[t]&&$.each(S[t],function(i,e){return o+=" "+e+t+": "+n+";\n"}),o+=" "+t+": "+n+";\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)):i},f=function(t){var n;n=s("style"),$("head").append(n);try{n.html(t)}catch(i){n[0].styleSheet.cssText=t}return n},b={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,n){var i;return i=function(){},i.prototype=t,$.extend(!0,new i,n)},a=function(t){return $.extend(b,t)},s=function(t){return $("<"+t+"></"+t+">")},p={},h=function(t){var n;return t.is("[type=radio]")&&(n=t.parents("form:first").find("[type=radio]").filter(function(n,i){return $(i).attr("name")===t.attr("name")}),t=n.first()),t},u=function(t,n,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[n.charAt(0)]],r=n,t[o]!==i&&(n=x[o.charAt(0)],e=-e),t[n]===i?t[n]=e:t[n]+=e,null},P=function(t,n,i){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return i/2-n/2;if("r"===t||"b"===t)return i-n;throw"Invalid alignment"},e=function(){function t(t,n,i){"string"==typeof i&&(i={className:i}),this.options=d(b,$.isPlainObject(i)?i:{}),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(n)}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,n){var e,o,r,s,a,h=this;if(o=function(){return t||h.elem||h.destroy(),n?n():i},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,n,i,e,o,r,a,h;return h=this.getPosition(),a=h[0],r=h[1],o=x[a],t=x[r],e=a+"|"+r,n=p[e],n||(n=p[e]=s("div"),i={},i[o]=0,"middle"===t?i.top="45%":"center"===t?i.left="45%":i[t]=0,n.css(i).addClass(""+g+"-corner"),$("body").append(n)),n.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,n,e,o,r,s,a,h,l,p,d,f,y,g,v,b,S,C,A,M,N,z,D,E,k,L,j,O,I;for(D=this.getPosition(),M=D[0],C=D[1],A=D[2],d=this.elem.position(),h=this.elem.outerHeight(),f=this.elem.outerWidth(),l=this.elem.innerHeight(),p=this.elem.innerWidth(),E=this.wrapper.position(),r=this.container.height(),s=this.container.width(),g=x[M],b=w[M],S=x[b],a={},a[S]="b"===M?h:"r"===M?f:0,u(a,"top",d.top-E.top),u(a,"left",d.left-E.left),I=["top","left"],k=0,j=Line truncated
|
||||
(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:'<div class="'+g+'-wrapper">\n <div class="'+g+'-arrow"></div>\n <div class="'+g+'-container"></div>\n</div>',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,"lefLine truncated
|
||||
Reference in new issue
Block a user