Last active
December 15, 2015 20:48
-
-
Save tassoevan/5320768 to your computer and use it in GitHub Desktop.
Basic jQuery plugins initialization
This file contains 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
// 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