Issue #1342198 by nod_, droplet, cosmicdreams, RobLoach, aspilicious: Use .on and .off instead of .bind, .unbind and .delegate.
parent
182099941f
commit
d4dcb5c357
|
@ -258,7 +258,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);
|
||||
});
|
||||
|
||||
|
@ -266,7 +266,7 @@ Drupal.ajax = function (base, element, element_settings) {
|
|||
// can be triggered through keyboard input as well as e.g. a mousedown
|
||||
// action.
|
||||
if (element_settings.keypress) {
|
||||
$(ajax.element).keypress(function (event) {
|
||||
$(ajax.element).on('keypress', function (event) {
|
||||
return ajax.keypressResponse(this, event);
|
||||
});
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ Drupal.ajax = function (base, element, element_settings) {
|
|||
// For example, prevent the browser default action of a click, even if the
|
||||
// AJAX behavior binds to mousedown.
|
||||
if (element_settings.prevent) {
|
||||
$(ajax.element).bind(element_settings.prevent, false);
|
||||
$(ajax.element).on(element_settings.prevent, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ $.extend(CollapsibleDetails.prototype, {
|
|||
setupSummary: function () {
|
||||
this.$summary = $('<span class="summary"></span>');
|
||||
this.$node
|
||||
.bind('summaryUpdated', $.proxy(this.onSummaryUpdated, this))
|
||||
.on('summaryUpdated', $.proxy(this.onSummaryUpdated, this))
|
||||
.trigger('summaryUpdated');
|
||||
},
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ $.extend(CollapsibleDetails.prototype, {
|
|||
.attr('href', '#' + this.$node.attr('id'))
|
||||
.prepend($legend.contents())
|
||||
.appendTo($legend)
|
||||
.click($.proxy(this.onLegendClick, this));
|
||||
.on('click', $.proxy(this.onLegendClick, this));
|
||||
$legend.append(this.$summary);
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -31,8 +31,8 @@ $.fn.drupalSetSummary = function (callback) {
|
|||
.data('summaryCallback', callback)
|
||||
// To prevent duplicate events, the handlers are first removed and then
|
||||
// (re-)added.
|
||||
.unbind('formUpdated.summary')
|
||||
.bind('formUpdated.summary', function () {
|
||||
.off('formUpdated.summary')
|
||||
.on('formUpdated.summary', function () {
|
||||
self.trigger('summaryUpdated');
|
||||
})
|
||||
// The actual summaryUpdated handler doesn't fire when the callback is
|
||||
|
@ -53,7 +53,7 @@ Drupal.behaviors.formUpdated = {
|
|||
.find(':input').addBack().filter(':input')
|
||||
// To prevent duplicate events, the handlers are first removed and then
|
||||
// (re-)added.
|
||||
.unbind(events).bind(events, function () {
|
||||
.off(events).on(events, function () {
|
||||
$(this).trigger('formUpdated');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ Drupal.behaviors.machineName = {
|
|||
var data = e.data;
|
||||
e.preventDefault();
|
||||
data.$wrapper.show();
|
||||
data.$target.focus();
|
||||
data.$target.trigger('focus');
|
||||
data.$suffix.hide();
|
||||
data.$source.unbind('.machineName');
|
||||
data.$source.off('.machineName');
|
||||
}
|
||||
|
||||
function machineNameHandler(e) {
|
||||
|
@ -109,16 +109,16 @@ Drupal.behaviors.machineName = {
|
|||
options: options
|
||||
};
|
||||
// If it is editable, append an edit link.
|
||||
var $link = $('<span class="admin-link"><button type="button" class="link">' + Drupal.t('Edit') + '</button></span>').bind('click', eventData, clickEditHandler);
|
||||
var $link = $('<span class="admin-link"><button type="button" class="link">' + Drupal.t('Edit') + '</button></span>').on('click', eventData, clickEditHandler);
|
||||
$suffix.append(' ').append($link);
|
||||
|
||||
// Preview the machine name in realtime when the human-readable name
|
||||
// changes, but only if there is no machine name yet; i.e., only upon
|
||||
// initial creation, not when editing.
|
||||
if ($target.val() === '') {
|
||||
$source.bind('keyup.machineName change.machineName input.machineName', eventData, machineNameHandler)
|
||||
$source.on('keyup.machineName change.machineName input.machineName', eventData, machineNameHandler)
|
||||
// Initialize machine name preview.
|
||||
.keyup();
|
||||
.trigger('keyup');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ states.Dependent.prototype = {
|
|||
this.values[selector][state.name] = null;
|
||||
|
||||
// Monitor state changes of the specified state for this dependee.
|
||||
$(selector).bind('state:' + state, {selector: selector, state: state}, stateEventHandler);
|
||||
$(selector).on('state:' + state, {selector: selector, state: state}, stateEventHandler);
|
||||
|
||||
// Make sure the event we just bound ourselves to is actually fired.
|
||||
new states.Trigger({ selector: selector, state: state });
|
||||
|
@ -348,7 +348,7 @@ states.Trigger.prototype = {
|
|||
var oldValue = valueFn.call(this.element);
|
||||
|
||||
// Attach the event callback.
|
||||
this.element.bind(event, $.proxy(function (e) {
|
||||
this.element.on(event, $.proxy(function (e) {
|
||||
var value = valueFn.call(this.element, e);
|
||||
// Only trigger the event if the value has actually changed.
|
||||
if (oldValue !== value) {
|
||||
|
@ -500,7 +500,7 @@ states.State.prototype = {
|
|||
* can override these state change handlers for particular parts of a page.
|
||||
*/
|
||||
|
||||
$(document).bind('state:disabled', function(e) {
|
||||
$(document).on('state:disabled', function (e) {
|
||||
// Only act when this change was triggered by a dependency and not by the
|
||||
// element monitoring itself.
|
||||
if (e.trigger) {
|
||||
|
@ -514,7 +514,7 @@ $(document).bind('state:disabled', function(e) {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).bind('state:required', function(e) {
|
||||
$(document).on('state:required', function (e) {
|
||||
if (e.trigger) {
|
||||
if (e.value) {
|
||||
var $label = $(e.target).attr({ 'required': 'required', 'aria-required': 'aria-required' }).closest('.form-item, .form-wrapper').find('label');
|
||||
|
@ -529,22 +529,22 @@ $(document).bind('state:required', function(e) {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).bind('state:visible', function(e) {
|
||||
$(document).on('state:visible', function (e) {
|
||||
if (e.trigger) {
|
||||
$(e.target).closest('.form-item, .form-submit, .form-wrapper').toggle(e.value);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).bind('state:checked', function(e) {
|
||||
$(document).on('state:checked', function (e) {
|
||||
if (e.trigger) {
|
||||
$(e.target).prop('checked', e.value);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).bind('state:collapsed', function(e) {
|
||||
$(document).on('state:collapsed', function (e) {
|
||||
if (e.trigger) {
|
||||
if ($(e.target).is('[open]') === e.value) {
|
||||
$(e.target).find('> summary a').click();
|
||||
$(e.target).find('> summary a').trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -127,7 +127,7 @@ $.extend(TabbingManager.prototype, {
|
|||
if ($hasFocus.length === 0) {
|
||||
$hasFocus = $set.eq(0);
|
||||
}
|
||||
$hasFocus.focus();
|
||||
$hasFocus.trigger('focus');
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -106,7 +106,7 @@ Drupal.tableDrag = function (table, tableSettings) {
|
|||
// Add a link before the table for users to show or hide weight columns.
|
||||
$table.before($('<button type="button" class="link tabledrag-toggle-weight"></button>')
|
||||
.attr('title', Drupal.t('Re-order rows by numerical weight instead of dragging.'))
|
||||
.click($.proxy(function (e) {
|
||||
.on('click', $.proxy(function (e) {
|
||||
e.preventDefault();
|
||||
this.toggleColumns();
|
||||
}, this))
|
||||
|
@ -123,16 +123,16 @@ Drupal.tableDrag = function (table, tableSettings) {
|
|||
// Add event bindings to the document. The self variable is passed along
|
||||
// as event handlers do not have direct access to the tableDrag object.
|
||||
if (Modernizr.touch) {
|
||||
$(document).bind('touchmove', function (event) { return self.dragRow(event.originalEvent.touches[0], self); });
|
||||
$(document).bind('touchend', function (event) { return self.dropRow(event.originalEvent.touches[0], self); });
|
||||
$(document).on('touchmove', function (event) { return self.dragRow(event.originalEvent.touches[0], self); });
|
||||
$(document).on('touchend', function (event) { return self.dropRow(event.originalEvent.touches[0], self); });
|
||||
}
|
||||
else {
|
||||
$(document).bind('mousemove', function (event) { return self.dragRow(event, self); });
|
||||
$(document).bind('mouseup', function (event) { return self.dropRow(event, self); });
|
||||
$(document).on('mousemove', function (event) { return self.dragRow(event, self); });
|
||||
$(document).on('mouseup', function (event) { return self.dropRow(event, self); });
|
||||
}
|
||||
|
||||
// React to localStorage event showing or hiding weight columns.
|
||||
$(window).bind('storage', $.proxy(function (e) {
|
||||
$(window).on('storage', $.proxy(function (e) {
|
||||
// Only react to 'Drupal.tableDrag.showWeight' value change.
|
||||
if (e.originalEvent.key === 'Drupal.tableDrag.showWeight') {
|
||||
// This was changed in another window, get the new value for this window.
|
||||
|
@ -332,32 +332,32 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
|
|||
});
|
||||
}
|
||||
else {
|
||||
handle.mousedown(function (event) {
|
||||
handle.on('mousedown', function (event) {
|
||||
event.preventDefault();
|
||||
self.dragStart(event, self, item);
|
||||
});
|
||||
}
|
||||
|
||||
// Prevent the anchor tag from jumping us to the top of the page.
|
||||
handle.click(function (e) {
|
||||
handle.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Set blur cleanup when a handle is focused.
|
||||
handle.focus(function () {
|
||||
handle.on('focus', function () {
|
||||
self.safeBlur = true;
|
||||
});
|
||||
|
||||
// On blur, fire the same function as a touchend/mouseup. This is used to
|
||||
// update values after a row has been moved through the keyboard support.
|
||||
handle.blur(function (event) {
|
||||
handle.on('blur', function (event) {
|
||||
if (self.rowObject && self.safeBlur) {
|
||||
self.dropRow(event, self);
|
||||
}
|
||||
});
|
||||
|
||||
// Add arrow-key support to the handle.
|
||||
handle.keydown(function (event) {
|
||||
handle.on('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);
|
||||
|
@ -406,7 +406,7 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
|
|||
self.rowObject.indent(0);
|
||||
window.scrollBy(0, -parseInt(item.offsetHeight, 10));
|
||||
}
|
||||
handle.get(0).focus(); // Regain focus after the DOM manipulation.
|
||||
handle.trigger('focus'); // Regain focus after the DOM manipulation.
|
||||
}
|
||||
break;
|
||||
case 39: // Right arrow.
|
||||
|
@ -448,7 +448,7 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
|
|||
self.rowObject.indent(0);
|
||||
window.scrollBy(0, parseInt(item.offsetHeight, 10));
|
||||
}
|
||||
handle.get(0).focus(); // Regain focus after the DOM manipulation.
|
||||
handle.trigger('focus'); // Regain focus after the DOM manipulation.
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -472,7 +472,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.on('keypress', function (event) {
|
||||
switch (event.keyCode) {
|
||||
case 37: // Left arrow.
|
||||
case 38: // Up arrow.
|
||||
|
@ -504,7 +504,7 @@ Drupal.tableDrag.prototype.dragStart = function (event, self, item) {
|
|||
|
||||
// If there's a lingering row object from the keyboard, remove its focus.
|
||||
if (self.rowObject) {
|
||||
$(self.rowObject.element).find('a.tabledrag-handle').blur();
|
||||
$(self.rowObject.element).find('a.tabledrag-handle').trigger('blur');
|
||||
}
|
||||
|
||||
// Create a new rowObject for manipulation of this row.
|
||||
|
|
|
@ -93,7 +93,7 @@ function TableHeader(table) {
|
|||
this.tableOffset = this.$originalTable.offset();
|
||||
|
||||
// React to columns change to avoid making checks in the scroll callback.
|
||||
this.$originalTable.bind('columnschange', {tableHeader: this}, function (e, display) {
|
||||
this.$originalTable.on('columnschange', {tableHeader: this}, function (e, display) {
|
||||
var tableHeader = e.data.tableHeader;
|
||||
if (tableHeader.displayWeight === null || tableHeader.displayWeight !== display) {
|
||||
tableHeader.recalculateSticky();
|
||||
|
|
|
@ -28,7 +28,7 @@ Drupal.tableSelect = function () {
|
|||
};
|
||||
|
||||
// Find all <th> with class select-all, and insert the check all checkbox.
|
||||
$table.find('th.select-all').prepend($('<input type="checkbox" class="form-checkbox" />').attr('title', strings.selectAll)).click(function (event) {
|
||||
$table.find('th.select-all').prepend($('<input type="checkbox" class="form-checkbox" />').attr('title', strings.selectAll)).on('click', function (event) {
|
||||
if ($(event.target).is('input[type="checkbox"]')) {
|
||||
// Loop through all checkboxes and set their state to the select all checkbox' state.
|
||||
checkboxes.each(function () {
|
||||
|
@ -42,7 +42,7 @@ Drupal.tableSelect = function () {
|
|||
});
|
||||
|
||||
// For each of the checkboxes within the table that are not disabled.
|
||||
checkboxes = $table.find('td input[type="checkbox"]:enabled').click(function (e) {
|
||||
checkboxes = $table.find('td input[type="checkbox"]:enabled').on('click', function (e) {
|
||||
// Either add or remove the selected class based on the state of the check all checkbox.
|
||||
$(this).closest('tr').toggleClass('selected', this.checked);
|
||||
|
||||
|
|
|
@ -90,24 +90,24 @@ Drupal.verticalTab = function (settings) {
|
|||
|
||||
this.link.attr('href', '#' + settings.details.attr('id'));
|
||||
|
||||
this.link.click(function (e) {
|
||||
this.link.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
self.focus();
|
||||
});
|
||||
|
||||
// Keyboard events added:
|
||||
// Pressing the Enter key will open the tab pane.
|
||||
this.link.keydown(function(event) {
|
||||
this.link.on('keydown', function (event) {
|
||||
event.preventDefault();
|
||||
if (event.keyCode === 13) {
|
||||
self.focus();
|
||||
// Set focus on the first input field of the visible details/tab pane.
|
||||
$(".vertical-tabs-pane :input:visible:enabled:first").focus();
|
||||
$(".vertical-tabs-pane :input:visible:enabled:first").trigger('focus');
|
||||
}
|
||||
});
|
||||
|
||||
this.details
|
||||
.bind('summaryUpdated', function () {
|
||||
.on('summaryUpdated', function () {
|
||||
self.updateSummary();
|
||||
})
|
||||
.trigger('summaryUpdated');
|
||||
|
|
|
@ -78,7 +78,7 @@ Drupal.behaviors.blockDrag = {
|
|||
window.alert(Drupal.t('The block cannot be placed in this region.'));
|
||||
// Simulate that there was a selected element change, so the row is put
|
||||
// back to from where the user tried to drag it.
|
||||
regionField.change();
|
||||
regionField.trigger('change');
|
||||
}
|
||||
else if ($rowElement.prev('tr').is('.region-message')) {
|
||||
var weightField = $rowElement.find('select.block-weight');
|
||||
|
@ -94,7 +94,7 @@ Drupal.behaviors.blockDrag = {
|
|||
|
||||
// Add the behavior to each region select list.
|
||||
$(context).find('select.block-region-select').once('block-region-select', function () {
|
||||
$(this).change(function (event) {
|
||||
$(this).on('change', function (event) {
|
||||
// Make our new row and select field.
|
||||
var row = $(this).closest('tr');
|
||||
var select = $(this);
|
||||
|
@ -106,7 +106,7 @@ Drupal.behaviors.blockDrag = {
|
|||
// Modify empty regions with added or removed fields.
|
||||
checkEmptyRegions(table, row);
|
||||
// Remove focus from selectbox.
|
||||
select.get(0).blur();
|
||||
select.trigger('blur');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@ Drupal.ckeditor = {
|
|||
if (success) {
|
||||
$group.appendTo($(event.currentTarget).closest('.ckeditor-row').children('.ckeditor-toolbar-groups'));
|
||||
// Focus on the new group.
|
||||
$group.focus();
|
||||
$group.trigger('focus');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ Drupal.ckeditor = {
|
|||
* elements involved in the sort action.
|
||||
*/
|
||||
startButtonDrag: function (event, ui) {
|
||||
this.$el.find('a:focus').blur();
|
||||
this.$el.find('a:focus').trigger('blur');
|
||||
|
||||
// Show the button group names as soon as the user starts dragging.
|
||||
this.model.set('groupNamesVisible', true);
|
||||
|
@ -597,7 +597,7 @@ Drupal.ckeditor = {
|
|||
}
|
||||
// Refocus the target button so that the user can continue from a known
|
||||
// place.
|
||||
ui.item.find('a').focus();
|
||||
ui.item.find('a').trigger('focus');
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -809,7 +809,7 @@ Drupal.ckeditor = {
|
|||
.off()
|
||||
.remove();
|
||||
// Focus on the first button in the active toolbar.
|
||||
$activeButtons.find('.ckeditor-toolbar-group-buttons').eq(0).children().eq(0).children().focus();
|
||||
$activeButtons.find('.ckeditor-toolbar-group-buttons').eq(0).children().eq(0).children().trigger('focus');
|
||||
}
|
||||
// Otherwise, move it.
|
||||
else {
|
||||
|
@ -852,7 +852,7 @@ Drupal.ckeditor = {
|
|||
}
|
||||
// Refocus the target button so that the user can continue from a known
|
||||
// place.
|
||||
$target.focus();
|
||||
$target.trigger('focus');
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -933,7 +933,7 @@ Drupal.ckeditor = {
|
|||
}
|
||||
|
||||
registerGroupMove(this, $group);
|
||||
$group.focus();
|
||||
$group.trigger('focus');
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
@ -1410,7 +1410,7 @@ function openGroupNameDialog (view, $group, callback) {
|
|||
// When editing, set the "group name" input in the form to the current value.
|
||||
.attr('value', $group.attr('data-drupal-ckeditor-toolbar-group-name'))
|
||||
// Focus on the "group name" input in the form.
|
||||
.focus();
|
||||
.trigger('focus');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,7 @@ Drupal.behaviors.color = {
|
|||
}
|
||||
|
||||
// Set up colorScheme selector.
|
||||
form.find('#edit-scheme').change(function () {
|
||||
form.find('#edit-scheme').on('change', function () {
|
||||
var schemes = settings.color.schemes, colorScheme = this.options[this.selectedIndex].value;
|
||||
if (colorScheme !== '' && schemes[colorScheme]) {
|
||||
// Get colors of active scheme.
|
||||
|
@ -184,8 +184,8 @@ Drupal.behaviors.color = {
|
|||
var input = e.target;
|
||||
// Remove old bindings.
|
||||
if (focused) {
|
||||
$(focused).unbind('keyup', farb.updateValue)
|
||||
.unbind('keyup', preview).unbind('keyup', resetScheme)
|
||||
$(focused).off('keyup', farb.updateValue)
|
||||
.off('keyup', preview).off('keyup', resetScheme)
|
||||
.parent().removeClass('item-selected');
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ Drupal.behaviors.color = {
|
|||
focused = input;
|
||||
farb.linkTo(function (color) { callback(input, color, true, false); });
|
||||
farb.setColor(input.value);
|
||||
$(focused).keyup(farb.updateValue).keyup(preview).keyup(resetScheme)
|
||||
$(focused).on('keyup', farb.updateValue).on('keyup', preview).on('keyup', resetScheme)
|
||||
.parent().addClass('item-selected');
|
||||
}
|
||||
|
||||
|
@ -240,11 +240,11 @@ Drupal.behaviors.color = {
|
|||
$(this).after(hook);
|
||||
hooks.push(hook);
|
||||
|
||||
$(this).parent().find('.lock').click();
|
||||
$(this).parent().find('.lock').trigger('click');
|
||||
this.i = i;
|
||||
inputs.push(this);
|
||||
})
|
||||
.focus(focus);
|
||||
.on('focus', focus);
|
||||
|
||||
form.find('#palette label');
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ Drupal.behaviors.editor = {
|
|||
});
|
||||
}
|
||||
// Detach any editor when the containing form is submitted.
|
||||
$this.parents('form').submit(function (event) {
|
||||
$this.parents('form').on('submit', function (event) {
|
||||
// Do not detach if the event was canceled.
|
||||
if (event.isDefaultPrevented()) {
|
||||
return;
|
||||
|
|
|
@ -157,7 +157,7 @@ Drupal.fieldUIOverview = {
|
|||
|
||||
// Fire the Ajax update.
|
||||
$('input[name=refresh_rows]').val(rowNames.join(' '));
|
||||
$('input#edit-refresh').mousedown();
|
||||
$('input#edit-refresh').trigger('mousedown');
|
||||
|
||||
// Disabled elements do not appear in POST ajax data, so we mark the
|
||||
// elements disabled only after firing the request.
|
||||
|
@ -190,7 +190,7 @@ Drupal.fieldUIDisplayOverview.field = function (row, data) {
|
|||
|
||||
// Attach change listener to the 'plugin type' select.
|
||||
this.$pluginSelect = $(row).find('select.field-plugin-type');
|
||||
this.$pluginSelect.change(Drupal.fieldUIOverview.onChange);
|
||||
this.$pluginSelect.on('change', Drupal.fieldUIOverview.onChange);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ Drupal.behaviors.fileValidateAutoAttach = {
|
|||
elements = settings.file.elements;
|
||||
for (selector in elements) {
|
||||
if (elements.hasOwnProperty(selector)) {
|
||||
$context.find(selector).bind('change', {extensions: elements[selector]}, validateExtension);
|
||||
$context.find(selector).on('change', {extensions: elements[selector]}, validateExtension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ Drupal.behaviors.fileValidateAutoAttach = {
|
|||
elements = settings.file.elements;
|
||||
for (selector in elements) {
|
||||
if (elements.hasOwnProperty(selector)) {
|
||||
$context.find(selector).unbind('change', validateExtension);
|
||||
$context.find(selector).off('change', validateExtension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,13 +63,13 @@ Drupal.behaviors.fileAutoUpload = {
|
|||
Drupal.behaviors.fileButtons = {
|
||||
attach: function (context) {
|
||||
var $context = $(context);
|
||||
$context.find('input.form-submit').bind('mousedown', Drupal.file.disableFields);
|
||||
$context.find('div.form-managed-file input.form-submit').bind('mousedown', Drupal.file.progressBar);
|
||||
$context.find('input.form-submit').on('mousedown', Drupal.file.disableFields);
|
||||
$context.find('div.form-managed-file input.form-submit').on('mousedown', Drupal.file.progressBar);
|
||||
},
|
||||
detach: function (context) {
|
||||
var $context = $(context);
|
||||
$context.find('input.form-submit').unbind('mousedown', Drupal.file.disableFields);
|
||||
$context.find('div.form-managed-file input.form-submit').unbind('mousedown', Drupal.file.progressBar);
|
||||
$context.find('input.form-submit').off('mousedown', Drupal.file.disableFields);
|
||||
$context.find('div.form-managed-file input.form-submit').off('mousedown', Drupal.file.progressBar);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -78,10 +78,10 @@ Drupal.behaviors.fileButtons = {
|
|||
*/
|
||||
Drupal.behaviors.filePreviewLinks = {
|
||||
attach: function (context) {
|
||||
$(context).find('div.form-managed-file .file a, .file-widget .file a').bind('click',Drupal.file.openInNewWindow);
|
||||
$(context).find('div.form-managed-file .file a, .file-widget .file a').on('click',Drupal.file.openInNewWindow);
|
||||
},
|
||||
detach: function (context){
|
||||
$(context).find('div.form-managed-file .file a, .file-widget .file a').unbind('click', Drupal.file.openInNewWindow);
|
||||
$(context).find('div.form-managed-file .file a, .file-widget .file a').off('click', Drupal.file.openInNewWindow);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Drupal.behaviors.filterStatus = {
|
|||
|
||||
// Bind click handler to this checkbox to conditionally show and hide the
|
||||
// filter's tableDrag row and vertical tab pane.
|
||||
$checkbox.bind('click.filterUpdate', function () {
|
||||
$checkbox.on('click.filterUpdate', function () {
|
||||
if ($checkbox.is(':checked')) {
|
||||
$row.show();
|
||||
if (filterSettingsTab) {
|
||||
|
|
|
@ -15,12 +15,12 @@ Drupal.behaviors.filterGuidelines = {
|
|||
$(context).find('.filter-guidelines').once('filter-guidelines')
|
||||
.find(':header').hide()
|
||||
.closest('.filter-wrapper').find('select.filter-list')
|
||||
.bind('change', function () {
|
||||
.on('change', function () {
|
||||
$(this).closest('.filter-wrapper')
|
||||
.find('.filter-guidelines-item').hide()
|
||||
.filter('.filter-guidelines-' + this.value).show();
|
||||
})
|
||||
.change();
|
||||
.trigger('change');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ Drupal.behaviors.menuLinkAutomaticTitle = {
|
|||
$link_title.data('menuLinkAutomaticTitleOveridden', true);
|
||||
}
|
||||
// Whenever the value is changed manually, disable this behavior.
|
||||
$link_title.keyup(function () {
|
||||
$link_title.on('keyup', function () {
|
||||
$link_title.data('menuLinkAutomaticTitleOveridden', true);
|
||||
});
|
||||
// Global trigger on checkbox (do not fill-in a value when disabled).
|
||||
|
@ -57,7 +57,7 @@ Drupal.behaviors.menuLinkAutomaticTitle = {
|
|||
$checkbox.trigger('formUpdated');
|
||||
});
|
||||
// Take over any title change.
|
||||
$title.keyup(function () {
|
||||
$title.on('keyup', function () {
|
||||
if (!$link_title.data('menuLinkAutomaticTitleOveridden') && $checkbox.is(':checked')) {
|
||||
$link_title.val($title.val());
|
||||
$link_title.val($title.val()).trigger('formUpdated');
|
||||
|
|
|
@ -11,7 +11,7 @@ Drupal.behaviors.newSet = {
|
|||
var selectDefault = function() {
|
||||
$(this).closest('form').find('.form-item-set .form-type-radio:last input').prop('checked', true);
|
||||
};
|
||||
$('div.form-item-new input').focus(selectDefault).keyup(selectDefault);
|
||||
$('div.form-item-new input').on('focus', selectDefault).on('keyup', selectDefault);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ Drupal.behaviors.simpleTestMenuCollapse = {
|
|||
$this.html(drupalSettings.simpleTest.images[direction]);
|
||||
|
||||
// Adds group toggling functionality to arrow images.
|
||||
$this.click(function () {
|
||||
$this.on('click', function () {
|
||||
var trs = $this.closest('tbody').children('.' + drupalSettings.simpleTest[this.id].testClass);
|
||||
var direction = drupalSettings.simpleTest[this.id].imageDirection;
|
||||
var row = direction ? trs.length - 1 : 0;
|
||||
|
@ -80,7 +80,7 @@ Drupal.behaviors.simpleTestSelectAll = {
|
|||
}
|
||||
|
||||
// Have the single-test checkboxes follow the group checkbox.
|
||||
groupCheckbox.change(function () {
|
||||
groupCheckbox.on('change', function () {
|
||||
var checked = $(this).prop('checked');
|
||||
for (var i = 0; i < testCheckboxes.length; i++) {
|
||||
$('#' + testCheckboxes[i]).prop('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(updateGroupCheckbox);
|
||||
$('#' + testCheckboxes[i]).on('change', updateGroupCheckbox);
|
||||
}
|
||||
|
||||
// Initialize status for the group checkbox correctly.
|
||||
|
|
|
@ -42,7 +42,7 @@ Drupal.behaviors.textSummary = {
|
|||
|
||||
// If no summary is set, hide the summary field.
|
||||
if ($widget.find('.text-summary').val() === '') {
|
||||
$link.click();
|
||||
$link.trigger('click');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ Drupal.behaviors.fieldUserRegistration = {
|
|||
|
||||
if ($checkbox.length) {
|
||||
$(context).find('input#edit-instance-required').once('user-register-form-checkbox', function () {
|
||||
$(this).bind('change', function (e) {
|
||||
$(this).on('change', function (e) {
|
||||
if ($(this).prop('checked')) {
|
||||
$checkbox.prop('checked', true);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ Drupal.behaviors.permissions = {
|
|||
|
||||
// Initialize the authenticated user checkbox.
|
||||
$table.find('input[type=checkbox].rid-authenticated')
|
||||
.bind('click.permissions', self.toggle)
|
||||
.on('click.permissions', self.toggle)
|
||||
// .triggerHandler() cannot be used here, as it only affects the first
|
||||
// element.
|
||||
.each(self.toggle);
|
||||
|
|
|
@ -49,9 +49,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').on('click', function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#preview-submit').click();
|
||||
$('#preview-submit').trigger('click');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -62,13 +62,13 @@
|
|||
*/
|
||||
Drupal.behaviors.syncPreviewDisplay = {
|
||||
attach: function (context) {
|
||||
$("#views-tabset a").once('views-ajax-processed').click(function() {
|
||||
$("#views-tabset a").once('views-ajax').on('click', function () {
|
||||
var href = $(this).attr('href');
|
||||
// Cut of #views-tabset.
|
||||
var display_id = href.substr(11);
|
||||
// Set the form element.
|
||||
$("#views-live-preview #preview-display-id").val(display_id);
|
||||
}).addClass('views-ajax-processed');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
|||
'progress': { 'type': 'throbber' }
|
||||
};
|
||||
// Bind AJAX behaviors to all items showing the class.
|
||||
$('a.views-ajax-link', context).once('views-ajax-processed').each(function () {
|
||||
$('a.views-ajax-link', context).once('views-ajax').each(function () {
|
||||
var element_settings = base_element_settings;
|
||||
// Set the URL to go to the anchor.
|
||||
if ($(this).attr('href')) {
|
||||
|
@ -91,7 +91,7 @@
|
|||
});
|
||||
|
||||
$('div#views-live-preview a')
|
||||
.once('views-ajax-processed').each(function () {
|
||||
.once('views-ajax').each(function () {
|
||||
// We don't bind to links without a URL.
|
||||
if (!$(this).attr('href')) {
|
||||
return true;
|
||||
|
@ -115,8 +115,8 @@
|
|||
// @todo Revisit this after fixing Views UI to display a Preview outside
|
||||
// of the main Edit form.
|
||||
$('div#views-live-preview input[type=submit]')
|
||||
.once('views-ajax-processed').each(function(event) {
|
||||
$(this).click(function () {
|
||||
.once('views-ajax').each(function(event) {
|
||||
$(this).on('click', function () {
|
||||
this.form.clk = this;
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -307,7 +307,7 @@ Drupal.viewsUi.OptionsSearch = function ($form) {
|
|||
this.$form = $form;
|
||||
// Add a keyup handler to the search box.
|
||||
this.$searchBox = this.$form.find('#edit-override-controls-options-search');
|
||||
this.$searchBox.keyup($.proxy(this.handleKeyup, this));
|
||||
this.$searchBox.on('keyup', $.proxy(this.handleKeyup, this));
|
||||
// Get a list of option labels and their corresponding divs and maintain it
|
||||
// in memory, so we have as little overhead as possible at keyup time.
|
||||
this.options = this.getOptions(this.$form.find('.filterable-option'));
|
||||
|
@ -527,7 +527,7 @@ $.extend(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.
|
||||
// mousedown and submit events.
|
||||
this.addGroupButton
|
||||
.trigger('mousedown')
|
||||
.trigger('submit');
|
||||
|
@ -856,7 +856,7 @@ Drupal.viewsUi.Checkboxifier = function (button) {
|
|||
this.$button.hide();
|
||||
this.$parent.find('.exposed-description, .grouped-description').hide();
|
||||
|
||||
this.$input.click($.proxy(this, 'clickHandler'));
|
||||
this.$input.on('click', $.proxy(this, 'clickHandler'));
|
||||
|
||||
};
|
||||
|
||||
|
@ -864,8 +864,9 @@ Drupal.viewsUi.Checkboxifier = function (button) {
|
|||
* When the checkbox is checked or unchecked, simulate a button press.
|
||||
*/
|
||||
Drupal.viewsUi.Checkboxifier.prototype.clickHandler = function (e) {
|
||||
this.$button.mousedown();
|
||||
this.$button.submit();
|
||||
this.$button
|
||||
.trigger('mousedown')
|
||||
.trigger('submit');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue