summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-07-01 15:37:10 +0000
committerDries Buytaert <dries@buytaert.net>2007-07-01 15:37:10 +0000
commitc11cb4ec24479e801076c094f043f2084b344d0c (patch)
tree5248d25917032a394ec350b65ebde88259168ffe /modules
parenta3d75e547f62174fe9fa2b5c3f9684b620612b00 (diff)
downloadbrdo-c11cb4ec24479e801076c094f043f2084b344d0c.tar.gz
brdo-c11cb4ec24479e801076c094f043f2084b344d0c.tar.bz2
- Patch #120360 by nedjo: enable AJAX by making all behaviours reattachable.
Diffstat (limited to 'modules')
-rw-r--r--modules/actions/actions.schema2
-rw-r--r--modules/color/color.js448
-rw-r--r--modules/comment/comment.js21
-rw-r--r--modules/locale/locale.module6
-rw-r--r--modules/openid/openid.js27
-rw-r--r--modules/system/system.js22
-rw-r--r--modules/system/system.module13
-rw-r--r--modules/translation/translation.module4
-rw-r--r--modules/user/user.js19
9 files changed, 283 insertions, 279 deletions
diff --git a/modules/actions/actions.schema b/modules/actions/actions.schema
index 2e2ca9b28..516e2ced3 100644
--- a/modules/actions/actions.schema
+++ b/modules/actions/actions.schema
@@ -7,7 +7,7 @@ function actions_schema() {
'aid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'),
'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'parameters' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big', 'default' => ''),
+ 'parameters' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
'description' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'),
),
'primary key' => array('aid'),
diff --git a/modules/color/color.js b/modules/color/color.js
index cb76ffabb..c64f41481 100644
--- a/modules/color/color.js
+++ b/modules/color/color.js
@@ -1,247 +1,251 @@
// $Id$
-if (Drupal.jsEnabled) {
- $(document).ready(function () {
- var form = $('#color_scheme_form .color-form');
- var inputs = [];
- var hooks = [];
- var locks = [];
- var focused = null;
-
- // Add Farbtastic
- $(form).prepend('<div id="placeholder"></div>');
- var farb = $.farbtastic('#placeholder');
-
- // Decode reference colors to HSL
- var reference = Drupal.settings.color.reference;
- for (i in reference) {
- reference[i] = farb.RGBToHSL(farb.unpack(reference[i]));
- }
-
- // Build preview
- $('#preview').append('<div id="gradient"></div>');
- var gradient = $('#preview #gradient');
- var h = parseInt(gradient.css('height')) / 10;
- for (i = 0; i < h; ++i) {
- gradient.append('<div class="gradient-line"></div>');
- }
-
- // Fix preview background in IE6
- if (navigator.appVersion.match(/MSIE [0-6]\./)) {
- var e = $('#preview #img')[0];
- var image = e.currentStyle.backgroundImage;
- e.style.backgroundImage = 'none';
- e.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image.substring(5, image.length - 2) + "')";
+Drupal.behaviors.color = function (context) {
+ // This behavior attaches by ID, so is only valid once on a page.
+ if ($('#color_scheme_form .color-form.color-processed').size()) {
+ return;
+ }
+ var form = $('#color_scheme_form .color-form', context);
+ var inputs = [];
+ var hooks = [];
+ var locks = [];
+ var focused = null;
+
+ // Add Farbtastic
+ $(form).prepend('<div id="placeholder"></div>').addClass('color-processed');
+ var farb = $.farbtastic('#placeholder');
+
+ // Decode reference colors to HSL
+ var reference = Drupal.settings.color.reference;
+ for (i in reference) {
+ reference[i] = farb.RGBToHSL(farb.unpack(reference[i]));
+ }
+
+ // Build preview
+ $('#preview:not(.color-processed)')
+ .append('<div id="gradient"></div>')
+ .addClass('color-processed');
+ var gradient = $('#preview #gradient');
+ var h = parseInt(gradient.css('height')) / 10;
+ for (i = 0; i < h; ++i) {
+ gradient.append('<div class="gradient-line"></div>');
+ }
+
+ // Fix preview background in IE6
+ if (navigator.appVersion.match(/MSIE [0-6]\./)) {
+ var e = $('#preview #img')[0];
+ var image = e.currentStyle.backgroundImage;
+ e.style.backgroundImage = 'none';
+ e.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image.substring(5, image.length - 2) + "')";
+ }
+
+ // Set up colorscheme selector
+ $('#edit-scheme', form).change(function () {
+ var colors = this.options[this.selectedIndex].value;
+ if (colors != '') {
+ colors = colors.split(',');
+ for (i in colors) {
+ callback(inputs[i], colors[i], false, true);
+ }
+ preview();
}
+ });
- // Set up colorscheme selector
- $('#edit-scheme', form).change(function () {
- var colors = this.options[this.selectedIndex].value;
- if (colors != '') {
- colors = colors.split(',');
- for (i in colors) {
- callback(inputs[i], colors[i], false, true);
- }
- preview();
+ /**
+ * Render the preview.
+ */
+ function preview() {
+ // Solid background
+ $('#preview', form).css('backgroundColor', inputs[0].value);
+
+ // Text preview
+ $('#text', form).css('color', inputs[4].value);
+ $('#text a, #text h2', form).css('color', inputs[1].value);
+
+ // Set up gradient
+ var top = farb.unpack(inputs[2].value);
+ var bottom = farb.unpack(inputs[3].value);
+ if (top && bottom) {
+ var delta = [];
+ for (i in top) {
+ delta[i] = (bottom[i] - top[i]) / h;
}
- });
+ var accum = top;
- /**
- * Render the preview.
- */
- function preview() {
- // Solid background
- $('#preview', form).css('backgroundColor', inputs[0].value);
-
- // Text preview
- $('#text', form).css('color', inputs[4].value);
- $('#text a, #text h2', form).css('color', inputs[1].value);
-
- // Set up gradient
- var top = farb.unpack(inputs[2].value);
- var bottom = farb.unpack(inputs[3].value);
- if (top && bottom) {
- var delta = [];
- for (i in top) {
- delta[i] = (bottom[i] - top[i]) / h;
+ // Render gradient lines
+ $('#gradient > div', form).each(function () {
+ for (i in accum) {
+ accum[i] += delta[i];
}
- var accum = top;
-
- // Render gradient lines
- $('#gradient > div', form).each(function () {
- for (i in accum) {
- accum[i] += delta[i];
- }
- this.style.backgroundColor = farb.pack(accum);
- });
- }
+ this.style.backgroundColor = farb.pack(accum);
+ });
}
-
- /**
- * Shift a given color, using a reference pair (ref in HSL).
- *
- * This algorithm ensures relative ordering on the saturation and luminance
- * axes is preserved, and performs a simple hue shift.
- *
- * It is also symmetrical. If: shift_color(c, a, b) == d,
- * then shift_color(d, b, a) == c.
- */
- function shift_color(given, ref1, ref2) {
- // Convert to HSL
- given = farb.RGBToHSL(farb.unpack(given));
-
- // Hue: apply delta
- given[0] += ref2[0] - ref1[0];
-
- // Saturation: interpolate
- if (ref1[1] == 0 || ref2[1] == 0) {
- given[1] = ref2[1];
+ }
+
+ /**
+ * Shift a given color, using a reference pair (ref in HSL).
+ *
+ * This algorithm ensures relative ordering on the saturation and luminance
+ * axes is preserved, and performs a simple hue shift.
+ *
+ * It is also symmetrical. If: shift_color(c, a, b) == d,
+ * then shift_color(d, b, a) == c.
+ */
+ function shift_color(given, ref1, ref2) {
+ // Convert to HSL
+ given = farb.RGBToHSL(farb.unpack(given));
+
+ // Hue: apply delta
+ given[0] += ref2[0] - ref1[0];
+
+ // Saturation: interpolate
+ if (ref1[1] == 0 || ref2[1] == 0) {
+ given[1] = ref2[1];
+ }
+ else {
+ var d = ref1[1] / ref2[1];
+ if (d > 1) {
+ given[1] /= d;
}
else {
- var d = ref1[1] / ref2[1];
- if (d > 1) {
- given[1] /= d;
- }
- else {
- given[1] = 1 - (1 - given[1]) * d;
- }
+ given[1] = 1 - (1 - given[1]) * d;
}
+ }
- // Luminance: interpolate
- if (ref1[2] == 0 || ref2[2] == 0) {
- given[2] = ref2[2];
+ // Luminance: interpolate
+ if (ref1[2] == 0 || ref2[2] == 0) {
+ given[2] = ref2[2];
+ }
+ else {
+ var d = ref1[2] / ref2[2];
+ if (d > 1) {
+ given[2] /= d;
}
else {
- var d = ref1[2] / ref2[2];
- if (d > 1) {
- given[2] /= d;
- }
- else {
- given[2] = 1 - (1 - given[2]) * d;
- }
+ given[2] = 1 - (1 - given[2]) * d;
}
-
- return farb.pack(farb.HSLToRGB(given));
}
- /**
- * Callback for Farbtastic when a new color is chosen.
- */
- function callback(input, color, propagate, colorscheme) {
- // Set background/foreground color
- $(input).css({
- backgroundColor: color,
- 'color': farb.RGBToHSL(farb.unpack(color))[2] > 0.5 ? '#000' : '#fff'
- });
+ return farb.pack(farb.HSLToRGB(given));
+ }
+
+ /**
+ * Callback for Farbtastic when a new color is chosen.
+ */
+ function callback(input, color, propagate, colorscheme) {
+ // Set background/foreground color
+ $(input).css({
+ backgroundColor: color,
+ 'color': farb.RGBToHSL(farb.unpack(color))[2] > 0.5 ? '#000' : '#fff'
+ });
- // Change input value
- if (input.value && input.value != color) {
- input.value = color;
-
- // Update locked values
- if (propagate) {
- var i = input.i;
- for (j = i + 1; ; ++j) {
- if (!locks[j - 1] || $(locks[j - 1]).is('.unlocked')) break;
- var matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
- callback(inputs[j], matched, false);
- }
- for (j = i - 1; ; --j) {
- if (!locks[j] || $(locks[j]).is('.unlocked')) break;
- var matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
- callback(inputs[j], matched, false);
- }
-
- // Update preview
- preview();
+ // Change input value
+ if (input.value && input.value != color) {
+ input.value = color;
+
+ // Update locked values
+ if (propagate) {
+ var i = input.i;
+ for (j = i + 1; ; ++j) {
+ if (!locks[j - 1] || $(locks[j - 1]).is('.unlocked')) break;
+ var matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
+ callback(inputs[j], matched, false);
}
-
- // Reset colorscheme selector
- if (!colorscheme) {
- resetScheme();
+ for (j = i - 1; ; --j) {
+ if (!locks[j] || $(locks[j]).is('.unlocked')) break;
+ var matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
+ callback(inputs[j], matched, false);
}
- }
- }
+ // Update preview
+ preview();
+ }
- /**
- * Reset the color scheme selector.
- */
- function resetScheme() {
- $('#edit-scheme', form).each(function () {
- this.selectedIndex = this.options.length - 1;
- });
+ // Reset colorscheme selector
+ if (!colorscheme) {
+ resetScheme();
+ }
}
- // Focus the Farbtastic on a particular field.
- function focus() {
- var input = this;
- // Remove old bindings
- focused && $(focused).unbind('keyup', farb.updateValue)
- .unbind('keyup', preview).unbind('keyup', resetScheme)
- .parent().removeClass('item-selected');
-
- // Add new bindings
- focused = this;
- farb.linkTo(function (color) { callback(input, color, true, false) });
- farb.setColor(this.value);
- $(focused).keyup(farb.updateValue).keyup(preview).keyup(resetScheme)
- .parent().addClass('item-selected');
- }
+ }
- // Initialize color fields
- $('#palette input.form-text', form)
- .each(function () {
- // Extract palette field name
- this.key = this.id.substring(13);
-
- // Link to color picker temporarily to initialize.
- farb.linkTo(function () {}).setColor('#000').linkTo(this);
-
- // Add lock
- var i = inputs.length;
- if (inputs.length) {
- var lock = $('<div class="lock"></div>').toggle(
- function () {
- $(this).addClass('unlocked');
- $(hooks[i - 1]).attr('class',
- locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook up' : 'hook'
- );
- $(hooks[i]).attr('class',
- locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook down' : 'hook'
- );
- },
- function () {
- $(this).removeClass('unlocked');
- $(hooks[i - 1]).attr('class',
- locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook both' : 'hook down'
- );
- $(hooks[i]).attr('class',
- locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook both' : 'hook up'
- );
- }
- );
- $(this).after(lock);
- locks.push(lock);
- };
-
- // Add hook
- var hook = $('<div class="hook"></div>');
- $(this).after(hook);
- hooks.push(hook);
-
- $(this).parent().find('.lock').click();
- this.i = i;
- inputs.push(this);
- })
- .focus(focus);
-
- $('#palette label', form);
-
- // Focus first color
- focus.call(inputs[0]);
-
- // Render preview
- preview();
- });
-}
+ /**
+ * Reset the color scheme selector.
+ */
+ function resetScheme() {
+ $('#edit-scheme', form).each(function () {
+ this.selectedIndex = this.options.length - 1;
+ });
+ }
+
+ // Focus the Farbtastic on a particular field.
+ function focus() {
+ var input = this;
+ // Remove old bindings
+ focused && $(focused).unbind('keyup', farb.updateValue)
+ .unbind('keyup', preview).unbind('keyup', resetScheme)
+ .parent().removeClass('item-selected');
+
+ // Add new bindings
+ focused = this;
+ farb.linkTo(function (color) { callback(input, color, true, false) });
+ farb.setColor(this.value);
+ $(focused).keyup(farb.updateValue).keyup(preview).keyup(resetScheme)
+ .parent().addClass('item-selected');
+ }
+
+ // Initialize color fields
+ $('#palette input.form-text', form)
+ .each(function () {
+ // Extract palette field name
+ this.key = this.id.substring(13);
+
+ // Link to color picker temporarily to initialize.
+ farb.linkTo(function () {}).setColor('#000').linkTo(this);
+
+ // Add lock
+ var i = inputs.length;
+ if (inputs.length) {
+ var lock = $('<div class="lock"></div>').toggle(
+ function () {
+ $(this).addClass('unlocked');
+ $(hooks[i - 1]).attr('class',
+ locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook up' : 'hook'
+ );
+ $(hooks[i]).attr('class',
+ locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook down' : 'hook'
+ );
+ },
+ function () {
+ $(this).removeClass('unlocked');
+ $(hooks[i - 1]).attr('class',
+ locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook both' : 'hook down'
+ );
+ $(hooks[i]).attr('class',
+ locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook both' : 'hook up'
+ );
+ }
+ );
+ $(this).after(lock);
+ locks.push(lock);
+ };
+
+ // Add hook
+ var hook = $('<div class="hook"></div>');
+ $(this).after(hook);
+ hooks.push(hook);
+
+ $(this).parent().find('.lock').click();
+ this.i = i;
+ inputs.push(this);
+ })
+ .focus(focus);
+
+ $('#palette label', form);
+
+ // Focus first color
+ focus.call(inputs[0]);
+
+ // Render preview
+ preview();
+};
diff --git a/modules/comment/comment.js b/modules/comment/comment.js
index 96ecbaf5d..69baf7423 100644
--- a/modules/comment/comment.js
+++ b/modules/comment/comment.js
@@ -1,15 +1,16 @@
// $Id$
-if (Drupal.jsEnabled) {
- $(document).ready(function() {
- var parts = new Array("name", "homepage", "mail");
- var cookie = '';
- for (i=0;i<3;i++) {
- cookie = Drupal.comment.getCookie('comment_info_' + parts[i]);
- if (cookie != '') {
- $("#comment-form input[@name=" + parts[i] + "]").val(cookie);
- }
+
+Drupal.behaviors.comment = function (context) {
+ var parts = new Array("name", "homepage", "mail");
+ var cookie = '';
+ for (i=0;i<3;i++) {
+ cookie = Drupal.comment.getCookie('comment_info_' + parts[i]);
+ if (cookie != '') {
+ $("#comment-form input[@name=" + parts[i] + "]:not(.comment-processed)", context)
+ .val(cookie)
+ .addClass('comment-processed');
}
- });
+ }
};
Drupal.comment = {};
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index c889241e7..f0ab48650 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -53,7 +53,7 @@ function locale_help($path, $arg) {
return '<p>'. t("This page allows you to export Drupal strings. The first option is to export a translation so it can be shared. The second option generates a translation template, which contains all Drupal strings, but without their translations. You can use this template to start a new translation using various software packages designed for this task.") .'</p>';
case 'admin/build/translate/search':
return '<p>'. t("It is often convenient to get the strings from your setup on the <a href=\"@export\">export page</a>, and use a desktop Gettext translation editor to edit the translations. On this page you can search in the translated and untranslated strings, and the default English texts provided by Drupal.", array("@export" => url("admin/build/translate/export"))) .'</p>';
-
+
case 'admin/build/block/configure':
if ($arg[4] == 'locale' && $arg[5] == 0) {
return '<p>'. t("This block is only shown if you have <a href=\"@languages\">at least two languages enabled</a> and you have a <a href=\"@configuration\">language negotiation setting</a> different from 'none', so you have different web addresses for different language versions.", array('@languages' => url('admin/settings/language'), '@configuration' => url('admin/settings/language/configure'))) .'</p>';
@@ -524,13 +524,13 @@ function locale_block($op = 'list', $delta = 0) {
'attributes' => array('class' => 'language-link'),
);
}
-
+
// Allow modules to provide translations for specific links.
// A translation link may need to point to a different path or use
// a translated link text before going through l(), which will just
// handle the path aliases.
drupal_alter('translation_link', $links, $_GET['q']);
-
+
$block['subject'] = t('Languages');
$block['content'] = theme('links', $links, array());
return $block;
diff --git a/modules/openid/openid.js b/modules/openid/openid.js
index 5f27b66f5..688ba47c5 100644
--- a/modules/openid/openid.js
+++ b/modules/openid/openid.js
@@ -1,14 +1,17 @@
// $Id$
-$(document).ready(
- function() {
- if ($("#edit-openid-url").val()) {
- $("#edit-name-wrapper").hide();
- $("#edit-pass-wrapper").hide();
- $("#edit-openid-url-wrapper").show();
- $("a.openid-link").hide();
- }
- $("a.openid-link").click( function() {
+Drupal.behaviors.openid = function (context) {
+ // This behavior attaches by ID, so is only valid once on a page.
+ if (!$("#edit-openid-url.openid-processed").size() && $("#edit-openid-url").val()) {
+ $("#edit-openid-url").addClass('openid-processed');
+ $("#edit-name-wrapper").hide();
+ $("#edit-pass-wrapper").hide();
+ $("#edit-openid-url-wrapper").show();
+ $("a.openid-link").hide();
+ }
+ $("a.openid-link:not(.openid-processed)", context)
+ .addClass('openid-processed')
+ .click( function() {
$("#edit-pass-wrapper").hide();
$("#edit-name-wrapper").fadeOut('medium', function() {
$("#edit-openid-url-wrapper").fadeIn('medium');
@@ -17,7 +20,9 @@ $(document).ready(
$("a.user-link").show();
return false;
});
- $("a.user-link").click( function() {
+ $("a.user-link:not(.openid-processed)", context)
+ .addClass('openid-processed')
+ .click(function() {
$("#edit-openid-url-wrapper").hide();
$("#edit-pass-wrapper").show();
$("#edit-name-wrapper").show();
@@ -25,5 +30,5 @@ $(document).ready(
$("a.openid-link").show();
return false;
});
- });
+};
diff --git a/modules/system/system.js b/modules/system/system.js
index 808dac7f5..3e0e3a501 100644
--- a/modules/system/system.js
+++ b/modules/system/system.js
@@ -7,7 +7,13 @@
* This function is not used to verify whether or not clean URLs
* are currently enabled.
*/
-Drupal.cleanURLsSettingsCheck = function() {
+Drupal.behaviors.cleanURLsSettingsCheck = function(context) {
+ // This behavior attaches by ID, so is only valid once on a page.
+ // Also skip if we are on an install page, as Drupal.cleanURLsInstallCheck will handle
+ // the processing.
+ if ($("#clean-url.clean-url-processed, #clean-url.install").size()) {
+ return;
+ }
var url = location.pathname +"admin/settings/clean-urls";
$("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>");
$("#clean-url p").hide();
@@ -23,6 +29,7 @@ Drupal.cleanURLsSettingsCheck = function() {
$("#clean-url .description span").append('<div class="warning">'+ Drupal.t('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.') +"</div>");
}
}});
+ $("#clean-url").addClass('clean-url-processed');
};
/**
@@ -50,6 +57,7 @@ Drupal.cleanURLsInstallCheck = function() {
$("#clean-url .description span").append('<div class="warning">'+ Drupal.settings.cleanURL.failure +"</div>");
}
}});
+ $("#clean-url").addClass('clean-url-processed');
};
Drupal.installDefaultTimezone = function() {
@@ -60,14 +68,14 @@ Drupal.installDefaultTimezone = function() {
/**
* Show/hide custom format sections on the date-time settings page.
*/
-Drupal.dateTimeAutoAttach = function() {
+Drupal.behaviors.dateTime = function(context) {
// Show/hide custom format depending on the select's value.
- $("select.date-format").change(function() {
- $(this).parents("div.date-container").children("div.custom-container")[$(this).val() == "custom" ? "show" : "hide"]();
+ $('select.date-format:not(.date-time-processed)', context).change(function() {
+ $(this).addClass('date-time-processed').parents("div.date-container").children("div.custom-container")[$(this).val() == "custom" ? "show" : "hide"]();
});
// Attach keyup handler to custom format inputs.
- $("input.custom-format").keyup(function() {
+ $('input.custom-format:not(.date-time-processed)', context).addClass('date-time-processed').keyup(function() {
var input = $(this);
var url = Drupal.settings.dateTime.lookup +(Drupal.settings.dateTime.lookup.match(/\?q=/) ? "&format=" : "?format=") + Drupal.encodeURIComponent(input.val());
$.getJSON(url, function(data) {
@@ -76,5 +84,5 @@ Drupal.dateTimeAutoAttach = function() {
});
// Trigger the event handler to show the form input if necessary.
- $("select.date-format").trigger("change");
-}
+ $('select.date-format', context).trigger('change');
+}; \ No newline at end of file
diff --git a/modules/system/system.module b/modules/system/system.module
index 5de9f0282..73f83cb13 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -616,13 +616,6 @@ function system_clean_url_settings() {
if (!variable_get('clean_url', 0)) {
if (strpos(request_uri(), '?q=') !== FALSE) {
drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module');
- drupal_add_js('
-// Global Killswitch
-if (Drupal.jsEnabled) {
- $(document).ready(function() {
- Drupal.cleanURLsSettingsCheck();
- });
-}', 'inline');
$form['clean_url']['#description'] .= ' <span>'. t('Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="@handbook">handbook page on Clean URLs</a> has additional troubleshooting information.', array('@handbook' => 'http://drupal.org/node/15365')) .'</span>';
@@ -820,11 +813,7 @@ function system_rss_feeds_settings() {
function system_date_time_settings() {
drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module');
drupal_add_js(array('dateTime' => array('lookup' => url('admin/settings/date-time/lookup'))), 'setting');
- drupal_add_js('
-// Global Killswitch
-if (Drupal.jsEnabled) {
- $(document).ready(Drupal.dateTimeAutoAttach);
-}', 'inline');
+
// Date settings:
$zones = _system_zonelist();
diff --git a/modules/translation/translation.module b/modules/translation/translation.module
index c7f464cd2..b45bf2126 100644
--- a/modules/translation/translation.module
+++ b/modules/translation/translation.module
@@ -339,12 +339,12 @@ function translation_supported_type($type) {
/**
* Return paths of all translations of a node, based on
- * its Drupal path.
+ * its Drupal path.
*
* @param $path
* A Drupal path, for example node/432.
* @return
- * An array of paths of translations of the node accessible
+ * An array of paths of translations of the node accessible
* to the current user keyed with language codes.
*/
function translation_path_get_translations($path) {
diff --git a/modules/user/user.js b/modules/user/user.js
index cbd46c992..bdfa06b43 100644
--- a/modules/user/user.js
+++ b/modules/user/user.js
@@ -4,11 +4,10 @@
* Attach handlers to evaluate the strength of any password fields and to check
* that its confirmation is correct.
*/
-Drupal.passwordAttach = function(context) {
- var context = context || $(document);
+Drupal.behaviors.password = function(context) {
var translate = Drupal.settings.password;
- $("input.password-field", context).each(function() {
- var passwordInput = $(this);
+ $("input.password-field:not(.password-processed)", context).each(function() {
+ var passwordInput = $(this).addClass('password-processed');
var parent = $(this).parent();
// Wait this number of milliseconds before checking password.
var monitorDelay = 700;
@@ -173,11 +172,9 @@ Drupal.evaluatePasswordStrength = function(value) {
* picture-related form elements depending on the current value of the
* "Picture support" radio buttons.
*/
-if (Drupal.jsEnabled) {
- $(document).ready(function () {
- $('div.user-admin-picture-radios input[@type=radio]').click(function () {
- $('div.user-admin-picture-settings')[['hide', 'show'][this.value]]();
- });
- Drupal.passwordAttach();
+Drupal.behaviors.userSettings = function (context) {
+ $('div.user-admin-picture-radios input[@type=radio]:not(.userSettings-processed)', context).addClass('userSettings-processed').click(function () {
+ $('div.user-admin-picture-settings', context)[['hide', 'show'][this.value]]();
});
-}
+};
+