Skip to content

Instantly share code, notes, and snippets.

@tassoevan
Last active December 15, 2015 20:48
Show Gist options
  • Save tassoevan/5320768 to your computer and use it in GitHub Desktop.
Save tassoevan/5320768 to your computer and use it in GitHub Desktop.
Basic jQuery plugins initialization
// Basic jQuery plugins initialization
var MyNamespace = MyNamespace || {};
MyNamespace.applyPlugins = function(parent) {
if (!parent)
parent = $('body');
$('[data-focus=auto]', parent).focus();
var richEdits = $('textarea[data-rich=true]');
if (richEdits.size() > 0) {
richEdits.fadeTo(0, 1e-8);
// head.js used here for instance
head.js('/js/vendor/ckeditor/ckeditor.js').ready(function() {
richEdits.fadeTo(0, 1).each(function() {
$(this).myRichEditorPlugin();
});
});
}
// more stuff ...
};
$(function() {
MyNamespace.applyPlugins();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment