summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc6
-rw-r--r--includes/locale.inc2
-rw-r--r--install.php2
-rw-r--r--misc/ahah.js24
-rw-r--r--misc/autocomplete.js66
-rw-r--r--misc/batch.js10
-rw-r--r--misc/collapse.js20
-rw-r--r--misc/drupal.js42
-rw-r--r--misc/form.js22
-rw-r--r--misc/progress.js20
-rw-r--r--misc/tabledrag.js106
-rw-r--r--misc/tableheader.js20
-rw-r--r--misc/tableselect.js20
-rw-r--r--misc/teaser.js6
-rw-r--r--misc/textarea.js6
-rw-r--r--misc/timezone.js8
-rw-r--r--misc/vertical-tabs.js22
-rw-r--r--modules/block/block.js20
-rw-r--r--modules/book/book.js6
-rw-r--r--modules/color/color.js20
-rw-r--r--modules/comment/comment-node-form.js6
-rw-r--r--modules/comment/comment.js8
-rw-r--r--modules/menu/menu.js6
-rw-r--r--modules/node/content_types.js8
-rw-r--r--modules/node/node.js12
-rw-r--r--modules/openid/openid.js8
-rw-r--r--modules/path/path.js6
-rw-r--r--modules/profile/profile.js10
-rw-r--r--modules/simpletest/simpletest.js20
-rw-r--r--modules/simpletest/tests/common.test4
-rw-r--r--modules/system/system.js28
-rw-r--r--modules/taxonomy/taxonomy.js6
-rw-r--r--modules/upload/upload.js6
-rw-r--r--modules/user/user.js16
34 files changed, 296 insertions, 296 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 85381326b..c52102b8b 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2362,7 +2362,7 @@ function drupal_clear_css_cache() {
* a new message arrived, by opening a pop up, alert box etc. This should only
* be used for JavaScript which cannot be placed and executed from a file.
* When adding inline code, make sure that you are not relying on $ being jQuery.
- * Wrap your code in (function($) { ... })(jQuery); or use jQuery instead of $.
+ * Wrap your code in (function ($) { ... })(jQuery); or use jQuery instead of $.
*
* - Add external JavaScript ('external'):
* Allows the inclusion of external JavaScript files that are not hosted on the
@@ -2378,8 +2378,8 @@ function drupal_clear_css_cache() {
* @code
* drupal_add_js('misc/collapse.js');
* drupal_add_js('misc/collapse.js', 'file');
- * drupal_add_js('jQuery(document).ready(function(){alert("Hello!");});', 'inline');
- * drupal_add_js('jQuery(document).ready(function(){alert("Hello!");});',
+ * drupal_add_js('jQuery(document).ready(function () { alert("Hello!"); });', 'inline');
+ * drupal_add_js('jQuery(document).ready(function () { alert("Hello!"); });',
* array('type' => 'inline', 'scope' => 'footer', 'weight' => 5)
* );
* drupal_add_js('http://example.com/example.js', 'external');
diff --git a/includes/locale.inc b/includes/locale.inc
index a386bbc69..e7a3534a0 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -2391,7 +2391,7 @@ function _locale_rebuild_js($langcode = NULL) {
$data = "Drupal.locale = { ";
if (!empty($language->formula)) {
- $data .= "'pluralFormula': function(\$n) { return Number({$language->formula}); }, ";
+ $data .= "'pluralFormula': function (\$n) { return Number({$language->formula}); }, ";
}
$data .= "'strings': " . drupal_to_js($translations) . " };";
diff --git a/install.php b/install.php
index 87ac52bc5..1fa053ddf 100644
--- a/install.php
+++ b/install.php
@@ -728,7 +728,7 @@ function install_tasks($profile, $task) {
// We add these strings as settings because JavaScript translation does not
// work on install time.
drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail'))), 'setting');
- drupal_add_js('jQuery(function() { Drupal.cleanURLsInstallCheck(); });', 'inline');
+ drupal_add_js('jQuery(function () { Drupal.cleanURLsInstallCheck(); });', 'inline');
// Build menu to allow clean URL check.
menu_rebuild();
diff --git a/misc/ahah.js b/misc/ahah.js
index 019680f42..b56044c3b 100644
--- a/misc/ahah.js
+++ b/misc/ahah.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Provides AJAX-like page updating via AHAH (Asynchronous HTML and HTTP).
@@ -17,12 +17,12 @@
* Attaches the ahah behavior to each ahah form element.
*/
Drupal.behaviors.ahah = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
for (var base in settings.ahah) {
if (!$('#' + base + '.ahah-processed').size()) {
var element_settings = settings.ahah[base];
- $(element_settings.selector).each(function() {
+ $(element_settings.selector).each(function () {
element_settings.element = this;
var ahah = new Drupal.ahah(base, element_settings);
});
@@ -36,7 +36,7 @@ Drupal.behaviors.ahah = {
/**
* AHAH object.
*/
-Drupal.ahah = function(base, element_settings) {
+Drupal.ahah = function (base, element_settings) {
// Set the properties for this object.
this.element = element_settings.element;
this.selector = element_settings.selector;
@@ -77,10 +77,10 @@ Drupal.ahah = function(base, element_settings) {
var options = {
url: ahah.url,
data: ahah.button,
- beforeSubmit: function(form_values, element_settings, options) {
+ beforeSubmit: function (form_values, element_settings, options) {
return ahah.beforeSubmit(form_values, element_settings, options);
},
- success: function(response, status) {
+ success: function (response, status) {
// Sanity check for browser support (object expected).
// When using iFrame uploads, responses must be returned as a string.
if (typeof response == 'string') {
@@ -88,7 +88,7 @@ Drupal.ahah = function(base, element_settings) {
}
return ahah.success(response, status);
},
- complete: function(response, status) {
+ complete: function (response, status) {
if (status == 'error' || status == 'parsererror') {
return ahah.error(response, ahah.url);
}
@@ -98,7 +98,7 @@ Drupal.ahah = function(base, element_settings) {
};
// Bind the ajaxSubmit function to the element event.
- $(element_settings.element).bind(element_settings.event, function() {
+ $(element_settings.element).bind(element_settings.event, function () {
$(element_settings.element).parents('form').ajaxSubmit(options);
return false;
});
@@ -106,7 +106,7 @@ Drupal.ahah = function(base, element_settings) {
// can be triggered through keyboard input as well as e.g. a mousedown
// action.
if (element_settings.keypress) {
- $(element_settings.element).keypress(function(event) {
+ $(element_settings.element).keypress(function (event) {
// Detect enter key.
if (event.keyCode == 13) {
$(element_settings.element).trigger(element_settings.event);
@@ -119,7 +119,7 @@ Drupal.ahah = function(base, element_settings) {
/**
* Handler for the form redirection submission.
*/
-Drupal.ahah.prototype.beforeSubmit = function(form_values, element, options) {
+Drupal.ahah.prototype.beforeSubmit = function (form_values, element, options) {
// Disable the element that received the change.
$(this.element).addClass('progress-disabled').attr('disabled', true);
@@ -148,7 +148,7 @@ Drupal.ahah.prototype.beforeSubmit = function(form_values, element, options) {
/**
* Handler for the form redirection completion.
*/
-Drupal.ahah.prototype.success = function(response, status) {
+Drupal.ahah.prototype.success = function (response, status) {
var wrapper = $(this.wrapper);
var form = $(this.element).parents('form');
// Manually insert HTML into the jQuery object, using $() directly crashes
@@ -206,7 +206,7 @@ Drupal.ahah.prototype.success = function(response, status) {
/**
* Handler for the form redirection error.
*/
-Drupal.ahah.prototype.error = function(response, uri) {
+Drupal.ahah.prototype.error = function (response, uri) {
alert(Drupal.ahahError(response, uri));
// Resore the previous action and target to the form.
$(this.element).parent('form').attr({ action: this.form_action, target: this.form_target });
diff --git a/misc/autocomplete.js b/misc/autocomplete.js
index 85469cc95..aed6628b3 100644
--- a/misc/autocomplete.js
+++ b/misc/autocomplete.js
@@ -1,13 +1,13 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Attaches the autocomplete behavior to all required fields.
*/
Drupal.behaviors.autocomplete = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
var acdb = [];
- $('input.autocomplete:not(.autocomplete-processed)', context).each(function() {
+ $('input.autocomplete:not(.autocomplete-processed)', context).each(function () {
var uri = this.value;
if (!acdb[uri]) {
acdb[uri] = new Drupal.ACDB(uri);
@@ -25,8 +25,8 @@ Drupal.behaviors.autocomplete = {
* Prevents the form from submitting if the suggestions popup is open
* and closes the suggestions popup when doing so.
*/
-Drupal.autocompleteSubmit = function() {
- return $('#autocomplete').each(function() {
+Drupal.autocompleteSubmit = function () {
+ return $('#autocomplete').each(function () {
this.owner.hidePopup();
}).size() == 0;
};
@@ -34,22 +34,22 @@ Drupal.autocompleteSubmit = function() {
/**
* An AutoComplete object.
*/
-Drupal.jsAC = function(input, db) {
+Drupal.jsAC = function (input, db) {
var ac = this;
this.input = input;
this.db = db;
$(this.input)
- .keydown(function(event) { return ac.onkeydown(this, event); })
- .keyup(function(event) { ac.onkeyup(this, event); })
- .blur(function() { ac.hidePopup(); ac.db.cancel(); });
+ .keydown(function (event) { return ac.onkeydown(this, event); })
+ .keyup(function (event) { ac.onkeyup(this, event); })
+ .blur(function () { ac.hidePopup(); ac.db.cancel(); });
};
/**
* Handler for the "keydown" event.
*/
-Drupal.jsAC.prototype.onkeydown = function(input, e) {
+Drupal.jsAC.prototype.onkeydown = function (input, e) {
if (!e) {
e = window.event;
}
@@ -68,7 +68,7 @@ Drupal.jsAC.prototype.onkeydown = function(input, e) {
/**
* Handler for the "keyup" event.
*/
-Drupal.jsAC.prototype.onkeyup = function(input, e) {
+Drupal.jsAC.prototype.onkeyup = function (input, e) {
if (!e) {
e = window.event;
}
@@ -105,14 +105,14 @@ Drupal.jsAC.prototype.onkeyup = function(input, e) {
/**
* Puts the currently highlighted suggestion into the autocomplete field.
*/
-Drupal.jsAC.prototype.select = function(node) {
- this.input.value = node.autocompleteValue;
+Drupal.jsAC.prototype.select = function (node) {
+ this.input.value = $(node).data('autocompleteValue');
};
/**
* Highlights the next suggestion.
*/
-Drupal.jsAC.prototype.selectDown = function() {
+Drupal.jsAC.prototype.selectDown = function () {
if (this.selected && this.selected.nextSibling) {
this.highlight(this.selected.nextSibling);
}
@@ -127,7 +127,7 @@ Drupal.jsAC.prototype.selectDown = function() {
/**
* Highlights the previous suggestion.
*/
-Drupal.jsAC.prototype.selectUp = function() {
+Drupal.jsAC.prototype.selectUp = function () {
if (this.selected && this.selected.previousSibling) {
this.highlight(this.selected.previousSibling);
}
@@ -136,7 +136,7 @@ Drupal.jsAC.prototype.selectUp = function() {
/**
* Highlights a suggestion.
*/
-Drupal.jsAC.prototype.highlight = function(node) {
+Drupal.jsAC.prototype.highlight = function (node) {
if (this.selected) {
$(this.selected).removeClass('selected');
}
@@ -147,7 +147,7 @@ Drupal.jsAC.prototype.highlight = function(node) {
/**
* Unhighlights a suggestion.
*/
-Drupal.jsAC.prototype.unhighlight = function(node) {
+Drupal.jsAC.prototype.unhighlight = function (node) {
$(node).removeClass('selected');
this.selected = false;
};
@@ -155,16 +155,16 @@ Drupal.jsAC.prototype.unhighlight = function(node) {
/**
* Hides the autocomplete suggestions.
*/
-Drupal.jsAC.prototype.hidePopup = function(keycode) {
+Drupal.jsAC.prototype.hidePopup = function (keycode) {
// Select item if the right key or mousebutton was pressed.
if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
- this.input.value = this.selected.autocompleteValue;
+ this.input.value = $(this.selected).data('autocompleteValue');
}
// Hide popup.
var popup = this.popup;
if (popup) {
this.popup = null;
- $(popup).fadeOut('fast', function() { $(popup).remove(); });
+ $(popup).fadeOut('fast', function () { $(popup).remove(); });
}
this.selected = false;
};
@@ -172,7 +172,7 @@ Drupal.jsAC.prototype.hidePopup = function(keycode) {
/**
* Positions the suggestions popup and starts a search.
*/
-Drupal.jsAC.prototype.populatePopup = function() {
+Drupal.jsAC.prototype.populatePopup = function () {
// Show popup.
if (this.popup) {
$(this.popup).remove();
@@ -195,7 +195,7 @@ Drupal.jsAC.prototype.populatePopup = function() {
/**
* Fills the suggestion popup with any matches received.
*/
-Drupal.jsAC.prototype.found = function(matches) {
+Drupal.jsAC.prototype.found = function (matches) {
// If no value in the textfield, do not show the popup.
if (!this.input.value.length) {
return false;
@@ -207,10 +207,10 @@ Drupal.jsAC.prototype.found = function(matches) {
for (key in matches) {
$('<li></li>')
.html($('<div></div>').html(matches[key]))
- .mousedown(function() { ac.select(this); })
- .mouseover(function() { ac.highlight(this); })
- .mouseout(function() { ac.unhighlight(this); })
- .attr('autocompleteValue', key)
+ .mousedown(function () { ac.select(this); })
+ .mouseover(function () { ac.highlight(this); })
+ .mouseout(function () { ac.unhighlight(this); })
+ .data('autocompleteValue', key)
.appendTo(ul);
}
@@ -226,7 +226,7 @@ Drupal.jsAC.prototype.found = function(matches) {
}
};
-Drupal.jsAC.prototype.setStatus = function(status) {
+Drupal.jsAC.prototype.setStatus = function (status) {
switch (status) {
case 'begin':
$(this.input).addClass('throbbing');
@@ -242,7 +242,7 @@ Drupal.jsAC.prototype.setStatus = function(status) {
/**
* An AutoComplete DataBase object.
*/
-Drupal.ACDB = function(uri) {
+Drupal.ACDB = function (uri) {
this.uri = uri;
this.delay = 300;
this.cache = {};
@@ -251,7 +251,7 @@ Drupal.ACDB = function(uri) {
/**
* Performs a cached and delayed search.
*/
-Drupal.ACDB.prototype.search = function(searchString) {
+Drupal.ACDB.prototype.search = function (searchString) {
var db = this;
this.searchString = searchString;
@@ -264,7 +264,7 @@ Drupal.ACDB.prototype.search = function(searchString) {
if (this.timer) {
clearTimeout(this.timer);
}
- this.timer = setTimeout(function() {
+ this.timer = setTimeout(function () {
db.owner.setStatus('begin');
// Ajax GET request for autocompletion.
@@ -272,7 +272,7 @@ Drupal.ACDB.prototype.search = function(searchString) {
type: 'GET',
url: db.uri + '/' + Drupal.encodeURIComponent(searchString),
dataType: 'json',
- success: function(matches) {
+ success: function (matches) {
if (typeof matches.status == 'undefined' || matches.status != 0) {
db.cache[searchString] = matches;
// Verify if these are still the matches the user wants to see.
@@ -282,7 +282,7 @@ Drupal.ACDB.prototype.search = function(searchString) {
db.owner.setStatus('found');
}
},
- error: function(xmlhttp) {
+ error: function (xmlhttp) {
alert(Drupal.ahahError(xmlhttp, db.uri));
}
});
@@ -292,7 +292,7 @@ Drupal.ACDB.prototype.search = function(searchString) {
/**
* Cancels the current autocomplete request.
*/
-Drupal.ACDB.prototype.cancel = function() {
+Drupal.ACDB.prototype.cancel = function () {
if (this.owner) this.owner.setStatus('cancel');
if (this.timer) clearTimeout(this.timer);
this.searchString = '';
diff --git a/misc/batch.js b/misc/batch.js
index fc334617d..8e53c210a 100644
--- a/misc/batch.js
+++ b/misc/batch.js
@@ -1,27 +1,27 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Attaches the batch behavior to progress bars.
*/
Drupal.behaviors.batch = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
// This behavior attaches by ID, so is only valid once on a page.
if ($('#progress.batch-processed').size()) {
return;
}
- $('#progress', context).addClass('batch-processed').each(function() {
+ $('#progress', context).addClass('batch-processed').each(function () {
var holder = $(this);
// Success: redirect to the summary.
- var updateCallback = function(progress, status, pb) {
+ var updateCallback = function (progress, status, pb) {
if (progress == 100) {
pb.stopMonitoring();
window.location = settings.batch.uri + '&op=finished';
}
};
- var errorCallback = function(pb) {
+ var errorCallback = function (pb) {
holder.prepend($('<p class="error"></p>').html(settings.batch.errorMessage));
$('#wait').hide();
};
diff --git a/misc/collapse.js b/misc/collapse.js
index 4c07506df..c4fac9be3 100644
--- a/misc/collapse.js
+++ b/misc/collapse.js
@@ -1,10 +1,10 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Toggle the visibility of a fieldset using smooth animations
*/
-Drupal.toggleFieldset = function(fieldset) {
+Drupal.toggleFieldset = function (fieldset) {
if ($(fieldset).is('.collapsed')) {
// Action div containers are processed separately because of a IE bug
// that alters the default submit button behavior.
@@ -14,12 +14,12 @@ Drupal.toggleFieldset = function(fieldset) {
content.slideDown({
duration: 'fast',
easing: 'linear',
- complete: function() {
+ complete: function () {
Drupal.collapseScrollIntoView(this.parentNode);
this.parentNode.animating = false;
$('div.action', fieldset).show();
},
- step: function() {
+ step: function () {
// Scroll the fieldset into view
Drupal.collapseScrollIntoView(this.parentNode);
}
@@ -27,7 +27,7 @@ Drupal.toggleFieldset = function(fieldset) {
}
else {
$('div.action', fieldset).hide();
- var content = $('> div:not(.action)', fieldset).slideUp('fast', function() {
+ var content = $('> div:not(.action)', fieldset).slideUp('fast', function () {
$(this.parentNode).addClass('collapsed');
this.parentNode.animating = false;
});
@@ -37,7 +37,7 @@ Drupal.toggleFieldset = function(fieldset) {
/**
* Scroll a given fieldset into view as much as possible.
*/
-Drupal.collapseScrollIntoView = function(node) {
+Drupal.collapseScrollIntoView = function (node) {
var h = self.innerHeight || document.documentElement.clientHeight || $('body')[0].clientHeight || 0;
var offset = self.pageYOffset || document.documentElement.scrollTop || $('body')[0].scrollTop || 0;
var posY = $(node).offset().top;
@@ -52,8 +52,8 @@ Drupal.collapseScrollIntoView = function(node) {
};
Drupal.behaviors.collapse = {
- attach: function(context, settings) {
- $('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function() {
+ attach: function (context, settings) {
+ $('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function () {
var fieldset = $(this.parentNode);
// Expand if there are errors inside
if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
@@ -62,7 +62,7 @@ Drupal.behaviors.collapse = {
var summary = $('<span class="summary"></span>');
fieldset.
- bind('summaryUpdated', function() {
+ bind('summaryUpdated', function () {
var text = $.trim(fieldset.getSummary());
summary.html(text ? ' (' + text + ')' : '');
})
@@ -71,7 +71,7 @@ Drupal.behaviors.collapse = {
// Turn the legend into a clickable link and wrap the contents of the fieldset
// in a div for easier animation
var text = this.innerHTML;
- $(this).empty().append($('<a href="#">' + text + '</a>').click(function() {
+ $(this).empty().append($('<a href="#">' + text + '</a>').click(function () {
var fieldset = $(this).parents('fieldset:first')[0];
// Don't animate multiple times
if (!fieldset.animating) {
diff --git a/misc/drupal.js b/misc/drupal.js
index d83bb8a30..cb650ac65 100644
--- a/misc/drupal.js
+++ b/misc/drupal.js
@@ -7,13 +7,13 @@ jQuery.noConflict();
// Indicate when other scripts use $ with out wrapping their code.
if ($ === undefined) {
- $ = function() {
- alert('Please wrap your JavaScript code in (function($) { ... })(jQuery); to be compatible. See http://docs.jquery.com/Using_jQuery_with_Other_Libraries.');
+ $ = function () {
+ alert('Please wrap your JavaScript code in (function ($) { ... })(jQuery); to be compatible. See http://docs.jquery.com/Using_jQuery_with_Other_Libraries.');
};
}
-(function($) {
+(function ($) {
/**
* Attach all registered behaviors to a page element.
@@ -23,10 +23,10 @@ if ($ === undefined) {
* object using the method 'attach' and optionally also 'detach' as follows:
* @code
* Drupal.behaviors.behaviorName = {
- * attach: function(context) {
+ * attach: function (context) {
* ...
* },
- * detach: function(context) {
+ * detach: function (context) {
* ...
* }
* };
@@ -50,11 +50,11 @@ if ($ === undefined) {
* An object containing settings for the current context. If none given, the
* global Drupal.settings object is used.
*/
-Drupal.attachBehaviors = function(context, settings) {
+Drupal.attachBehaviors = function (context, settings) {
context = context || document;
settings = settings || Drupal.settings;
// Execute all of them.
- $.each(Drupal.behaviors, function() {
+ $.each(Drupal.behaviors, function () {
if ($.isFunction(this.attach)) {
this.attach(context, settings);
}
@@ -80,11 +80,11 @@ Drupal.attachBehaviors = function(context, settings) {
*
* @see Drupal.attachBehaviors
*/
-Drupal.detachBehaviors = function(context, settings) {
+Drupal.detachBehaviors = function (context, settings) {
context = context || document;
settings = settings || Drupal.settings;
// Execute all of them.
- $.each(Drupal.behaviors, function() {
+ $.each(Drupal.behaviors, function () {
if ($.isFunction(this.detach)) {
this.detach(context, settings);
}
@@ -94,7 +94,7 @@ Drupal.detachBehaviors = function(context, settings) {
/**
* Encode special characters in a plain-text string for display as HTML.
*/
-Drupal.checkPlain = function(str) {
+Drupal.checkPlain = function (str) {
str = String(str);
var replace = { '&': '&amp;', '"': '&quot;', '<': '&lt;', '>': '&gt;' };
for (var character in replace) {
@@ -122,7 +122,7 @@ Drupal.checkPlain = function(str) {
* @return
* The translated string.
*/
-Drupal.t = function(str, args) {
+Drupal.t = function (str, args) {
// Fetch the localized version of the string.
if (Drupal.locale.strings && Drupal.locale.strings[str]) {
str = Drupal.locale.strings[str];
@@ -182,7 +182,7 @@ Drupal.t = function(str, args) {
* @return
* A translated string.
*/
-Drupal.formatPlural = function(count, singular, plural, args) {
+Drupal.formatPlural = function (count, singular, plural, args) {
var args = args || {};
args['@count'] = count;
// Determine the index of the plural form.
@@ -220,7 +220,7 @@ Drupal.formatPlural = function(count, singular, plural, args) {
* Any data the theme function returns. This could be a plain HTML string,
* but also a complex object.
*/
-Drupal.theme = function(func) {
+Drupal.theme = function (func) {
for (var i = 1, args = []; i < arguments.length; i++) {
args.push(arguments[i]);
}
@@ -233,7 +233,7 @@ Drupal.theme = function(func) {
*
* The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
*/
-Drupal.parseJson = function(data) {
+Drupal.parseJson = function (data) {
if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') };
}
@@ -244,7 +244,7 @@ Drupal.parseJson = function(data) {
* Freeze the current body height (as minimum height). Used to prevent
* unnecessary upwards scrolling when doing DOM manipulations.
*/
-Drupal.freezeHeight = function() {
+Drupal.freezeHeight = function () {
Drupal.unfreezeHeight();
$('<div id="freeze-height"></div>').css({
position: 'absolute',
@@ -258,7 +258,7 @@ Drupal.freezeHeight = function() {
/**
* Unfreeze the body height.
*/
-Drupal.unfreezeHeight = function() {
+Drupal.unfreezeHeight = function () {
$('#freeze-height').remove();
};
@@ -266,7 +266,7 @@ Drupal.unfreezeHeight = function() {
* Wrapper to address the mod_rewrite url encoding bug
* (equivalent of drupal_urlencode() in PHP).
*/
-Drupal.encodeURIComponent = function(item, uri) {
+Drupal.encodeURIComponent = function (item, uri) {
uri = uri || location.href;
item = encodeURIComponent(item).replace(/%2F/g, '/');
return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F');
@@ -275,7 +275,7 @@ Drupal.encodeURIComponent = function(item, uri) {
/**
* Get the text selection in a textarea.
*/
-Drupal.getSelection = function(element) {
+Drupal.getSelection = function (element) {
if (typeof element.selectionStart != 'number' && document.selection) {
// The current selection.
var range1 = document.selection.createRange();
@@ -295,7 +295,7 @@ Drupal.getSelection = function(element) {
/**
* Build an error message from ahah response.
*/
-Drupal.ahahError = function(xmlhttp, uri) {
+Drupal.ahahError = function (xmlhttp, uri) {
if (xmlhttp.status == 200) {
if ($.trim(xmlhttp.responseText)) {
var message = Drupal.t('An error occurred. \n@uri\n@text', { '@uri': uri, '@text': xmlhttp.responseText });
@@ -317,7 +317,7 @@ $('html').addClass('js');
document.cookie = 'has_js=1; path=/';
// Attach all behaviors.
-$(function() {
+$(function () {
Drupal.attachBehaviors(document, Drupal.settings);
});
@@ -334,7 +334,7 @@ Drupal.theme.prototype = {
* @return
* The formatted text (html).
*/
- placeholder: function(str) {
+ placeholder: function (str) {
return '<em>' + Drupal.checkPlain(str) + '</em>';
}
};
diff --git a/misc/form.js b/misc/form.js
index 39c605978..9f916c345 100644
--- a/misc/form.js
+++ b/misc/form.js
@@ -1,10 +1,10 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Retrieves the summary for the first element.
*/
-$.fn.getSummary = function() {
+$.fn.getSummary = function () {
var callback = this.data('summaryCallback');
return (this[0] && callback) ? $.trim(callback(this[0])) : '';
};
@@ -16,14 +16,14 @@ $.fn.getSummary = function() {
* Either a function that will be called each time the summary is
* retrieved or a string (which is returned each time).
*/
-$.fn.setSummary = function(callback) {
+$.fn.setSummary = function (callback) {
var that = this;
// To facilitate things, the callback should always be a function. If it's
// not, we wrap it into an anonymous function which just returns the value.
if (typeof callback != 'function') {
var val = callback;
- callback = function() { return val; };
+ callback = function () { return val; };
}
return this
@@ -31,7 +31,7 @@ $.fn.setSummary = function(callback) {
// To prevent duplicate events, the handlers are first removed and then
// (re-)added.
.unbind('formUpdated.summary')
- .bind('formUpdated.summary', function() {
+ .bind('formUpdated.summary', function () {
that.trigger('summaryUpdated');
})
// The actual summaryUpdated handler doesn't fire when the callback is
@@ -43,7 +43,7 @@ $.fn.setSummary = function(callback) {
* Sends a 'formUpdated' event each time a form element is modified.
*/
Drupal.behaviors.formUpdated = {
- attach: function(context) {
+ attach: function (context) {
// These events are namespaced so that we can remove them later.
var events = 'change.formUpdated click.formUpdated blur.formUpdated keyup.formUpdated';
$(context)
@@ -52,17 +52,17 @@ Drupal.behaviors.formUpdated = {
.find(':input').andSelf().filter(':input')
// To prevent duplicate events, the handlers are first removed and then
// (re-)added.
- .unbind(events).bind(events, function() {
+ .unbind(events).bind(events, function () {
$(this).trigger('formUpdated');
});
}
};
Drupal.behaviors.multiselectSelector = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
// Automatically selects the right radio button in a multiselect control.
$('.multiselect select:not(.multiselectSelector-processed)', context)
- .addClass('multiselectSelector-processed').change(function() {
+ .addClass('multiselectSelector-processed').change(function () {
$('.multiselect input:radio[value="' + this.id.substr(5) + '"]')
.attr('checked', true);
});
@@ -74,12 +74,12 @@ Drupal.behaviors.multiselectSelector = {
* Automatically display the guidelines of the selected text format.
*/
Drupal.behaviors.filterGuidelines = {
- attach: function(context) {
+ attach: function (context) {
$('.filter-guidelines:not(.filter-guidelines-processed)', context)
.addClass('filter-guidelines-processed')
.find('label').hide()
.parents('.filter-wrapper').find('select.filter-list')
- .bind('change', function() {
+ .bind('change', function () {
$(this).parents('.filter-wrapper')
.find('.filter-guidelines-item').hide()
.siblings('#filter-guidelines-' + this.value).show();
diff --git a/misc/progress.js b/misc/progress.js
index 265c538f7..2d95573c2 100644
--- a/misc/progress.js
+++ b/misc/progress.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* A progressbar object. Initialized with the given id. Must be inserted into
@@ -11,7 +11,7 @@
* e.g. pb = new progressBar('myProgressBar');
* some_element.appendChild(pb.element);
*/
-Drupal.progressBar = function(id, updateCallback, method, errorCallback) {
+Drupal.progressBar = function (id, updateCallback, method, errorCallback) {
var pb = this;
this.id = id;
this.method = method || 'GET';
@@ -27,7 +27,7 @@ Drupal.progressBar = function(id, updateCallback, method, errorCallback) {
/**
* Set the percentage and status message for the progressbar.
*/
-Drupal.progressBar.prototype.setProgress = function(percentage, message) {
+Drupal.progressBar.prototype.setProgress = function (percentage, message) {
if (percentage >= 0 && percentage <= 100) {
$('div.filled', this.element).css('width', percentage + '%');
$('div.percentage', this.element).html(percentage + '%');
@@ -41,7 +41,7 @@ Drupal.progressBar.prototype.setProgress = function(percentage, message) {
/**
* Start monitoring progress via Ajax.
*/
-Drupal.progressBar.prototype.startMonitoring = function(uri, delay) {
+Drupal.progressBar.prototype.startMonitoring = function (uri, delay) {
this.delay = delay;
this.uri = uri;
this.sendPing();
@@ -50,7 +50,7 @@ Drupal.progressBar.prototype.startMonitoring = function(uri, delay) {
/**
* Stop monitoring progress via Ajax.
*/
-Drupal.progressBar.prototype.stopMonitoring = function() {
+Drupal.progressBar.prototype.stopMonitoring = function () {
clearTimeout(this.timer);
// This allows monitoring to be stopped from within the callback.
this.uri = null;
@@ -59,7 +59,7 @@ Drupal.progressBar.prototype.stopMonitoring = function() {
/**
* Request progress data from server.
*/
-Drupal.progressBar.prototype.sendPing = function() {
+Drupal.progressBar.prototype.sendPing = function () {
if (this.timer) {
clearTimeout(this.timer);
}
@@ -72,7 +72,7 @@ Drupal.progressBar.prototype.sendPing = function() {
url: this.uri,
data: '',
dataType: 'json',
- success: function(progress) {
+ success: function (progress) {
// Display errors.
if (progress.status == 0) {
pb.displayError(progress.data);
@@ -81,9 +81,9 @@ Drupal.progressBar.prototype.sendPing = function() {
// Update display.
pb.setProgress(progress.percentage, progress.message);
// Schedule next timer.
- pb.timer = setTimeout(function() { pb.sendPing(); }, pb.delay);
+ pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay);
},
- error: function(xmlhttp) {
+ error: function (xmlhttp) {
pb.displayError(Drupal.ahahError(xmlhttp, pb.uri));
}
});
@@ -93,7 +93,7 @@ Drupal.progressBar.prototype.sendPing = function() {
/**
* Display errors on the page.
*/
-Drupal.progressBar.prototype.displayError = function(string) {
+Drupal.progressBar.prototype.displayError = function (string) {
var error = $('<div class="error"></div>').html(string);
$(this.element).before(error).hide();
diff --git a/misc/tabledrag.js b/misc/tabledrag.js
index 1901f84be..04e4b8bd4 100644
--- a/misc/tabledrag.js
+++ b/misc/tabledrag.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Drag and drop table rows with field manipulation.
@@ -13,12 +13,12 @@
* See blocks.js for an example of adding additional functionality to tableDrag.
*/
Drupal.behaviors.tableDrag = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
for (var base in settings.tableDrag) {
if (!$('#' + base + '.tabledrag-processed', context).size()) {
var tableSettings = settings.tableDrag[base];
- $('#' + base).filter(':not(.tabledrag-processed)').each(function() {
+ $('#' + base).filter(':not(.tabledrag-processed)').each(function () {
// Create the new tableDrag instance. Save in the Drupal variable
// to allow other scripts access to the object.
Drupal.tableDrag[base] = new Drupal.tableDrag(this, tableSettings);
@@ -38,7 +38,7 @@ Drupal.behaviors.tableDrag = {
* @param tableSettings
* Settings for the table added via drupal_add_dragtable().
*/
-Drupal.tableDrag = function(table, tableSettings) {
+Drupal.tableDrag = function (table, tableSettings) {
var self = this;
// Required object variables.
@@ -85,22 +85,22 @@ Drupal.tableDrag = function(table, tableSettings) {
}
// Make each applicable row draggable.
- $('tr.draggable', table).each(function() { self.makeDraggable(this); });
+ $('tr.draggable', table).each(function () { self.makeDraggable(this); });
// Hide columns containing affected form elements.
this.hideColumns();
// Add mouse bindings to the document. The self variable is passed along
// as event handlers do not have direct access to the tableDrag object.
- $(document).bind('mousemove', function(event) { return self.dragRow(event, self); });
- $(document).bind('mouseup', function(event) { return self.dropRow(event, self); });
+ $(document).bind('mousemove', function (event) { return self.dragRow(event, self); });
+ $(document).bind('mouseup', function (event) { return self.dropRow(event, self); });
};
/**
* Hide the columns containing form elements according to the settings for
* this tableDrag instance.
*/
-Drupal.tableDrag.prototype.hideColumns = function() {
+Drupal.tableDrag.prototype.hideColumns = function () {
for (var group in this.tableSettings) {
// Find the first field in this group.
for (var d in this.tableSettings[group]) {
@@ -117,13 +117,13 @@ Drupal.tableDrag.prototype.hideColumns = function() {
// Add 1 to our indexes. The nth-child selector is 1 based, not 0 based.
var columnIndex = $('td', cell.parent()).index(cell.get(0)) + 1;
var headerIndex = $('td:not(:hidden)', cell.parent()).index(cell.get(0)) + 1;
- $('tr', this.table).each(function() {
+ $('tr', this.table).each(function () {
var row = $(this);
var parentTag = row.parent().get(0).tagName.toLowerCase();
var index = (parentTag == 'thead') ? headerIndex : columnIndex;
// Adjust the index to take into account colspans.
- row.children().each(function(n) {
+ row.children().each(function (n) {
if (n < index) {
index -= (this.colSpan && this.colSpan > 1) ? this.colSpan - 1 : 0;
}
@@ -148,7 +148,7 @@ Drupal.tableDrag.prototype.hideColumns = function() {
/**
* Find the target used within a particular row and group.
*/
-Drupal.tableDrag.prototype.rowSettings = function(group, row) {
+Drupal.tableDrag.prototype.rowSettings = function (group, row) {
var field = $('.' + group, row);
for (delta in this.tableSettings[group]) {
var targetClass = this.tableSettings[group][delta].target;
@@ -166,7 +166,7 @@ Drupal.tableDrag.prototype.rowSettings = function(group, row) {
/**
* Take an item and add event handlers to make it become draggable.
*/
-Drupal.tableDrag.prototype.makeDraggable = function(item) {
+Drupal.tableDrag.prototype.makeDraggable = function (item) {
var self = this;
// Create the handle.
@@ -181,14 +181,14 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) {
}
// Add hover action for the handle.
- handle.hover(function() {
+ handle.hover(function () {
self.dragObject == null ? $(this).addClass('tabledrag-handle-hover') : null;
- }, function() {
+ }, function () {
self.dragObject == null ? $(this).removeClass('tabledrag-handle-hover') : null;
});
// Add the mousedown action for the handle.
- handle.mousedown(function(event) {
+ handle.mousedown(function (event) {
// Create a new dragObject recording the event information.
self.dragObject = {};
self.dragObject.initMouseOffset = self.getMouseOffset(item, event);
@@ -234,18 +234,18 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) {
});
// Prevent the anchor tag from jumping us to the top of the page.
- handle.click(function() {
+ handle.click(function () {
return false;
});
// Similar to the hover event, add a class when the handle is focused.
- handle.focus(function() {
+ handle.focus(function () {
$(this).addClass('tabledrag-handle-hover');
self.safeBlur = true;
});
// Remove the handle class on blur and fire the same function as a mouseup.
- handle.blur(function(event) {
+ handle.blur(function (event) {
$(this).removeClass('tabledrag-handle-hover');
if (self.rowObject && self.safeBlur) {
self.dropRow(event, self);
@@ -253,7 +253,7 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) {
});
// Add arrow-key support to the handle.
- handle.keydown(function(event) {
+ handle.keydown(function (event) {
// If a rowObject doesn't yet exist and this isn't the tab key.
if (event.keyCode != 9 && !self.rowObject) {
self.rowObject = new self.row(item, 'keyboard', self.indentEnabled, self.maxDepth, true);
@@ -322,7 +322,7 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) {
var groupHeight = 0;
nextGroup = new self.row(nextRow, 'keyboard', self.indentEnabled, self.maxDepth, false);
if (nextGroup) {
- $(nextGroup.group).each(function() {
+ $(nextGroup.group).each(function () {
groupHeight += $(this).is(':hidden') ? 0 : this.offsetHeight;
});
nextGroupRow = $(nextGroup.group).filter(':last').get(0);
@@ -362,7 +362,7 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) {
// Compatibility addition, return false on keypress to prevent unwanted scrolling.
// IE and Safari will suppress scrolling on keydown, but all other browsers
// need to return false on keypress. http://www.quirksmode.org/js/keys.html
- handle.keypress(function(event) {
+ handle.keypress(function (event) {
switch (event.keyCode) {
case 37: // Left arrow.
case 38: // Up arrow.
@@ -376,7 +376,7 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) {
/**
* Mousemove event handler, bound to document.
*/
-Drupal.tableDrag.prototype.dragRow = function(event, self) {
+Drupal.tableDrag.prototype.dragRow = function (event, self) {
if (self.dragObject) {
self.currentMouseCoords = self.mouseCoords(event);
@@ -431,7 +431,7 @@ Drupal.tableDrag.prototype.dragRow = function(event, self) {
* Mouseup event handler, bound to document.
* Blur event handler, bound to drag handle for keyboard support.
*/
-Drupal.tableDrag.prototype.dropRow = function(event, self) {
+Drupal.tableDrag.prototype.dropRow = function (event, self) {
// Drop row functionality shared between mouseup and blur events.
if (self.rowObject != null) {
var droppedRow = self.rowObject.element;
@@ -488,7 +488,7 @@ Drupal.tableDrag.prototype.dropRow = function(event, self) {
/**
* Get the mouse coordinates from the event (allowing for browser differences).
*/
-Drupal.tableDrag.prototype.mouseCoords = function(event) {
+Drupal.tableDrag.prototype.mouseCoords = function (event) {
if (event.pageX || event.pageY) {
return { x: event.pageX, y: event.pageY };
}
@@ -502,7 +502,7 @@ Drupal.tableDrag.prototype.mouseCoords = function(event) {
* Given a target element and a mouse event, get the mouse offset from that
* element. To do this we need the element's position and the mouse position.
*/
-Drupal.tableDrag.prototype.getMouseOffset = function(target, event) {
+Drupal.tableDrag.prototype.getMouseOffset = function (target, event) {
var docPos = $(target).offset();
var mousePos = this.mouseCoords(event);
return { x: mousePos.x - docPos.left, y: mousePos.y - docPos.top };
@@ -517,7 +517,7 @@ Drupal.tableDrag.prototype.getMouseOffset = function(target, event) {
* @param y
* The y coordinate of the mouse on the page (not the screen).
*/
-Drupal.tableDrag.prototype.findDropTargetRow = function(x, y) {
+Drupal.tableDrag.prototype.findDropTargetRow = function (x, y) {
var rows = this.table.tBodies[0].rows;
for (var n = 0; n < rows.length; n++) {
var row = rows[n];
@@ -575,7 +575,7 @@ Drupal.tableDrag.prototype.findDropTargetRow = function(x, y) {
* @param changedRow
* DOM object for the row that was just dropped.
*/
-Drupal.tableDrag.prototype.updateFields = function(changedRow) {
+Drupal.tableDrag.prototype.updateFields = function (changedRow) {
for (var group in this.tableSettings) {
// Each group may have a different setting for relationship, so we find
// the source rows for each separately.
@@ -592,7 +592,7 @@ Drupal.tableDrag.prototype.updateFields = function(changedRow) {
* @param group
* The settings group on which field updates will occur.
*/
-Drupal.tableDrag.prototype.updateField = function(changedRow, group) {
+Drupal.tableDrag.prototype.updateField = function (changedRow, group) {
var rowSettings = this.rowSettings(group, changedRow);
// Set the row as it's own target.
@@ -683,12 +683,12 @@ Drupal.tableDrag.prototype.updateField = function(changedRow, group) {
if ($(targetElement).is('select')) {
// Get a list of acceptable values.
var values = [];
- $('option', targetElement).each(function() {
+ $('option', targetElement).each(function () {
values.push(this.value);
});
var maxVal = values[values.length - 1];
// Populate the values in the siblings.
- $(targetClass, siblings).each(function() {
+ $(targetClass, siblings).each(function () {
// If there are more items than possible values, assign the maximum value to the row.
if (values.length > 0) {
this.value = values.shift();
@@ -701,7 +701,7 @@ Drupal.tableDrag.prototype.updateField = function(changedRow, group) {
else {
// Assume a numeric input field.
var weight = parseInt($(targetClass, siblings[0]).val()) || 0;
- $(targetClass, siblings).each(function() {
+ $(targetClass, siblings).each(function () {
this.value = weight;
weight++;
});
@@ -716,7 +716,7 @@ Drupal.tableDrag.prototype.updateField = function(changedRow, group) {
* different one, removing any special classes that the destination row
* may have had.
*/
-Drupal.tableDrag.prototype.copyDragClasses = function(sourceRow, targetRow, group) {
+Drupal.tableDrag.prototype.copyDragClasses = function (sourceRow, targetRow, group) {
var sourceElement = $('.' + group, sourceRow);
var targetElement = $('.' + group, targetRow);
if (sourceElement.length && targetElement.length) {
@@ -724,7 +724,7 @@ Drupal.tableDrag.prototype.copyDragClasses = function(sourceRow, targetRow, grou
}
};
-Drupal.tableDrag.prototype.checkScroll = function(cursorY) {
+Drupal.tableDrag.prototype.checkScroll = function (cursorY) {
var de = document.documentElement;
var b = document.body;
@@ -746,10 +746,10 @@ Drupal.tableDrag.prototype.checkScroll = function(cursorY) {
}
};
-Drupal.tableDrag.prototype.setScroll = function(scrollAmount) {
+Drupal.tableDrag.prototype.setScroll = function (scrollAmount) {
var self = this;
- this.scrollInterval = setInterval(function() {
+ this.scrollInterval = setInterval(function () {
// Update the scroll values stored in the object.
self.checkScroll(self.currentMouseCoords.y);
var aboveTable = self.scrollY > self.table.topY;
@@ -760,7 +760,7 @@ Drupal.tableDrag.prototype.setScroll = function(scrollAmount) {
}, this.scrollSettings.interval);
};
-Drupal.tableDrag.prototype.restripeTable = function() {
+Drupal.tableDrag.prototype.restripeTable = function () {
// :even and :odd are reversed because jQuery counts from 0 and
// we count from 1, so we're out of sync.
$('tr.draggable', this.table)
@@ -774,14 +774,14 @@ Drupal.tableDrag.prototype.restripeTable = function() {
/**
* Stub function. Allows a custom handler when a row begins dragging.
*/
-Drupal.tableDrag.prototype.onDrag = function() {
+Drupal.tableDrag.prototype.onDrag = function () {
return null;
};
/**
* Stub function. Allows a custom handler when a row is dropped.
*/
-Drupal.tableDrag.prototype.onDrop = function() {
+Drupal.tableDrag.prototype.onDrop = function () {
return null;
};
@@ -799,7 +799,7 @@ Drupal.tableDrag.prototype.onDrop = function() {
* @param addClasses
* Whether we want to add classes to this row to indicate child relationships.
*/
-Drupal.tableDrag.prototype.row = function(tableRow, method, indentEnabled, maxDepth, addClasses) {
+Drupal.tableDrag.prototype.row = function (tableRow, method, indentEnabled, maxDepth, addClasses) {
this.element = tableRow;
this.method = method;
this.group = [tableRow];
@@ -827,7 +827,7 @@ Drupal.tableDrag.prototype.row = function(tableRow, method, indentEnabled, maxDe
* @param addClasses
* Whether we want to add classes to this row to indicate child relationships.
*/
-Drupal.tableDrag.prototype.row.prototype.findChildren = function(addClasses) {
+Drupal.tableDrag.prototype.row.prototype.findChildren = function (addClasses) {
var parentIndentation = this.indents;
var currentRow = $(this.element, this.table).next('tr.draggable');
var rows = [];
@@ -839,7 +839,7 @@ Drupal.tableDrag.prototype.row.prototype.findChildren = function(addClasses) {
child++;
rows.push(currentRow[0]);
if (addClasses) {
- $('.indentation', currentRow).each(function(indentNum) {
+ $('.indentation', currentRow).each(function (indentNum) {
if (child == 1 && (indentNum == parentIndentation)) {
$(this).addClass('tree-child-first');
}
@@ -869,7 +869,7 @@ Drupal.tableDrag.prototype.row.prototype.findChildren = function(addClasses) {
* @param row
* DOM object for the row being considered for swapping.
*/
-Drupal.tableDrag.prototype.row.prototype.isValidSwap = function(row) {
+Drupal.tableDrag.prototype.row.prototype.isValidSwap = function (row) {
if (this.indentEnabled) {
var prevRow, nextRow;
if (this.direction == 'down') {
@@ -904,7 +904,7 @@ Drupal.tableDrag.prototype.row.prototype.isValidSwap = function(row) {
* @param row
* DOM element what will be swapped with the row group.
*/
-Drupal.tableDrag.prototype.row.prototype.swap = function(position, row) {
+Drupal.tableDrag.prototype.row.prototype.swap = function (position, row) {
$(row)[position](this.group);
this.changed = true;
this.onSwap(row);
@@ -921,7 +921,7 @@ Drupal.tableDrag.prototype.row.prototype.swap = function(position, row) {
* DOM object for the row after the tested position
* (or null for last position in the table).
*/
-Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function(prevRow, nextRow) {
+Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow, nextRow) {
var minIndent, maxIndent;
// Minimum indentation:
@@ -953,7 +953,7 @@ Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function(prevRow,
* positive or negative). This number will be adjusted to nearest valid
* indentation level for the row.
*/
-Drupal.tableDrag.prototype.row.prototype.indent = function(indentDiff) {
+Drupal.tableDrag.prototype.row.prototype.indent = function (indentDiff) {
// Determine the valid indentations interval if not available yet.
if (!this.interval) {
prevRow = $(this.element).prev('tr').get(0);
@@ -995,7 +995,7 @@ Drupal.tableDrag.prototype.row.prototype.indent = function(indentDiff) {
* @param settings
* The field settings we're using to identify what constitutes a sibling.
*/
-Drupal.tableDrag.prototype.row.prototype.findSiblings = function(rowSettings) {
+Drupal.tableDrag.prototype.row.prototype.findSiblings = function (rowSettings) {
var siblings = [];
var directions = ['prev', 'next'];
var rowIndentation = this.indents;
@@ -1036,7 +1036,7 @@ Drupal.tableDrag.prototype.row.prototype.findSiblings = function(rowSettings) {
/**
* Remove indentation helper classes from the current row group.
*/
-Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function() {
+Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function () {
for (n in this.children) {
$('.indentation', this.children[n])
.removeClass('tree-child')
@@ -1049,7 +1049,7 @@ Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function() {
/**
* Add an asterisk or other marker to the changed row.
*/
-Drupal.tableDrag.prototype.row.prototype.markChanged = function() {
+Drupal.tableDrag.prototype.row.prototype.markChanged = function () {
var marker = Drupal.theme('tableDragChangedMarker');
var cell = $('td:first', this.element);
if ($('span.tabledrag-changed', cell).length == 0) {
@@ -1060,26 +1060,26 @@ Drupal.tableDrag.prototype.row.prototype.markChanged = function() {
/**
* Stub function. Allows a custom handler when a row is indented.
*/
-Drupal.tableDrag.prototype.row.prototype.onIndent = function() {
+Drupal.tableDrag.prototype.row.prototype.onIndent = function () {
return null;
};
/**
* Stub function. Allows a custom handler when a row is swapped.
*/
-Drupal.tableDrag.prototype.row.prototype.onSwap = function(swappedRow) {
+Drupal.tableDrag.prototype.row.prototype.onSwap = function (swappedRow) {
return null;
};
-Drupal.theme.prototype.tableDragChangedMarker = function() {
+Drupal.theme.prototype.tableDragChangedMarker = function () {
return '<span class="warning tabledrag-changed">*</span>';
};
-Drupal.theme.prototype.tableDragIndentation = function() {
+Drupal.theme.prototype.tableDragIndentation = function () {
return '<div class="indentation">&nbsp;</div>';
};
-Drupal.theme.prototype.tableDragChangedWarning = function() {
+Drupal.theme.prototype.tableDragChangedWarning = function () {
return '<div class="warning">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t('Changes made in this table will not be saved until the form is submitted.') + '</div>';
};
diff --git a/misc/tableheader.js b/misc/tableheader.js
index 92fc28281..a49dd2d40 100644
--- a/misc/tableheader.js
+++ b/misc/tableheader.js
@@ -1,14 +1,14 @@
// $Id$
-(function($) {
+(function ($) {
-Drupal.tableHeaderDoScroll = function() {
+Drupal.tableHeaderDoScroll = function () {
if ($.isFunction(Drupal.tableHeaderOnScroll)) {
Drupal.tableHeaderOnScroll();
}
};
Drupal.behaviors.tableHeader = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
// This breaks in anything less than IE 7. Prevent it from running.
if ($.browser.msie && parseInt($.browser.version) < 7) {
return;
@@ -17,7 +17,7 @@ Drupal.behaviors.tableHeader = {
// Keep track of all cloned table headers.
var headers = [];
- $('table.sticky-enabled thead:not(.tableHeader-processed)', context).each(function() {
+ $('table.sticky-enabled thead:not(.tableHeader-processed)', context).each(function () {
// Clone thead so it inherits original jQuery properties.
var headerClone = $(this).clone(true).insertBefore(this.parentNode).wrap('<table class="sticky-header"></table>').parent().css({
position: 'fixed',
@@ -51,7 +51,7 @@ Drupal.behaviors.tableHeader = {
e.vLength = e.table.clientHeight - 100;
// Resize header and its cell widths.
var parentCell = $('th', e.table);
- $('th', e).each(function(index) {
+ $('th', e).each(function (index) {
var cellWidth = parentCell.eq(index).css('width');
// Exception for IE7.
if (cellWidth == 'auto') {
@@ -88,21 +88,21 @@ Drupal.behaviors.tableHeader = {
}
// Track scrolling.
- Drupal.tableHeaderOnScroll = function() {
- $(headers).each(function() {
+ Drupal.tableHeaderOnScroll = function () {
+ $(headers).each(function () {
tracker(this);
});
};
// Track resizing.
var time = null;
- var resize = function() {
+ var resize = function () {
// Ensure minimum time between adjustments.
if (time) {
return;
}
- time = setTimeout(function() {
- $('table.sticky-header').each(function() {
+ time = setTimeout(function () {
+ $('table.sticky-header').each(function () {
// Force cell width calculation.
this.viewHeight = 0;
tracker(this);
diff --git a/misc/tableselect.js b/misc/tableselect.js
index 43a5c2aa6..332a1d9e5 100644
--- a/misc/tableselect.js
+++ b/misc/tableselect.js
@@ -1,13 +1,13 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.tableSelect = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
$('form table:has(th.select-all):not(.tableSelect-processed)', context).each(Drupal.tableSelect);
}
};
-Drupal.tableSelect = function() {
+Drupal.tableSelect = function () {
// Do not add a "Select all" checkbox if there are no rows with checkboxes in the table
if ($('td input:checkbox', this).size() == 0) {
return;
@@ -16,18 +16,18 @@ Drupal.tableSelect = function() {
// Keep track of the table, which checkbox is checked and alias the settings.
var table = this, checkboxes, lastChecked;
var strings = { 'selectAll': Drupal.t('Select all rows in this table'), 'selectNone': Drupal.t('Deselect all rows in this table') };
- var updateSelectAll = function(state) {
- $('th.select-all input:checkbox', table).each(function() {
+ var updateSelectAll = function (state) {
+ $('th.select-all input:checkbox', table).each(function () {
$(this).attr('title', state ? strings.selectNone : strings.selectAll);
this.checked = state;
});
};
// Find all <th> with class select-all, and insert the check all checkbox.
- $('th.select-all', table).prepend($('<input type="checkbox" class="form-checkbox" />').attr('title', strings.selectAll)).click(function(event) {
+ $('th.select-all', table).prepend($('<input type="checkbox" class="form-checkbox" />').attr('title', strings.selectAll)).click(function (event) {
if ($(event.target).is('input:checkbox')) {
// Loop through all checkboxes and set their state to the select all checkbox' state.
- checkboxes.each(function() {
+ checkboxes.each(function () {
this.checked = event.target.checked;
// Either add or remove the selected class based on the state of the check all checkbox.
$(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
@@ -38,7 +38,7 @@ Drupal.tableSelect = function() {
});
// For each of the checkboxes within the table.
- checkboxes = $('td input:checkbox', table).click(function(e) {
+ checkboxes = $('td input:checkbox', table).click(function (e) {
// Either add or remove the selected class based on the state of the check all checkbox.
$(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
@@ -59,7 +59,7 @@ Drupal.tableSelect = function() {
$(this).addClass('tableSelect-processed');
};
-Drupal.tableSelectRange = function(from, to, state) {
+Drupal.tableSelectRange = function (from, to, state) {
// We determine the looping mode based on the the order of from and to.
var mode = from.rowIndex > to.rowIndex ? 'previousSibling' : 'nextSibling';
@@ -72,7 +72,7 @@ Drupal.tableSelectRange = function(from, to, state) {
// Either add or remove the selected class based on the state of the target checkbox.
$(i)[ state ? 'addClass' : 'removeClass' ]('selected');
- $('input:checkbox', i).each(function() {
+ $('input:checkbox', i).each(function () {
this.checked = state;
});
diff --git a/misc/teaser.js b/misc/teaser.js
index d54605018..e8ee8061d 100644
--- a/misc/teaser.js
+++ b/misc/teaser.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Auto-attach for teaser behavior.
@@ -7,8 +7,8 @@
* Note: depends on resizable textareas.
*/
Drupal.behaviors.teaser = {
- attach: function(context, settings) {
- $('textarea.teaser:not(.teaser-processed)', context).each(function() {
+ attach: function (context, settings) {
+ $('textarea.teaser:not(.teaser-processed)', context).each(function () {
var teaser = $(this).addClass('teaser-processed');
// Move teaser textarea before body, and remove its form-item wrapper.
diff --git a/misc/textarea.js b/misc/textarea.js
index 88f5b0970..cec9abfff 100644
--- a/misc/textarea.js
+++ b/misc/textarea.js
@@ -1,9 +1,9 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.textarea = {
- attach: function(context, settings) {
- $('textarea.resizable:not(.textarea-processed)', context).each(function() {
+ attach: function (context, settings) {
+ $('textarea.resizable:not(.textarea-processed)', context).each(function () {
// Avoid non-processed teasers.
if ($(this).is(('textarea.teaser:not(.teaser-processed)'))) {
return false;
diff --git a/misc/timezone.js b/misc/timezone.js
index c4ababfad..a1e689c92 100644
--- a/misc/timezone.js
+++ b/misc/timezone.js
@@ -1,12 +1,12 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Set the client's system time zone as default values of form fields.
*/
Drupal.behaviors.setTimezone = {
- attach: function(context, settings) {
- $('select.timezone-detect:not(.timezone-processed)', context).addClass('timezone-processed').each(function() {
+ attach: function (context, settings) {
+ $('select.timezone-detect:not(.timezone-processed)', context).addClass('timezone-processed').each(function () {
var dateString = Date();
// In some client environments, date strings include a time zone
// abbreviation, between 3 and 5 letters enclosed in parentheses,
@@ -54,7 +54,7 @@ Drupal.behaviors.setTimezone = {
url: settings.basePath,
data: { q: path, date: dateString },
dataType: 'json',
- success: function(data) {
+ success: function (data) {
if (data) {
$(element).val(data);
}
diff --git a/misc/vertical-tabs.js b/misc/vertical-tabs.js
index f0819475e..e96fba6d4 100644
--- a/misc/vertical-tabs.js
+++ b/misc/vertical-tabs.js
@@ -1,6 +1,6 @@
// $Id$
-(function($) {
+(function ($) {
/**
* This script transforms a set of fieldsets into a stack of vertical
@@ -14,8 +14,8 @@
* element inside the tab pane.
*/
Drupal.behaviors.verticalTabs = {
- attach: function(context) {
- $('.vertical-tabs-panes:not(.vertical-tabs-processed)', context).each(function() {
+ attach: function (context) {
+ $('.vertical-tabs-panes:not(.vertical-tabs-processed)', context).each(function () {
var focusID = $(':hidden.vertical-tabs-active-tab', this).val();
var focus;
// Create the tab column.
@@ -23,7 +23,7 @@ Drupal.behaviors.verticalTabs = {
$(this).wrap('<div class="vertical-tabs clearfix"></div>').before(list);
// Transform each fieldset into a tab.
- $('> fieldset', this).each(function() {
+ $('> fieldset', this).each(function () {
var tab = new Drupal.verticalTab({ title: $('> legend', this).text(), fieldset: $(this) });
list.append(tab.item);
$(this)
@@ -54,17 +54,17 @@ Drupal.behaviors.verticalTabs = {
* - title: The name of the tab.
* - fieldset: The jQuery object of the fieldset that is the tab pane.
*/
-Drupal.verticalTab = function(settings) {
+Drupal.verticalTab = function (settings) {
var that = this;
$.extend(this, settings, Drupal.theme('verticalTab', settings));
- this.link.click(function() {
+ this.link.click(function () {
that.focus();
return false;
});
this.fieldset
- .bind('summaryUpdated', function() {
+ .bind('summaryUpdated', function () {
that.updateSummary();
})
.trigger('summaryUpdated');
@@ -72,10 +72,10 @@ Drupal.verticalTab = function(settings) {
Drupal.verticalTab.prototype = {
// Displays the tab's content pane.
- focus: function() {
+ focus: function () {
this.fieldset
.siblings('fieldset.vertical-tabs-pane')
- .each(function() {
+ .each(function () {
var tab = $(this).data('verticalTab');
tab.fieldset.hide();
tab.item.removeClass('selected');
@@ -88,7 +88,7 @@ Drupal.verticalTab.prototype = {
},
// Updates the tab's summary.
- updateSummary: function() {
+ updateSummary: function () {
this.summary.html(this.fieldset.getSummary());
}
};
@@ -106,7 +106,7 @@ Drupal.verticalTab.prototype = {
* (jQuery version)
* - summary: The jQuery element that contains the tab summary
*/
-Drupal.theme.prototype.verticalTab = function(settings) {
+Drupal.theme.prototype.verticalTab = function (settings) {
var tab = {};
tab.item = $('<li class="vertical-tab-button"></li>')
.append(tab.link = $('<a href="#"></a>')
diff --git a/modules/block/block.js b/modules/block/block.js
index f8f96111c..3fd6a5aba 100644
--- a/modules/block/block.js
+++ b/modules/block/block.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Move a block in the blocks table from one region to another via select list.
@@ -8,22 +8,22 @@
* objects initialized in that behavior to update the row.
*/
Drupal.behaviors.blockDrag = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
var table = $('table#blocks');
var tableDrag = Drupal.tableDrag.blocks; // Get the blocks tableDrag object.
// Add a handler for when a row is swapped, update empty regions.
- tableDrag.row.prototype.onSwap = function(swappedRow) {
+ tableDrag.row.prototype.onSwap = function (swappedRow) {
checkEmptyRegions(table, this);
};
// A custom message for the blocks page specifically.
- Drupal.theme.tableDragChangedWarning = function() {
+ 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.
- tableDrag.onDrop = function() {
+ tableDrag.onDrop = function () {
dragObject = this;
if ($(dragObject.rowObject.element).prev('tr').is('.region-message')) {
var regionRow = $(dragObject.rowObject.element).prev('tr').get(0);
@@ -41,15 +41,15 @@ Drupal.behaviors.blockDrag = {
};
// Add the behavior to each region select list.
- $('select.block-region-select:not(.blockregionselect-processed)', context).each(function() {
- $(this).change(function(event) {
+ $('select.block-region-select:not(.blockregionselect-processed)', context).each(function () {
+ $(this).change(function (event) {
// Make our new row and select field.
var row = $(this).parents('tr:first');
var select = $(this);
tableDrag.rowObject = new tableDrag.row(row);
// Find the correct region and insert the row as the first in the region.
- $('tr.region-message', table).each(function() {
+ $('tr.region-message', table).each(function () {
if ($(this).is('.region-' + select[0].value + '-message')) {
// Add the new row and remove the old one.
$(this).after(row);
@@ -75,8 +75,8 @@ Drupal.behaviors.blockDrag = {
$(this).addClass('blockregionselect-processed');
});
- var checkEmptyRegions = function(table, rowObject) {
- $('tr.region-message', table).each(function() {
+ var checkEmptyRegions = function (table, rowObject) {
+ $('tr.region-message', table).each(function () {
// If the dragged row is in this region, but above the message row, swap it down one space.
if ($(this).prev('tr').get(0) == rowObject.element) {
// Prevent a recursion problem when using the keyboard to move rows up.
diff --git a/modules/book/book.js b/modules/book/book.js
index 74baffccf..cc3e66847 100644
--- a/modules/book/book.js
+++ b/modules/book/book.js
@@ -1,10 +1,10 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.bookFieldsetSummaries = {
- attach: function(context) {
- $('fieldset#edit-book', context).setSummary(function(context) {
+ attach: function (context) {
+ $('fieldset#edit-book', context).setSummary(function (context) {
var val = $('#edit-book-bid').val();
if (val === '0') {
diff --git a/modules/color/color.js b/modules/color/color.js
index 1b1199899..5c978d4d5 100644
--- a/modules/color/color.js
+++ b/modules/color/color.js
@@ -1,8 +1,8 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.color = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
// This behavior attaches by ID, so is only valid once on a page.
if ($('#color_scheme_form .color-form.color-processed').size()) {
return;
@@ -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-node-form.js b/modules/comment/comment-node-form.js
index 9c7dea7cc..20d8729f4 100644
--- a/modules/comment/comment-node-form.js
+++ b/modules/comment/comment-node-form.js
@@ -1,10 +1,10 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.commentFieldsetSummaries = {
- attach: function(context) {
- $('fieldset#edit-comment-settings', context).setSummary(function(context) {
+ attach: function (context) {
+ $('fieldset#edit-comment-settings', context).setSummary(function (context) {
return Drupal.checkPlain($('input:checked', context).parent().text());
});
}
diff --git a/modules/comment/comment.js b/modules/comment/comment.js
index 3d2b92edd..bdd1c3b95 100644
--- a/modules/comment/comment.js
+++ b/modules/comment/comment.js
@@ -1,9 +1,9 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.comment = {
- attach: function(context, settings) {
- $.each(['name', 'homepage', 'mail'], function() {
+ attach: function (context, settings) {
+ $.each(['name', 'homepage', 'mail'], function () {
var cookie = Drupal.comment.getCookie('comment_info_' + this);
if (cookie) {
$('#comment-form input[name=' + this + ']:not(.comment-processed)', context)
@@ -16,7 +16,7 @@ Drupal.behaviors.comment = {
Drupal.comment = {};
-Drupal.comment.getCookie = function(name) {
+Drupal.comment.getCookie = function (name) {
var search = name + '=';
var returnValue = '';
diff --git a/modules/menu/menu.js b/modules/menu/menu.js
index cc39e7e8e..255891df1 100644
--- a/modules/menu/menu.js
+++ b/modules/menu/menu.js
@@ -1,10 +1,10 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.menuFieldsetSummaries = {
- attach: function(context) {
- $('fieldset#edit-menu', context).setSummary(function(context) {
+ attach: function (context) {
+ $('fieldset#edit-menu', context).setSummary(function (context) {
return Drupal.checkPlain($('#edit-menu-link-title', context).val()) || Drupal.t('Not in menu');
});
}
diff --git a/modules/node/content_types.js b/modules/node/content_types.js
index 8b32ae8ea..bee78bc83 100644
--- a/modules/node/content_types.js
+++ b/modules/node/content_types.js
@@ -1,15 +1,15 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.contentTypes = {
- attach: function() {
+ attach: function () {
if ($('#edit-type').val() == $('#edit-name').val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_') || $('#edit-type').val() == '') {
$('#edit-type-wrapper').hide();
- $('#edit-name').keyup(function() {
+ $('#edit-name').keyup(function () {
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/node/node.js b/modules/node/node.js
index 59647b34e..4a0c49d63 100644
--- a/modules/node/node.js
+++ b/modules/node/node.js
@@ -1,26 +1,26 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.nodeFieldsetSummaries = {
- attach: function(context) {
- $('fieldset#edit-revision-information', context).setSummary(function(context) {
+ attach: function (context) {
+ $('fieldset#edit-revision-information', context).setSummary(function (context) {
return $('#edit-revision', context).is(':checked') ?
Drupal.t('New revision') :
Drupal.t('No revision');
});
- $('fieldset#edit-author', context).setSummary(function(context) {
+ $('fieldset#edit-author', context).setSummary(function (context) {
var name = $('#edit-name').val(), date = $('#edit-date').val();
return date ?
Drupal.t('By @name on @date', { '@name': name, '@date': date }) :
Drupal.t('By @name', { '@name': name });
});
- $('fieldset#edit-options', context).setSummary(function(context) {
+ $('fieldset#edit-options', context).setSummary(function (context) {
var vals = [];
- $('input:checked', context).parent().each(function() {
+ $('input:checked', context).parent().each(function () {
vals.push(Drupal.checkPlain($.trim($(this).text())));
});
diff --git a/modules/openid/openid.js b/modules/openid/openid.js
index 14d70d3a1..78c1d2b3f 100644
--- a/modules/openid/openid.js
+++ b/modules/openid/openid.js
@@ -1,8 +1,8 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.openid = {
- attach: function(context) {
+ attach: function (context) {
var loginElements = $('#edit-name-wrapper, #edit-pass-wrapper, li.openid-link');
var openidElements = $('#edit-openid-identifier-wrapper, li.user-link');
@@ -15,7 +15,7 @@ Drupal.behaviors.openid = {
}
$('li.openid-link:not(.openid-processed)', context)
.addClass('openid-processed')
- .click(function() {
+ .click(function () {
loginElements.hide();
openidElements.css('display', 'block');
// Remove possible error message.
@@ -27,7 +27,7 @@ Drupal.behaviors.openid = {
});
$('li.user-link:not(.openid-processed)', context)
.addClass('openid-processed')
- .click(function() {
+ .click(function () {
openidElements.hide();
loginElements.css('display', 'block');
// Clear OpenID Identifier field and remove possible error message.
diff --git a/modules/path/path.js b/modules/path/path.js
index e801a9a26..388c1f53e 100644
--- a/modules/path/path.js
+++ b/modules/path/path.js
@@ -1,10 +1,10 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.pathFieldsetSummaries = {
- attach: function(context) {
- $('fieldset#edit-path', context).setSummary(function(context) {
+ attach: function (context) {
+ $('fieldset#edit-path', context).setSummary(function (context) {
var path = $('#edit-path-1').val();
return path ?
diff --git a/modules/profile/profile.js b/modules/profile/profile.js
index 334d71df6..9f52559f5 100644
--- a/modules/profile/profile.js
+++ b/modules/profile/profile.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Add functionality to the profile drag and drop table.
@@ -9,14 +9,14 @@
* a warning message when removing the last field from a profile category.
*/
Drupal.behaviors.profileDrag = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
var table = $('#profile-fields');
var tableDrag = Drupal.tableDrag['profile-fields']; // Get the profile tableDrag object.
// Add a handler for when a row is swapped, update empty categories.
- tableDrag.row.prototype.onSwap = function(swappedRow) {
+ tableDrag.row.prototype.onSwap = function (swappedRow) {
var rowObject = this;
- $('tr.category-message', table).each(function() {
+ $('tr.category-message', table).each(function () {
// If the dragged row is in this category, but above the message row, swap it down one space.
if ($(this).prev('tr').get(0) == rowObject.element) {
// Prevent a recursion problem when using the keyboard to move rows up.
@@ -36,7 +36,7 @@ Drupal.behaviors.profileDrag = {
};
// Add a handler so when a row is dropped, update fields dropped into new categories.
- tableDrag.onDrop = function() {
+ tableDrag.onDrop = function () {
dragObject = this;
if ($(dragObject.rowObject.element).prev('tr').is('.category-message')) {
var categoryRow = $(dragObject.rowObject.element).prev('tr').get(0);
diff --git a/modules/simpletest/simpletest.js b/modules/simpletest/simpletest.js
index 91912599f..dc11cfca4 100644
--- a/modules/simpletest/simpletest.js
+++ b/modules/simpletest/simpletest.js
@@ -1,20 +1,20 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Add the cool table collapsing on the testing overview page.
*/
Drupal.behaviors.simpleTestMenuCollapse = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
var timeout = null;
// Adds expand-collapse functionality.
- $('div.simpletest-image').each(function() {
+ $('div.simpletest-image').each(function () {
direction = settings.simpleTest[$(this).attr('id')].imageDirection;
$(this).html(settings.simpleTest.images[direction]);
});
// Adds group toggling functionality to arrow images.
- $('div.simpletest-image').click(function() {
+ $('div.simpletest-image').click(function () {
var trs = $(this).parents('tbody').children('.' + settings.simpleTest[this.id].testClass);
var direction = settings.simpleTest[this.id].imageDirection;
var row = direction ? trs.size() - 1 : 0;
@@ -60,17 +60,17 @@ Drupal.behaviors.simpleTestMenuCollapse = {
* selected/deselected.
*/
Drupal.behaviors.simpleTestSelectAll = {
- attach: function(context, settings) {
- $('td.simpletest-select-all').each(function() {
+ attach: function (context, settings) {
+ $('td.simpletest-select-all').each(function () {
var testCheckboxes = settings.simpleTest['simpletest-test-group-' + $(this).attr('id')].testNames;
var groupCheckbox = $('<input type="checkbox" class="form-checkbox" id="' + $(this).attr('id') + '-select-all" />');
// Each time a single-test checkbox is checked or unchecked, make sure
// that the associated group checkbox gets the right state too.
- var updateGroupCheckbox = function() {
+ var updateGroupCheckbox = function () {
var checkedTests = 0;
for (var i = 0; i < testCheckboxes.length; i++) {
- $('#' + testCheckboxes[i]).each(function() {
+ $('#' + testCheckboxes[i]).each(function () {
if (($(this).attr('checked'))) {
checkedTests++;
}
@@ -80,7 +80,7 @@ Drupal.behaviors.simpleTestSelectAll = {
};
// Have the single-test checkboxes follow the group checkbox.
- groupCheckbox.change(function() {
+ groupCheckbox.change(function () {
var checked = !!($(this).attr('checked'));
for (var i = 0; i < testCheckboxes.length; i++) {
$('#' + testCheckboxes[i]).attr('checked', checked);
@@ -89,7 +89,7 @@ Drupal.behaviors.simpleTestSelectAll = {
// Have the group checkbox follow the single-test checkboxes.
for (var i = 0; i < testCheckboxes.length; i++) {
- $('#' + testCheckboxes[i]).change(function() {
+ $('#' + testCheckboxes[i]).change(function () {
updateGroupCheckbox();
});
}
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index a6ff854ba..735360eb8 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -493,7 +493,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
* Test adding inline scripts.
*/
function testAddInline() {
- $inline = 'jQuery(function(){});';
+ $inline = 'jQuery(function () { });';
$javascript = drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer'));
$this->assertTrue(array_key_exists('misc/jquery.js', $javascript), t('jQuery is added when inline scripts are added.'));
$data = end($javascript);
@@ -515,7 +515,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
* Test drupal_get_js() with a footer scope.
*/
function testFooterHTML() {
- $inline = 'jQuery(function(){});';
+ $inline = 'jQuery(function () { });';
drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer'));
$javascript = drupal_get_js('footer');
$this->assertTrue(strpos($javascript, $inline) > 0, t('Rendered JavaScript footer returns the inline code.'));
diff --git a/modules/system/system.js b/modules/system/system.js
index 0b424812a..3422cd879 100644
--- a/modules/system/system.js
+++ b/modules/system/system.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Internal function to check using Ajax if clean URLs can be enabled on the
@@ -9,7 +9,7 @@
* are currently enabled.
*/
Drupal.behaviors.cleanURLsSettingsCheck = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
// 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.
@@ -22,13 +22,13 @@ Drupal.behaviors.cleanURLsSettingsCheck = {
$.ajax({
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();
},
- error: function() {
+ 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();
@@ -45,7 +45,7 @@ Drupal.behaviors.cleanURLsSettingsCheck = {
* This function is not used to verify whether or not clean URLs
* are currently enabled.
*/
-Drupal.cleanURLsInstallCheck = function() {
+Drupal.cleanURLsInstallCheck = function () {
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.
@@ -53,7 +53,7 @@ Drupal.cleanURLsInstallCheck = function() {
async: false,
url: url,
dataType: 'json',
- success: function() {
+ success: function () {
// Check was successful.
$('#edit-clean-url').attr('value', 1);
}
@@ -67,14 +67,14 @@ Drupal.cleanURLsInstallCheck = function() {
* administrator e-mail address with the same value as the site e-mail address.
*/
Drupal.behaviors.copyFieldValue = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
for (var sourceId in settings.copyFieldValue) {
// Get the list of target fields.
targetIds = settings.copyFieldValue[sourceId];
if (!$('#'+ sourceId + '.copy-field-values-processed', context).size()) {
// Add the behavior to update target fields on blur of the primary field.
sourceField = $('#' + sourceId);
- sourceField.bind('blur', function() {
+ sourceField.bind('blur', function () {
for (var delta in targetIds) {
var targetField = $('#'+ targetIds[delta]);
if (targetField.val() == '') {
@@ -92,17 +92,17 @@ Drupal.behaviors.copyFieldValue = {
* Show/hide custom format sections on the regional settings page.
*/
Drupal.behaviors.dateTime = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
// Show/hide custom format depending on the select's value.
- $('select.date-format:not(.date-time-processed)', context).change(function() {
+ $('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:not(.date-time-processed)', context).addClass('date-time-processed').keyup(function() {
+ $('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());
- $.getJSON(url, function(data) {
+ $.getJSON(url, function (data) {
$('div.description span', input.parent()).html(data);
});
});
@@ -116,8 +116,8 @@ Drupal.behaviors.dateTime = {
* Show the powered by Drupal image preview
*/
Drupal.behaviors.poweredByPreview = {
- attach: function(context, settings) {
- $('#edit-color, #edit-size').change(function() {
+ attach: function (context, settings) {
+ $('#edit-color, #edit-size').change(function () {
var path = settings.basePath + 'misc/' + $('#edit-color').val() + '-' + $('#edit-size').val() + '.png';
$('img.powered-by-preview').attr('src', path);
});
diff --git a/modules/taxonomy/taxonomy.js b/modules/taxonomy/taxonomy.js
index d047950df..a9539b206 100644
--- a/modules/taxonomy/taxonomy.js
+++ b/modules/taxonomy/taxonomy.js
@@ -1,5 +1,5 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Move a block in the blocks table from one region to another via select list.
@@ -8,13 +8,13 @@
* objects initialized in that behavior to update the row.
*/
Drupal.behaviors.termDrag = {
- attach: function(context, settings) {
+ attach: function (context, settings) {
var table = $('#taxonomy', context);
var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
var rows = $('tr', table).size();
// When a row is swapped, keep previous and next page classes set.
- tableDrag.row.prototype.onSwap = function(swappedRow) {
+ tableDrag.row.prototype.onSwap = function (swappedRow) {
$('tr.taxonomy-term-preview', table).removeClass('taxonomy-term-preview');
$('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
$('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
diff --git a/modules/upload/upload.js b/modules/upload/upload.js
index 16f1ad3da..1aae5d1b7 100644
--- a/modules/upload/upload.js
+++ b/modules/upload/upload.js
@@ -1,10 +1,10 @@
// $Id$
-(function($) {
+(function ($) {
Drupal.behaviors.uploadFieldsetSummaries = {
- attach: function(context) {
- $('fieldset#edit-attachments', context).setSummary(function(context) {
+ attach: function (context) {
+ $('fieldset#edit-attachments', context).setSummary(function (context) {
var size = $('#upload-attachments tbody tr').size();
return Drupal.formatPlural(size, '1 attachment', '@count attachments');
});
diff --git a/modules/user/user.js b/modules/user/user.js
index 10077434c..3f2a6a07e 100644
--- a/modules/user/user.js
+++ b/modules/user/user.js
@@ -1,14 +1,14 @@
// $Id$
-(function($) {
+(function ($) {
/**
* Attach handlers to evaluate the strength of any password fields and to check
* that its confirmation is correct.
*/
Drupal.behaviors.password = {
- attach: function(context, settings) {
+ 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();
@@ -31,7 +31,7 @@ Drupal.behaviors.password = {
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);
@@ -56,7 +56,7 @@ Drupal.behaviors.password = {
};
// Check that password and confirmation inputs match.
- var passwordCheckMatch = function() {
+ var passwordCheckMatch = function () {
if (confirmInput.val()) {
var success = passwordInput.val() === confirmInput.val();
@@ -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]+/);
@@ -166,8 +166,8 @@ Drupal.evaluatePasswordStrength = function(password, translate) {
* "Picture support" radio buttons.
*/
Drupal.behaviors.userSettings = {
- attach: function(context, settings) {
- $('div.user-admin-picture-radios input[type=radio]:not(.userSettings-processed)', context).addClass('userSettings-processed').click(function() {
+ 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-settings', context)[['hide', 'show'][this.value]]();
});
}