-
-
Save gavinblair/907973 to your computer and use it in GitHub Desktop.
<?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); | |
} | |
} | |
?> |
Also, that should be jquery 1.5.2
should it not?
Adding a second jQuery in another namespace was suggested, but I don't like the thought of loading jQuery twice - it's small but not that small.
I'm not sure, 1.5.1 is what came with the HTML5 Boilerplate.
My goal is to have the frontend completely independent of Drupal styles and scripts.
My goal is to have the frontend completely independent of Drupal styles and scripts.
A lofty goal, but there are lots of modules that use javascript on the front end...
Which admin menu are you using?
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.
Instead of removing jQuery and Drupal.js, why not instead just add another jQuery:
Where
jquery-1.5.1.noconflict.min.js
=[minified jQuery source] + var $j = jQuery.noConflict();
Not the greatest solution, but it will not bust things on the front end that rely on jQuery 1.2.6