Created
April 7, 2011 15:14
-
-
Save gavinblair/907973 to your computer and use it in GitHub Desktop.
Use the latest jQuery with your Drupal theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function {theme_name}_preprocess(&$vars, $hook) { | |
if (arg(0) != 'admin' && $hook == "page") { | |
// Get an array of all JavaScripts that have been added | |
$javascript = drupal_add_js(NULL, NULL, 'header'); | |
// Remove the original jQuery library and Drupal's JS include | |
unset($javascript['core']['misc/jquery.js']); | |
unset($javascript['core']['misc/drupal.js']); | |
// Add in our new jQuery library and Drupal's JS include | |
// We do it this way to keep the includes in the same order | |
$core = array( | |
//Alternative jQuery | |
drupal_get_path('theme', '{theme_name}').'/js/libs/jquery-1.5.1.min.js' => array( | |
'cache' => TRUE, | |
'defer' => FALSE, | |
), | |
'misc/drupal.js' => array( | |
'cache' => TRUE, | |
'defer' => FALSE, | |
) | |
); | |
// Merge back into the array of core JavaScripts | |
$javascript['core'] = array_merge($javascript['core'], $core); | |
// Rerender the block of JavaScripts | |
$vars['scripts'] = drupal_get_js(NULL, $javascript); | |
} | |
} | |
?> |
I was using a module called Administration, but now I'm using a module called Toolbars
wow Toolbar is really bad - switching to SimpleMenu. Working fine so far!
totally using this on http://i.seanja.com so I can use a lightbox plugin to show the images full size
Hmmm... it doesn't really work with compression turned on...
Does it include it? Does it include Drupal's jQuery instead?
I think it might be, I am going to try it out again when I get home to see what it is actually doing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which admin menu are you using?