// ==UserScript==
// @name            Accessible Specs
// @namespace       http://people.opera.com/rijk/opera/scripts/
// @description     Make the anchors in the headers on W3C specpages clickable
// @include         http://www.w3.org/TR/*
// ==/UserScript==

/*
Script source:
  Mark Schenk
  http://www.markschenk.com/webdesign/userjs/accessiblespecs.js
  On W3C specpages, such as the CSS2.1, this script makes the anchors in
  the headers clickable. So if you click on a header, the browser will
  jump to that fragment identifier and you can copy-paste the URL from the
  addressfield.

  This adaption made by Rijk van Geijtenbeek, 2005-03-25.
*/

(function() {
  var elements = document.body.childNodes;
  var headers = new Array();
  for (var i=0;i<elements.length;i++) {
    if (elements[i].nodeName.indexOf('H') != -1)
      headers.push(elements[i])
  }
  for(var j=0;j<headers.length; j++) {
    var tmp = headers[j].getElementsByTagName('A')[0];
    if (tmp && tmp.getAttribute('name')) {
      naam = tmp.getAttribute('name');
      tmp.setAttribute('href','#' + naam)
    }
  }
})();


