How to inject custom css and javascript to any moodle page

Re: How to inject custom css and javascript to any moodle page

by Zoran Jeremic -
Number of replies: 0

Hi guys,

Thank you so much for all these ideas.

@Tim: Your idea with block sounds good, since I already implemented 2 blocks that work together with this main plugin, so I can embed JS and CSS as you suggested from one of the blocks. I also had that in mind, but for some reason I thought these blocks are generated after the page content and it would not be possible to embed CSS that will afect the whole page.

When you suggested "The block does not have to appear as a block at the side of the page.." did you mean to configure it as hidden? Is it possible to enforce it from the code that block will always appear on each page (either visible or hidden), so if teacher removes it from the course, it will still be there, but hidden. This is just to prevent this case when teacher removed block from some page.

@Justin: I will definitely try with additional html and see if it works. I just could not try any example using it to inject JS or CSS to $PAGE.

@Charles: I didn't understand what you are refering to in your post.

Thanks,
Zoran