Jump to content

User:Jimbojw/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
 /**
  * Replaces Cite links with direct links to the cited page (skips the in-page jump).
  */
 addOnloadHook(function(){
     var
         links = document.getElementsByTagName('a'),
         re = /#(cite_note-.*)$/;
     for (var i = 0, l = links.length; i<l; i++) {
         var
             a = links[i],
             m = a.href.match(re);
         if (m) {
             var
                 t = document.getElementById(m[1]),
                 u = t.getElementsByTagName('a')[1];
             if (u) {
                 a.href = u.href;
             }
         }
     }
 });