Changed plugin setup to use RequireJS if present

Uses RequireJS to resolve dependencies and if this fails rolls back to the $("head").append() method.