User:CALR/dpl.js

addOnloadHook(addCountLinks);

function hidePagesOutsideArticleNamespace{ var body = document.getElementById('bodyContent'); if( !body ){ return; }

if (document.getElementById('dpl_banner')) { open(document.URL, "_self"); //refresh the page return; }

var lists = body.getElementsByTagName( "ul" ); for ( var j=0; j (redirect page)' ) == -1 &&        ( link.innerHTML.indexOf( 'href="/wiki/Talk:' ) != -1 ||           link.innerHTML.indexOf( 'href="/wiki/Template talk:' ) != -1 || link.innerHTML.indexOf( 'href="/wiki/Wikipedia:' ) != -1 ||         link.innerHTML.indexOf( 'href="/wiki/Wikipedia_talk:' ) != -1 || link.innerHTML.indexOf( 'href="/wiki/User:' ) != -1 ||         link.innerHTML.indexOf( 'href="/wiki/User_talk:' ) != -1 )     ) {      links[i].style.display = 'none'; } }

var banner = document.createElement("div"); banner.id = "dpl_banner"; banner.style.backgroundColor = "yellow"; banner.style.fontSize = 'larger'; banner.innerHTML = "DPL MODE ON"; body.insertBefore(banner,body.childNodes[0] );

}

function addCountLinks{ if (!document.URL.match('Special:Whatlinkshere')) { return; } // only add toolbox link on 'whatlinkshere' pages

var target = document.getElementById('p-tb').getElementsByTagName( "ul" ); if( target.length == 0 ){ return; } //no toolbox to hook into

target = target[0]; var newTool = document.createElement("li"); target.appendChild( newTool ); newTool.innerHTML = 'DPL mode'; }