From ddf8bbdd9e7ad66c2bf0b7ce93239ab9f4774490 Mon Sep 17 00:00:00 2001 From: joaoafrmartins Date: Wed, 17 Sep 2014 00:03:02 +0100 Subject: [PATCH 1/2] support UMD --- src/jquery.collision.js | 6 ++++-- src/jquery.coords.js | 6 ++++-- src/jquery.draggable.js | 6 ++++-- src/jquery.gridster.extras.js | 6 ++++-- src/jquery.gridster.js | 6 ++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/jquery.collision.js b/src/jquery.collision.js index 4a15e8e3..c22bf62e 100644 --- a/src/jquery.collision.js +++ b/src/jquery.collision.js @@ -7,8 +7,10 @@ */ ;(function(root, factory) { - - if (typeof define === 'function' && define.amd) { + if(typeof exports === 'object') { + module.exports = factory(require('jquery')); + } + else if (typeof define === 'function' && define.amd) { define('gridster-collision', ['jquery', 'gridster-coords'], factory); } else { root.GridsterCollision = factory(root.$ || root.jQuery, diff --git a/src/jquery.coords.js b/src/jquery.coords.js index 821b67c8..0f5e2c0b 100644 --- a/src/jquery.coords.js +++ b/src/jquery.coords.js @@ -7,8 +7,10 @@ */ ;(function(root, factory) { - - if (typeof define === 'function' && define.amd) { + if(typeof exports === 'object') { + module.exports = factory(require('jquery')); + } + else if (typeof define === 'function' && define.amd) { define('gridster-coords', ['jquery'], factory); } else { root.GridsterCoords = factory(root.$ || root.jQuery); diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 45d7b290..c54037c7 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -7,8 +7,10 @@ */ ;(function(root, factory) { - - if (typeof define === 'function' && define.amd) { + if(typeof exports === 'object') { + module.exports = factory(require('jquery')); + } + else if (typeof define === 'function' && define.amd) { define('gridster-draggable', ['jquery'], factory); } else { root.GridsterDraggable = factory(root.$ || root.jQuery); diff --git a/src/jquery.gridster.extras.js b/src/jquery.gridster.extras.js index e7ea59f8..93a7e509 100644 --- a/src/jquery.gridster.extras.js +++ b/src/jquery.gridster.extras.js @@ -1,6 +1,8 @@ ;(function(root, factory) { - - if (typeof define === 'function' && define.amd) { + if(typeof exports === 'object') { + module.exports = factory(require('jquery'), require('./jquery-gridster.js')); + } + else if (typeof define === 'function' && define.amd) { define(['jquery', 'gridster'], factory); } else { root.Gridster = factory(root.$ || root.jQuery, root.Gridster); diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 7bac9118..96894997 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -7,8 +7,10 @@ */ ;(function(root, factory) { - - if (typeof define === 'function' && define.amd) { + if(typeof exports === 'object') { + module.exports = factory(require('jquery'), require('./jquery.draggable.js'), require('./jquery.collision.js')); + } + else if (typeof define === 'function' && define.amd) { define(['jquery', 'gridster-draggable', 'gridster-collision'], factory); } else { root.Gridster = factory(root.$ || root.jQuery, root.GridsterDraggable, From 17b101328b4d64dc6a7bb94dcba12d068415de2f Mon Sep 17 00:00:00 2001 From: joaoafrmartins Date: Wed, 17 Sep 2014 00:49:35 +0100 Subject: [PATCH 2/2] commonjs --- src/jquery.gridster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 96894997..4fc3c6f5 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -8,7 +8,7 @@ ;(function(root, factory) { if(typeof exports === 'object') { - module.exports = factory(require('jquery'), require('./jquery.draggable.js'), require('./jquery.collision.js')); + module.exports = factory(require('jquery'), require('./jquery.draggable.js'), require('./jquery.collision.js'), require('./jquery.coords.js'), require('./utils.js')); } else if (typeof define === 'function' && define.amd) { define(['jquery', 'gridster-draggable', 'gridster-collision'], factory);