From 446852a260aab2e7caf772a62fbde8b518c38816 Mon Sep 17 00:00:00 2001 From: joaoafrmartins Date: Wed, 17 Sep 2014 00:03:02 +0100 Subject: [PATCH] feat(gridster): Common.js support Closes #434 --- src/jquery.collision.js | 5 +++-- src/jquery.coords.js | 7 ++++--- src/jquery.draggable.js | 5 +++-- src/jquery.gridster.extras.js | 5 +++-- src/jquery.gridster.js | 7 +++++-- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/jquery.collision.js b/src/jquery.collision.js index 4a15e8e34b..a81d41406b 100644 --- a/src/jquery.collision.js +++ b/src/jquery.collision.js @@ -7,8 +7,9 @@ */ ;(function(root, factory) { - - if (typeof define === 'function' && define.amd) { + if (typeof exports === 'object') { + module.exports = factory(require('jquery'), require('./jquery.coords.js')); + } 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 821b67c8b2..ff7c0d68ae 100644 --- a/src/jquery.coords.js +++ b/src/jquery.coords.js @@ -7,11 +7,12 @@ */ ;(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); + root.GridsterCoords = factory(root.$ || root.jQuery); } }(this, function($) { diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index d9b5d9884b..2822b3b176 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -7,8 +7,9 @@ */ ;(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 e7ea59f8ba..6915a848b1 100644 --- a/src/jquery.gridster.extras.js +++ b/src/jquery.gridster.extras.js @@ -1,6 +1,7 @@ ;(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 de7f06d608..c9d5ea82da 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -7,8 +7,11 @@ */ ;(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'), + require('./utils.js')); + } else if (typeof define === 'function' && define.amd) { define(['jquery', 'gridster-draggable', 'gridster-collision'], factory); } else { root.Gridster = factory(root.$ || root.jQuery, root.GridsterDraggable,