- /**
- * Settings for an Ajax object.
- *
- * @typedef {object} Drupal.Ajax~element_settings
- *
- * @prop {string} url
- * Target of the Ajax request.
- * @prop {?string} [event]
- * Event bound to settings.element which will trigger the Ajax request.
- * @prop {bool} [keypress=true]
- * Triggers a request on keypress events.
- * @prop {?string} selector
- * jQuery selector targeting the element to bind events to or used with
- * {@link Drupal.AjaxCommands}.
- * @prop {string} [effect='none']
- * Name of the jQuery method to use for displaying new Ajax content.
- * @prop {string|number} [speed='none']
- * Speed with which to apply the effect.
- * @prop {string} [method]
- * Name of the jQuery method used to insert new content in the targeted
- * element.
- * @prop {object} [progress]
- * Settings for the display of a user-friendly loader.
- * @prop {string} [progress.type='throbber']
- * Type of progress element, core provides `'bar'`, `'throbber'` and
- * `'fullscreen'`.
- * @prop {string} [progress.message=Drupal.t('Please wait...')]
- * Custom message to be used with the bar indicator.
- * @prop {object} [submit]
- * Extra data to be sent with the Ajax request.
- * @prop {bool} [submit.js=true]
- * Allows the PHP side to know this comes from an Ajax request.
- * @prop {object} [dialog]
- * Options for {@link Drupal.dialog}.
- * @prop {string} [dialogType]
- * One of `'modal'` or `'dialog'`.
- * @prop {string} [prevent]
- * List of events on which to stop default action and stop propagation.
- */
-
- /**
- * Ajax constructor.
- *
- * The Ajax request returns an array of commands encoded in JSON, which is
- * then executed to make any changes that are necessary to the page.
- *
- * Drupal uses this file to enhance form elements with `#ajax['url']` and
- * `#ajax['wrapper']` properties. If set, this file will automatically be
- * included to provide Ajax capabilities.
- *
- * @constructor
- *
- * @param {string} [base]
- * Base parameter of {@link Drupal.Ajax} constructor
- * @param {HTMLElement} [element]
- * Element parameter of {@link Drupal.Ajax} constructor, element on which
- * event listeners will be bound.
- * @param {Drupal.Ajax~element_settings} element_settings
- * Settings for this Ajax object.
- */
- Drupal.Ajax = function (base, element, element_settings) {
+ Drupal.ajax.bindAjaxLinks = function (element) {
+ $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) {
+ var $linkElement = $(ajaxLink);
+
+ var elementSettings = {
+ progress: { type: 'throbber' },
+ dialogType: $linkElement.data('dialog-type'),
+ dialog: $linkElement.data('dialog-options'),
+ dialogRenderer: $linkElement.data('dialog-renderer'),
+ base: $linkElement.attr('id'),
+ element: ajaxLink
+ };
+ var href = $linkElement.attr('href');
+
+ if (href) {
+ elementSettings.url = href;
+ elementSettings.event = 'click';
+ }
+ Drupal.ajax(elementSettings);
+ });
+ };
+
+ Drupal.Ajax = function (base, element, elementSettings) {