includes/clientside/static/toolbar.js
changeset 1227 bdac73ed481e
parent 582 a38876c0793c
equal deleted inserted replaced
1226:de56132c008d 1227:bdac73ed481e
     1 // Page toolbar - selecting buttons
     1 // Page toolbar - selecting buttons
     2 
     2 
     3 window.unselectAllButtonsMajor = function()
     3 window.unselectAllButtonsMajor = function()
     4 {
     4 {
     5   if ( !document.getElementById('pagebar_main') )
     5 	if ( !document.getElementById('pagebar_main') )
     6     return false;
     6 		return false;
     7   obj = document.getElementById('pagebar_main').firstChild;
     7 	obj = document.getElementById('pagebar_main').firstChild;
     8   while(obj)
     8 	while(obj)
     9   {
     9 	{
    10     if(obj.id == 'mdgToolbar_article' || obj.id == 'mdgToolbar_discussion')
    10 		if(obj.id == 'mdgToolbar_article' || obj.id == 'mdgToolbar_discussion')
    11     {
    11 		{
    12       $dynano(obj).rmClass('selected');
    12 			$dynano(obj).rmClass('selected');
    13     }
    13 		}
    14     obj = obj.nextSibling;
    14 		obj = obj.nextSibling;
    15   }
    15 	}
    16 }
    16 }
    17 
    17 
    18 window.unselectAllButtonsMinor = function()
    18 window.unselectAllButtonsMinor = function()
    19 {
    19 {
    20   if ( !document.getElementById('pagebar_main') )
    20 	if ( !document.getElementById('pagebar_main') )
    21     return false;
    21 		return false;
    22   obj = document.getElementById('pagebar_main').firstChild.nextSibling;
    22 	obj = document.getElementById('pagebar_main').firstChild.nextSibling;
    23   while(obj)
    23 	while(obj)
    24   {
    24 	{
    25     if ( !$dynano(obj).hasClass('selected') )
    25 		if ( !$dynano(obj).hasClass('selected') )
    26     {
    26 		{
    27       obj = obj.nextSibling;
    27 			obj = obj.nextSibling;
    28       continue;
    28 			continue;
    29     }
    29 		}
    30     if(obj.id != 'mdgToolbar_article' && obj.id != 'mdgToolbar_discussion')
    30 		if(obj.id != 'mdgToolbar_article' && obj.id != 'mdgToolbar_discussion')
    31     {
    31 		{
    32       if ( obj.className )
    32 			if ( obj.className )
    33         $dynano(obj).rmClass('selected');
    33 				$dynano(obj).rmClass('selected');
    34     }
    34 		}
    35     obj = obj.nextSibling;
    35 		obj = obj.nextSibling;
    36   }
    36 	}
    37 }
    37 }
    38 
    38 
    39 window.selectButtonMajor = function(which)
    39 window.selectButtonMajor = function(which)
    40 {
    40 {
    41   if ( !document.getElementById('pagebar_main') )
    41 	if ( !document.getElementById('pagebar_main') )
    42     return false;
    42 		return false;
    43   var dom = document.getElementById('mdgToolbar_'+which);
    43 	var dom = document.getElementById('mdgToolbar_'+which);
    44   if ( !dom )
    44 	if ( !dom )
    45     return false;
    45 		return false;
    46   if(typeof(dom) == 'object')
    46 	if(typeof(dom) == 'object')
    47   {
    47 	{
    48     unselectAllButtonsMajor();
    48 		unselectAllButtonsMajor();
    49     $dynano('mdgToolbar_'+which).addClass('selected');
    49 		$dynano('mdgToolbar_'+which).addClass('selected');
    50   }
    50 	}
    51 }
    51 }
    52 
    52 
    53 window.selectButtonMinor = function(which)
    53 window.selectButtonMinor = function(which)
    54 {
    54 {
    55   if ( !document.getElementById('pagebar_main') )
    55 	if ( !document.getElementById('pagebar_main') )
    56     return false;
    56 		return false;
    57   if(typeof(document.getElementById('mdgToolbar_'+which)) == 'object')
    57 	if(typeof(document.getElementById('mdgToolbar_'+which)) == 'object')
    58   {
    58 	{
    59     unselectAllButtonsMinor();
    59 		unselectAllButtonsMinor();
    60     $dynano('mdgToolbar_'+which).addClass('selected');
    60 		$dynano('mdgToolbar_'+which).addClass('selected');
    61   }
    61 	}
    62 }
    62 }
    63 
    63