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

attach, block, click, context, cookie, false, form-item-openid-identifier, form-item-pass, function, if, jquery, php, return, var

The openid.js Drupal example source code

// $Id: openid.js,v 1.13 2010/03/22 18:55:45 dries Exp $
(function ($) {

Drupal.behaviors.openid = {
  attach: function (context) {
    var loginElements = $('.form-item-name, .form-item-pass, li.openid-link');
    var openidElements = $('.form-item-openid-identifier, li.user-link');
    var cookie = $.cookie('Drupal.visitor.openid_identifier');

    // This behavior attaches by ID, so is only valid once on a page.
    if (!$('#edit-openid-identifier.openid-processed').size()) {
      if (cookie) {
      if ($('#edit-openid-identifier').val()) {
        // Use .css('display', 'block') instead of .show() to  Konqueror friendly.
        openidElements.css('display', 'block');

    $('li.openid-link:not(.openid-processed)', context)
      .click(function () {
         openidElements.css('display', 'block');
        // Remove possible error message.
        $('#edit-name, #edit-pass').removeClass('error');
        // Set focus on OpenID Identifier field.
        return false;
    $('li.user-link:not(.openid-processed)', context)
      .click(function () {
         loginElements.css('display', 'block');
        // Clear OpenID Identifier field and remove possible error message.
        $('div.messages.error').css('display', 'block');
        // Set focus on username field.
        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.