Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow setting of the has_js cookie for authenticated users.

  • Loading branch information...
commit f678c7b621f61f0bb499d4a7c25bb4ce90e06e8a 1 parent 580d402
@deviantintegral authored
Showing with 17 additions and 10 deletions.
  1. +7 −0 includes/common.inc
  2. +5 −10 misc/drupal.js
  3. +5 −0 misc/jsenabled.js
View
7 includes/common.inc
@@ -2180,6 +2180,13 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
),
'inline' => array(),
);
+
+ // We never cache authenticated user pages, so if they are logged in we
+ // allow setting of the has_js cookie so batch API functions use the JS
+ // version.
+ if (!user_is_anonymous()) {
+ $javascript['header']['core']['misc/jsenabled.js'] = array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE);
+ }
}
if (isset($scope) && !isset($javascript[$scope])) {
View
15 misc/drupal.js
@@ -266,16 +266,11 @@ Drupal.ahahError = function(xmlhttp, uri) {
}
// Global Killswitch on the <html> element
-if (Drupal.jsEnabled) {
- // Global Killswitch on the <html> element
- $(document.documentElement).addClass('js');
- // 'js enabled' cookie
- document.cookie = 'has_js=1; path=/';
- // Attach all behaviors.
- $(document).ready(function() {
- Drupal.attachBehaviors(this);
- });
-}
+$(document.documentElement).addClass('js');
+// Attach all behaviors.
+$(document).ready(function() {
+ Drupal.attachBehaviors(this);
+});
/**
* The default themes.
View
5 misc/jsenabled.js
@@ -0,0 +1,5 @@
+if (Drupal.jsEnabled) {
+ // 'js enabled' cookie
+ document.cookie = 'has_js=1; path=/';
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.