We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37275
    • 2 Posts
    Hey all,

    Am new to MODX, and got a few issues. I hope someone can help :-s

    Here's what it's all about. I got a source page on my own web site which shows a clickable map. Parts of that map light up when doing onMouseOver. If you open the page on a smartphone/tablet, then you get extra buttons allowing you to get idem results (highlighted map portions). Simple enough. Here's that page:

    http://www.pixelpower.be/Sun/code/SA/SA-MAIN.html

    Works fine. If you look at the code you will see quite an extensive java block for platform detection and for that onMouseOver stuff, and a smaller java block in the end to write the code for the extra buttons if needed.

    So now I tried copying this code to the web server where our main web site is on. The target web page is on MODX (Revolution 2.1.1-pl (traditional)). Here's the target page:

    http://www.sunsafaris.com/south-africa-map/

    I basically got two issues. The first one is that every time I leave the MODX backend admin page, and then come back and edit my page again, the software has put these CDATA tags around my java code blocks. Now, that shouldn't be a problem, but it's not done correctly I think. Because if I open the page with the CDATA tags in it, then the bottom java script part is no longer executed (I no longer see any buttons on iPad, for instance). Plus, he simply throws away some parts of my code;
    - the little CSS portion (somewhere 1/3rd down the page, so not the top part that comes from the MODX site framework)
    - the "topDestBottom" DIV which sits all the way in the bottom of my code part (there's more code after that, again coming from the site framework).

    For now, I simply copied my code in a txt file on my PC, and simply overwrite the whole damn page when I need to edit it. But I would appreciate it if someone could tell me how I can stop MODX from altering my code. Or at least how to put in the CDATA tags correctly (although those are not really necessary, if I understand correctly what I read about it on the web).

    A second issue is that on my target page, the onMouseOver routines no longer work. To be precise; they work when you run them via the buttons on an iPad, but not when you test the page in a regular browser. This is strange, as I cannot find any noticeable difference with the code on my source page. Anyone got any idea?

    1000x thanks in advice,

    Jochen the MODX noob
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That is from the Rich Text editor, TinyMCE, being overly helpful. The best way to work around this is to break your javascript out to an external .js file and just have
      <script href="link-to-js-file.js"></script>
      tags in your content. Another way is to put the javascript into a chunk and only have the chunk tags in the content; but this will also be "helpfully" enclosed in < p > tags and that may mess up the workings if the javascript isn't expecting them in that place.

      If you don't need the rich text editor for that particular page, just turn it off for that page (I don't know how that's done in Revo, but it's one of the main page configuration settings in Evo).

      Otherwise, MODx doesn't care what javascript you have; in itself it is not affected nor does it in any way affect your javascript. TinyMCE is included as a convenience, and is not associated with MODx.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 37275
        • 2 Posts
        Hey Susan,

        Of course! Fantastic idea!

        Will try that tomorrow and let you know the result.

        Thanks!

        J.