home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (openid.js)

This example Drupal source code file (openid.js) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

block, click, context, display, edit-name, edit-openid-identifier, edit-pass, edit-pass-wrapper, error, false, function, php, return, var

The openid.js Drupal example source code

// $Id: openid.js,v 1.6 2008/01/30 22:11:22 goba Exp $

Drupal.behaviors.openid = function (context) {
  var $loginElements = $("#edit-name-wrapper, #edit-pass-wrapper, li.openid-link");
  var $openidElements = $("#edit-openid-identifier-wrapper, li.user-link");

  // This behavior attaches by ID, so is only valid once on a page.
  if (!$("#edit-openid-identifier.openid-processed").size() && $("#edit-openid-identifier").val()) {
    $("#edit-openid-identifier").addClass('openid-processed');
    $loginElements.hide();
    // Use .css("display", "block") instead of .show() to be Konqueror friendly.
    $openidElements.css("display", "block");
  }
  $("li.openid-link:not(.openid-processed)", context)
    .addClass('openid-processed')
    .click( function() {
       $loginElements.hide();
       $openidElements.css("display", "block");
      // Remove possible error message.
      $("#edit-name, #edit-pass").removeClass("error");
      $("div.messages.error").hide();
      // Set focus on OpenID Identifier field.
      $("#edit-openid-identifier")[0].focus();
      return false;
    });
  $("li.user-link:not(.openid-processed)", context)
    .addClass('openid-processed')
    .click(function() {
       $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");
      // Set focus on username field.
      $("#edit-name")[0].focus();
      return false;
    });
};

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal openid.js source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.