//-------------------BASIC SCRIPTS ---------------------------------
// ***********Add LI link-script***********
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
// ***********addlimenu***********
function addlimenu(tabs, name, id)
{
var na = document.createElement('a');
na.href = '';
var mn = document.createElement('ul');
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.className = 'tabmenu';
li.appendChild(na);
li.appendChild(mn);
tabs.appendChild(li);
return li;
}
//***********addTab script***********
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
// ***********addToolboxLink script***********
function addToolboxLink(url, name, id){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
// addlilink(tb, url, name, id);
addlilink(tb, '/wiki/Special:Newpages', 'New pages', '');
addlilink(tb, '/wiki/Special:Log', 'Logs', '');
}
//***********Replace function***********
function replace()
{
var s = prompt("Search regexp?");
if(s){
var r = prompt("Replace regexp?");
if(!r && r != '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "g"), r);
}
}
//-------------------BASIC SCRIPTS END HERE---------------------------------
//***FUNC'S NEW USERS PATROL SCRIPT***
// name
function addlilinkb(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;
}
// Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&faketarget;=username" is present.
function do_blockip_stuff()
{
// focus on Reason field
document.getElementsByName('wpBlockReason')[0].focus();
// 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(addlilinkb('/w/index.php?title=Special%3ALog&type;=block&user;=&page;=User%3A' + target, 'blocklog'));
}
// Opens the block log in the current window, and Special:Blockip in a popup.
// Width, height, top, and left are chosen for a 1600x1200 display.
//function blockpage_and_log(target)
//{
// window.open('Special_Blockip.html?foo=blarg&faketarget;=' + target, 'Block', 'width=1600,height=600,top=600,left=0');
// document.location.href = 'http://en.wikipedia.org/w/index.php?title=Special%3ALog&type;=block&user;=&page;=User%3A' + target;
//}
// 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(addlilinkb('/w/index.php?title=Special%3ABlockip&faketarget;=' + editlk, 'block'));
// To open the block page and block log simultaneously, replace the above line with:
// tabs.appendChild(addlilinkb('javascript:blockpage_and_log("' + editlk + '")', 'Block'));
// and uncomment the blockpage_and_log() function above.
// add "blocklog" tab
tabs.appendChild(addlilinkb('/w/index.php?title=Special%3ALog&type;=block&user;=&page;=User%3A' + editlk, 'blocklog'));
}
function do_onload()
{
if (document.title.indexOf('User:') == 0
|| document.title.indexOf('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);
//AUTO-VFD
// This needs to change depending on skin used.
function add_link(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
tabs.appendChild(li);
}
function strip_namespace(target)
{
var colon = target.indexOf(':');
if (colon != -1)
{
var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');
var ns = target.substring(0, colon);
if (ns == '' || ns == 'Talk')
return target.substring(colon + 1);
else
for (var i = 0; i < spaces.length; ++i)
{
if (ns == spaces[i]
|| ns == spaces[i] + '_talk')
return target.substring(colon + 1);
}
}
return target;
}
function vfd()
{
document.editform.wpTextbox1.value = '{{' + 'subst:vfd}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'vfd';
var target = document.editform.action;
target = target.substring(target.indexOf('title=') + 6,
target.lastIndexOf('&action;=submit'));
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var date = new Date();
date = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();
var pagename = strip_namespace(target);
window.open('/w/index.php?title=Wikipedia:Votes_for_deletion/' + pagename + '&action;=edit&fakeaction;=vfdsub&faketarget;=' + target,
'Vfd ' + unescape(target),
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
window.open('/w/index.php?title=Wikipedia:Votes_for_deletion/Log/' + date + '&action;=edit&fakeaction;=vfdlist&faketarget;=' + pagename,
'VfdLog ' + unescape(target),
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}
function autovfd()
{
if (document.title.indexOf('Editing ') == 0)
{
var action = '';
var target = '';
if (location.search)
{
var l = location.search.substring(1).split('&');
for (var i = 0; i < l.length; ++i)
{
var eq = l[i].indexOf('=');
var name = l[i].substring(0, eq);
if (name == 'fakeaction')
action = l[i].substring(eq + 1);
else if (name == 'faketarget')
target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
}
}
if (action == 'vfdlist')
{
document.editform.wpTextbox1.value += '{{' + 'Wikipedia:Votes for deletion/' + target + '}}\n';
document.editform.wpSummary.value = 'Wikipedia:Votes_for_deletion/'_+_target_+_'';
}
else if (action == 'vfdsub')
{
if (document.editform.wpTextbox1.value.length > 0)
{
target = document.editform.action;
target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action;=submit'))).replace(/_/g, ' ');
window.alert("There's an old vfd at the default location already.\n\n" +
'Please either move it out of the way (and update existing links to it), or file the Vfd by hand in another location (such as '_+_target_+_'_(2)).');
}
else
document.editform.wpTextbox1.value += '==='_+_target_+_'===\n' +
'Reason for nomination. ~~' + '~~\n*\n*\n*\n';
}
else
add_link('javascript:vfd()', 'Vfd');
}
}
if (window.addEventListener)
window.addEventListener('load', autovfd, false);
else if (window.attachEvent)
window.attachEvent('onload', autovfd);
//Scripts from User:JesseW.
//************************************ Edit lead section *****************************
//From http://en.wikipedia.org/w/index.php?title=User:ABCD/monobook.js&oldid;=19452182
function addEditSection0(){
ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
if(!document.getElementById) return;
var x = document.getElementById('ca-edit');
if(!x) return;
var y = document.createElement('LI');
y.id = 'ca-edit-0';
if(x.className == 'selected'){
if(/&action;=edit§ion;=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if(x.className == 'selected istalk'){
if(/&action;=edit§ion;=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
var z = document.createElement('A');
if(x.children){
z.href = x.children[0].href + '§ion;=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
}else{
z.href = x.childNodes[0].href + '§ion;=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
}
//************************************ Purge cache tab *****************************
// From http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts
function addPurge(){
ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
var x = document.getElementById('ca-history');
if(!x) return;
if(x.children) x = x.children[0].href;
else x = x.childNodes[0].href;
addTab(x.replace(/=history/, "=purge"), 'purge', 'ca-purge');
akeytt();
}
if (window.addEventListener) window.addEventListener("load", addPurge, false);
else if (window.attachEvent) window.attachEvent("onload", addPurge);
//************************************ Changes since I last edited
//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid;=20755510
function addSinceTab() {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if (window.location.href.indexOf("&action;=history&gotosince;=true")!=-1) {
do_since_I_last_edited()
}
else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) {
var thetitle=document.title.slice(0, String(document.title).indexOf(" - "));
var l=addlilink(tabs, "/w/index.php?title="+thetitle+"&action;=history&gotosince;=true", 'since', '');
l.lastChild.title="Changes since I last edited";
}
}
function do_since_I_last_edited() {
var csub=document.getElementById("contentSub");
var msg=document.createElement("p");
msg.appendChild(document.createTextNode
("Parsing history... please wait..."));
msg.className="error";
csub.insertBefore(msg, csub.firstChild)
var username=document.getElementById("pt-userpage").textContent;
var hists=document.getElementById("pagehistory").childNodes;
for (n=0;n
//Lupin's Popup navigation script // User:Lupin/popups.js - please include this line document.write(''); popupAdminLinks=true; // optional: enable admin links popupStructure='fancy2'; //Under development = popupsdev.js // ***BLOCK IP SCRIPT*** // Returns// Released into the public domain by User:Func // function NUPatrol() { if ( ( window.location.href.indexOf( 'Special%3ALog&type;=newusers' ) == -1 ) && ( window.location.href.indexOf( 'Special:Log/newusers' ) == -1 ) ) return; // make more robust??? 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, linkColor ) { var a = document.createElement( 'a' ); a.appendChild( document.createTextNode( txt ) ); a.href = url; if ( plainlinks ) a.className = 'plainlinks'; if ( linkColor ) { if ( typeof linkColor == "string" ) a.style.color = linkColor; else a.style.color = '#FF0000'; // old default behavior } 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, '#000088' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'blocks', '/w/index.php?title=Special%3ALog&type;=block&page;=User%3A' + name, true, '#008800' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'is blocked?', '/wiki/Special:Ipblocklist?action=search&ip;=' + name, true, '#888800' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'do block!', '/w/index.php?title=Special:Blockip&ip;=' + name, true, '#880000' ), 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 ); //