Skip to content

Commit

Permalink
use jQuery from core module in module factory function
Browse files Browse the repository at this point in the history
  • Loading branch information
inferpse committed Aug 3, 2015
1 parent 9cce84c commit 267e1f6
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
9 changes: 4 additions & 5 deletions js/jcf.button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($) {
jcf.addModule(function($) {
'use strict';

jcf.addModule({
return {
name: 'Button',
selector: 'button, input[type="button"], input[type="submit"], input[type="reset"]',
options: {
Expand Down Expand Up @@ -80,6 +80,5 @@
opacity: ''
});
}
});

}(jQuery));
};
});
9 changes: 4 additions & 5 deletions js/jcf.checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($) {
jcf.addModule(function($) {
'use strict';

jcf.addModule({
return {
name: 'Checkbox',
selector: 'input[type="checkbox"]',
options: {
Expand Down Expand Up @@ -162,6 +162,5 @@
click: this.onRealClick
});
}
});

}(jQuery));
};
});
9 changes: 4 additions & 5 deletions js/jcf.file.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($) {
jcf.addModule(function($) {
'use strict';

jcf.addModule({
return {
name: 'File',
selector: 'input[type="file"]',
options: {
Expand Down Expand Up @@ -118,6 +118,5 @@
});
this.doc.off('jcf-pointerup', this.onRelease);
}
});

}(jQuery));
};
});
5 changes: 5 additions & 0 deletions js/jcf.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@
}
},
addModule: function(proto) {
// proto is factory function
if ($.isFunction(proto)) {
proto = proto($, window);
}

// add module to list
var Module = function(options) {
// save instance to collection
Expand Down
9 changes: 4 additions & 5 deletions js/jcf.number.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($) {
jcf.addModule(function($) {
'use strict';

jcf.addModule({
return {
name: 'Number',
selector: 'input[type="number"]',
options: {
Expand Down Expand Up @@ -151,6 +151,5 @@
blur: this.onBlur
});
}
});

}(jQuery));
};
});
9 changes: 4 additions & 5 deletions js/jcf.radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($) {
jcf.addModule(function($) {
'use strict';

jcf.addModule({
return {
name: 'Radio',
selector: 'input[type="radio"]',
options: {
Expand Down Expand Up @@ -186,6 +186,5 @@
click: this.onRealClick
});
}
});

}(jQuery));
};
});
9 changes: 4 additions & 5 deletions js/jcf.range.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($) {
jcf.addModule(function($) {
'use strict';

jcf.addModule({
return {
name: 'Range',
selector: 'input[type="range"]',
options: {
Expand Down Expand Up @@ -475,6 +475,5 @@
blur: this.onBlur
});
}
});

}(jQuery));
};
});
9 changes: 5 additions & 4 deletions js/jcf.scrollable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($, window) {
jcf.addModule(function($, window) {
'use strict';

jcf.addModule({
var module = {
name: 'Scrollable',
selector: '.jcf-scrollable',
plugins: {
Expand Down Expand Up @@ -379,7 +379,7 @@
this.scrollWrapper.remove();
this.restoreScrollOffsets();
}
});
};

// custom scrollbar
function ScrollBar(options) {
Expand Down Expand Up @@ -659,4 +659,5 @@
}
});

}(jQuery, this));
return module;
});
9 changes: 5 additions & 4 deletions js/jcf.select.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($, window) {
jcf.addModule(function($, window) {
'use strict';

jcf.addModule({
var module = {
name: 'Select',
selector: 'select',
options: {
Expand Down Expand Up @@ -54,7 +54,7 @@
destroy: function() {
this.instance.destroy();
}
});
};

// combobox module
function ComboBox(options) {
Expand Down Expand Up @@ -937,4 +937,5 @@
};
}());

}(jQuery, this));
return module;
});
9 changes: 4 additions & 5 deletions js/jcf.textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Version: 1.1.3
*/
;(function($) {
jcf.addModule(function($) {
'use strict';

jcf.addModule({
return {
name: 'Textarea',
selector: 'textarea',
options: {
Expand Down Expand Up @@ -149,6 +149,5 @@
// remove scrollbar and fake wrapper
this.fakeElement.remove();
}
});

}(jQuery));
};
});

0 comments on commit 267e1f6

Please sign in to comment.