Created
September 13, 2009 18:51
-
-
Save furf/186283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery plugin Textmate snippet | |
(function (\$) { | |
/** | |
* ${10:plugin} | |
*/ | |
\$.fn.${10:plugin} = function(cfg) { | |
if (this.length === 0) { | |
return this; | |
} | |
/** | |
* Configuration | |
*/ | |
cfg = $.extend(true, | |
// Private config | |
{}, | |
// Public config | |
\$.fn.${10:plugin}.defaults, | |
// User config | |
cfg); | |
/** | |
* Private static methods | |
*/ | |
/** | |
* Return instance | |
*/ | |
return this.each(function() { | |
var \$this = \$(this); | |
}); | |
}; | |
\$.fn.${10:plugin}.defaults = { | |
${20:// Configuration properties} | |
}; | |
})(jQuery); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery plugin template | |
(function ($) { | |
/** | |
* plugin | |
*/ | |
$.fn.plugin = function(cfg) { | |
if (this.length === 0) { | |
return this; | |
} | |
/** | |
* Configuration | |
*/ | |
cfg = .extend(true, | |
// Private config | |
{}, | |
// Public config | |
$.fn.plugin.defaults, | |
// User config | |
cfg); | |
/** | |
* Private static methods | |
*/ | |
/** | |
* Return instance | |
*/ | |
return this.each(function() { | |
var $this = $(this); | |
}); | |
}; | |
$.fn.plugin.defaults = { | |
// Configuration properties | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment