diff options
Diffstat (limited to 'modules/openid')
-rw-r--r-- | modules/openid/openid.css | 2 | ||||
-rw-r--r-- | modules/openid/openid.js | 37 | ||||
-rw-r--r-- | modules/openid/openid.module | 4 |
3 files changed, 23 insertions, 20 deletions
diff --git a/modules/openid/openid.css b/modules/openid/openid.css index 2685eef03..aa6c8e667 100644 --- a/modules/openid/openid.css +++ b/modules/openid/openid.css @@ -1,6 +1,6 @@ /* $Id$ */ -a.openid-link, a.user-link, #edit-openid-url { +a.openid-link, #edit-openid-url { background-image: url("login-bg.png"); background-position: 0% 50%; background-repeat: no-repeat; diff --git a/modules/openid/openid.js b/modules/openid/openid.js index 75ffec394..73552e47e 100644 --- a/modules/openid/openid.js +++ b/modules/openid/openid.js @@ -1,35 +1,38 @@ // $Id$ Drupal.behaviors.openid = function (context) { + var $loginElements = $("#edit-name-wrapper, #edit-pass-wrapper, a.openid-link"); + var $openidElements = $("#edit-openid-url-wrapper, a.user-link"); + // This behavior attaches by ID, so is only valid once on a page. if (!$("#edit-openid-url.openid-processed").size() && $("#edit-openid-url").val()) { $("#edit-openid-url").addClass('openid-processed'); - $("#edit-name-wrapper").hide(); - $("#edit-pass-wrapper").hide(); - $("#edit-openid-url-wrapper").show(); - $("a.openid-link").hide(); - $("a.user-link").show(); + $loginElements.hide(); + // Use .css("display", "block") instead of .show() to be Konqueror friendly. + $openidElements.css("display", "block"); } $("a.openid-link:not(.openid-processed)", context) .addClass('openid-processed') .click( function() { - $("#edit-pass-wrapper").hide(); - $("#edit-name-wrapper").fadeOut('medium', function() { - $("#edit-openid-url-wrapper").fadeIn('medium'); - }); - $("a.openid-link").hide(); - $("a.user-link").show(); + $loginElements.hide(); + $openidElements.css("display", "block"); + // Remove possible error message. + $("#edit-name, #edit-pass").removeClass("error"); + $("div.messages.error").hide(); + // Set focus on OpenID URL field. + $("#edit-openid-url")[0].focus(); return false; }); $("a.user-link:not(.openid-processed)", context) .addClass('openid-processed') .click(function() { - $("#edit-openid-url-wrapper").hide(); - $("#edit-pass-wrapper").show(); - $("#edit-name-wrapper").show(); - $("a.user-link").hide(); - $("a.openid-link").show(); + $openidElements.hide(); + $loginElements.css("display", "block"); + // Clear OpenID URL field and remove possible error message. + $("#edit-openid-url").val('').removeClass("error"); + $("div.messages.error").css("display", "block"); + // Set focus on username field. + $("#edit-name")[0].focus(); return false; }); }; - diff --git a/modules/openid/openid.module b/modules/openid/openid.module index 056429916..084783245 100644 --- a/modules/openid/openid.module +++ b/modules/openid/openid.module @@ -84,8 +84,8 @@ function openid_form_alter(&$form, $form_state, $form_id) { $form['#validate'] = array('openid_login_validate'); } - $form['openid_link'] = array('#value' => l(t('Log in using OpenID'), '#', array('attributes' => array('class' => 'openid-link')))); - $form['user_link'] = array('#value' => l(t('Cancel OpenID login'), '#', array('attributes' => array('class' => 'user-link')))); + $form['openid_link'] = array('#value' => l(t('Log in using OpenID'), '#', array('attributes' => array('class' => 'openid-link'))), '#weight' => 3); + $form['user_link'] = array('#value' => l(t('Cancel OpenID login'), '#', array('attributes' => array('class' => 'user-link'))), '#weight' => 3); $form['openid_url'] = array( '#type' => 'textfield', |