Editor munges javascript

Editor munges javascript

Scott Krajewski གིས-
Number of replies: 2
We're trying to include an image mouseover function in a web page resource. But it looks like the HTML editor keeps munging part of the simple javascript every time we edit the page.

For example it takes a quote " and makes it an &quote; in the line
document.b1.src="urltoimage"
I can escape the quote to save it for that session but re-editing transforms it again.

Also, the editor seems to recursively wrap function{} around my onmouseover events. Any way to change these behaviors?
དཔྱ་སྙོམས་ཀྱི་སྐུགས་ཚུ།: -
In reply to Scott Krajewski

Re: Editor munges javascript

Robert Piercy གིས-
I am having a similar problem.

Actually, I have seen in other threads that there is a way to disable to javascript filter for the entire site (although I can't seem to find this in the admin area), but a better solution would be for an administrator to be able to grant javascript rights to course creators and/or teachers.

I tried to disable it through code by returning the same text that was passed in in the "cleanAttributes" function in /moodle/lib/weblib.php, but it is still changing my javascript.  The reason I need it is for AJAX.  We have mixed some of our old site into moodle, and I want those pages from our old site to show up in the middle column without refreshing the entire page.

Any ideas would be very helpful.

Regards,
Robert Piercy
In reply to Robert Piercy

Re: Editor munges javascript

Don Schwartz གིས-
You have to go into admin/editor and disable the wysiwyg html editor for the time you want to do this sort of work.  That gives you a plain html text editor.
I've had to do this to add Google search and other javascripts.
don