From 5472f95252c5b50f1db45d31ca05d58639295260 Mon Sep 17 00:00:00 2001 From: Chaoyu Date: Fri, 9 Oct 2015 14:46:12 -0700 Subject: [PATCH 1/3] common js suport --- src/gridstack.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gridstack.js b/src/gridstack.js index 9b7aaa7..1922301 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -8,6 +8,11 @@ define(['jquery', 'lodash', 'jquery-ui/core', 'jquery-ui/widget', 'jquery-ui/mouse', 'jquery-ui/draggable', 'jquery-ui/resizable'], factory); } + else if(typeof exports !== 'undefined') { + var _ = require("lodash"); + try { jQuery = require('jquery'); } catch(e) {} + factory(jQuery, _); + } else { factory(jQuery, _); } From b7c7b3b8f38a69972890d89ac095c914fb3e4031 Mon Sep 17 00:00:00 2001 From: Chaoyu Date: Fri, 9 Oct 2015 15:10:22 -0700 Subject: [PATCH 2/3] fix --- src/gridstack.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gridstack.js b/src/gridstack.js index 1922301..82267aa 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -8,10 +8,9 @@ define(['jquery', 'lodash', 'jquery-ui/core', 'jquery-ui/widget', 'jquery-ui/mouse', 'jquery-ui/draggable', 'jquery-ui/resizable'], factory); } - else if(typeof exports !== 'undefined') { - var _ = require("lodash"); + else if (typeof exports !== 'undefined') { try { jQuery = require('jquery'); } catch(e) {} - factory(jQuery, _); + factory(jQuery, require("lodash")); } else { factory(jQuery, _); From 3be2105a93dffc38b70b3d998a086cc234f7678b Mon Sep 17 00:00:00 2001 From: Chaoyu Date: Fri, 9 Oct 2015 15:22:00 -0700 Subject: [PATCH 3/3] try load lodash, otherwise use global _ --- src/gridstack.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gridstack.js b/src/gridstack.js index 82267aa..afd7843 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -10,7 +10,8 @@ } else if (typeof exports !== 'undefined') { try { jQuery = require('jquery'); } catch(e) {} - factory(jQuery, require("lodash")); + try { _ = require('lodash'); } catch(e) {} + factory(jQuery, _); } else { factory(jQuery, _);