User:Green tentacle/monaco.js

/* Magic edit intro */ function addEditIntro(name) { var el = document.getElementById('ca-edit');

if (!el) return; if(typeof(el.href) == 'undefined') { el = el.getElementsByTagName('a')[0]; }

if (el) el.href += '&editintro=' + name; } if (wgNamespaceNumber == 0) { /*addOnloadHook(function{   if (document.getElementById('disambigbox'))      addEditIntro('Template:Disambig_editintro');  });*/ addOnloadHook(function{   var cats = document.getElementById('mw-normal-catlinks');    if (!cats)      return;    cats = cats.getElementsByTagName('a');    for (var i = 0; i < cats.length; i++) {      if (cats[i].title == 'Category:Wookieepedia featured articles') {        addEditIntro('Template:Featured');        break;      }      else if (cats[i].title == 'Category:Disambiguation pages') {        addEditIntro('Template:Disambig');        break;      }    }  }); }