Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
302b39f587 | ||
|
|
97c2fd11e2 | ||
|
|
3b6b214eb8 | ||
|
|
4f88f06677 | ||
|
|
b724df3b02 | ||
|
|
521514180d | ||
|
|
904d09251b |
+2
-5
@@ -1,7 +1,4 @@
|
||||
2015-10-20 v0.3.3
|
||||
|
||||
@EvanCarroll - Updated to remove Grunt, and coffeescript stuff.
|
||||
|
||||
2015-11-01 v0.3.4
|
||||
2015-10-20 v0.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
|
||||
|
||||
@@ -7,25 +7,26 @@ See demos and full documentation at:
|
||||
|
||||
## http://notifyjs.com/
|
||||
|
||||
#### MIT License
|
||||
SYNOPSIS
|
||||
====
|
||||
|
||||
Copyright © 2015 Jaime Pillora <dev@jpillora.com>
|
||||
Global Notifications
|
||||
----
|
||||
|
||||
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:
|
||||
$.notify("Hello World");
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
Element Notifications
|
||||
----
|
||||
|
||||
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.
|
||||
$(".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).
|
||||
|
||||
Copyright © Jaime Pillora <dev@jpillora.com>
|
||||
|
||||
Vendored
+50
-20
@@ -1,6 +1,33 @@
|
||||
/* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
|
||||
(function(window, document, $, undefined) {
|
||||
"use strict";
|
||||
(function (factory) {
|
||||
// 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
|
||||
var indexOf = [].indexOf || function(item) {
|
||||
for (var i = 0, l = this.length; i < l; i++) {
|
||||
@@ -65,7 +92,6 @@
|
||||
};
|
||||
|
||||
var addStyle = function(name, def) {
|
||||
var cssText, elem, fields, ref;
|
||||
if (!name) {
|
||||
throw "Missing Style name";
|
||||
}
|
||||
@@ -75,7 +101,9 @@
|
||||
if (!def.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) {
|
||||
console.warn(pluginName + ": overwriting style '" + name + "'");
|
||||
}
|
||||
@@ -83,7 +111,7 @@
|
||||
}
|
||||
def.name = name;
|
||||
styles[name] = def;
|
||||
cssText = "";
|
||||
var cssText = "";
|
||||
if (def.classes) {
|
||||
$.each(def.classes, function(className, props) {
|
||||
cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n";
|
||||
@@ -105,11 +133,11 @@
|
||||
def.cssElem = insertCSS(cssText);
|
||||
def.cssElem.attr("id", "notify-" + def.name);
|
||||
}
|
||||
fields = {};
|
||||
elem = $(def.html);
|
||||
var fields = {};
|
||||
var elem = $(def.html);
|
||||
findFields("html", elem, fields);
|
||||
findFields("text", elem, fields);
|
||||
return def.fields = fields;
|
||||
def.fields = fields;
|
||||
};
|
||||
|
||||
var insertCSS = function(cssText) {
|
||||
@@ -119,8 +147,7 @@
|
||||
$("head").append(elem);
|
||||
try {
|
||||
elem.html(cssText);
|
||||
} catch (error) {
|
||||
e = error;
|
||||
} catch (_) {
|
||||
elem[0].styleSheet.cssText = cssText;
|
||||
}
|
||||
return elem;
|
||||
@@ -138,7 +165,7 @@
|
||||
if (!name) {
|
||||
name = blankFieldName;
|
||||
}
|
||||
return fields[name] = type;
|
||||
fields[name] = type;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -303,15 +330,16 @@
|
||||
};
|
||||
|
||||
Notification.prototype.setGlobalPosition = function() {
|
||||
var align, anchor, css, key, main, pAlign, pMain, ref;
|
||||
ref = this.getPosition(), pMain = ref[0], pAlign = ref[1];
|
||||
main = positions[pMain];
|
||||
align = positions[pAlign];
|
||||
key = pMain + "|" + pAlign;
|
||||
anchor = globalAnchors[key];
|
||||
var p = this.getPosition();
|
||||
var pMain = p[0];
|
||||
var pAlign = p[1];
|
||||
var main = positions[pMain];
|
||||
var align = positions[pAlign];
|
||||
var key = pMain + "|" + pAlign;
|
||||
var anchor = globalAnchors[key];
|
||||
if (!anchor) {
|
||||
anchor = globalAnchors[key] = createElem("div");
|
||||
css = {};
|
||||
var css = {};
|
||||
css[main] = 0;
|
||||
if (align === "middle") {
|
||||
css.top = '45%';
|
||||
@@ -329,7 +357,9 @@
|
||||
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;
|
||||
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();
|
||||
elemH = this.elem.outerHeight();
|
||||
elemW = this.elem.outerWidth();
|
||||
@@ -583,4 +613,4 @@
|
||||
});
|
||||
});
|
||||
|
||||
}).call(this, window, document, jQuery);
|
||||
}));
|
||||
|
||||
+19
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"title": "Notify.js",
|
||||
"name": "notify",
|
||||
"version": "0.3.4",
|
||||
"version": "0.4.0",
|
||||
"author": {
|
||||
"name": "Jaime Pillora"
|
||||
},
|
||||
@@ -14,5 +14,22 @@
|
||||
],
|
||||
"homepage": "http://notifyjs.com/",
|
||||
"license": "MIT",
|
||||
"main": "dist/notify.js"
|
||||
"main": "dist/notify.js",
|
||||
"scripts": {
|
||||
"test": "npm run lint",
|
||||
"lint": "jshint ./dist/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"jquery": "^2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "^2.8.0"
|
||||
},
|
||||
"keywords": [
|
||||
"notify",
|
||||
"notification",
|
||||
"prompt",
|
||||
"popup",
|
||||
"jquery-plugin"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user