The objective of this is to remove all legacy javascript files from the homepage except for the new javascript files I specifically want to load.
Here is how I remove all the Javascript files I don't need:
function phptemplate_preprocess_page(&$vars) {
$template_files = $vars['template_files'];
$scripts = drupal_add_js();
if (in_array('page-front', $template_files === true) {
// Here I unset all the javascripts that I don't want to be loaded in the homepage
unset($scripts['theme']['themes/"theme_name"/js/jquery.jcarousel.min.js']);
...
// Once cleaned up all unncessary javascripts, I load them into $var['scripts']
$var['scripts'] = drupal_get_js('header', $scripts);
}
}
This works fine, however it only works when the jQuery Update module is desactivated. If the jQuery Update module is active, somehow it overseeds this logic and all the javascript files are loaded anyways.
I don't want to use the jQuery Update logic in the homepage, but I'm affraid that if I disable this module, I can provoke negative side effects in the other pages of the website.
Conclusion: I want to desactivate jQuery Update logic for handling javascript files but only for the homepage.
Any other alternative solution / conclusion to this problem is also welcome.