github.com/mgood/deis@v1.0.2-0.20141120022609-9a185b756e7d/controller/web/static/js/checkURL.js (about)

     1  //Remove <ul> from Releases
     2  $('.toctree-l1 > a:contains("Releases")').siblings().remove();
     3  
     4  //Check URL
     5  var path = window.location.pathname.split('/');
     6  var cleanedPath = $.grep(path,function(n){ return(n) });
     7  
     8  // the second to last path segment is the section
     9  // unless there's only 1 segment
    10  if (cleanedPath.length == 1) {
    11      path = cleanedPath[0];
    12  } else {
    13      path = cleanedPath[cleanedPath.length-2];
    14  }
    15  
    16  switch(path) {
    17    case 'understanding_deis':
    18      $('.toctree-l1 > a:contains("Understanding Deis")').attr('state', 'open');
    19      break;
    20    case 'installing_deis':
    21      $('.toctree-l1 > a:contains("Installing Deis")').attr('state', 'open');
    22      break;
    23    case 'using_deis':
    24      $('.toctree-l1 > a:contains("Using Deis")').attr('state', 'open');
    25      break;
    26    case 'managing_deis':
    27      $('.toctree-l1 > a:contains("Managing Deis")').attr('state', 'open');
    28      break;
    29    case 'troubleshooting_deis':
    30      $('.toctree-l1 > a:contains("Troubleshooting Deis")').attr('state', 'open');
    31      break;
    32    case 'customizing_deis':
    33      $('.toctree-l1 > a:contains("Customizing Deis")').attr('state', 'open');
    34      break;
    35    case 'contributing':
    36      $('.toctree-l1 > a:contains("Contributing")').attr('state', 'open');
    37      break;
    38    case 'reference':
    39    case 'client':
    40    case 'server':
    41    case 'terms':
    42      $('.toctree-l1 > a:contains("Reference Guide")').attr('state', 'open');
    43      break;
    44    default:
    45      $('.toctree-l1 > a:contains("Version")').attr('state', 'close');
    46      break;
    47  }