Usar Jquery 1.4 / 1.5 a Drupal 6

Drupal 6 ve per defecte amb JQuery 1.2, en un projecte he necessitat usar Jquery 1.4 com a mínim, i si substitueixes el fitxer hi ha coses de la interfície d’administració que deixen de funcionar. Per resoldre-ho, cal fer que el sistema carregui versions diferents de Jquery segons on es trobi:

Modifiquem el mòdul jquery_update


function jquery_update_jquery_path() {    
    $curr_uri = request_uri();
     if (strpos($curr_uri,'admin')>0 || strpos($curr_uri,'edit')>0 || strpos($curr_uri,'add')>0){
        $jquery_file = array('none' => 'jquery.js', 'min' => 'jquery.min.js');
        return JQUERY_UPDATE_REPLACE_PATH .'/'. $jquery_file[variable_get('jquery_update_compression_type', 'min')]
;
    }
    else {
        $jquery_file = array('none' => 'jquery-1.5.2.js', 'min' => 'jquery-1.5.2.min.js');
        return JQUERY_UPDATE_REPLACE_PATH .'/'. $jquery_file[variable_get('jquery_update_compression_type', 'min')]
;
    }
}

http://drupal.org/node/775924#comment-2987316

http://stackoverflow.com/questions/5874880/drupal-6-and-jquery-1-4-1-5

 

This entry was posted in Drupal and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Security Code: