diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 2407e85..98da451 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -961,12 +961,19 @@ * Command to insert new content into the DOM. * * @param {Drupal.Ajax} ajax + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {string} response.data + * The data to use with the jQuery method. * @param {string} [response.method] + * The JQuery DOM manipulation method to be used. * @param {string} [response.selector] + * (optional) A optional jQuery selector string. * @param {object} [response.settings] + * (optional) An optional array of settings that will be used. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ insert: function (ajax, response, status) { // Get information from the response. If it is not there, default to @@ -1043,10 +1050,15 @@ * Command to remove a chunk from the page. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {string} response.selector + * A JQuery selector string. * @param {object} [response.settings] + * (optional) An optional array of settings that will be used. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ remove: function (ajax, response, status) { var settings = response.settings || ajax.settings || drupalSettings; @@ -1060,10 +1072,16 @@ * Command to mark a chunk changed. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The JSON response object from the Ajax request. * @param {string} response.selector + * A JQuery selector string. * @param {bool} [response.asterisk] + * (optional) An optional CSS selector. If specified, an asterisk will be + * appended to the HTML inside the provided selector. * @param {number} [status] + * (optional) The request status. */ changed: function (ajax, response, status) { if (!$(response.selector).hasClass('ajax-changed')) { @@ -1078,10 +1096,13 @@ * Command to provide an alert. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The JSON response from the Ajax request. * @param {string} response.text - * @param {string} response.title + * The text that will be displayed in an alert dialog. * @param {number} [status] + * The XMLHttpRequest status. */ alert: function (ajax, response, status) { window.alert(response.text, response.title); @@ -1091,9 +1112,13 @@ * Command to set the window.location, redirecting the browser. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {string} response.url + * The URL to redirect to. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ redirect: function (ajax, response, status) { window.location = response.url; @@ -1103,9 +1128,15 @@ * Command to provide the jQuery css() function. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. + * @param {string} response.selector + * A JQuery selector string. * @param {object} response.argument + * An array of key/value pairs to set in the CSS for the selector. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ css: function (ajax, response, status) { $(response.selector).css(response.argument); @@ -1115,10 +1146,16 @@ * Command to set the settings used for other commands in this response. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {bool} response.merge + * Determines whether the additional settings should be merged to the + * global settings. * @param {object} response.settings + * Contains additional settings to add to the global settings. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ settings: function (ajax, response, status) { if (response.merge) { @@ -1133,11 +1170,18 @@ * Command to attach data using jQuery's data API. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {string} response.name + * The name or key (in the key value pair) of the data attached to this + * selector. * @param {string} response.selector + * A jQuery selector string. * @param {string|object} response.value + * The value of to be attached. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ data: function (ajax, response, status) { $(response.selector).data(response.name, response.value); @@ -1147,11 +1191,17 @@ * Command to apply a jQuery method. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {Array} response.args + * An array of arguments to the jQuery method, if any. * @param {string} response.method + * The jQuery method to invoke. * @param {string} response.selector + * A jQuery selector string. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ invoke: function (ajax, response, status) { var $element = $(response.selector); @@ -1162,9 +1212,13 @@ * Command to restripe a table. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {string} response.selector + * A jQuery selector string. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ restripe: function (ajax, response, status) { // :even and :odd are reversed because jQuery counts from 0 and @@ -1180,10 +1234,15 @@ * Command to update a form's build ID. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {string} response.old + * The old form build ID. * @param {string} response.new + * The new form build ID. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ update_build_id: function (ajax, response, status) { $('input[name="form_build_id"][value="' + response.old + '"]').val(response.new); @@ -1197,9 +1256,13 @@ * stylesheets. * * @param {Drupal.Ajax} [ajax] + * {@link Drupal.Ajax} object created by {@link Drupal.ajax}. * @param {object} response + * The response from the Ajax request. * @param {string} response.data + * A string that contains the styles to be added. * @param {number} [status] + * (optional) The XMLHttpRequest status. */ add_css: function (ajax, response, status) { // Add the styles in the normal way.