User:RockMFR/editintros.js

/** Magic editintros **************************************************** * * Description: Adds editintros on disambiguation pages and BLP pages. * Maintainers: User:RockMFR */

function addEditIntro(name) { var el = document.getElementById('ca-edit'); if (!el) return; el = el.getElementsByTagName('a')[0]; if (el) el.href += '&editintro=' + name; }

if (wgNamespaceNumber == 0) { addOnloadHook(function{   if (document.getElementById('disambig'))      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:Living people') {        addEditIntro('Template:BLP_editintro');        break;      }    }  }); }