jqeury.min.js conflict - Page 3 jqeury.min.js conflict - Page 3
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

jqeury.min.js conflict

Started by allvip, November 26, 2013, 01:41:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Αndré

Quote from: allvip on February 04, 2014, 11:30:31 AM
Can I please know wath issues can cause?

We currently have a working gallery software. As Abbas said, if we update a third party library, we don't know what exactly may break, even if we test as thorough as possible.


Regarding the change to js/utils.php, this is my proposal. Find
$('#' + $(this).attr('id') + '_wrapper').css('display', ($(this).attr('checked')) ? 'block' : 'none');
and replace with
$('#' + this.getAttribute('id') + '_wrapper').css('display', (this.checked) ? 'block' : 'none');

As we use plain JavaScript, this change works regardless of the jQuery version. Or does somebody see a disadvantage (browser compatibility, etc.)? If not, I'd like to add that change even to cpg1.5.x, so users don't need to modify that file.

phill104

Quote from: allvip on February 04, 2014, 11:25:25 AM


2.replaced js_include('js/jquery-1.3.2.js'); with js_include('js/jquery-1.11.0.min.js'); in include/init.inc.php


There are a number of other files that hard code the jquery version such as pic_editor.php at line 257 , themes.inc.php at line 400 as well as in some theme.php files such as in eyeball a few times and obviously the sample theme.
It is a mistake to think you can solve any major problems just with potatoes.

allvip

ok.thanks Abbas Ali and Andre.

Αndré

Quote from: Phill Luckhurst on February 04, 2014, 11:46:44 AM
There are a number of other files that hard code the jquery version such as pic_editor.php at line 257 , themes.inc.php at line 400 as well as in some theme.php files such as in eyeball a few times and obviously the sample theme.

A simple plugin using the page_html hook could easily replace the jQuery version everywhere without fail, as it modifies the HTML output directly before it's submitted to the browser.

phill104

Sounds like a very good ideas coupled with your utils.php modification above. It could even be extended to get the latest jquery version from the cdn if needed. Users would then have less cause to complain about the bundled version.
It is a mistake to think you can solve any major problems just with potatoes.

allvip

Quote from: Phill Luckhurst on February 04, 2014, 11:46:44 AM
There are a number of other files that hard code the jquery version such as pic_editor.php at line 257 , themes.inc.php at line 400 as well as in some theme.php files such as in eyeball a few times and obviously the sample theme.

Thanks.I did not though about it.Is there something else in coppermine files that has to do with jquery 1.3.2?

checked all the files including themes/curve (but not the js and bridge folder) and even include/cpg15x.files.xml has 1.3.2 hardcoded once.

include/themes.inc.php can be found 5 times: in function <<<theme_javascript_head>>>,<<<theme_display_fullsize_pic>>> 2 times,<<<$template_sidebar>>> 1 time.

replaced with 1.11.0 in pic_editor.php,include/cpg15x.files.xml,include/themes.inc.php .after a short test everyting looks fine but can not test sidebar.I don't have a sidebar.



gmc

I think Αndré's proposed change for utils.php would be fine in 1.5.x (at least I don't see a disadvantage to that method)... but I would agree with those saying the change to include the new jquery should wait until 1.6.
While there may be no security related issues with jquery - if we were to break a theme or plugin a user relied on by including new jquery in 1.5.28, the user would be unable to apply any future security fixes (1.5.30, etc) until the jquery issue were addressed...
With 1.6, they will have the option to stay on a still supported (for a while) 1.5 version - with any new security fixes - until they can address the compatibility issues and are ready to upgrade..

I was going to suggest possibly a 'hidden' config option in 1.5.x to specify the level of jquery to include - thinking it was only used in one place (init.inc.php) - but as it is hardcoded elsewhere - may not be best choice...
The plugin using page_html hook would certainly find them all.

As a 'strategic' direction - I would think a config option in 1.6 for the jquery versions to use with all hardcoded references changed to look there might be best choice (and maybe an option to indicate include from cpg distribution or load from cdn as Phill suggested?)
Would position for users to adopt jquery 2.x before CPG 1.7... :)
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Αndré

Quote from: gmc on February 04, 2014, 03:00:04 PM
As a 'strategic' direction - I would think a config option in 1.6 for the jquery versions to use with all hardcoded references changed to look there might be best choice (and maybe an option to indicate include from cpg distribution or load from cdn as Phill suggested?)
Would position for users to adopt jquery 2.x before CPG 1.7... :)

IMHO such an option will lull users into a false sense of security, as they will think "Hey, it's a official config option, so it will work with all versions of jQuery (or whatever library)". In cpg1.6.x, like in cpg1.5.x, we should stick with the jQuery version we bundle in the first release, so we can be sure that everything works as expected. Of course we still can provide an (unofficial) plugin to use a later jQuery version if users need it for a particular reason.

I'll create the plugin now. I assume the hardest task is to find a meaningful name, as the rest is just a simple str_replace line ;)


phill104

Well done Andre. That has to be the smallest plugin yet lol.
It is a mistake to think you can solve any major problems just with potatoes.

allvip


Αndré

Quote from: Αndré on February 04, 2014, 11:43:28 AM
Find
$('#' + $(this).attr('id') + '_wrapper').css('display', ($(this).attr('checked')) ? 'block' : 'none');
and replace with
$('#' + this.getAttribute('id') + '_wrapper').css('display', (this.checked) ? 'block' : 'none');

Committed in SVN revision 8668. Please report any unexpected behavior.

allvip

I still need to find out how to use jquery no conflict if I need to use 2 jquery version on the same page even if on the jquery website they don't recommend 2 version of jquery on the same page.

allvip


Αndré

Why do you want to use 2 versions simultaneously? As I said earlier, it's easy to use different jQuery versions on different Coppermine sections. Just wrap something like
global $CPG_PHP_SELF;
if ($CPG_PHP_SELF != 'whatever.php') {

}

around the plugin code that replaces the used jQuery version.

phill104

Quote from: allvip on February 04, 2014, 04:39:01 PM
I still need to find out how to use jquery no conflict if I need to use 2 jquery version on the same page even if on the jquery website they don't recommend 2 version of jquery on the same page.

I too have no idea why you want to do that. Just load the one version and be done with it. I can only assume you are trying to use a different package alongside coppermine and that is also loading jQuery. Simply remove the load from one of the packages.
It is a mistake to think you can solve any major problems just with potatoes.

allvip

If I use 2 jquery plugins:one that does not work with the latest jquery one that works with the latest jquery.

with this code I can use 1.11.0 for the filmstrip if I ad it to film function,1.6 for stars if I ad it to stars function and rest of the displayimage.php to use default coppermine 1.3.2? (is just an example) ?

Αndré

That's probably something you should ask in the jQuery boards. At least I have no clue if this will ever work, as I don't know how the plugins should "find" the correct jQuery version.

allvip

Loading multiple jquery version on the same page is bad ideea and not recommended by jquery website.
I will not use jquery plugins with old jquery versions.
Thanks for all the answers.
For me the topic is solved.

allvip

#59
Quote from: Αndré on February 04, 2014, 03:43:23 PM
Here we go: http://sourceforge.net/p/coppermine/code/HEAD/tree/branches/cpg1.5.x/plugins/jquery_update/

I created  jquery_update folder on my desktop.I downloded  codebase.php  and configuration.php and put them in the folder.I uploaded the folder to coppermine plugins folder on the server.Installed the plugin with coppermine plugin manager.

Reason for editing:  made a mistake when I test it.That's why was not working.

The plugin works VERY WELL.