User:Sannse/forumtools.js

if(wgCanonicalNamespace=='Forum') addOnloadHook(forumTools) function forumTools { var titles = getElementsByClassName(document, 'td', 'forum_title'); if(titles.length==0) return addPortletLink('p-cactions','javascript:forumPrune','Topic links only','ca-frune','show just forum topic links'); }

function forumPrune { var ftable = getElementsByClassName(document, 'table', 'forumlist'); var links = ftable[0].getElementsByTagName('a'); for(var i=0;i < links.length;i++) { if(links[i].parentNode.className!='forum_title') { links[i].parentNode.removeChild(links[i]); } } }