Commit e77c1c3a authored by Jaap Jan Koster's avatar Jaap Jan Koster Committed by Lucas Hedding
Browse files

Issue #3391546 by jaapjan, heddn: Replace deprecated core/jquery.once for Drupal 10 support

parent 4e070377
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Adds JS functionality to the Private Message form.
 */

(function ($, Drupal, drupalSettings) {
(function ($, Drupal, drupalSettings, once) {

  'use strict';

@@ -32,7 +32,7 @@
   * @param {Object} context The context.
   */
  function submitButtonListener(context) {
    $(context).parent().find('.private-message-add-form textarea').once('private-message-form-submit-button-listener').each(function () {
    $(once('private-message-form-submit-button-listener', '.private-message-add-form textarea', context)).each(function () {
      $(this).keyup(submitKeyPress);
    });
  }
@@ -47,4 +47,4 @@
    }
  };

}(jQuery, Drupal, drupalSettings));
}(jQuery, Drupal, drupalSettings, once));
+4 −4
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
Drupal.PrivateMessageInbox = {};
Drupal.PrivateMessageInbox.updateInbox = {};

(function ($, Drupal, drupalSettings, window) {
(function ($, Drupal, drupalSettings, window, once) {

  'use strict';

@@ -143,7 +143,7 @@ Drupal.PrivateMessageInbox.updateInbox = {};
   * @param {Object} context The context.
   */
  function loadOlderThreadWatcher(context) {
    $(context).find('#load-previous-threads-button').once('load-loder-threads-watcher').each(function () {
    $(once('load-loder-threads-watcher', '#load-previous-threads-button', context)).each(function () {
      $(this).on('click', loadOldThreadWatcherHandler);
    });
  }
@@ -167,7 +167,7 @@ Drupal.PrivateMessageInbox.updateInbox = {};
   * @param {Object} context The context.
   */
  function inboxThreadLinkListener(context) {
    $(context).find('.private-message-inbox-thread-link').once('inbox-thread-link-listener').each(function () {
    $(once('inbox-thread-link-listener', '.private-message-inbox-thread-link', context)).each(function () {
      $(this).click(inboxThreadLinkListenerHandler);
    });
  }
@@ -230,4 +230,4 @@ Drupal.PrivateMessageInbox.updateInbox = {};
    }
  };

}(jQuery, Drupal, drupalSettings, window));
}(jQuery, Drupal, drupalSettings, window, once));
+5 −6
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Handles JavaScript for the members widget of a private message thread.
 */

(function ($, Drupal, drupalSettings, window) {
(function ($, Drupal, drupalSettings, window, once) {
  'use strict';

  // Initialize script variables.
@@ -227,7 +227,7 @@
   * Watch the members field, inserting usernames as necessary.
   */
  function membersFieldListener() {
    usernameInput.once('members-field-listener').each(function () {
    $(once('members-field-listener', usernameInput)).each(function () {

      var timeout;
      // Act on keydown.
@@ -393,8 +393,7 @@
    // Only do something if there is a container to work with.
    if (autocompleteResultsContainer) {
      // The JS is only applied a single time, by using $.once().
      autocompleteResultsContainer.children('ul:first').children('li').children('a').once('pm-autocomplete-listener').each(function () {

      $(once('pm-autocomplete-listener', autocompleteResultsContainer.children('ul:first').children('li').children('a'))).each(function () {
        // If a search result is clicked, the username is added to the list of
        // members.
        $(this).click(addUserToMembersClickHandler)
@@ -449,7 +448,7 @@
   * @param {Object} context The context.
   */
  function membersWatcher(context) {
    $(context).find('.private-message-member-display-item .pm-username-remove-link').once('private-message-members-watcher').each(function () {
    $(once('private-message-members-watcher', '.private-message-member-display-item .pm-username-remove-link', context)).each(function () {
      $(this).click(function () {
        removeMember($(this));
      });
@@ -548,4 +547,4 @@
    return $('<div />', { 'class': 'private-message-member-display-item', 'data-username': userName }).append($('<span/>', { 'class': 'pm-username', 'data-pm-username': userName }).text(extractUsernameFromAutocompleteValue(userName))).append($('<span/>', {class: 'pm-username-remove-link'}).text('X'));
  };

}(jQuery, Drupal, drupalSettings, window));
}(jQuery, Drupal, drupalSettings, window, once));
+3 −3
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
Drupal.PrivateMessages = {};
Drupal.PrivateMessages.threadChange = {};

(function ($, Drupal, drupalSettings, window) {
(function ($, Drupal, drupalSettings, window, once) {

  'use strict';

@@ -95,7 +95,7 @@ Drupal.PrivateMessages.threadChange = {};
   * @param {Object} context The context.
   */
  function loadPreviousListener(context) {
    $(context).find('#load-previous-messages').once('load-previous-private-messages-listener').each(function () {
    $(once('load-previous-private-messages-listener', '#load-previous-messages', context)).each(function () {
      $(this).click(loadPreviousListenerHandler);
    });
  }
@@ -389,4 +389,4 @@ Drupal.PrivateMessages.threadChange = {};
    }
  };

}(jQuery, Drupal, drupalSettings, window));
}(jQuery, Drupal, drupalSettings, window, once));
+3 −3
Original line number Diff line number Diff line
@@ -3,12 +3,12 @@
 * Adds JavaScript functionality to the uninstall preparation confirm page.
 */

(function ($, Drupal, window) {
(function ($, Drupal, window, once) {

  'use strict';

  function uninstallButtonWatcher(context) {
    $(context).find('#private-message-admin-uninstall-form #edit-submit').once('uninstall-button-watcher').each(function () {
    $(once('uninstall-button-watcher', '#private-message-admin-uninstall-form #edit-submit', context)).each(function () {
      $(this).click(function () {
        return window.confirm(Drupal.t('This will delete all private message content from the database. Are you absolutely sure you wish to proceed?'));
      });
@@ -21,4 +21,4 @@
    }
  };

}(jQuery, Drupal, window));
}(jQuery, Drupal, window, once));
Loading