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