web/drupal/modules/openid/openid.js
branchdrupal
changeset 74 0ff3ba646492
equal deleted inserted replaced
73:fcf75e232c5b 74:0ff3ba646492
       
     1 // $Id: openid.js,v 1.6 2008/01/30 22:11:22 goba Exp $
       
     2 
       
     3 Drupal.behaviors.openid = function (context) {
       
     4   var $loginElements = $("#edit-name-wrapper, #edit-pass-wrapper, li.openid-link");
       
     5   var $openidElements = $("#edit-openid-identifier-wrapper, li.user-link");
       
     6 
       
     7   // This behavior attaches by ID, so is only valid once on a page.
       
     8   if (!$("#edit-openid-identifier.openid-processed").size() && $("#edit-openid-identifier").val()) {
       
     9     $("#edit-openid-identifier").addClass('openid-processed');
       
    10     $loginElements.hide();
       
    11     // Use .css("display", "block") instead of .show() to be Konqueror friendly.
       
    12     $openidElements.css("display", "block");
       
    13   }
       
    14   $("li.openid-link:not(.openid-processed)", context)
       
    15     .addClass('openid-processed')
       
    16     .click( function() {
       
    17        $loginElements.hide();
       
    18        $openidElements.css("display", "block");
       
    19       // Remove possible error message.
       
    20       $("#edit-name, #edit-pass").removeClass("error");
       
    21       $("div.messages.error").hide();
       
    22       // Set focus on OpenID Identifier field.
       
    23       $("#edit-openid-identifier")[0].focus();
       
    24       return false;
       
    25     });
       
    26   $("li.user-link:not(.openid-processed)", context)
       
    27     .addClass('openid-processed')
       
    28     .click(function() {
       
    29        $openidElements.hide();
       
    30        $loginElements.css("display", "block");
       
    31       // Clear OpenID Identifier field and remove possible error message.
       
    32       $("#edit-openid-identifier").val('').removeClass("error");
       
    33       $("div.messages.error").css("display", "block");
       
    34       // Set focus on username field.
       
    35       $("#edit-name")[0].focus();
       
    36       return false;
       
    37     });
       
    38 };