add requirejs support

It's not work correct with requirejs, so I modify something for it