User:Charibot/monaco.js

/* Edit links on category pages */

if(wgNamespaceNumber == 14) addOnloadHook(categoryEditLinks) function categoryEditLinks { var pagediv = document.getElementById('mw-pages'); if(!pagediv) return var pages = pagediv.getElementsByTagName('a'); if(pages.length == 0) return for(var i=pages.length-1;i>0;i--) { if(!pages[i].href) continue; var li = pages[i].parentNode; li.appendChild(document.createTextNode(' [')); var ea = document.createElement('a'); ea.appendChild(document.createTextNode('edit')); var url = (pages[i].href.indexOf('?') != -1) ? '&' : '?'   url = pages[i].href + url + 'action=edit'; ea.setAttribute('href',url); li.appendChild(ea); li.appendChild(document.createTextNode(']')); } }