Add JS in open edx

566 views
Skip to first unread message

Дмитрий Утробин

unread,
Sep 27, 2016, 5:25:42 AM9/27/16
to General Open edX discussion
Hello!

How to add javascript library to open edx theme?

Thanks
Message has been deleted

Дмитрий Утробин

unread,
Sep 27, 2016, 6:28:52 AM9/27/16
to General Open edX discussion
For example, in lms/static/js/ I found bootstrap.js and some jquery modules. But I want to use jqueryui. How to include it in open edx?

вторник, 27 сентября 2016 г., 16:25:42 UTC+7 пользователь Дмитрий Утробин написал:

Andy Armstrong

unread,
Sep 27, 2016, 10:06:55 AM9/27/16
to edx-...@googlegroups.com
Here's our wiki page for how to add a new JavaScript library:


Note that this updates the platform, so you probably can't do all of this within a theme. You'll probably have to fork the code to use this approach.

Let me know if you'd like more details.

 - Andy




--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/02a444f6-3ffe-4271-b650-60e0f99113b1%40googlegroups.com.



--

Andy Armstrong

edX | UI Architect  | an...@edx.org  

141 Portland Street, 9th floor

Cambridge, MA 02139

http://www.edx.org

http://www.e-learn.nl/media/blogs/e-learn/edX_Logo_Col_RGB_FINAL.jpg?mtime=1336074566

Дмитрий Утробин

unread,
Sep 27, 2016, 11:10:30 PM9/27/16
to General Open edX discussion
Thank you for your answer.

I don't understand how it works. I added a simple code from jqueryui.com in lms/js/course_info.js. And it's all right. It works. But I don't understand where jqueryui is included in open edx?

вторник, 27 сентября 2016 г., 21:06:55 UTC+7 пользователь Andy Armstrong написал:

Andy Armstrong

unread,
Sep 28, 2016, 8:42:03 AM9/28/16
to edx-...@googlegroups.com
Good question. It turns out that JQuery.UI is already included in edx-platform. It is made available through RequireJS, and there are a number of files that load it as a dependency. You can see its registration here:


Probably your safest bet is to load JQuery.UI using RequireJS because then it will be guaranteed to be loaded even if other files stop using it. Here's an example:


I hope this helps.

 - Andy

Reply all
Reply to author
Forward
0 new messages