2009-04-27 20:19:38 +00:00
|
|
|
(function ($) {
|
2007-06-18 16:09:39 +00:00
|
|
|
|
2012-05-08 02:57:33 +00:00
|
|
|
"use strict";
|
|
|
|
|
2008-10-29 10:01:28 +00:00
|
|
|
Drupal.behaviors.openid = {
|
2009-04-27 20:19:38 +00:00
|
|
|
attach: function (context) {
|
2012-10-24 03:28:47 +00:00
|
|
|
function clearStatus ($form) {
|
|
|
|
$form.find('input:first').focus();
|
2012-09-30 16:53:26 +00:00
|
|
|
// Clear input fields and reset any validation errors.
|
2012-10-24 03:28:47 +00:00
|
|
|
$form[0].reset();
|
2012-09-30 16:53:26 +00:00
|
|
|
|
|
|
|
// Reset error state.
|
2012-10-24 03:28:47 +00:00
|
|
|
$form.find('.error').removeClass('error');
|
2012-04-17 03:33:58 +00:00
|
|
|
|
2012-09-30 16:53:26 +00:00
|
|
|
// Forget saved identifier.
|
|
|
|
$.cookie('Drupal.visitor.openid_identifier', null);
|
2012-10-24 03:28:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($('#block-user-login').length) {
|
|
|
|
var $login_form = $('#user-login-form');
|
|
|
|
var $openid_form = $('#openid-login-form');
|
|
|
|
|
|
|
|
// Change link text and triggers loginchange event.
|
|
|
|
$('#block-user-login .openid-link').toggle(
|
|
|
|
function() {
|
|
|
|
$(this).html(Drupal.t('Cancel OpenID login'));
|
|
|
|
$login_form.hide();
|
|
|
|
$openid_form.show();
|
|
|
|
clearStatus($login_form);
|
|
|
|
// Move focus to OpenID input.
|
|
|
|
$('#edit-openid-identifier').focus();
|
|
|
|
},
|
|
|
|
function() {
|
|
|
|
$(this).html(Drupal.t('Log in using OpenID'));
|
|
|
|
$login_form.show();
|
|
|
|
$openid_form.hide();
|
|
|
|
clearStatus($openid_form);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2007-07-01 15:37:10 +00:00
|
|
|
}
|
|
|
|
};
|
2012-10-24 03:28:47 +00:00
|
|
|
})(jQuery, Drupal);
|