[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/admin/toolbar/ -> admin_toolbar.js (source)

   1  // $Id: admin_toolbar.js,v 1.1.2.2 2009/06/08 00:52:46 yhahn Exp $
   2  
   3  Drupal.admin = Drupal.admin || {};
   4  Drupal.admin.toolbar = Drupal.admin.toolbar || {};
   5  
   6  Drupal.admin.toolbar.setActive = function(toolbar_id) {
   7    // Show the right toolbar
   8    $('#admin-toolbar .depth-1 ul.links').addClass('collapsed');
   9    $(toolbar_id).removeClass('collapsed');
  10    $('div#admin-toolbar, div#admin-toolbar .depth-1').removeClass('collapsed');
  11  
  12    // Switch link active class to corresponding menu item
  13    var link_id = toolbar_id.replace('admin-toolbar', 'admin-link');
  14    $('#admin-toolbar .depth-0 ul.links a').removeClass('active');
  15    $(link_id).addClass('active');
  16  }
  17  
  18  Drupal.behaviors.admin_toolbar = function(context) {
  19  
  20    // Primary menus
  21    $('#admin-toolbar .depth-0 ul.links a:not(.processed)').each(function() {
  22      var target = $(this).attr('id');
  23      if (target) {
  24        target = '#'+ target.replace('admin-link', 'admin-toolbar');
  25        if ($(target, '#admin-toolbar').size() > 0) {
  26          // If this link is active show this toolbar on setup
  27          if ($(this).parent().is('.active-trail')) {
  28            Drupal.admin.toolbar.setActive(target);
  29          }
  30          // Add click handler
  31          $(this).click(function() {
  32            Drupal.admin.toolbar.setActive(target);
  33            return false;
  34          });
  35        }
  36      }
  37      $(this).addClass('processed');
  38    });
  39  
  40    $('#admin-toolbar .depth-1 span.close:not(.processed)').each(function() {
  41      $(this).click(function() {
  42        $('#admin-toolbar .depth-1').addClass('collapsed');
  43        return false;
  44      });
  45      $(this).addClass('processed');
  46    });
  47  
  48    // Secondary menus
  49    $('#admin-toolbar .depth-1 ul.links:not(.processed)').each(function() {
  50      $(this).addClass('processed');
  51    });
  52  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7