diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 974f5d0..2163445 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -212,7 +212,7 @@ Drupal.ajax = function (base, element, element_settings) { } // Bind the ajaxSubmit function to the element event. - $(ajax.element).bind(element_settings.event, function (event) { + $(ajax.element).on(element_settings.event, function (event) { return ajax.eventResponse(this, event); }); diff --git a/core/modules/views_ui/js/ajax.js b/core/modules/views_ui/js/ajax.js index ef45e24..77ac664 100644 --- a/core/modules/views_ui/js/ajax.js +++ b/core/modules/views_ui/js/ajax.js @@ -16,13 +16,13 @@ Drupal.attachBehaviors($(ajax_popup), ajax.settings); if (response.url) { // Identify the button that was clicked so that .ajaxSubmit() can use it. - // We need to do this for both .click() and .mousedown() since JavaScript + // We need to do this for both click and mousedown events since JavaScript // code might trigger either behavior. var $submit_buttons = $('input[type=submit], button', ajax_body); - $submit_buttons.click(function(event) { + $submit_buttons.on('click', function () { this.form.clk = this; }); - $submit_buttons.mousedown(function(event) { + $submit_buttons.on('mousedown', function () { this.form.clk = this; }); @@ -87,9 +87,9 @@ */ Drupal.behaviors.livePreview = { attach: function (context) { - $('input#edit-displays-live-preview', context).once('views-ajax-processed').click(function() { + $('input#edit-displays-live-preview', context).once('views-ajax-processed').on('click', function () { if ($(this).is(':checked')) { - $('#preview-submit').click(); + $('#preview-submit').trigger('click'); } }); } @@ -100,7 +100,7 @@ */ Drupal.behaviors.syncPreviewDisplay = { attach: function (context) { - $("#views-tabset a").once('views-ajax-processed').click(function() { + $("#views-tabset a").once('views-ajax-processed').on('click', function () { var href = $(this).attr('href'); // Cut of #views-tabset. var display_id = href.substr(11); diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js index f695e77..24a0166 100644 --- a/core/modules/views_ui/js/views-admin.js +++ b/core/modules/views_ui/js/views-admin.js @@ -127,9 +127,9 @@ Drupal.viewsUi.FormFieldFiller.prototype.bind = function () { this.unbind(); // Populate the form field when the source changes. - this.source.bind('keyup.viewsUi change.viewsUi', this.populate); + this.source.on('keyup.viewsUi change.viewsUi', this.populate); // Quit populating the field as soon as it gets focus. - this.target.bind('focus.viewsUi', this.unbind); + this.target.on('focus.viewsUi', this.unbind); }; /** @@ -164,8 +164,8 @@ Drupal.viewsUi.FormFieldFiller.prototype._unbind = function () { "use strict"; - this.source.unbind('keyup.viewsUi change.viewsUi', this.populate); - this.target.unbind('focus.viewsUi', this.unbind); + this.source.off('keyup.viewsUi change.viewsUi', this.populate); + this.target.off('focus.viewsUi', this.unbind); }; /** @@ -194,7 +194,7 @@ Drupal.behaviors.addItemForm.attach = function (context) { } }; -Drupal.viewsUi.addItemForm = function($form) { +Drupal.viewsUi.addItemForm = function ($form) { "use strict"; @@ -239,7 +239,7 @@ Drupal.viewsUi.addItemForm.prototype.handleCheck = function (event) { /** * Refresh the display of the checked items. */ -Drupal.viewsUi.addItemForm.prototype.refreshCheckedItems = function() { +Drupal.viewsUi.addItemForm.prototype.refreshCheckedItems = function () { "use strict"; @@ -283,7 +283,7 @@ Drupal.behaviors.viewsUiRenderAddViewButton.attach = function (context, settings $addDisplayDropdown.appendTo($menu); // Add the click handler for the add display button - $('li.add > a', $menu).bind('click', function (event) { + $('li.add > a', $menu).on('click', function (event) { event.preventDefault(); var $trigger = $(this); Drupal.behaviors.viewsUiRenderAddViewButton.toggleMenu($trigger); @@ -529,7 +529,7 @@ Drupal.viewsUi.rearrangeFilterHandler = function (table, operator) { this.redrawOperatorLabels(); $('.views-group-title select', table) .once('views-rearrange-filter-handler') - .bind('change.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels')); + .on('change.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels')); // Bind handlers so that when a "Remove" link is clicked, we: // - Update the rowspans of cells containing an operator dropdown (since they @@ -539,8 +539,8 @@ Drupal.viewsUi.rearrangeFilterHandler = function (table, operator) { // have a label display next to it). $('a.views-groups-remove-link', this.table) .once('views-rearrange-filter-handler') - .bind('click.views-rearrange-filter-handler', $.proxy(this, 'updateRowspans')) - .bind('click.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels')); + .on('click.views-rearrange-filter-handler', $.proxy(this, 'updateRowspans')) + .on('click.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels')); }; /** @@ -561,7 +561,7 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.insertAddRemoveFilterGroupLinks // When the link is clicked, dynamically click the hidden form button for // adding a new filter group. .once('views-rearrange-filter-handler') - .bind('click.views-rearrange-filter-handler', $.proxy(this, 'clickAddGroupButton')); + .on('click.views-rearrange-filter-handler', $.proxy(this, 'clickAddGroupButton')); // Find each (visually hidden) button for removing a filter group and insert // a link next to it. @@ -575,7 +575,7 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.insertAddRemoveFilterGroupLinks // When the link is clicked, dynamically click the corresponding form // button. .once('views-rearrange-filter-handler') - .bind('click.views-rearrange-filter-handler', {buttonId: buttonId}, $.proxy(this, 'clickRemoveGroupButton')); + .on('click.views-rearrange-filter-handler', {buttonId: buttonId}, $.proxy(this, 'clickRemoveGroupButton')); } }; @@ -588,9 +588,9 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton = function ( // Due to conflicts between Drupal core's AJAX system and the Views AJAX // system, the only way to get this to work seems to be to trigger both the - // .mousedown() and .submit() events. - this.addGroupButton.mousedown(); - this.addGroupButton.submit(); + // mousedown and submit events. + this.addGroupButton.trigger('mousedown'); + this.addGroupButton.trigger('submit'); event.preventDefault(); }; @@ -605,10 +605,10 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.clickRemoveGroupButton = functio "use strict"; - // For some reason, here we only need to trigger .submit(), unlike for + // For some reason, here we only need to trigger submit event, unlike for // Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton() - // where we had to trigger .mousedown() also. - jQuery('input#' + event.data.buttonId, this.table).submit(); + // where we had to trigger mousedown event also. + jQuery('input#' + event.data.buttonId, this.table).trigger('submit'); event.preventDefault(); }; @@ -848,7 +848,7 @@ Drupal.behaviors.viewsFilterConfigSelectAll = {}; /** * Add a select all checkbox, which checks each checkbox at once. */ -Drupal.behaviors.viewsFilterConfigSelectAll.attach = function(context) { +Drupal.behaviors.viewsFilterConfigSelectAll.attach = function (context) { "use strict"; @@ -983,12 +983,12 @@ Drupal.behaviors.viewsUiOverrideSelect.attach = function (context, settings) { var old_value = $submit.val(); $submit.once('views-ui-override-button-text') - .bind('mouseup', function() { + .on('mouseup', function() { $(this).val(old_value); return true; }); - $(this).bind('change', function() { + $(this).on('change', function() { if ($(this).val() === 'default') { $submit.val(Drupal.t('Apply (all displays)')); } @@ -1099,7 +1099,7 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) { }; Drupal.behaviors.viewsUiHandlerRemoveLink = {}; -Drupal.behaviors.viewsUiHandlerRemoveLink.attach = function(context) { +Drupal.behaviors.viewsUiHandlerRemoveLink.attach = function (context) { var $ = jQuery; // Handle handler deletion by looking for the hidden checkbox and hiding the @@ -1126,6 +1126,6 @@ jQuery(function() { "use strict" - jQuery(window).bind('resize', Drupal.viewsUi.resizeModal); - jQuery(window).bind('scroll', Drupal.viewsUi.resizeModal); + jQuery(window).on('resize', Drupal.viewsUi.resizeModal); + jQuery(window).on('scroll', Drupal.viewsUi.resizeModal); });