readded UMD stuff, and package.json tests

This commit is contained in:
Evan Carroll
2015-11-02 18:18:18 -06:00
parent 0b8891e8c8
commit 904d09251b
3 changed files with 595 additions and 571 deletions
+2 -5
View File
@@ -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
+50 -30
View File
@@ -1,28 +1,50 @@
/* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
(function(window, document, $, undefined) {
"use strict";
//IE8 indexOf polyfill
var indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) {
return i;
// UMD start
// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
(function (factory) {
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 ( window ) {
jQuery = require('jquery');
}
else {
jQuery = require('jquery')(root);
}
}
return -1;
factory(jQuery);
return jQuery;
};
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var Notification, addStyle, blankFieldName, coreStyle, createElem, defaults, encode, find, findFields, 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';
pluginClassName = pluginName + 'js';
blankFieldName = pluginName + "!blank";
positions = {
t: 'top',
m: 'middle',
b: 'bottom',
l: 'left',
c: 'center',
r: 'right'
};
var pluginName = "notify";
var pluginClassName = pluginName + "js";
var blankFieldName = pluginName + "!blank";
var positions = {
t: "top",
m: "middle",
b: "bottom",
l: "left",
c: "center",
r: "right"
};
var hAligns = ["l", "c", "r"];
var vAligns = ["t", "m", "b"];
var mainPositions = ["t", "b", "l", "r"];
@@ -571,16 +593,14 @@
});
$(function() {
insertCSS(coreStyle.css).attr("id", "core-notify");
$(document).on("click", "." + pluginClassName + "-hidable", function(e) {
return $(this).trigger("notify-hide");
insertCSS(coreStyle.css).attr('id', 'core-notify');
$(document).on('click', "." + pluginClassName + "-hidable", function(e) {
return $(this).trigger('notify-hide');
});
return $(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
var elem = $(this).data(pluginClassName);
if(elem) {
elem.show(false);
}
return $(document).on('notify-hide', "." + pluginClassName + "-wrapper", function(e) {
var _ref;
return (_ref = $(this).data(pluginClassName)) != null ? _ref.show(false) : void 0;
});
});
}).call(this, window, document, jQuery);
}));
+9 -2
View File
@@ -1,7 +1,7 @@
{
"title": "Notify.js",
"name": "notify",
"version": "0.3.4",
"version": "0.4.0",
"author": {
"name": "Jaime Pillora"
},
@@ -14,5 +14,12 @@
],
"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"
}
}