fixed global position
This commit is contained in:
1 parent
a7e896514d
commit
9e192d505e
7 files changed
+39
-36
No files matched your search
Vendored
+14
-13
@@ -54,7 +54,7 @@ styles = {};
|
||||
coreStyle = {
|
||||
name: 'core',
|
||||
html: "<div class=\"" + pluginClassName + "-wrapper\">\n <div class=\"" + pluginClassName + "-arrow\"></div>\n <div class=\"" + pluginClassName + "-container\"></div>\n</div>",
|
||||
css: "." + pluginClassName + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + pluginClassName + "-corner ." + pluginClassName + "-wrapper,\n." + pluginClassName + "-corner ." + pluginClassName + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n}\n\n." + pluginClassName + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + pluginClassName + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n." + pluginClassName + "-text {\n position: relative;\n}\n\n." + pluginClassName + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
|
||||
css: "." + pluginClassName + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + pluginClassName + "-corner ." + pluginClassName + "-wrapper,\n." + pluginClassName + "-corner ." + pluginClassName + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + pluginClassName + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + pluginClassName + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n." + pluginClassName + "-text {\n position: relative;\n}\n\n." + pluginClassName + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
|
||||
};
|
||||
|
||||
stylePrefixes = {
|
||||
@@ -259,12 +259,13 @@ Notification = (function() {
|
||||
return elems[fn].apply(elems, args);
|
||||
};
|
||||
|
||||
Notification.prototype.setGlobalPosition = function(position) {
|
||||
var align, anchor, css, key, main, pAlign, pMain;
|
||||
Notification.prototype.setGlobalPosition = function() {
|
||||
var align, anchor, css, key, main, pAlign, pMain, position;
|
||||
position = this.getPosition();
|
||||
pMain = position[0], pAlign = position[1];
|
||||
main = positions[pMain];
|
||||
align = positions[pAlign];
|
||||
key = position(pMain + "|" + pAlign);
|
||||
key = pMain + "|" + pAlign;
|
||||
anchor = globalAnchors[key];
|
||||
if (!anchor) {
|
||||
anchor = globalAnchors[key] = createElem("div");
|
||||
@@ -283,8 +284,9 @@ Notification = (function() {
|
||||
return anchor.prepend(this.wrapper);
|
||||
};
|
||||
|
||||
Notification.prototype.setElementPosition = function(position) {
|
||||
var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, wrapPos, _i, _j, _len, _len1, _ref;
|
||||
Notification.prototype.setElementPosition = function() {
|
||||
var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, wrapPos, _i, _j, _len, _len1, _ref;
|
||||
position = this.getPosition();
|
||||
pMain = position[0], pAlign = position[1], pArrow = position[2];
|
||||
elemPos = this.elem.position();
|
||||
elemH = this.elem.outerHeight();
|
||||
@@ -401,8 +403,7 @@ Notification = (function() {
|
||||
};
|
||||
|
||||
Notification.prototype.run = function(data, options) {
|
||||
var position,
|
||||
_this = this;
|
||||
var _this = this;
|
||||
if ($.isPlainObject(options)) {
|
||||
$.extend(this.options, options);
|
||||
} else if ($.type(options) === 'string') {
|
||||
@@ -416,11 +417,10 @@ Notification = (function() {
|
||||
}
|
||||
this.text[this.rawHTML ? 'html' : 'text'](data);
|
||||
this.updateClasses();
|
||||
position = this.getPosition();
|
||||
if (this.elem) {
|
||||
this.setElementPosition(position);
|
||||
this.setElementPosition();
|
||||
} else {
|
||||
this.setGlobalPosition(position);
|
||||
this.setGlobalPosition();
|
||||
}
|
||||
this.show(true);
|
||||
if (this.options.autoHide) {
|
||||
@@ -465,7 +465,8 @@ $.fn[pluginName] = function(data, options) {
|
||||
|
||||
$.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle
|
||||
addStyle: addStyle,
|
||||
pluginOptions: pluginOptions
|
||||
});
|
||||
|
||||
$(function() {
|
||||
@@ -487,7 +488,7 @@ $(function() {
|
||||
}(window,document));
|
||||
|
||||
$.notify.addStyle("bootstrap", {
|
||||
html: "<div>\n<span data-notify-text></span>\n<span data-notify-src></span>\n</div>",
|
||||
html: "<div>\n<span data-notify-text></span>\n</div>",
|
||||
classes: {
|
||||
base: {
|
||||
"font-weight": "bold",
|
||||
|
||||
Vendored
+1
-1
@@ -2,4 +2,4 @@
|
||||
* 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}\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(t){var n,e,i,o,r,a,l;return l=t[0],a=t[1],r=b[l],n=b[a],o=t(l+"|"+a),e=h[o],e||(e=h[o]=s("div"),i={},i[r]=0,"middle"===n?i.top="45%":"center"===n?i.left="45%":i[n]=0,e.css(i).addClass(""+w+"-corner"),$("body").append(e)),e.prepend(this.wrapper)},t.prototype.setElementPosition=function(t){var 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,X;for(T=t[0],D=t[1],S=t[2],m=this.elem.position(),h=this.elem.outerHeight(),w=this.elem.outerWidth(),u=this.elem.innerHeight(),d=this.elem.innerWidth(),k=this.wrapper.position(),s=this.container.height(),a=this.container.width(),y=b[T],C=f[T],M=b[C],l={},l[M]="b"===T?h:"r"===T?w:0,p(l,"top",m.top-k.top),p(l,"left",m.left-k.left),X=["top","left"],B=0,R=X.length;R>B;B++)F=X[B],x=parseInt(this.elem.css("margin-"+F),10),x&&p(l,F,x);if(g=Math.max(0,this.options.gap-(this.options.arrowShow?o:0)),p(l,M,g),this.oLine truncated
|
||||
(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
|
||||
Vendored
+13
-12
@@ -54,7 +54,7 @@ styles = {};
|
||||
coreStyle = {
|
||||
name: 'core',
|
||||
html: "<div class=\"" + pluginClassName + "-wrapper\">\n <div class=\"" + pluginClassName + "-arrow\"></div>\n <div class=\"" + pluginClassName + "-container\"></div>\n</div>",
|
||||
css: "." + pluginClassName + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + pluginClassName + "-corner ." + pluginClassName + "-wrapper,\n." + pluginClassName + "-corner ." + pluginClassName + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n}\n\n." + pluginClassName + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + pluginClassName + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n." + pluginClassName + "-text {\n position: relative;\n}\n\n." + pluginClassName + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
|
||||
css: "." + pluginClassName + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + pluginClassName + "-corner ." + pluginClassName + "-wrapper,\n." + pluginClassName + "-corner ." + pluginClassName + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + pluginClassName + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + pluginClassName + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n." + pluginClassName + "-text {\n position: relative;\n}\n\n." + pluginClassName + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
|
||||
};
|
||||
|
||||
stylePrefixes = {
|
||||
@@ -259,12 +259,13 @@ Notification = (function() {
|
||||
return elems[fn].apply(elems, args);
|
||||
};
|
||||
|
||||
Notification.prototype.setGlobalPosition = function(position) {
|
||||
var align, anchor, css, key, main, pAlign, pMain;
|
||||
Notification.prototype.setGlobalPosition = function() {
|
||||
var align, anchor, css, key, main, pAlign, pMain, position;
|
||||
position = this.getPosition();
|
||||
pMain = position[0], pAlign = position[1];
|
||||
main = positions[pMain];
|
||||
align = positions[pAlign];
|
||||
key = position(pMain + "|" + pAlign);
|
||||
key = pMain + "|" + pAlign;
|
||||
anchor = globalAnchors[key];
|
||||
if (!anchor) {
|
||||
anchor = globalAnchors[key] = createElem("div");
|
||||
@@ -283,8 +284,9 @@ Notification = (function() {
|
||||
return anchor.prepend(this.wrapper);
|
||||
};
|
||||
|
||||
Notification.prototype.setElementPosition = function(position) {
|
||||
var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, wrapPos, _i, _j, _len, _len1, _ref;
|
||||
Notification.prototype.setElementPosition = function() {
|
||||
var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, wrapPos, _i, _j, _len, _len1, _ref;
|
||||
position = this.getPosition();
|
||||
pMain = position[0], pAlign = position[1], pArrow = position[2];
|
||||
elemPos = this.elem.position();
|
||||
elemH = this.elem.outerHeight();
|
||||
@@ -401,8 +403,7 @@ Notification = (function() {
|
||||
};
|
||||
|
||||
Notification.prototype.run = function(data, options) {
|
||||
var position,
|
||||
_this = this;
|
||||
var _this = this;
|
||||
if ($.isPlainObject(options)) {
|
||||
$.extend(this.options, options);
|
||||
} else if ($.type(options) === 'string') {
|
||||
@@ -416,11 +417,10 @@ Notification = (function() {
|
||||
}
|
||||
this.text[this.rawHTML ? 'html' : 'text'](data);
|
||||
this.updateClasses();
|
||||
position = this.getPosition();
|
||||
if (this.elem) {
|
||||
this.setElementPosition(position);
|
||||
this.setElementPosition();
|
||||
} else {
|
||||
this.setGlobalPosition(position);
|
||||
this.setGlobalPosition();
|
||||
}
|
||||
this.show(true);
|
||||
if (this.options.autoHide) {
|
||||
@@ -465,7 +465,8 @@ $.fn[pluginName] = function(data, options) {
|
||||
|
||||
$.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle
|
||||
addStyle: addStyle,
|
||||
pluginOptions: pluginOptions
|
||||
});
|
||||
|
||||
$(function() {
|
||||
|
||||
Vendored
+1
-1
@@ -2,4 +2,4 @@
|
||||
* http://notifyjs.com/
|
||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||
*/
|
||||
(function(t,n,e){"use strict";var i,r,o,s,a,h,l,c,p,u,d,f,m,w,y,g,v,b,x,C,P,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"},c=["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 r;return r=i.toLowerCase().charAt(0),b[r]?n.push(r):e}),n},P={},o={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}\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}"},C={"border-radius":["-webkit-","-moz-"]},r=function(n,i){var r,o;return(null!=(o=P[n])?o.cssElem:void 0)&&(t.console&&console.warn(""+g+": overwriting style '"+n+"'"),P[n].cssElem.remove()),i.name=n,P[n]=i,r="",i.classes&&$.each(i.classes,function(t,n){return r+="."+y+"-"+i.name+"-"+t+" {\n",$.each(n,function(t,n){return C[t]&&$.each(C[t],function(e,i){return r+=" "+i+t+": "+n+";\n"}),r+=" "+t+": "+n+";\n"}),r+="}\n"}),i.css&&(r+="/* styles for "+i.name+" */\n"+i.css),r?(i.cssElem=d(r),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},p=function(t,n,i){var r,o;if("string"==typeof i)i=parseInt(i,10);else if("number"!=typeof i)return;if(!isNaN(i))return r=b[m[n.charAt(0)]],o=n,t[r]!==e&&(n=b[r.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=$(o.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,r,o,s,a,h=this;if(r=function(){return t||h.elem||h.destroy(),n?n():e},a=this.container.parent().parents(":hidden").length>0,o=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 r();s=this.options.hideAnimation,i.push(this.options.hideDuration)}return i.push(r),o[s].apply(o,i)},t.prototype.setGlobalPosition=function(t){var n,e,i,r,o,a,h;return h=t[0],a=t[1],o=b[h],n=b[a],r=t(h+"|"+a),e=l[r],e||(e=l[r]=s("div"),i={},i[o]=0,"middle"===n?i.top="45%":"center"===n?i.left="45%":i[n]=0,e.css(i).addClass(""+y+"-corner"),$("body").append(e)),e.prepend(this.wrapper)},t.prototype.setElementPosition=function(t){var n,i,r,o,s,a,h,l,u,d,w,y,g,v,C,P,A,S,N,M,z,D,E,k,L,j,I,O;for(M=t[0],S=t[1],N=t[2],w=this.elem.position(),l=this.elem.outerHeight(),y=this.elem.outerWidth(),u=this.elem.innerHeight(),d=this.elem.innerWidth(),E=this.wrapper.position(),s=this.container.height(),a=this.container.width(),v=b[M],P=m[M],A=b[P],h={},h[A]="b"===M?l:"r"===M?y:0,p(h,"top",w.top-E.top),p(h,"left",w.left-E.left),O=["top","left"],k=0,j=O.length;j>k;k++)z=O[k],C=parseInt(this.elem.css("margin-"+z),10),C&&p(h,z,C);if(g=Math.max(0,this.options.gap-(this.options.arrowShow?r:0)),p(h,A,g),this.oLine truncated
|
||||
(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
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
$.notify.addStyle("bootstrap", {
|
||||
html: "<div>\n<span data-notify-text></span>\n<span data-notify-src></span>\n</div>",
|
||||
html: "<div>\n<span data-notify-text></span>\n</div>",
|
||||
classes: {
|
||||
base: {
|
||||
"font-weight": "bold",
|
||||
|
||||
Reference in new issue
Block a user