/* <nowiki> */
function changeLinks(){
if(!document.getElementById) return;
// document.getElementById('pt-userpage').firstChild.innerHTML = 'me';
document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist';
document.getElementById('pt-preferences').firstChild.innerHTML = 'prefs';
document.getElementById('pt-mycontris').firstChild.innerHTML = 'contribs';
document.getElementById('pt-logout').firstChild.innerHTML = 'log out';
document.getElementById('ca-talk').firstChild.innerHTML = 'talk';
document.getElementById('ca-edit').firstChild.innerHTML = 'edit this page';
}
function myLoadFuncs(){
changeLinks();
}
if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
function addlilink(tabs, url, name, id) {
var na = document.createElement('a');
na.href = url;
na.id = id;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function addtab(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
var txt = document.createTextNode(name);
na.appendChild(txt);
var li = document.createElement('li');
li.appendChild(na);
return li;
}
function vandal(tmplt, summ) {
var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n';
txt.value += '{{subst:' + tmplt + '}} ~~~~';
txt.focus();
txt = document.editform.wpSummary;
txt.value = summ
document.editform.wpWatchthis.checked = false;
}
function speedy (criterion) {
var form = document.forms.deleteconfirm;
form.wpReason.value = criterion;
}
function morelinks() {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("Editing User talk:") == 0) {
addlilink(tabs, 'javascript:vandal("User:Rdsmith4/test", "test")', '1', '');
addlilink(tabs, 'javascript:vandal("User:Rdsmith4/test2", "test2")', '2', '');
addlilink(tabs, 'javascript:vandal("test3", "test3")', '3', '');
addlilink(tabs, 'javascript:vandal("test4", "test4")', '4', '');
addlilink(tabs, 'javascript:vandal("test5", "test5")', '5', '');
addlilink(tabs, 'javascript:vandal("spam", "spam")', 's1', '');
addlilink(tabs, 'javascript:vandal("spam3", "spam3")', 's3', '');
addlilink(tabs, 'javascript:vandal("spam4", "spam4")', 's4', '');
}
if(document.title.indexOf("Confirm delete - Delete") == 0) {
addlilink(tabs, 'javascript:speedy("nonsense")', 'no', '');
addlilink(tabs, 'javascript:speedy("remove redirect for page move")', 're', '');
addlilink(tabs, 'javascript:speedy("misleading redirect")', 'mr', '');
addlilink(tabs, 'javascript:speedy("talk page with no useful history")', 'tu', '');
addlilink(tabs, 'javascript:speedy("talk page of deleted article")', 'td', '');
}
}
// Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&faketarget=username" is present.
function do_blockip_stuff()
{
// Look for a &faketarget= for the username/ip
var l = location.search.substring(1).split('&');
var target = '';
for (var i = 0; i < l.length; ++i)
{
var n = l[i].indexOf('=');
if (l[i].substring(0, n) == 'faketarget')
{
target = l[i].substring(n + 1);
break;
}
}
if (target == '')
return;
// put account name in "IP Address/username" field
var addr = document.getElementsByName('wpBlockAddress')[0];
addr.value = unescape(target);
// add "blocklog" tab
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
tabs.appendChild(addtab('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target, 'log'));
}
// Adds "block" and "blocklog" tabs to User: and User talk: pages.
function add_block_tab()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// use the "edit this page" tab to get already-tidied url
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
// cut everything up to "title=" from the start and everything past "&action=edit" from the end
editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
editlk = editlk.substring(editlk.indexOf(':') + 1);
var slloc = editlk.indexOf('/');
if (slloc > 0)
editlk = editlk.substring(0, slloc);
// add "block" tab
tabs.appendChild(addtab('/w/index.php?title=Special%3ABlockip&faketarget=' + editlk, 'Block'));
// add "blocklog" tab
tabs.appendChild(addtab('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'log'));
}
function do_onload()
{
if (document.title.indexOf('User:') == 0
|| document.title.indexOf('User talk:') == 0
|| document.title.indexOf('Editing User:') == 0
|| document.title.indexOf('Editing User talk:') == 0)
add_block_tab();
else if (document.title.indexOf('Block user') == 0) // could stand to be more robust
do_blockip_stuff();
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
window.attachEvent("onload", do_onload);
window.onload = Main;
function Main() {
morelinks();
}
// The following is modified from Func's new-page-patrol scripts:
// http://en.wikipedia.org/wiki/User:Func/wpfunc/nupatrol.js
function NUPatrol()
{
if ( window.location.href.indexOf( 'Special:Log/newusers' ) < 0 &&
window.location.href.indexOf( '&type=newusers' ) < 0 ) return;
var items, item, i, links, user, name, talk, contribs, insertLoc, link;
items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );
function NewLink( txt, url, plainlinks )
{ var a = document.createElement( 'a' );
a.appendChild( document.createTextNode( txt ) );
a.href = url;
if ( plainlinks ) a.className = 'plainlinks';
return a;
}
for ( i = 0; i < items.length; i++ )
{
item = items[ i ];
links = item.getElementsByTagName( 'a' );
user = links[ 0 ]; name = user.firstChild.nodeValue;
talk = links[ 2 ]; talk.firstChild.nodeValue = 'talk'; // lowercase 'Talk' for consistency
contribs = links[ 3 ];
insertLoc = user.nextSibling; // ' newusers '
item.insertBefore( document.createTextNode( ' ( ' ), insertLoc );
item.insertBefore( talk, insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( contribs, insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'actions', '/w/index.php?title=Special%3ALog&user=' + name, true), insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'log', '/w/index.php?title=Special%3ALog&type=block&page=User%3A' + name, true ), insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'list', '/wiki/Special:Ipblocklist?action=search&ip=' + name, true ), insertLoc );
item.insertBefore( document.createTextNode( ', ' ), insertLoc );
item.insertBefore( NewLink( 'block', '/w/index.php?title=Special:Blockip&ip=' + name, true ), insertLoc );
item.insertBefore( document.createTextNode( ' )' ), insertLoc );
item.removeChild( insertLoc.nextSibling ); // should remove the span
item.removeChild( insertLoc ); // should remove ' newusers ' text
}
}
if ( window.addEventListener ) window.addEventListener( 'load', NUPatrol, false );
else if ( window.attachEvent ) window.attachEvent( 'onload', NUPatrol );
/* </nowiki> */