We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5727
    • 160 Posts
    I’m currently developing a small snippet that changes the CSS without reloading the page, using the prototype library. My problem is that the snippet fails when it’s on the same page along with MaxiGallery, which also uses the Prototype library. I added a parameter to specify if the prototype file should be included or not, but since I’m putting my snippet inside a template and that MaxiGallery uses the same template but is not on every page, it sometimes work, sometimes don’t.

    So, in short, I’m wondering if somebody has any suggestion regarding the issue of js libs. Anyone has a best way of handling this?

    I hope I’m clear, and thanks in advance for your suggestions.
      Olivier Deland
      Montreal, Canada - Web Developer
      • 7923
      • 4,213 Posts
      MaxiGallery has &disable_js_libs parameter what you can use to make it not add prototype/scriptaculous libraries to the web page.. see http://wiki.modxcms.com/index.php/MaxiGallery for more information.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 5727
        • 160 Posts
        Quote from: doze at Jun 13, 2007, 06:53 AM

        MaxiGallery has &disable_js_libs parameter what you can use to make it not add prototype/scriptaculous libraries to the web page.. see http://wiki.modxcms.com/index.php/MaxiGallery for more information.

        I was already aware of that parameter, the problem is that my snippet doesn’t include scriptaculous and I want the nice effects of MaxiGallery.

        The other problem is that I want to release my snippet to the public, so I want it to be compatible with as much snippet as possible without changes on the other snippets/plug-ins. I had the idea of adding a parameter to specify the path to the prototype lib file, so that the regClientStartupScript magic can happen. I was just wondering if something had been thought to fix the multiple js libs problem. I searched the forum in vein.
          Olivier Deland
          Montreal, Canada - Web Developer
          • 7923
          • 4,213 Posts
          yea, there is no fix for it really.. other than if there would be a common place for the js libs and some naming standards (eg. different versions of the libs).. then it would be possible for the regClientxxx functions to check that one script isn’t included twice. It’s not possible to just not include scripts if they are the same name, because the content can still be different (different versions etc..) and comparing the two files to see if they are same is too heavy, unless if the compare results would be cached someway then.. in any case, I haven’t heard any plans for this "issue".


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 5727
            • 160 Posts
            Al’right, thanks for your help doze.
              Olivier Deland
              Montreal, Canada - Web Developer