summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-09-01 08:44:25 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-09-01 08:44:25 +0000
commit246334f30d63a468dcb564703b4ca27a4c22d3d3 (patch)
treed56cc5fabfd7def27915ef0d252c20a2fa805bbb /includes
parent94098f7e931db2efc354af97302c2f44af7bb4f5 (diff)
downloadbrdo-246334f30d63a468dcb564703b4ca27a4c22d3d3.tar.gz
brdo-246334f30d63a468dcb564703b4ca27a4c22d3d3.tar.bz2
Don't include drupal.js if there is no JS on the page
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc16
1 files changed, 11 insertions, 5 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 73839d2d3..c4d17485f 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1363,15 +1363,21 @@ function drupal_get_css($css = NULL) {
* far for $scope is returned.
*/
function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer = FALSE, $cache = TRUE) {
+ if (!is_null($data)) {
+ _drupal_add_js('misc/jquery.js', 'core', 'header', FALSE, $cache);
+ _drupal_add_js('misc/drupal.js', 'core', 'header', FALSE, $cache);
+ }
+ return _drupal_add_js($data, $type, $scope, $defer, $cache);
+}
+
+/**
+ * Helper function for drupal_add_js().
+ */
+function _drupal_add_js($data, $type, $scope, $defer, $cache) {
static $javascript = array();
if (!isset($javascript[$scope])) {
$javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
-
- if (empty($javascript['header']['core']['misc/drupal.js'])) {
- drupal_add_js('misc/jquery.js', 'core', 'header', FALSE, $cache);
- drupal_add_js('misc/drupal.js', 'core', 'header', FALSE, $cache);
- }
}
if (!isset($javascript[$scope][$type])) {