0

Does anyone know how to update jQuery and jQuery UI that comes with EE 2.10.1? This question was asked once before but no answers (link)...

After doing some digging I found the assets at: /themes/javascript/compressed/jquery /themes/javascript/compressed/jquery/ui

The problem started with some javascript errors concerning zoo_visitor and photo frame. The only way to use these plugins now is to use jQuery 1.7.1 but that conflicts with Bootstrap 3. After setting include_assets="no" I tried to mimic the includes and that was the point the trouble started...

Actually I think that the developers of EE should find a fix for this. For a 299 dollar CMS this is one major fail.

  • Have you tried a drop-in on those files with updated versions? Doubt it would work but would be super easy to try... – jrothafer May 11 '15 at 19:41
  • Did you solve this? I'm running into show-stopping problems with Photo Frame as well and there is no response from the developer whatsoever! – shyko Jun 3 '15 at 8:02
1

Ok, To update the jquery reference globally you can do it by redefining the constant PATH_JQUERY. This definition is defined in the file /system/expressionengine/modules/jquery/mod.jquery.php, lines 39 through 46 (on EE2.10.1).

This patch assumes you have your jquery and its dependant libraries in the same folder structure as in /themes/javascript.

And my usual notice : This method involves modifying core files. Be aware that future upgrades and/or changes may invalidate your work! Modifying core is usually not recommended however there's no other way thus far (apart from writing a module that overloads the Jquery class in EE, but I digress).

The easiest way to apply this patch is to first copy the jquery directory at /themes/javascript/compressed/jquery to the same parent folder. For this example lets assume I've copied the directory and renamed to jquery_2.

By copying the existing folder we can pick and choose the elements we upgrade, you can rebuild or refactor other or specific elements which I hint to at the end, but this method is by far the easiest to manage.

So now in my jquery_2 folder I wish to just update jquery core, so I go and get my compressed file, and replace the jquery.js file in my new directory. Similarly if you wish to upgrade UI elements you'll need to replace the resourses in your new directory in the same fashion.

Lastly, we need to tell EE to look in our new directory, so referring to the file mentioned able I change line 45 (EE2.10.1) from

define('PATH_JQUERY', PATH_THEMES.'javascript/compressed/jquery/');

to

define('PATH_JQUERY', PATH_THEMES.'javascript/compressed/jquery_2/');

And thats it, we're done. This patch works to update Jquery in the CP, SAEF, File Upload and the front end jquery tags too.

Cherry Picking elements to upgrade

Perhaps you don't want to copy the entire themes javascript folder, perhaps you just want to drop in a minor change to just the jquery core? In this case take a look at lines 80 through 106 of /system/expressionengine/modules/jquery/mod.jquery.php. Here what is happening is depending on what part of jquery is requested (file, plugin, ui, effect, or core) the sub path is appened to PATH_JQUERY (which we no from above is defined as PATH_THEMES.'javascript/compressed/jquery/), therefor just drop your new file(s) somewhere in the PATH_JQUERY folder, find the lines in the big if statement that relate to what you need and alter the sub-path.

And finally While this solution is more verbose, it is technichally the same as jChrono's comment, except we're not overriding the existing files, but a copy.

| improve this answer | |
  • Not quite sure who downvoted or why, but a common courtesy of a comment would not have gone amiss! Oh well, you can't please everyone, lol. – Blatant May 13 '15 at 8:41
  • Thanks Blatant! I figured that I could just overwrite the themes javascript files, but after doing that a whole sh*thole started of plugin's not working anymore in front- and backend (e.g. Photoframe plugin). I'm slowly dropping EE as my CMS because I'm trying to recreate clients site in Craft CMS. I think EE has had its chance ;) – Marnix Harderwijk May 18 '15 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.