updated
This commit is contained in:
1 parent
6cff558639
commit
9bd9e58fec
5 files changed
+41
-11
No files matched your search
Vendored
+14
-3
@@ -1,11 +1,11 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/06
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(window,document,undefined) {
|
||||
'use strict';
|
||||
|
||||
var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
|
||||
var Notification, addStyle, coreStyle, createElem, defaults, 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';
|
||||
@@ -61,8 +61,18 @@ stylePrefixes = {
|
||||
"border-radius": ["-webkit-", "-moz-"]
|
||||
};
|
||||
|
||||
getStyle = function(name) {
|
||||
return styles[name];
|
||||
};
|
||||
|
||||
addStyle = function(name, def) {
|
||||
var cssText, _ref;
|
||||
if (!name) {
|
||||
throw "Missing Style name";
|
||||
}
|
||||
if (!def) {
|
||||
throw "Missing Style definition";
|
||||
}
|
||||
if ((_ref = styles[name]) != null ? _ref.cssElem : void 0) {
|
||||
if (window.console) {
|
||||
console.warn("" + pluginName + ": overwriting style '" + name + "'");
|
||||
@@ -466,7 +476,8 @@ $.fn[pluginName] = function(data, options) {
|
||||
$.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle,
|
||||
pluginOptions: pluginOptions
|
||||
pluginOptions: pluginOptions,
|
||||
getStyle: getStyle
|
||||
});
|
||||
|
||||
$(function() {
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/06
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(t,n,e){"use strict";var i,o,r,s,a,l,h,c,p,u,d,A,f,m,w,g,y,b,v,x,C,E,H=[].indexOf||function(t){for(var n=0,e=this.length;e>n;n++)if(n in this&&this[n]===t)return n;return-1};g="notify",w=g+"js",b={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},c=["l","c","r"],E=["t","m","b"],A=["t","b","l","r"],f={t:"b",m:null,b:"t",l:"r",c:null,r:"l"},m=function(t){var n;return n=[],$.each(t.split(/\W+/),function(t,i){var o;return o=i.toLowerCase().charAt(0),b[o]?n.push(o):e}),n},C={},r={name:"core",html:'<div class="'+w+'-wrapper">\n <div class="'+w+'-arrow"></div>\n <div class="'+w+'-container"></div>\n</div>',css:"."+w+"-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n."+w+"-corner ."+w+"-wrapper,\n."+w+"-corner ."+w+"-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n."+w+"-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n."+w+"-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n."+w+"-text {\n position: relative;\n}\n\n."+w+"-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"},x={"border-radius":["-webkit-","-moz-"]},o=function(n,i){var o,r;return(null!=(r=C[n])?r.cssElem:void 0)&&(t.console&&console.warn(""+g+": overwriting style '"+n+"'"),C[n].cssElem.remove()),i.name=n,C[n]=i,o="",i.classes&&$.each(i.classes,function(t,n){return o+="."+w+"-"+i.name+"-"+t+" {\n",$.each(n,function(t,n){return x[t]&&$.each(x[t],function(e,i){return o+=" "+i+t+": "+n+";\n"}),o+=" "+t+": "+n+";\n"}),o+="}\n"}),i.css&&(o+="/* styles for "+i.name+" */\n"+i.css),o?(i.cssElem=d(o),i.cssElem.attr("id","notify-"+i.name)):e},d=function(t){var n;n=s("style"),$("head").append(n);try{n.html(t)}catch(e){n[0].styleSheet.cssText=t}return n},y={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},u=function(t,n){var e;return e=function(){},e.prototype=t,$.extend(!0,new e,n)},a=function(t){return $.extend(y,t)},s=function(t){return $("<"+t+"></"+t+">")},h={},l=function(t){var n;return t.is("[type=radio]")&&(n=t.parents("form:first").find("[type=radio]").filter(function(n,e){return $(e).attr("name")===t.attr("name")}),t=n.first()),t},p=function(t,n,i){var o,r;if("string"==typeof i)i=parseInt(i,10);else if("number"!=typeof i)return;if(!isNaN(i))return o=b[f[n.charAt(0)]],r=n,t[o]!==e&&(n=b[o.charAt(0)],i=-i),t[n]===e?t[n]=i:t[n]+=i,null},v=function(t,n,e){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return e/2-n/2;if("r"===t||"b"===t)return e-n;throw"Invalid alignment"},i=function(){function t(t,n,e){"string"==typeof e&&(e={className:e}),this.options=u(y,$.isPlainObject(e)?e:{}),this.loadHTML(),this.wrapper=$(r.html),this.wrapper.data(w,this),this.arrow=this.wrapper.find("."+w+"-arrow"),this.container=this.wrapper.find("."+w+"-container"),this.container.append(this.userContainer),t&&t.length&&(this.elementType=t.attr("type"),this.originalElement=t,this.elem=l(t),this.elem.data(w,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(""+w+"-text")},t.prototype.show=function(t,n){var i,o,r,s,a,l=this;if(o=function(){return t||l.elem||l.destroy(),n?n():e},a=this.container.parent().parents(":hidden").length>0,r=this.container.add(this.arrow),i=[],a&&t)s="show";else if(a&&!t)s="hide";else if(!a&&t)s=this.options.showAnimation,i.push(this.options.showDuration);else{if(a||t)return o();s=this.options.hideAnimation,i.push(this.options.hideDuration)}return i.push(o),r[s].apply(r,i)},t.prototype.setGlobalPosition=function(){var t,n,e,i,o,r,a,l;return l=this.getPosition(),a=l[0],r=l[1],o=b[a],t=b[r],i=a+"|"+r,n=h[i],n||(n=h[i]=s("div"),e={},e[o]=0,"middle"===t?e.top="45%":"center"===t?e.left="45%":e[t]=0,n.css(e).addClass(""+w+"-corner"),$("body").append(n)),n.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,n,i,o,r,s,a,l,h,u,d,m,w,g,y,x,C,M,D,S,T,F,z,k,B,Q,R,U,P;for(z=this.getPosition(),S=z[0],M=z[1],D=z[2],d=this.elem.position(),l=this.elem.outerHeight(),m=this.elem.outerWidth(),h=this.elem.innerHeight(),u=this.elem.innerWidth(),k=this.wrapper.position(),r=this.container.height(),s=this.container.width(),g=b[S],x=f[S],C=b[x],a={},a[C]="b"===S?l:"r"===S?m:0,p(a,"top",d.top-k.top),p(a,"left",d.left-k.left),P=["top","left"],B=0,R=P.length;R>B;B++)T=P[B],y=parseInt(this.elem.css("margin-"+T),10),y&&p(a,T,y);if(w=Math.max(0,this.Line truncated
|
||||
(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
|
||||
Vendored
+14
-3
@@ -1,11 +1,11 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/06
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(window,document,undefined) {
|
||||
'use strict';
|
||||
|
||||
var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
|
||||
var Notification, addStyle, coreStyle, createElem, defaults, 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';
|
||||
@@ -61,8 +61,18 @@ stylePrefixes = {
|
||||
"border-radius": ["-webkit-", "-moz-"]
|
||||
};
|
||||
|
||||
getStyle = function(name) {
|
||||
return styles[name];
|
||||
};
|
||||
|
||||
addStyle = function(name, def) {
|
||||
var cssText, _ref;
|
||||
if (!name) {
|
||||
throw "Missing Style name";
|
||||
}
|
||||
if (!def) {
|
||||
throw "Missing Style definition";
|
||||
}
|
||||
if ((_ref = styles[name]) != null ? _ref.cssElem : void 0) {
|
||||
if (window.console) {
|
||||
console.warn("" + pluginName + ": overwriting style '" + name + "'");
|
||||
@@ -466,7 +476,8 @@ $.fn[pluginName] = function(data, options) {
|
||||
$.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle,
|
||||
pluginOptions: pluginOptions
|
||||
pluginOptions: pluginOptions,
|
||||
getStyle: getStyle
|
||||
});
|
||||
|
||||
$(function() {
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
/** Notify.js - v0.0.1 - 2013/06/06
|
||||
/** Notify.js - v0.0.1 - 2013/06/11
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(t,n,e){"use strict";var i,o,r,s,a,h,l,p,c,u,d,f,m,w,y,g,v,b,x,P,C,H,T=[].indexOf||function(t){for(var n=0,e=this.length;e>n;n++)if(n in this&&this[n]===t)return n;return-1};g="notify",y=g+"js",b={t:"top",m:"middle",b:"bottom",l:"left",c:"center",r:"right"},p=["l","c","r"],H=["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,i){var o;return o=i.toLowerCase().charAt(0),b[o]?n.push(o):e}),n},C={},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}"},P={"border-radius":["-webkit-","-moz-"]},o=function(n,i){var o,r;return(null!=(r=C[n])?r.cssElem:void 0)&&(t.console&&console.warn(""+g+": overwriting style '"+n+"'"),C[n].cssElem.remove()),i.name=n,C[n]=i,o="",i.classes&&$.each(i.classes,function(t,n){return o+="."+y+"-"+i.name+"-"+t+" {\n",$.each(n,function(t,n){return P[t]&&$.each(P[t],function(e,i){return o+=" "+i+t+": "+n+";\n"}),o+=" "+t+": "+n+";\n"}),o+="}\n"}),i.css&&(o+="/* styles for "+i.name+" */\n"+i.css),o?(i.cssElem=d(o),i.cssElem.attr("id","notify-"+i.name)):e},d=function(t){var n;n=s("style"),$("head").append(n);try{n.html(t)}catch(e){n[0].styleSheet.cssText=t}return n},v={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},u=function(t,n){var e;return e=function(){},e.prototype=t,$.extend(!0,new e,n)},a=function(t){return $.extend(v,t)},s=function(t){return $("<"+t+"></"+t+">")},l={},h=function(t){var n;return t.is("[type=radio]")&&(n=t.parents("form:first").find("[type=radio]").filter(function(n,e){return $(e).attr("name")===t.attr("name")}),t=n.first()),t},c=function(t,n,i){var o,r;if("string"==typeof i)i=parseInt(i,10);else if("number"!=typeof i)return;if(!isNaN(i))return o=b[m[n.charAt(0)]],r=n,t[o]!==e&&(n=b[o.charAt(0)],i=-i),t[n]===e?t[n]=i:t[n]+=i,null},x=function(t,n,e){if("l"===t||"t"===t)return 0;if("c"===t||"m"===t)return e/2-n/2;if("r"===t||"b"===t)return e-n;throw"Invalid alignment"},i=function(){function t(t,n,e){"string"==typeof e&&(e={className:e}),this.options=u(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(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(""+y+"-text")},t.prototype.show=function(t,n){var i,o,r,s,a,h=this;if(o=function(){return t||h.elem||h.destroy(),n?n():e},a=this.container.parent().parents(":hidden").length>0,r=this.container.add(this.arrow),i=[],a&&t)s="show";else if(a&&!t)s="hide";else if(!a&&t)s=this.options.showAnimation,i.push(this.options.showDuration);else{if(a||t)return o();s=this.options.hideAnimation,i.push(this.options.hideDuration)}return i.push(o),r[s].apply(r,i)},t.prototype.setGlobalPosition=function(){var t,n,e,i,o,r,a,h;return h=this.getPosition(),a=h[0],r=h[1],o=b[a],t=b[r],i=a+"|"+r,n=l[i],n||(n=l[i]=s("div"),e={},e[o]=0,"middle"===t?e.top="45%":"center"===t?e.left="45%":e[t]=0,n.css(e).addClass(""+y+"-corner"),$("body").append(n)),n.prepend(this.wrapper)},t.prototype.setElementPosition=function(){var t,n,i,o,r,s,a,h,l,u,d,w,y,g,v,P,C,A,S,N,M,z,D,E,k,L,j,O,I;for(D=this.getPosition(),N=D[0],A=D[1],S=D[2],d=this.elem.position(),h=this.elem.outerHeight(),w=this.elem.outerWidth(),l=this.elem.innerHeight(),u=this.elem.innerWidth(),E=this.wrapper.position(),r=this.container.height(),s=this.container.width(),g=b[N],P=m[N],C=b[P],a={},a[C]="b"===N?h:"r"===N?w:0,c(a,"top",d.top-E.top),c(a,"left",d.left-E.left),I=["top","left"],k=0,j=I.length;j>k;k++)M=I[k],v=parseInt(this.elem.css("margin-"+M),10),v&&c(a,M,v);if(y=Math.max(0,this.Line truncated
|
||||
(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
|
||||
Reference in new issue
Block a user