summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block.js6
-rw-r--r--modules/color/color.js16
-rw-r--r--modules/comment/comment.js12
-rw-r--r--modules/node/content_types.js2
-rw-r--r--modules/openid/openid.js40
-rw-r--r--modules/profile/profile.js2
-rw-r--r--modules/simpletest/simpletest.js2
-rw-r--r--modules/system/system.js40
-rw-r--r--modules/user/user.js44
9 files changed, 81 insertions, 83 deletions
diff --git a/modules/block/block.js b/modules/block/block.js
index f095c3dbc..f8f96111c 100644
--- a/modules/block/block.js
+++ b/modules/block/block.js
@@ -18,8 +18,8 @@ Drupal.behaviors.blockDrag = {
};
// A custom message for the blocks page specifically.
- Drupal.theme.tableDragChangedWarning = function () {
- return '<div class="warning">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t("The changes to these blocks will not be saved until the <em>Save blocks</em> button is clicked.") + '</div>';
+ Drupal.theme.tableDragChangedWarning = function() {
+ return '<div class="warning">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t('The changes to these blocks will not be saved until the <em>Save blocks</em> button is clicked.') + '</div>';
};
// Add a handler so when a row is dropped, update fields dropped into new regions.
@@ -32,7 +32,7 @@ Drupal.behaviors.blockDrag = {
var weightField = $('select.block-weight', dragObject.rowObject.element);
var oldRegionName = weightField[0].className.replace(/([^ ]+[ ]+)*block-weight-([^ ]+)([ ]+[^ ]+)*/, '$2');
- if (!regionField.is('.block-region-'+ regionName)) {
+ if (!regionField.is('.block-region-' + regionName)) {
regionField.removeClass('block-region-' + oldRegionName).addClass('block-region-' + regionName);
weightField.removeClass('block-weight-' + oldRegionName).addClass('block-weight-' + regionName);
regionField.val(regionName);
diff --git a/modules/color/color.js b/modules/color/color.js
index 8ab30fa90..1b1199899 100644
--- a/modules/color/color.js
+++ b/modules/color/color.js
@@ -42,7 +42,7 @@ Drupal.behaviors.color = {
}
// Set up colorscheme selector.
- $('#edit-scheme', form).change(function () {
+ $('#edit-scheme', form).change(function() {
var colors = this.options[this.selectedIndex].value;
if (colors != '') {
colors = colors.split(',');
@@ -75,7 +75,7 @@ Drupal.behaviors.color = {
var accum = top;
// Render gradient lines.
- $('#gradient > div', form).each(function () {
+ $('#gradient > div', form).each(function() {
for (i in accum) {
accum[i] += delta[i];
}
@@ -175,7 +175,7 @@ Drupal.behaviors.color = {
* Reset the color scheme selector.
*/
function resetScheme() {
- $('#edit-scheme', form).each(function () {
+ $('#edit-scheme', form).each(function() {
this.selectedIndex = this.options.length - 1;
});
}
@@ -190,7 +190,7 @@ Drupal.behaviors.color = {
// Add new bindings.
focused = this;
- farb.linkTo(function (color) { callback(input, color, true, false); });
+ 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');
@@ -198,18 +198,18 @@ Drupal.behaviors.color = {
// Initialize color fields.
$('#palette input.form-text', form)
- .each(function () {
+ .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);
+ farb.linkTo(function() {}).setColor('#000').linkTo(this);
// Add lock.
var i = inputs.length;
if (inputs.length) {
var lock = $('<div class="lock"></div>').toggle(
- function () {
+ function() {
$(this).addClass('unlocked');
$(hooks[i - 1]).attr('class',
locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook up' : 'hook'
@@ -218,7 +218,7 @@ Drupal.behaviors.color = {
locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook down' : 'hook'
);
},
- function () {
+ function() {
$(this).removeClass('unlocked');
$(hooks[i - 1]).attr('class',
locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook both' : 'hook down'
diff --git a/modules/comment/comment.js b/modules/comment/comment.js
index 38a026b72..3d2b92edd 100644
--- a/modules/comment/comment.js
+++ b/modules/comment/comment.js
@@ -3,16 +3,14 @@
Drupal.behaviors.comment = {
attach: function(context, settings) {
- 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)
+ $.each(['name', 'homepage', 'mail'], function() {
+ var cookie = Drupal.comment.getCookie('comment_info_' + this);
+ if (cookie) {
+ $('#comment-form input[name=' + this + ']:not(.comment-processed)', context)
.val(cookie)
.addClass('comment-processed');
}
- }
+ });
}
};
diff --git a/modules/node/content_types.js b/modules/node/content_types.js
index 7f6ff3a2d..8b32ae8ea 100644
--- a/modules/node/content_types.js
+++ b/modules/node/content_types.js
@@ -9,7 +9,7 @@ Drupal.behaviors.contentTypes = {
var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_');
if (machine != '_' && machine != '') {
$('#edit-type').val(machine);
- $('#node-type-name-suffix').empty().append(' Machine name: ' + machine + ' [').append($('<a href="#">'+ Drupal.t('Edit') +'</a>').click(function() {
+ $('#node-type-name-suffix').empty().append(' Machine name: ' + machine + ' [').append($('<a href="#">' + Drupal.t('Edit') + '</a>').click(function() {
$('#edit-type-wrapper').show();
$('#node-type-name-suffix').hide();
$('#edit-name').unbind('keyup');
diff --git a/modules/openid/openid.js b/modules/openid/openid.js
index 1511348c8..14d70d3a1 100644
--- a/modules/openid/openid.js
+++ b/modules/openid/openid.js
@@ -3,38 +3,38 @@
Drupal.behaviors.openid = {
attach: function(context) {
- var $loginElements = $("#edit-name-wrapper, #edit-pass-wrapper, li.openid-link");
- var $openidElements = $("#edit-openid-identifier-wrapper, li.user-link");
+ var loginElements = $('#edit-name-wrapper, #edit-pass-wrapper, li.openid-link');
+ var openidElements = $('#edit-openid-identifier-wrapper, li.user-link');
// This behavior attaches by ID, so is only valid once on a page.
- if (!$("#edit-openid-identifier.openid-processed").size() && $("#edit-openid-identifier").val()) {
- $("#edit-openid-identifier").addClass('openid-processed');
- $loginElements.hide();
- // Use .css("display", "block") instead of .show() to be Konqueror friendly.
- $openidElements.css("display", "block");
+ if (!$('#edit-openid-identifier.openid-processed').size() && $('#edit-openid-identifier').val()) {
+ $('#edit-openid-identifier').addClass('openid-processed');
+ loginElements.hide();
+ // Use .css('display', 'block') instead of .show() to be Konqueror friendly.
+ openidElements.css('display', 'block');
}
- $("li.openid-link:not(.openid-processed)", context)
+ $('li.openid-link:not(.openid-processed)', context)
.addClass('openid-processed')
- .click( function() {
- $loginElements.hide();
- $openidElements.css("display", "block");
+ .click(function() {
+ loginElements.hide();
+ openidElements.css('display', 'block');
// Remove possible error message.
- $("#edit-name, #edit-pass").removeClass("error");
- $("div.messages.error").hide();
+ $('#edit-name, #edit-pass').removeClass('error');
+ $('div.messages.error').hide();
// Set focus on OpenID Identifier field.
- $("#edit-openid-identifier")[0].focus();
+ $('#edit-openid-identifier')[0].focus();
return false;
});
- $("li.user-link:not(.openid-processed)", context)
+ $('li.user-link:not(.openid-processed)', context)
.addClass('openid-processed')
.click(function() {
- $openidElements.hide();
- $loginElements.css("display", "block");
+ openidElements.hide();
+ loginElements.css('display', 'block');
// Clear OpenID Identifier field and remove possible error message.
- $("#edit-openid-identifier").val('').removeClass("error");
- $("div.messages.error").css("display", "block");
+ $('#edit-openid-identifier').val('').removeClass('error');
+ $('div.messages.error').css('display', 'block');
// Set focus on username field.
- $("#edit-name")[0].focus();
+ $('#edit-name')[0].focus();
return false;
});
}
diff --git a/modules/profile/profile.js b/modules/profile/profile.js
index f1d53378b..334d71df6 100644
--- a/modules/profile/profile.js
+++ b/modules/profile/profile.js
@@ -45,7 +45,7 @@ Drupal.behaviors.profileDrag = {
var weightField = $('select.profile-weight', dragObject.rowObject.element);
var oldcategoryNum = weightField[0].className.replace(/([^ ]+[ ]+)*profile-weight-([^ ]+)([ ]+[^ ]+)*/, '$2');
- if (!categoryField.is('.profile-category-'+ categoryNum)) {
+ if (!categoryField.is('.profile-category-' + categoryNum)) {
categoryField.removeClass('profile-category-' + oldcategoryNum).addClass('profile-category-' + categoryNum);
weightField.removeClass('profile-weight-' + oldcategoryNum).addClass('profile-weight-' + categoryNum);
diff --git a/modules/simpletest/simpletest.js b/modules/simpletest/simpletest.js
index 06fb70f30..91912599f 100644
--- a/modules/simpletest/simpletest.js
+++ b/modules/simpletest/simpletest.js
@@ -83,7 +83,7 @@ Drupal.behaviors.simpleTestSelectAll = {
groupCheckbox.change(function() {
var checked = !!($(this).attr('checked'));
for (var i = 0; i < testCheckboxes.length; i++) {
- $('#'+ testCheckboxes[i]).attr('checked', checked);
+ $('#' + testCheckboxes[i]).attr('checked', checked);
}
});
diff --git a/modules/system/system.js b/modules/system/system.js
index 3015a2a8a..0b424812a 100644
--- a/modules/system/system.js
+++ b/modules/system/system.js
@@ -13,28 +13,28 @@ Drupal.behaviors.cleanURLsSettingsCheck = {
// 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-processed, #edit-clean-url.install").size()) {
+ if ($('.clean-url-processed, #edit-clean-url.install').size()) {
return;
}
- var url = settings.basePath +"admin/settings/clean-urls/check";
- $("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>");
- $("#clean-url p").hide();
+ var url = settings.basePath + 'admin/settings/clean-urls/check';
+ $('#clean-url .description span').html('<div id="testing">' + Drupal.t('Testing clean URLs...') + '</div>');
+ $('#clean-url p').hide();
$.ajax({
- url: location.protocol +"//"+ location.host + url,
+ url: location.protocol + '//' + location.host + url,
dataType: 'json',
- success: function () {
+ success: function() {
// Check was successful.
- $("#clean-url input.form-radio").attr("disabled", false);
- $("#clean-url .description span").append('<div class="ok">'+ Drupal.t('Your server has been successfully tested to support this feature.') +"</div>");
- $("#testing").hide();
+ $('#clean-url input.form-radio').attr('disabled', false);
+ $('#clean-url .description span').append('<div class="ok">' + Drupal.t('Your server has been successfully tested to support this feature.') + '</div>');
+ $('#testing').hide();
},
error: function() {
// Check failed.
- $("#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>");
- $("#testing").hide();
+ $('#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>');
+ $('#testing').hide();
}
});
- $("#clean-url").addClass('clean-url-processed');
+ $('#clean-url').addClass('clean-url-processed');
}
};
@@ -46,19 +46,19 @@ Drupal.behaviors.cleanURLsSettingsCheck = {
* are currently enabled.
*/
Drupal.cleanURLsInstallCheck = function() {
- var url = location.protocol +"//"+ location.host + Drupal.settings.basePath +"admin/settings/clean-urls/check";
+ var url = location.protocol + '//' + location.host + Drupal.settings.basePath + 'admin/settings/clean-urls/check';
// Submit a synchronous request to avoid database errors associated with
// concurrent requests during install.
$.ajax({
async: false,
url: url,
dataType: 'json',
- success: function () {
+ success: function() {
// Check was successful.
- $("#edit-clean-url").attr("value", 1);
- },
+ $('#edit-clean-url').attr('value', 1);
+ }
});
- $("#edit-clean-url").addClass('clean-url-processed');
+ $('#edit-clean-url').addClass('clean-url-processed');
};
/**
@@ -95,15 +95,15 @@ Drupal.behaviors.dateTime = {
attach: function(context, settings) {
// Show/hide custom format depending on the select's value.
$('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"]();
+ $(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:not(.date-time-processed)', context).addClass('date-time-processed').keyup(function() {
var input = $(this);
- var url = settings.dateTime.lookup +(settings.dateTime.lookup.match(/\?q=/) ? "&format=" : "?format=") + Drupal.encodeURIComponent(input.val());
+ var url = settings.dateTime.lookup +(settings.dateTime.lookup.match(/\?q=/) ? '&format=' : '?format=') + Drupal.encodeURIComponent(input.val());
$.getJSON(url, function(data) {
- $("div.description span", input.parent()).html(data);
+ $('div.description span', input.parent()).html(data);
});
});
diff --git a/modules/user/user.js b/modules/user/user.js
index 66e74e890..10077434c 100644
--- a/modules/user/user.js
+++ b/modules/user/user.js
@@ -8,30 +8,30 @@
Drupal.behaviors.password = {
attach: function(context, settings) {
var translate = settings.password;
- $("input.password-field:not(.password-processed)", context).each(function() {
+ $('input.password-field:not(.password-processed)', context).each(function() {
var passwordInput = $(this).addClass('password-processed');
var innerWrapper = $(this).parent();
var outerWrapper = $(this).parent().parent();
// Add the password strength layers.
- var passwordStrength = $("span.password-strength", innerWrapper);
- var passwordResult = $("span.password-result", passwordStrength);
- innerWrapper.addClass("password-parent");
+ var passwordStrength = $('span.password-strength', innerWrapper);
+ var passwordResult = $('span.password-result', passwordStrength);
+ innerWrapper.addClass('password-parent');
// Add the description box at the end.
var passwordMeter = '<div id="password-strength"><div class="password-strength-title">' + translate.strengthTitle + '</div><div id="password-indicator"><div id="indicator"></div></div></div>';
- $("div.description", outerWrapper).prepend('<div class="password-suggestions"></div>');
+ $('div.description', outerWrapper).prepend('<div class="password-suggestions"></div>');
$(innerWrapper).append(passwordMeter);
- var passwordDescription = $("div.password-suggestions", outerWrapper).hide();
+ var passwordDescription = $('div.password-suggestions', outerWrapper).hide();
// Add the password confirmation layer.
- $("input.password-confirm", outerWrapper).after('<div class="password-confirm">' + translate["confirmTitle"] + ' <span></span></div>').parent().addClass("confirm-parent");
- var confirmInput = $("input.password-confirm", outerWrapper);
- var confirmResult = $("div.password-confirm", outerWrapper);
- var confirmChild = $("span", confirmResult);
+ $('input.password-confirm', outerWrapper).after('<div class="password-confirm">' + translate['confirmTitle'] + ' <span></span></div>').parent().addClass('confirm-parent');
+ var confirmInput = $('input.password-confirm', outerWrapper);
+ var confirmResult = $('div.password-confirm', outerWrapper);
+ var confirmChild = $('span', confirmResult);
// Check the password strength.
- var passwordCheck = function () {
+ var passwordCheck = function() {
// Evaluate the password strength.
var result = Drupal.evaluatePasswordStrength(passwordInput.val(), settings.password);
@@ -50,19 +50,19 @@ Drupal.behaviors.password = {
}
// Adjust the length of the strength indicator.
- $("#indicator").css('width', result.strength + '%');
+ $('#indicator').css('width', result.strength + '%');
passwordCheckMatch();
};
// Check that password and confirmation inputs match.
- var passwordCheckMatch = function () {
+ var passwordCheckMatch = function() {
if (confirmInput.val()) {
var success = passwordInput.val() === confirmInput.val();
// Show the confirm result.
- confirmResult.css({ visibility: "visible" });
+ confirmResult.css({ visibility: 'visible' });
// Remove the previous styling if any exists.
if (this.confirmClass) {
@@ -70,12 +70,12 @@ Drupal.behaviors.password = {
}
// Fill in the success message and set the class accordingly.
- var confirmClass = success ? "ok" : 'error';
- confirmChild.html(translate["confirm" + (success ? "Success" : "Failure")]).addClass(confirmClass);
+ var confirmClass = success ? 'ok' : 'error';
+ confirmChild.html(translate['confirm' + (success ? 'Success' : 'Failure')]).addClass(confirmClass);
this.confirmClass = confirmClass;
}
else {
- confirmResult.css({ visibility: "hidden" });
+ confirmResult.css({ visibility: 'hidden' });
}
};
@@ -92,7 +92,7 @@ Drupal.behaviors.password = {
*
* Returns the estimated strength and the relevant output message.
*/
-Drupal.evaluatePasswordStrength = function (password, translate) {
+Drupal.evaluatePasswordStrength = function(password, translate) {
var weaknesses = 0, strength = 100, msg = [];
var hasLowercase = password.match(/[a-z]+/);
@@ -102,7 +102,7 @@ Drupal.evaluatePasswordStrength = function (password, translate) {
// If there is a username edit box on the page, compare password to that, otherwise
// use value from the database.
- var usernameBox = $("input.username");
+ var usernameBox = $('input.username');
var username = (usernameBox.length > 0) ? usernameBox.val() : translate.username;
// Lose 10 points for every character less than 6.
@@ -149,14 +149,14 @@ Drupal.evaluatePasswordStrength = function (password, translate) {
}
// Check if password is the same as the username.
- if ((password !== '') && (password.toLowerCase() === username.toLowerCase())){
+ if (password !== '' && password.toLowerCase() === username.toLowerCase()) {
msg.push(translate.sameAsUsername);
// Passwords the same as username are always very weak.
strength = 5;
}
// Assemble the final message.
- msg = translate.hasWeaknesses + "<ul><li>" + msg.join("</li><li>") + "</li></ul>";
+ msg = translate.hasWeaknesses + '<ul><li>' + msg.join('</li><li>') + '</li></ul>';
return { strength: strength, message: msg };
};
@@ -167,7 +167,7 @@ Drupal.evaluatePasswordStrength = function (password, translate) {
*/
Drupal.behaviors.userSettings = {
attach: function(context, settings) {
- $('div.user-admin-picture-radios input[type=radio]:not(.userSettings-processed)', context).addClass('userSettings-processed').click(function () {
+ $('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]]();
});
}