Patch: Do not load jQuery if already loaded

Patch: Do not load jQuery if already loaded


Hi,
I have a mashup website and can not control whether other modules pre-
load jQuery on a page. To solve this problem I encapsulated it with a
condition as shown in the diff below. This may be useful to someone,
or if you know of a better maintainable method, please let me know.
Regards
Jaco Vosloo
Index: jquery-1.2.6.js
===================================================================
--- jquery-1.2.6.js    (revision 2751)
+++ jquery-1.2.6.js    (working copy)
@@ -1,3 +1,5 @@
+//Only load jQuery if it is not loaded yet.
+if ((typeof jQuery == 'undefined') || (jQuery == null)) {
(function(){
/*
* jQuery 1.2.6 - New Wave Javascript
@@ -3547,3 +3549,6 @@
    };
});})();
+}
+else if ((typeof window.console != 'undefined') && (window.console !=
null) && (window.console.info != null))
+console.info('jQuery' + jQuery.fn.jquery + ' already loaded, not
loading again.');
\ No newline at end of file