diff --git a/js/jcf.button.js b/js/jcf.button.js index 34e06c6..d67b71a 100644 --- a/js/jcf.button.js +++ b/js/jcf.button.js @@ -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: { @@ -80,6 +80,5 @@ opacity: '' }); } - }); - -}(jQuery)); + }; +}); diff --git a/js/jcf.checkbox.js b/js/jcf.checkbox.js index 4e9fe78..3c54cc9 100755 --- a/js/jcf.checkbox.js +++ b/js/jcf.checkbox.js @@ -6,10 +6,10 @@ * * Version: 1.1.3 */ -;(function($) { +jcf.addModule(function($) { 'use strict'; - jcf.addModule({ + return { name: 'Checkbox', selector: 'input[type="checkbox"]', options: { @@ -162,6 +162,5 @@ click: this.onRealClick }); } - }); - -}(jQuery)); + }; +}); diff --git a/js/jcf.file.js b/js/jcf.file.js index 50cce75..f97a687 100644 --- a/js/jcf.file.js +++ b/js/jcf.file.js @@ -6,10 +6,10 @@ * * Version: 1.1.3 */ -;(function($) { +jcf.addModule(function($) { 'use strict'; - jcf.addModule({ + return { name: 'File', selector: 'input[type="file"]', options: { @@ -118,6 +118,5 @@ }); this.doc.off('jcf-pointerup', this.onRelease); } - }); - -}(jQuery)); + }; +}); diff --git a/js/jcf.js b/js/jcf.js index 585c3e5..5c9fb47 100755 --- a/js/jcf.js +++ b/js/jcf.js @@ -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 diff --git a/js/jcf.number.js b/js/jcf.number.js index 2002bc0..6ee19b8 100644 --- a/js/jcf.number.js +++ b/js/jcf.number.js @@ -6,10 +6,10 @@ * * Version: 1.1.3 */ -;(function($) { +jcf.addModule(function($) { 'use strict'; - jcf.addModule({ + return { name: 'Number', selector: 'input[type="number"]', options: { @@ -151,6 +151,5 @@ blur: this.onBlur }); } - }); - -}(jQuery)); + }; +}); diff --git a/js/jcf.radio.js b/js/jcf.radio.js index 4f9e20d..9c0c34b 100755 --- a/js/jcf.radio.js +++ b/js/jcf.radio.js @@ -6,10 +6,10 @@ * * Version: 1.1.3 */ -;(function($) { +jcf.addModule(function($) { 'use strict'; - jcf.addModule({ + return { name: 'Radio', selector: 'input[type="radio"]', options: { @@ -186,6 +186,5 @@ click: this.onRealClick }); } - }); - -}(jQuery)); + }; +}); diff --git a/js/jcf.range.js b/js/jcf.range.js index 743c8fd..c27fb7d 100644 --- a/js/jcf.range.js +++ b/js/jcf.range.js @@ -6,10 +6,10 @@ * * Version: 1.1.3 */ -;(function($) { +jcf.addModule(function($) { 'use strict'; - jcf.addModule({ + return { name: 'Range', selector: 'input[type="range"]', options: { @@ -475,6 +475,5 @@ blur: this.onBlur }); } - }); - -}(jQuery)); + }; +}); diff --git a/js/jcf.scrollable.js b/js/jcf.scrollable.js index 201bbff..e7c38e8 100755 --- a/js/jcf.scrollable.js +++ b/js/jcf.scrollable.js @@ -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: { @@ -379,7 +379,7 @@ this.scrollWrapper.remove(); this.restoreScrollOffsets(); } - }); + }; // custom scrollbar function ScrollBar(options) { @@ -659,4 +659,5 @@ } }); -}(jQuery, this)); + return module; +}); diff --git a/js/jcf.select.js b/js/jcf.select.js index 7781245..cfc432c 100644 --- a/js/jcf.select.js +++ b/js/jcf.select.js @@ -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: { @@ -54,7 +54,7 @@ destroy: function() { this.instance.destroy(); } - }); + }; // combobox module function ComboBox(options) { @@ -937,4 +937,5 @@ }; }()); -}(jQuery, this)); + return module; +}); diff --git a/js/jcf.textarea.js b/js/jcf.textarea.js index 12c713b..ea8c547 100644 --- a/js/jcf.textarea.js +++ b/js/jcf.textarea.js @@ -6,10 +6,10 @@ * * Version: 1.1.3 */ -;(function($) { +jcf.addModule(function($) { 'use strict'; - jcf.addModule({ + return { name: 'Textarea', selector: 'textarea', options: { @@ -149,6 +149,5 @@ // remove scrollbar and fake wrapper this.fakeElement.remove(); } - }); - -}(jQuery)); + }; +});