Highlight an active nav item

The left-side menu on this site highlights the active item by giving it a color. The effect kan achieved by a custom class and a script, both from Sarah Martin.

First, the CSS:

// HIGHLIGHT CURRENT NAV ITEM
.RSD_active {
  color: blue;
}

Second, the script that adds the .RSD_active class to, in this example, the .summary-title selector. If removed, the script will affect all the links that contain "contact", not only the summary used for the submenu.  

<script>
function secondaryNav(){
  var pageURL = window.location.pathname;

  if(Y.one('.summary-title [href="/contact"]')){
    if(pageURL == '/contact' || pageURL =='/contact/'){
     Y.one('.summary-title [href="/contact"]').addClass("RSD_active");
    }
  }

}

Y.on('domready', function(){
  secondaryNav();
});

function RSD_mo(){
  secondaryNav();
}

// init watch function
window.onload = watch;

function watch() {
  MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

  var a = new MutationObserver(function(a) {
    var moCount = 0;
    for (var b = 0; b < a.length; b++) {
      var c = a[b];

      if ("attributes" === c.type  && moCount === 0) {
        RSD_mo();

      }
     }
  });

  var options = { attributes : true, attributeFilter : ['id']};

  a.observe(document.body, options);
}
</script>