Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drupal 6 and jquery 1.4/1.5

is there a way in drupal 6 to use in non admin pages jquery 1.5 / 1.4 without breaking the core functionality on non-admin pages??

like image 211
dorong123 Avatar asked May 03 '11 19:05

dorong123


1 Answers

Yes.

Install and enable http://drupal.org/project/jquery_update

Download the version of jQuery you want, and place it alongside the ones included in the module.

Edit the module

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')]
;
    }
}

Use the filename of the version you downloaded.

There is an issue logged about the edit above, but I have the reference at work. I will update the answer tomorrow with the link.

I have this running live on a bunch of sites w/o a problem.

Addendum:

This is the link to the thread / patch about the issue: http://drupal.org/node/775924#comment-2987316

like image 102
mpdonadio Avatar answered Oct 06 '22 14:10

mpdonadio