feat: make gridster AMD compatible

This commit is contained in:
vieron
2014-06-25 10:54:21 +02:00
parent 5c6d25cbbe
commit 589d7fd509
5 changed files with 61 additions and 12 deletions
+12 -2
View File
@@ -6,7 +6,16 @@
* Licensed under the MIT licenses.
*/
;(function($, window, document, undefined){
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define('gridster-collision', ['jquery', 'gridster-coords'], factory);
} else {
root.GridsterCollision = factory(root.$ || root.jQuery,
root.GridsterCoords);
}
}(this, function($, Coords) {
var defaults = {
colliders_context: document.body,
@@ -227,5 +236,6 @@
return new Collision( this, collider, options );
};
return Collision;
}(jQuery, window, document));
}));
+12 -2
View File
@@ -6,7 +6,15 @@
* Licensed under the MIT licenses.
*/
;(function($, window, document, undefined){
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define('gridster-coords', ['jquery'], factory);
} else {
root.GridsterCoords = factory(root.$ || root.jQuery);
}
}(this, function($) {
/**
* Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)
* to simulate DOM elements on the screen.
@@ -112,4 +120,6 @@
return ins;
};
}(jQuery, window, document));
return Coords;
}));
+11 -2
View File
@@ -6,7 +6,15 @@
* Licensed under the MIT licenses.
*/
;(function($, window, document, undefined) {
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define('gridster-draggable', ['jquery'], factory);
} else {
root.GridsterDraggable = factory(root.$ || root.jQuery);
}
}(this, function($) {
var defaults = {
items: 'li',
@@ -402,5 +410,6 @@
return new Draggable(this, options);
};
return Draggable;
}(jQuery, window, document));
}));
+13 -3
View File
@@ -1,6 +1,14 @@
;(function($, window, document, undefined) {
;(function(root, factory) {
var fn = $.Gridster;
if (typeof define === 'function' && define.amd) {
define(['jquery', 'gridster'], factory);
} else {
root.Gridster = factory(root.$ || root.jQuery, root.Gridster);
}
}(this, function($, Gridster) {
var fn = Gridster.prototype;
fn.widgets_in_col = function(col) {
if (!this.gridmap[col]) {
@@ -162,4 +170,6 @@
return false;
};
}(jQuery, window, document));
return Gridster;
}));
+13 -3
View File
@@ -5,7 +5,17 @@
* Copyright (c) 2012 ducksboard
* Licensed under the MIT licenses.
*/
;(function($, window, document, undefined) {
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery', 'gridster-draggable', 'gridster-collision'], factory);
} else {
root.Gridster = factory(root.$ || root.jQuery, root.GridsterDraggable,
root.GridsterCollision);
}
}(this, function($, Draggable, Collision) {
var defaults = {
namespace: '',
@@ -3111,6 +3121,6 @@
});
};
$.Gridster = fn;
return Gridster;
}(jQuery, window, document));
}));