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