Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed npm - replaced hidden module with _module variable #1156

Merged
merged 1 commit into from
Oct 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,16 @@ module.exports = function(grunt) {
options: {
patterns: [
{
match: /\$.fn.\w+/g,
replacement: 'module.exports'
match: /\$\.fn\.\w+\s*=\s*function\(parameters\)\s*{/g,
replacement: 'module.exports = function(parameters) {\n var _module = module;\n'
},
{
match: /\$\.fn\.\w+\.settings/g,
replacement: '_module.exports.settings'
},
{
match: /\$\.fn\.\w+\.settings\s*=/g,
replacement: 'module.exports.settings ='
},
{
match: /jQuery/g,
Expand Down
6 changes: 4 additions & 2 deletions npm/modules/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ($, window, document, undefined) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),

Expand All @@ -27,8 +29,8 @@ module.exports = function(parameters) {
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, module.exports.settings, parameters)
: $.extend({}, module.exports.settings),
? $.extend(true, {}, _module.exports.settings, parameters)
: $.extend({}, _module.exports.settings),

className = settings.className,
namespace = settings.namespace,
Expand Down
8 changes: 6 additions & 2 deletions npm/modules/behavior/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ( $, window, document, undefined ) {

$.api = module.exports = function(parameters) {
var _module = module;


var
settings = $.extend(true, {}, $.api.settings, parameters),
Expand Down Expand Up @@ -524,6 +526,8 @@

// handle DOM attachment to API functionality
module.exports = function(parameters) {
var _module = module;

$(this)
.each(function(){
var
Expand All @@ -532,8 +536,8 @@
selector = $(this).selector || '',

settings = ( $.isFunction(parameters) )
? $.extend(true, {}, $.api.settings, module.exports.settings, { stateContext: this, success: parameters })
: $.extend(true, {}, $.api.settings, module.exports.settings, { stateContext: this}, parameters),
? $.extend(true, {}, $.api.settings, _module.exports.settings, { stateContext: this, success: parameters })
: $.extend(true, {}, $.api.settings, _module.exports.settings, { stateContext: this}, parameters),
module
;
module = {
Expand Down
4 changes: 3 additions & 1 deletion npm/modules/behavior/colorize.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
;(function ( $, window, document, undefined ) {

module.exports = function(parameters) {
var _module = module;

var
settings = $.extend(true, {}, module.exports.settings, parameters),
settings = $.extend(true, {}, _module.exports.settings, parameters),
// hoist arguments
moduleArguments = arguments || false
;
Expand Down
10 changes: 5 additions & 5 deletions npm/modules/behavior/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

;(function ( $, window, document, undefined ) {

module.exports = function(fields, parameters) {
$.fn.form = function(fields, parameters) {
var
$allModules = $(this),

settings = $.extend(true, {}, module.exports.settings, parameters),
validation = $.extend({}, module.exports.settings.defaults, fields),
settings = $.extend(true, {}, _module.exports.settings, parameters),
validation = $.extend({}, _module.exports.settings.defaults, fields),

namespace = settings.namespace,
metadata = settings.metadata,
Expand Down Expand Up @@ -282,7 +282,7 @@ module.exports = function(fields, parameters) {
.html(errors[0])
;
if(!promptExists) {
if(settings.transition && module.exports !== undefined && $module.transition('is supported')) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
module.verbose('Displaying error with css transition', settings.transition);
$prompt.transition(settings.transition + ' in', settings.duration);
}
Expand Down Expand Up @@ -318,7 +318,7 @@ module.exports = function(fields, parameters) {
;
if(settings.inline && $prompt.is(':visible')) {
module.verbose('Removing prompt for field', field);
if(settings.transition && module.exports !== undefined && $module.transition('is supported')) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
$prompt.transition(settings.transition + ' out', settings.duration, function() {
$prompt.remove();
});
Expand Down
4 changes: 3 additions & 1 deletion npm/modules/behavior/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
;(function ( $, window, document, undefined ) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
settings = $.extend(true, {}, module.exports.settings, parameters),
settings = $.extend(true, {}, _module.exports.settings, parameters),

moduleSelector = $allModules.selector || '',

Expand Down
4 changes: 3 additions & 1 deletion npm/modules/chatroom.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ($, window, document, undefined) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
moduleSelector = $allModules.selector || '',
Expand All @@ -27,7 +29,7 @@ module.exports = function(parameters) {
$(this)
.each(function() {
var
settings = $.extend(true, {}, module.exports.settings, parameters),
settings = $.extend(true, {}, _module.exports.settings, parameters),

className = settings.className,
namespace = settings.namespace,
Expand Down
4 changes: 3 additions & 1 deletion npm/modules/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ( $, window, document, undefined ) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
moduleSelector = $allModules.selector || '',
Expand All @@ -28,7 +30,7 @@ module.exports = function(parameters) {
$allModules
.each(function() {
var
settings = $.extend(true, {}, module.exports.settings, parameters),
settings = $.extend(true, {}, _module.exports.settings, parameters),

className = settings.className,
namespace = settings.namespace,
Expand Down
10 changes: 6 additions & 4 deletions npm/modules/dimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ( $, window, document, undefined ) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),

Expand All @@ -29,8 +31,8 @@ module.exports = function(parameters) {
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, module.exports.settings, parameters)
: $.extend({}, module.exports.settings),
? $.extend(true, {}, _module.exports.settings, parameters)
: $.extend({}, _module.exports.settings),

selector = settings.selector,
namespace = settings.namespace,
Expand Down Expand Up @@ -155,7 +157,7 @@ module.exports = function(parameters) {
: function(){}
;
module.set.dimmed();
if(settings.on != 'hover' && settings.useCSS && module.exports !== undefined && $dimmer.transition('is supported')) {
if(settings.on != 'hover' && settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
$dimmer
.transition({
animation : settings.transition + ' in',
Expand Down Expand Up @@ -190,7 +192,7 @@ module.exports = function(parameters) {
? callback
: function(){}
;
if(settings.on != 'hover' && settings.useCSS && module.exports !== undefined && $dimmer.transition('is supported')) {
if(settings.on != 'hover' && settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
module.verbose('Hiding dimmer with css');
$dimmer
.transition({
Expand Down
10 changes: 6 additions & 4 deletions npm/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
;(function ( $, window, document, undefined ) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
$document = $(document),
Expand All @@ -31,8 +33,8 @@ module.exports = function(parameters) {
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, module.exports.settings, parameters)
: $.extend({}, module.exports.settings),
? $.extend(true, {}, _module.exports.settings, parameters)
: $.extend({}, _module.exports.settings),

className = settings.className,
metadata = settings.metadata,
Expand Down Expand Up @@ -605,7 +607,7 @@ module.exports = function(parameters) {
if(settings.transition == 'none') {
callback();
}
else if(module.exports !== undefined && $module.transition('is supported')) {
else if($.fn.transition !== undefined && $module.transition('is supported')) {
$currentMenu
.transition({
animation : settings.transition + ' in',
Expand Down Expand Up @@ -655,7 +657,7 @@ module.exports = function(parameters) {
callback = callback || function(){};
if(module.is.visible($currentMenu) ) {
module.verbose('Doing menu hide animation', $currentMenu);
if(module.exports !== undefined && $module.transition('is supported')) {
if($.fn.transition !== undefined && $module.transition('is supported')) {
$currentMenu
.transition({
animation : settings.transition + ' out',
Expand Down
14 changes: 8 additions & 6 deletions npm/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ( $, window, document, undefined ) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
$window = $(window),
Expand Down Expand Up @@ -39,8 +41,8 @@ module.exports = function(parameters) {
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, module.exports.settings, parameters)
: $.extend({}, module.exports.settings),
? $.extend(true, {}, _module.exports.settings, parameters)
: $.extend({}, _module.exports.settings),

selector = settings.selector,
className = settings.className,
Expand Down Expand Up @@ -71,7 +73,7 @@ module.exports = function(parameters) {
initialize: function() {
module.verbose('Initializing dimmer', $context);

if(module.exports === undefined) {
if($.fn.dimmer === undefined) {
module.error(error.dimmer);
return;
}
Expand Down Expand Up @@ -285,7 +287,7 @@ module.exports = function(parameters) {
callback();
};

if(settings.transition && module.exports !== undefined && $module.transition('is supported')) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
module.debug('Showing modal with css animations');
$module
.transition(settings.transition + ' in', settings.duration, transitionCallback)
Expand Down Expand Up @@ -334,7 +336,7 @@ module.exports = function(parameters) {
;
}
$dimmable.dimmer('hide', function() {
if(settings.transition && module.exports !== undefined && $module.transition('is supported')) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
$module
.transition('reset')
;
Expand Down Expand Up @@ -366,7 +368,7 @@ module.exports = function(parameters) {
callback();
};

if(settings.transition && module.exports !== undefined && $module.transition('is supported')) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
module.debug('Hiding modal with css animations');
$module
.transition(settings.transition + ' out', settings.duration, transitionCallback)
Expand Down
4 changes: 3 additions & 1 deletion npm/modules/nag.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ($, window, document, undefined) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
moduleSelector = $allModules.selector || '',
Expand All @@ -27,7 +29,7 @@ module.exports = function(parameters) {
$(this)
.each(function() {
var
settings = $.extend(true, {}, module.exports.settings, parameters),
settings = $.extend(true, {}, _module.exports.settings, parameters),

className = settings.className,
selector = settings.selector,
Expand Down
10 changes: 6 additions & 4 deletions npm/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ($, window, document, undefined) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
$document = $(document),
Expand All @@ -31,8 +33,8 @@ module.exports = function(parameters) {
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, module.exports.settings, parameters)
: $.extend({}, module.exports.settings),
? $.extend(true, {}, _module.exports.settings, parameters)
: $.extend({}, _module.exports.settings),

selector = settings.selector,
className = settings.className,
Expand Down Expand Up @@ -288,7 +290,7 @@ module.exports = function(parameters) {
$module
.addClass(className.visible)
;
if(settings.transition && module.exports !== undefined && $module.transition('is supported')) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
$popup
.transition(settings.transition + ' in', settings.duration, function() {
module.bind.close();
Expand All @@ -310,7 +312,7 @@ module.exports = function(parameters) {
hide: function(callback) {
callback = callback || function(){};
module.debug('Hiding pop-up');
if(settings.transition && module.exports !== undefined && $module.transition('is supported')) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
$popup
.transition(settings.transition + ' out', settings.duration, function() {
module.reset();
Expand Down
6 changes: 4 additions & 2 deletions npm/modules/rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
;(function ($, window, document, undefined) {

module.exports = function(parameters) {
var _module = module;

var
$allModules = $(this),
moduleSelector = $allModules.selector || '',
Expand All @@ -28,8 +30,8 @@ module.exports = function(parameters) {
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, module.exports.settings, parameters)
: $.extend({}, module.exports.settings),
? $.extend(true, {}, _module.exports.settings, parameters)
: $.extend({}, _module.exports.settings),

namespace = settings.namespace,
className = settings.className,
Expand Down
4 changes: 2 additions & 2 deletions npm/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

;(function ($, window, document, undefined) {

module.exports = function(source, parameters) {
$.fn.search = function(source, parameters) {
var
$allModules = $(this),
moduleSelector = $allModules.selector || '',
Expand All @@ -27,7 +27,7 @@ module.exports = function(source, parameters) {
$(this)
.each(function() {
var
settings = $.extend(true, {}, module.exports.settings, parameters),
settings = $.extend(true, {}, _module.exports.settings, parameters),

className = settings.className,
selector = settings.selector,
Expand Down
Loading