Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3da96e3a1 | ||
|
|
0e258e80ec | ||
|
|
7191c17e26 | ||
|
|
d27d96fc24 | ||
|
|
d5ddfb7bd1 | ||
|
|
64dda76979 | ||
|
|
8ba7204c0d | ||
|
|
6a2024b997 | ||
|
|
119d4b2f44 | ||
|
|
dd5adda0bd | ||
|
|
9e61e5418d | ||
|
|
67dda7928d | ||
|
|
f1e11bcf21 | ||
|
|
4bc2d70f4c | ||
|
|
ac9bb74367 | ||
|
|
b99c2ae69c | ||
|
|
7b0164fc63 | ||
|
|
e621c2643d | ||
|
|
a4d7da2ee2 | ||
|
|
a721573076 | ||
|
|
302b39f587 | ||
|
|
97c2fd11e2 | ||
|
|
3b6b214eb8 | ||
|
|
4f88f06677 | ||
|
|
b724df3b02 | ||
|
|
521514180d | ||
|
|
904d09251b |
+2
-5
@@ -1,7 +1,4 @@
|
|||||||
2015-10-20 v0.3.3
|
2015-10-20 v0.4
|
||||||
|
|
||||||
@EvanCarroll - Updated to remove Grunt, and coffeescript stuff.
|
|
||||||
|
|
||||||
2015-11-01 v0.3.4
|
|
||||||
|
|
||||||
|
@EvanCarroll - Updated to remove Grunt, and coffeescript stuff, changed to use UMD.
|
||||||
@jpillora - Remove deprecated grunt file, there is now a single `notify.js` file
|
@jpillora - Remove deprecated grunt file, there is now a single `notify.js` file
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Jaime Pillora <dev@jpillora.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -5,27 +5,10 @@ Notify.js
|
|||||||
|
|
||||||
See demos and full documentation at:
|
See demos and full documentation at:
|
||||||
|
|
||||||
## http://notifyjs.com/
|
## https://notifyjs.jpillora.com/
|
||||||
|
|
||||||
#### MIT License
|
----
|
||||||
|
|
||||||
Copyright © 2015 Jaime Pillora <dev@jpillora.com>
|
Notify.js is released under the [MIT License](https://opensource.org/licenses/MIT).
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Copyright © Jaime Pillora <dev@jpillora.com>
|
||||||
a copy of this software and associated documentation files (the
|
|
||||||
'Software'), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "notifyjs",
|
"name": "notifyjs",
|
||||||
"version": "0.3.4",
|
"version": "0.4.1",
|
||||||
"homepage": "http://notifyjs.com/",
|
"homepage": "http://notifyjs.com/",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Jaime Pillora <dev@jpillora.com>"
|
"Jaime Pillora <dev@jpillora.com>"
|
||||||
|
|||||||
Vendored
+70
-31
@@ -1,6 +1,33 @@
|
|||||||
/* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
|
/* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
|
||||||
(function(window, document, $, undefined) {
|
(function (factory) {
|
||||||
"use strict";
|
// UMD start
|
||||||
|
// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define(['jquery'], factory);
|
||||||
|
} else if (typeof module === 'object' && module.exports) {
|
||||||
|
// Node/CommonJS
|
||||||
|
module.exports = function( root, jQuery ) {
|
||||||
|
if ( jQuery === undefined ) {
|
||||||
|
// require('jQuery') returns a factory that requires window to
|
||||||
|
// build a jQuery instance, we normalize how we use modules
|
||||||
|
// that require this pattern but the window provided is a noop
|
||||||
|
// if it's defined (how jquery works)
|
||||||
|
if ( typeof window !== 'undefined' ) {
|
||||||
|
jQuery = require('jquery');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
jQuery = require('jquery')(root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
factory(jQuery);
|
||||||
|
return jQuery;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
factory(jQuery);
|
||||||
|
}
|
||||||
|
}(function ($) {
|
||||||
//IE8 indexOf polyfill
|
//IE8 indexOf polyfill
|
||||||
var indexOf = [].indexOf || function(item) {
|
var indexOf = [].indexOf || function(item) {
|
||||||
for (var i = 0, l = this.length; i < l; i++) {
|
for (var i = 0, l = this.length; i < l; i++) {
|
||||||
@@ -64,8 +91,16 @@
|
|||||||
return styles[name];
|
return styles[name];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var removeStyle = function(name) {
|
||||||
|
if (!name) {
|
||||||
|
throw "Missing Style name";
|
||||||
|
}
|
||||||
|
if (styles[name]) {
|
||||||
|
delete styles[name];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var addStyle = function(name, def) {
|
var addStyle = function(name, def) {
|
||||||
var cssText, elem, fields, ref;
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw "Missing Style name";
|
throw "Missing Style name";
|
||||||
}
|
}
|
||||||
@@ -75,7 +110,9 @@
|
|||||||
if (!def.html) {
|
if (!def.html) {
|
||||||
throw "Missing Style HTML";
|
throw "Missing Style HTML";
|
||||||
}
|
}
|
||||||
if ((ref = styles[name]) != null ? ref.cssElem : void 0) {
|
//remove existing style
|
||||||
|
var existing = styles[name];
|
||||||
|
if (existing && existing.cssElem) {
|
||||||
if (window.console) {
|
if (window.console) {
|
||||||
console.warn(pluginName + ": overwriting style '" + name + "'");
|
console.warn(pluginName + ": overwriting style '" + name + "'");
|
||||||
}
|
}
|
||||||
@@ -83,7 +120,7 @@
|
|||||||
}
|
}
|
||||||
def.name = name;
|
def.name = name;
|
||||||
styles[name] = def;
|
styles[name] = def;
|
||||||
cssText = "";
|
var cssText = "";
|
||||||
if (def.classes) {
|
if (def.classes) {
|
||||||
$.each(def.classes, function(className, props) {
|
$.each(def.classes, function(className, props) {
|
||||||
cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n";
|
cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n";
|
||||||
@@ -105,11 +142,11 @@
|
|||||||
def.cssElem = insertCSS(cssText);
|
def.cssElem = insertCSS(cssText);
|
||||||
def.cssElem.attr("id", "notify-" + def.name);
|
def.cssElem.attr("id", "notify-" + def.name);
|
||||||
}
|
}
|
||||||
fields = {};
|
var fields = {};
|
||||||
elem = $(def.html);
|
var elem = $(def.html);
|
||||||
findFields("html", elem, fields);
|
findFields("html", elem, fields);
|
||||||
findFields("text", elem, fields);
|
findFields("text", elem, fields);
|
||||||
return def.fields = fields;
|
def.fields = fields;
|
||||||
};
|
};
|
||||||
|
|
||||||
var insertCSS = function(cssText) {
|
var insertCSS = function(cssText) {
|
||||||
@@ -119,8 +156,7 @@
|
|||||||
$("head").append(elem);
|
$("head").append(elem);
|
||||||
try {
|
try {
|
||||||
elem.html(cssText);
|
elem.html(cssText);
|
||||||
} catch (error) {
|
} catch (_) {
|
||||||
e = error;
|
|
||||||
elem[0].styleSheet.cssText = cssText;
|
elem[0].styleSheet.cssText = cssText;
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
@@ -138,7 +174,7 @@
|
|||||||
if (!name) {
|
if (!name) {
|
||||||
name = blankFieldName;
|
name = blankFieldName;
|
||||||
}
|
}
|
||||||
return fields[name] = type;
|
fields[name] = type;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -303,15 +339,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Notification.prototype.setGlobalPosition = function() {
|
Notification.prototype.setGlobalPosition = function() {
|
||||||
var align, anchor, css, key, main, pAlign, pMain, ref;
|
var p = this.getPosition();
|
||||||
ref = this.getPosition(), pMain = ref[0], pAlign = ref[1];
|
var pMain = p[0];
|
||||||
main = positions[pMain];
|
var pAlign = p[1];
|
||||||
align = positions[pAlign];
|
var main = positions[pMain];
|
||||||
key = pMain + "|" + pAlign;
|
var align = positions[pAlign];
|
||||||
anchor = globalAnchors[key];
|
var key = pMain + "|" + pAlign;
|
||||||
if (!anchor) {
|
var anchor = globalAnchors[key];
|
||||||
|
if (!anchor || !document.body.contains(anchor[0])) {
|
||||||
anchor = globalAnchors[key] = createElem("div");
|
anchor = globalAnchors[key] = createElem("div");
|
||||||
css = {};
|
var css = {};
|
||||||
css[main] = 0;
|
css[main] = 0;
|
||||||
if (align === "middle") {
|
if (align === "middle") {
|
||||||
css.top = '45%';
|
css.top = '45%';
|
||||||
@@ -329,7 +366,9 @@
|
|||||||
Notification.prototype.setElementPosition = function() {
|
Notification.prototype.setElementPosition = function() {
|
||||||
var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, j, k, len, len1, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, ref, wrapPos;
|
var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, j, k, len, len1, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, ref, wrapPos;
|
||||||
position = this.getPosition();
|
position = this.getPosition();
|
||||||
pMain = position[0], pAlign = position[1], pArrow = position[2];
|
pMain = position[0];
|
||||||
|
pAlign = position[1];
|
||||||
|
pArrow = position[2];
|
||||||
elemPos = this.elem.position();
|
elemPos = this.elem.position();
|
||||||
elemH = this.elem.outerHeight();
|
elemH = this.elem.outerHeight();
|
||||||
elemW = this.elem.outerWidth();
|
elemW = this.elem.outerWidth();
|
||||||
@@ -360,7 +399,7 @@
|
|||||||
} else {
|
} else {
|
||||||
arrowSize = this.options.arrowSize;
|
arrowSize = this.options.arrowSize;
|
||||||
arrowCss = $.extend({}, css);
|
arrowCss = $.extend({}, css);
|
||||||
arrowColor = this.userContainer.css("border-color") || this.userContainer.css("background-color") || "white";
|
arrowColor = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
|
||||||
for (k = 0, len1 = mainPositions.length; k < len1; k++) {
|
for (k = 0, len1 = mainPositions.length; k < len1; k++) {
|
||||||
pos = mainPositions[k];
|
pos = mainPositions[k];
|
||||||
posFull = positions[pos];
|
posFull = positions[pos];
|
||||||
@@ -492,7 +531,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Notification.prototype.destroy = function() {
|
Notification.prototype.destroy = function() {
|
||||||
return this.wrapper.remove();
|
this.wrapper.data(pluginClassName, null);
|
||||||
|
this.wrapper.remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
$[pluginName] = function(elem, data, options) {
|
$[pluginName] = function(elem, data, options) {
|
||||||
@@ -508,13 +548,11 @@
|
|||||||
|
|
||||||
$.fn[pluginName] = function(data, options) {
|
$.fn[pluginName] = function(data, options) {
|
||||||
$(this).each(function() {
|
$(this).each(function() {
|
||||||
var inst;
|
var prev = getAnchorElement($(this)).data(pluginClassName);
|
||||||
inst = getAnchorElement($(this)).data(pluginClassName);
|
if (prev) {
|
||||||
if (inst) {
|
prev.destroy();
|
||||||
return inst.run(data, options);
|
|
||||||
} else {
|
|
||||||
return new Notification($(this), data, options);
|
|
||||||
}
|
}
|
||||||
|
var curr = new Notification($(this), data, options);
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@@ -522,6 +560,7 @@
|
|||||||
$.extend($[pluginName], {
|
$.extend($[pluginName], {
|
||||||
defaults: defaults,
|
defaults: defaults,
|
||||||
addStyle: addStyle,
|
addStyle: addStyle,
|
||||||
|
removeStyle: removeStyle,
|
||||||
pluginOptions: pluginOptions,
|
pluginOptions: pluginOptions,
|
||||||
getStyle: getStyle,
|
getStyle: getStyle,
|
||||||
insertCSS: insertCSS
|
insertCSS: insertCSS
|
||||||
@@ -573,9 +612,9 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
insertCSS(coreStyle.css).attr("id", "core-notify");
|
insertCSS(coreStyle.css).attr("id", "core-notify");
|
||||||
$(document).on("click", "." + pluginClassName + "-hidable", function(e) {
|
$(document).on("click", "." + pluginClassName + "-hidable", function(e) {
|
||||||
return $(this).trigger("notify-hide");
|
$(this).trigger("notify-hide");
|
||||||
});
|
});
|
||||||
return $(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
|
$(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
|
||||||
var elem = $(this).data(pluginClassName);
|
var elem = $(this).data(pluginClassName);
|
||||||
if(elem) {
|
if(elem) {
|
||||||
elem.show(false);
|
elem.show(false);
|
||||||
@@ -583,4 +622,4 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}).call(this, window, document, jQuery);
|
}));
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "notify",
|
"name": "notify",
|
||||||
"version": "0.3.4",
|
"version": "0.4.1",
|
||||||
"title": "notify",
|
"title": "notify",
|
||||||
"description": "A robust, customizable notification library",
|
"description": "A robust, customizable notification library",
|
||||||
"bugs": "https://github.com/jpillora/notifyjs/issues",
|
"bugs": "https://github.com/jpillora/notifyjs/issues",
|
||||||
|
|||||||
+20
-3
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "Notify.js",
|
"title": "Notify.js",
|
||||||
"name": "notify",
|
"name": "notifyjs-browser",
|
||||||
"version": "0.3.4",
|
"version": "0.4.2",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Jaime Pillora"
|
"name": "Jaime Pillora"
|
||||||
},
|
},
|
||||||
@@ -14,5 +14,22 @@
|
|||||||
],
|
],
|
||||||
"homepage": "http://notifyjs.com/",
|
"homepage": "http://notifyjs.com/",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/notify.js"
|
"main": "dist/notify.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "npm run lint",
|
||||||
|
"lint": "jshint ./dist/*.js"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"jquery": ">=1.11.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jshint": "^2.8.0"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"notify",
|
||||||
|
"notification",
|
||||||
|
"prompt",
|
||||||
|
"popup",
|
||||||
|
"jquery-plugin"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user