15 Commits
Author SHA1 Message Date
Jaime Pillora 64dda76979 Revert "Make a nice top/bottom center global position" 2016-06-09 03:58:15 +10:00
Jaime Pillora 8ba7204c0d Merge pull request #57 from leoding86/master
Make a nice top/bottom center global position
2016-06-09 03:43:22 +10:00
Jaime Pillora 6a2024b997 Merge pull request #54 from tinbka/master
Fixed anchors cache
2016-06-09 03:41:50 +10:00
Jaime Pillora 119d4b2f44 Merge pull request #67 from spartaMatt/master
Introducing 'removeStyle' method
2016-06-09 03:38:37 +10:00
matt dd5adda0bd Introducing 'removeStyle' method 2016-06-08 07:21:22 -04:00
Jaime Pillora 9e61e5418d 0.4.2 2016-04-03 00:59:57 +11:00
Jaime Pillora 67dda7928d Merge pull request #60 from Kreozot/patch-1
jquery peerDep changes to 1.x version minimum
2016-04-01 11:08:32 +11:00
Sergey Sharov f1e11bcf21 jquery peerDep changes to 1.x version minimum
It prevents errors with npm install when using jquery 1.x version in project.
2016-03-31 16:25:25 +03:00
Leo Ding 4bc2d70f4c Make a nice top/bottom center global position
The example is in 'examples/position.html'
2016-02-16 11:55:18 +08:00
Sergey ac9bb74367 Fixed anchors cache
Fixed anchors cache for compatibility with Turbolinks.
"Anchor" element must not be used if it occasionally is out of DOM.
2016-02-05 03:26:48 +03:00
Jaime Pillora b99c2ae69c Bump to 0.4.1, see description
* IE9 fix
* code cleanup
* publish to npm (closes #31)
* jquery is now a peerDep (closes #53)
* improve positioning documentation
* dont reuse element notifications, always recreate (closes #43)
2015-12-06 00:53:19 +11:00
Jaime Pillora 7b0164fc63 Merge pull request #50 from herong/master
Compatible  ie9 and below
2015-11-19 22:33:18 +11:00
herong e621c2643d Merge branch 'master' of https://github.com/herong/notifyjs 2015-11-19 15:07:22 +08:00
herong a4d7da2ee2 Compatible ie9 and above 2015-11-19 15:03:00 +08:00
herong a721573076 Compatible ie9 and below 2015-11-19 14:35:45 +08:00
5 changed files with 28 additions and 37 deletions
+1 -19
View File
@@ -5,28 +5,10 @@ Notify.js
See demos and full documentation at: See demos and full documentation at:
## http://notifyjs.com/ ## https://notifyjs.com/
SYNOPSIS
====
Global Notifications
---- ----
$.notify("Hello World");
Element Notifications
----
$(".elem-demo").notify("Hello World");
// where x is one letter: [t]op [m]iddle [b]ottom
// where y is one letter: [l]eft [c]enter [r]ight
$(".elem-demo").notify("Hello World", {position: "x y"});
COPYRIGHT
====
Notify.js is released under the [MIT License](https://opensource.org/licenses/MIT). Notify.js is released under the [MIT License](https://opensource.org/licenses/MIT).
Copyright © Jaime Pillora <dev@jpillora.com> Copyright © Jaime Pillora <dev@jpillora.com>
+1 -1
View File
@@ -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>"
+20 -11
View File
@@ -91,6 +91,15 @@
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) {
if (!name) { if (!name) {
throw "Missing Style name"; throw "Missing Style name";
@@ -337,7 +346,7 @@
var align = positions[pAlign]; var align = positions[pAlign];
var key = pMain + "|" + pAlign; var key = pMain + "|" + pAlign;
var anchor = globalAnchors[key]; var anchor = globalAnchors[key];
if (!anchor) { if (!anchor || !document.contains(anchor[0])) {
anchor = globalAnchors[key] = createElem("div"); anchor = globalAnchors[key] = createElem("div");
var css = {}; var css = {};
css[main] = 0; css[main] = 0;
@@ -390,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];
@@ -522,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) {
@@ -538,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;
}; };
@@ -552,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
@@ -603,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);
+1 -1
View File
@@ -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",
+4 -4
View File
@@ -1,7 +1,7 @@
{ {
"title": "Notify.js", "title": "Notify.js",
"name": "notify", "name": "notifyjs-browser",
"version": "0.4.0", "version": "0.4.2",
"author": { "author": {
"name": "Jaime Pillora" "name": "Jaime Pillora"
}, },
@@ -19,8 +19,8 @@
"test": "npm run lint", "test": "npm run lint",
"lint": "jshint ./dist/*.js" "lint": "jshint ./dist/*.js"
}, },
"dependencies": { "peerDependencies": {
"jquery": "^2.1.4" "jquery": ">=1.11.0"
}, },
"devDependencies": { "devDependencies": {
"jshint": "^2.8.0" "jshint": "^2.8.0"