Issue #1473314 by litwol, nod_, tim.plunkett, attiks: Core js still uses -processed instead of context/.once().
parent
a4de2caaf0
commit
b3e2c8b4af
|
@ -21,23 +21,18 @@ Drupal.behaviors.AJAX = {
|
|||
attach: function (context, settings) {
|
||||
// Load all Ajax behaviors specified in the settings.
|
||||
for (var base in settings.ajax) {
|
||||
if (!$('#' + base + '.ajax-processed').length) {
|
||||
var element_settings = settings.ajax[base];
|
||||
|
||||
if (typeof element_settings.selector == 'undefined') {
|
||||
element_settings.selector = '#' + base;
|
||||
}
|
||||
$(element_settings.selector).each(function () {
|
||||
element_settings.element = this;
|
||||
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
|
||||
});
|
||||
|
||||
$('#' + base).addClass('ajax-processed');
|
||||
var element_settings = settings.ajax[base];
|
||||
if (typeof element_settings.selector == 'undefined') {
|
||||
element_settings.selector = '#' + base;
|
||||
}
|
||||
$(element_settings.selector).once('drupal-ajax', function() {
|
||||
element_settings.element = this;
|
||||
Drupal.ajax[element_settings.selector] = new Drupal.ajax(base, this, element_settings);
|
||||
});
|
||||
}
|
||||
|
||||
// Bind Ajax behaviors to all items showing the class.
|
||||
$('.use-ajax:not(.ajax-processed)').addClass('ajax-processed').each(function () {
|
||||
$('.use-ajax').once('ajax', function () {
|
||||
var element_settings = {};
|
||||
// Clicked links look better with the throbber than the progress bar.
|
||||
element_settings.progress = { 'type': 'throbber' };
|
||||
|
@ -53,7 +48,7 @@ Drupal.behaviors.AJAX = {
|
|||
});
|
||||
|
||||
// This class means to submit the form to the action using Ajax.
|
||||
$('.use-ajax-submit:not(.ajax-processed)').addClass('ajax-processed').each(function () {
|
||||
$('.use-ajax-submit').once('ajax', function () {
|
||||
var element_settings = {};
|
||||
|
||||
// Ajax submits specified in this manner automatically submit to the
|
||||
|
|
|
@ -19,7 +19,7 @@ Drupal.behaviors.color = {
|
|||
var focused = null;
|
||||
|
||||
// Add Farbtastic.
|
||||
form.prepend('<div id="placeholder"></div>').addClass('color-processed');
|
||||
$('<div id="placeholder"></div>').once('color').prependTo(form);
|
||||
var farb = $.farbtastic('#placeholder');
|
||||
|
||||
// Decode reference colors to HSL.
|
||||
|
|
|
@ -8,23 +8,24 @@ Drupal.behaviors.openid = {
|
|||
var cookie = $.cookie('Drupal.visitor.openid_identifier');
|
||||
|
||||
// This behavior attaches by ID, so is only valid once on a page.
|
||||
if (!$('#edit-openid-identifier.openid-processed').length) {
|
||||
if (cookie || location.hash == '#openid-login') {
|
||||
$edit_openid_identifier = $('#edit-openid-identifier');
|
||||
if (cookie) {
|
||||
$('#edit-openid-identifier').val(cookie);
|
||||
$edit_openid_identifier.val(cookie);
|
||||
}
|
||||
if ($('#edit-openid-identifier').val() || location.hash == '#openid-login') {
|
||||
$('#edit-openid-identifier').addClass('openid-processed');
|
||||
$edit_openid_identifier.once('openid', function() {
|
||||
loginElements.hide();
|
||||
// Use .css('display', 'block') instead of .show() to be Konqueror friendly.
|
||||
openidElements.css('display', 'block');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$context.find('li.openid-link:not(.openid-processed)')
|
||||
.addClass('openid-processed')
|
||||
|
||||
$context.find('li.openid-link')
|
||||
.once('openid')
|
||||
.click(function () {
|
||||
loginElements.hide();
|
||||
openidElements.css('display', 'block');
|
||||
loginElements.hide();
|
||||
openidElements.css('display', 'block');
|
||||
// Remove possible error message.
|
||||
$('#edit-name, #edit-pass').removeClass('error');
|
||||
$('div.messages.error').hide();
|
||||
|
@ -32,11 +33,11 @@ Drupal.behaviors.openid = {
|
|||
$('#edit-openid-identifier')[0].focus();
|
||||
return false;
|
||||
});
|
||||
$context.find('li.user-link:not(.openid-processed)')
|
||||
.addClass('openid-processed')
|
||||
$context.find('li.user-link')
|
||||
.once('openid')
|
||||
.click(function () {
|
||||
openidElements.hide();
|
||||
loginElements.css('display', 'block');
|
||||
openidElements.hide();
|
||||
loginElements.css('display', 'block');
|
||||
// Clear OpenID Identifier field and remove possible error message.
|
||||
$('#edit-openid-identifier').val('').removeClass('error');
|
||||
$('div.messages.error').css('display', 'block');
|
||||
|
|
Loading…
Reference in New Issue