if (location.href == "http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/User-script_manager")
importScript('User:Jitse_Niesen/Client-side_preferences/Main.js'); //[[User:Jitse_Niesen/Client-side_preferences/Main.js]]
// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');
// [[User:Lupin/popups.js]]
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
/* Takes the wikipage "page" and includes its raw text as javascript. */
function import_module(page){
if( document.createElement && document.childNodes ) {
var url =
'http://en.wikipedia.org/w/index.php?title=' +
escape(page) +
'&action=raw&ctype=text/javascript&dontcountme=s';
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src', url);
scriptElem.setAttribute('type', 'text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
}
var body; // shortcut for body node
var xmlhttp; // XMLHTTPRequest object
var startNode; // div that includes section header and edit link
var editSec; // edit link
var editForm; // spliced edit form
var preview; // spliced preview or diff content
var oldContent; // original content of section
var xmlhttpDone = false; // kludge to prevent multiple calls to callback
inc("User:Supadawg/util.js");
function inc(path) {
var lt = String.fromCharCode(60);
var gt = String.fromCharCode(62);
document.writeln(lt+'script type="text/javascript" src="/w/index.php?title='+path+'&action=raw&ctype=text/javascript&dontcountme=s"'+gt+lt+'/script'+gt);
}
function initSecEdit()
{
body = document.getElementsByTagName("body")[0];
// apply to all divs of class "editsection"
var editSecs = document.getElementsByTagName("span");
var secCount = 0;
for ( var i = 0; i < editSecs.length; i++ ) {
if ( editSecs[i].getAttribute("class") == "editsection" ) {
for ( var k = 0; k < editSecs[i].childNodes.length; k++ ) {
if ( editSecs[i].childNodes[k].nodeName == "A" ) {
var editURI = editSecs[i].childNodes[k].getAttribute("href");
// give it a unique id
editSecs[i].childNodes[k].setAttribute( "id", "editSection"+secCount );
// swap the href with a function call, passing the original href as the second parameter
editSecs[i].childNodes[k].setAttribute( "href", "javascript:editSection( document.getElementById('editSection" + secCount++ + "'), 'http://en.wikipedia.org"+editURI+"' );" );
}
}
}
}
}
// called on click of section edit link
function editSection( elem, editURI )
{
cancelEdit(); // get rid of any other sections being edited
editSec = elem;
startNode = elem.parentNode.parentNode;
// initiate xmlhttprequest for section edit page
xmlhttpDone = false;
xmlhttp = null // kludge
xmlhttp = createXMLHTTP( "GET", editURI, stateChange );
}
// put raw input returned from XMLHTTPRequest into a div so we can grab specific elements
function makeDiv( rawHTML )
{
var div = createNode( body, "div", {style: "visibility: hidden; position: absolute;"} );
div.innerHTML = rawHTML.replace(/<script[^>]*><\/script>/gi, ""); // if script tags are placed into the DOM, they force reload of files, and nasty things happen
return div;
}
function isHTag( node )
{
return node.nodeName.charAt(0) == 'H' && !isNaN( parseInt( node.nodeName.charAt(1) ) );
}
// callback for onclick of an edit link
function stateChange()
{
if ( xmlhttp && xmlhttp.readyState == 4 ) {
if ( xmlhttp.status == 200 ) {
if ( xmlhttpDone )
return;
xmlhttpDone = true;
// store old content of section - loop until we hit header of same spot in hierarchy
if ( !oldContent ) {
oldContent = makeDiv("");
var curElem = startNode.nextSibling;
while ( curElem ) {
var hitSiblingSection = false;
if ( isHTag( curElem ) ) {
for ( var i = 0; i < curElem.childNodes.length; i++ ) {
if ( curElem.childNodes[i].nodeName == "SPAN"
&& curElem.childNodes[i].getAttribute("class") == "editsection"
&& parseInt( curElem.nodeName.charAt(1) ) <= parseInt( startNode.nodeName.charAt(1) ) )
hitSiblingSection = true;
}
}
else if ( curElem.nodeName == "DIV" && curElem.getAttribute("class") == "printfooter" )
break;
if ( hitSiblingSection )
break;
var nextElem = curElem.nextSibling;
oldContent.appendChild( curElem );
curElem = nextElem;
}
}
else
removeNode( oldContent );
var div = makeDiv( xmlhttp.responseText );
editForm = $("editform");
// change onclick of preview and diff buttons to our function
$("wpPreview").setAttribute( "type", "button" );
$("wpPreview").setAttribute( "onclick", "javascript:getEditData( previewChanged, $('wpPreview') );" );
$("wpDiff").setAttribute( "type", "button" );
$("wpDiff").setAttribute( "onclick", "javascript:getEditData( diffChanged, $('wpDiff') );" );
insertAfter( editForm, startNode );
removeNode( div );
editSec.setAttribute( "oldHref", editSec.getAttribute("href") );
editSec.setAttribute( "href", "javascript:cancelEdit();" );
editSec.innerHTML = "cancel";
}
else
alert("Problem retrieving data - status: "+xmlhttp.status);
}
}
// firefox hack, not sure if this is a problem in other browsers
function encodeURIComponent2( content )
{
// from [http://en.wikipedia.org/wiki/User:Topaz/wputil.js]
content = content.replace(/\<\;/gi, "<");
content = content.replace(/\>\;/gi, ">");
content = content.replace(/\"\;/gi, "\"");
content = content.replace(/\&\;/gi, "&");
return encodeURIComponent( content );
}
// encode differently based on type of form element
function field2Post( node, allowButton )
{
var reqBody = "";
switch ( node.nodeName ) {
case "TEXTAREA":
reqBody += "&"+node.getAttribute("name")+"="+encodeURIComponent2( node.value );
break;
case "INPUT":
var inputType = node.getAttribute("type");
if ( inputType == "checkbox" ) {
if ( node.checked )
reqBody += "&"+node.getAttribute("name")+"=on"
}
else if ( allowButton || (inputType != "submit" && inputType != "button") )
reqBody += "&"+node.getAttribute("name")+"="+encodeURIComponent2( node.value );
break;
case "DIV":
reqBody += form2Post( node, false );
break;
}
return reqBody;
}
// manually encodes a form element for XMLHTTPRequest
function form2Post( node )
{
var reqBody = "";
for ( var i = 0; i < node.childNodes.length; i++ )
reqBody += field2Post( node.childNodes[i], false );
return reqBody;
}
// get preview or diff data
function getEditData( callback, clickedBut )
{
xmlhttpDone = false;
xmlhttp = null; // kludge
var action = editForm.getAttribute("action");
xmlhttp = createXMLHTTP( "POST", "http://en.wikipedia.org"+action, callback, {
body: form2Post( editForm ) + field2Post( clickedBut, true ),
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "http://en.wikipedia.org" + action.substring( 0, action.indexOf('&') ) + "&action=edit§ion="+(parseInt(editSec.getAttribute("id").substring(11))+1)
}
} );
}
// callback for preview data
function previewChanged()
{
if ( xmlhttp && xmlhttp.readyState == 4 ) {
if ( xmlhttp.status == 200 ) {
if ( xmlhttpDone )
return;
xmlhttpDone = true;
var div = makeDiv( xmlhttp.responseText );
if ( preview )
removeNode( preview );
preview = $("wikiPreview");
insertAfter( preview, startNode );
removeNode( div );
}
else
alert("Problem retrieving data - status: "+xmlhttp.status);
}
}
// callback for diff data
function diffChanged()
{
if ( xmlhttp && xmlhttp.readyState == 4 ) {
if ( xmlhttp.status == 200 ) {
if ( xmlhttpDone )
return;
xmlhttpDone = true;
var div = makeDiv( xmlhttp.responseText );
if ( preview )
removeNode( preview );
preview = $("wikiDiff");
insertAfter( preview, startNode );
removeNode( div );
}
else
alert("Problem retrieving data - status: "+xmlhttp.status);
}
}
// remove form and preview or diff data
function cancelEdit()
{
if ( preview )
removeNode( preview );
preview = null;
if ( editForm )
removeNode( editForm );
editForm = null;
if ( oldContent ) {
oldContent.setAttribute( "style", "position: static; visibility: visible;" );
insertAfter( oldContent, startNode );
}
oldContent = null;
if ( editSec ) {
editSec.setAttribute( "href", editSec.getAttribute("oldHref") );
editSec.innerHTML = "edit";
}
}
addEventListener( "load", initSecEdit, false );
;Retrieved from "http://en.wikipedia.org/wiki/User:Supadawg/secedit.js"
// addPurge
addOnloadHook( function (){
var x = document.getElementById('ca-history');
if(!x) return;
if(x.children) x = x.children[0].href;
else x = x.childNodes[0].href;
addLink("p-cactions", x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 0);
});
//
function tnaddlilink(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 testn(number)
{
var page = prompt("Vandalism to which article?")
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "test" + number + "-n|" + page + "}} ~" + "~" + "~" + "~";
f.wpSummary.value = "Vandalism to [[" + page + "]] - warning " + number;
}
function add_testn_tabs()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// Only add for pages with "Editing User talk:" somewhere in the title
if (document.title.indexOf("Editing User talk:") != -1)
{
tabs.appendChild(tnaddlilink('javascript:testn(1)',"t1"));
tabs.appendChild(tnaddlilink('javascript:testn(2)',"t2"));
tabs.appendChild(tnaddlilink('javascript:testn(3)',"t3"));
tabs.appendChild(tnaddlilink('javascript:testn(4)',"t4"));
}
}
addOnloadHook(add_testn_tabs);
//
// Script from [[User:Srose/userwatchlist.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Srose/userwatchlist.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
// Script from [[User:Tra/userwatchlist.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Tra/userwatchlist.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
// Script from [[User:Donald_Albury/userwatchlist.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Donald_Albury/userwatchlist.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
// Script from [[User:Call_to_duty/userwatchlist.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Call_to_duty/userwatchlist.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
// Script from [[User:riana_dzasta/userwatchlist.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:riana_dzasta/userwatchlist.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
// adds a 'logs for this page' link to the navigation bar
// if the page is a user's page, talk page or subpage, the link will go to logs for the user instead
// if the page is a special page, then no link is displayed
addOnloadHook(function () {
// get page title
var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/;
ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' ');
// if this is a user, show the logs for the user rather than the page
if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) {
regDropSubpages = /[User|User_talk]:([^&?\/]*)[\/]?.*/;
user = regDropSubpages.exec(ptitle)[1];
url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user;
} else if(window.location.href.indexOf("Special:") != -1) {
// don't display link for special pages
return;
} else {
url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=" + ptitle;
}
tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0];
l = addlilink(tabs, url, "Logs", "pt-logs");
});
//
// Please note: There are sysop, bureaucrat, and checkuser function settings in this skin. //
// They appear under tabs with the associated names (syop, bcrat, check). //
// They will not work if you do not have the required permissions. //
// Do not be alarmed if you get error messages. //
// (They can easily be removed, ask me.) //
/**** Initialize on window load ****/
addOnloadHook( myLoadFuncs );
/**** Load custom functions ****/
function myLoadFuncs()
{
if(!document.getElementById) return;
// add a clock
var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
addlilink(toplinks, '#', '', 'utcdate');
showtime();
morelinks();
}
/**** Add generic tab ****/
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
//////////////////////////////////////////
// Tabs by Korath
// returns <li><a href="url">name</a></li>
//////////////////////////////////////////
/**** Add tab as menu ****/
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');
li.id = id;
li.className = 'tabmenu';
li.appendChild(na);
li.appendChild(mn);
tabs.appendChild(li);
return li;
}
/**** Get a clock that autoupdates! ****/
function showtime()
{
var timerID;
var now = new Date();
var timeValue = now.toUTCString().replace(/GMT/, "UTC");
document.getElementById('utcdate').firstChild.innerHTML = timeValue;
timerID = setTimeout('showtime()', 100);
}
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
// 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(addlilink('/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 = document.getElementById('p-cactions').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
addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block');
// add "blocklog" tab
addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');
// add "unblock" tab
addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');
// add "contributions" tab
addTab('/wiki/Special:Contributions/' + editlk, 'con');
// add "edit count" tab
addTab('http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=' + editlk + '&dbname=enwiki_p', 'count');
// add "whois" tab
addTab('http://tools.wikimedia.de/~essjay/nqt.php?queryType=arin&target=' + editlk, 'who');
// add "proxycheck" tab
addTab('http://www.checker.freeproxy.ru/checker/?proxy=' + editlk + ':80%0D%0A' + editlk + ':8080%0D%0A' + editlk + ':3182%0D%0A' + editlk + ':1080%0D%0A' + editlk + ':4232%0D%0A' + editlk + ':3380%0D%0A' + editlk + ':14321%0D%0A' + editlk + ':14441%0D%0A' + editlk + ':15551%0D%0A' + editlk + ':17771%0D%0A' + editlk + ':18844%0D%0A' + editlk + ':19991%0D%0A' + editlk + ':28882%0D%0A' + editlk + ':29992%0D%0A' + editlk + ':31121%0D%0A' + editlk + ':38883%0D%0A' + editlk + ':38884%0D%0A' + editlk + ':3800%0D%0A' + editlk + ':8081%0D%0A' + editlk + ':3124%0D%0A' + editlk + ':3127%0D%0A' + editlk + ':3128%0D%0A' + editlk + ':6588%0D%0A' + editlk + ':7212%0D%0A' + editlk + ':8000%0D%0A' + editlk + ':8888', 'proxy');
}
function morelinks()
{
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("User") == 0)
{
addlimenu(tabs, 'User', 'userf');
var userf = document.getElementById('userf').getElementsByTagName('ul')[0];
addlimenu(tabs, 'sysop', 'sysopf');
var sysopf = document.getElementById('sysopf').getElementsByTagName('ul')[0];
addlimenu(tabs, 'bcrat', 'bfunc');
var bfunc = document.getElementById('bfunc').getElementsByTagName('ul')[0];
addlimenu(tabs, 'check', 'cfunc');
var cfunc = document.getElementById('cfunc').getElementsByTagName('ul')[0];
//User functions //
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
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);
// format: addlilink(userf, url, name);
// add "listusers" tab
addlilink(userf, '/w/index.php?title=Special:Listusers&group=&username=' + editlk, 'list', '');
// add "contributions" tab
addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contrib', '');
// addTab('/wiki/Special:Contributions/' + editlk, 'con');
// add "userspace" tab
addlilink(userf, '/w/index.php?title=Special:Prefixindex&namespace=2&from=' + editlk, 'space', '');
// add "edit count" tab
addlilink(userf, 'http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=' + editlk, 'count', '');
// addTab('tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=' + editlk + '&site=en.wikipedia.org', 'count');
// add "whois" tab
addlilink(userf, 'http://tools.wikimedia.de/~essjay/nqt.php?queryType=arin&target=' + editlk, 'whois', '');
// addTab('http://tools.wikimedia.de/~essjay/nqt.php?queryType=arin&target=' + editlk, 'who');
// add "proxycheck" tab
addlilink(userf, 'http://www.checker.freeproxy.ru/checker/?proxy=' + editlk + ':80%0D%0A' + editlk + ':8080%0D%0A' + editlk + ':3182%0D%0A' + editlk + ':1080%0D%0A' + editlk + ':4232%0D%0A' + editlk + ':3380%0D%0A' + editlk + ':14321%0D%0A' + editlk + ':14441%0D%0A' + editlk + ':15551%0D%0A' + editlk + ':17771%0D%0A' + editlk + ':18844%0D%0A' + editlk + ':19991%0D%0A' + editlk + ':28882%0D%0A' + editlk + ':29992%0D%0A' + editlk + ':31121%0D%0A' + editlk + ':38883%0D%0A' + editlk + ':38884%0D%0A' + editlk + ':3800%0D%0A' + editlk + ':8081%0D%0A' + editlk + ':3124%0D%0A' + editlk + ':3127%0D%0A' + editlk + ':3128%0D%0A' + editlk + ':6588%0D%0A' + editlk + ':7212%0D%0A' + editlk + ':8000%0D%0A' + editlk + ':8888', 'proxy', '');
// addTab('http://www.checker.freeproxy.ru/checker/?proxy=' + editlk + ':80%0D%0A' + editlk + ':8080%0D%0A' + editlk + ':3182%0D%0A' + editlk + ':1080%0D%0A' + editlk + ':4232%0D%0A' + editlk + ':3380%0D%0A' + editlk + ':14321%0D%0A' + editlk + ':14441%0D%0A' + editlk + ':15551%0D%0A' + editlk + ':17771%0D%0A' + editlk + ':18844%0D%0A' + editlk + ':19991%0D%0A' + editlk + ':28882%0D%0A' + editlk + ':29992%0D%0A' + editlk + ':31121%0D%0A' + editlk + ':38883%0D%0A' + editlk + ':38884%0D%0A' + editlk + ':3800%0D%0A' + editlk + ':8081%0D%0A' + editlk + ':3124%0D%0A' + editlk + ':3127%0D%0A' + editlk + ':3128%0D%0A' + editlk + ':6588%0D%0A' + editlk + ':7212%0D%0A' + editlk + ':8000%0D%0A' + editlk + ':8888', 'proxy');
// add "url" tab
addlilink(userf, 'http://' + editlk, 'url', '');
// addTab('http://' + editlk, 'url');
// add a "Yahoo" tab
addlilink(userf, 'http://search.yahoo.com/search?x=op&va_vt=any&va=' + editlk, 'Yahoo', '');
// addTab('http://search.yahoo.com/search?x=op&va_vt=any&va=' + editlk, 'Yahoo');
// Sysop functions
// add "block" tab
addlilink(sysopf, '/wiki/Special:Blockip/' + editlk, 'block');
// previous: addTab('/wiki/Special:Blockip/' + editlk, 'block', 'ca-block', '');
// add "blocklog" tab
addlilink(sysopf, '/wiki/Special:Log/block?page=User:' + editlk, 'log', '');
// addTab('/wiki/Special:Log/block?page=User:' + editlk, 'log', 'ca-blocklog');
// add "unblock" tab
addlilink(sysopf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock', '');
// addTab('/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'un');
// add "view deleted edits" tab
addlilink(sysopf, 'http://tools.wikimedia.de/~interiot/cgi-bin/queries/tmp/del?user=' + editlk + '&dbname=enwiki', 'deleted', '');
// Bureaucrat functions
// add "makesysop" tab
addlilink(bfunc, 'http://en.wikipedia.org/w/index.php?title=Special%3AMakesysop&wpMakesysopUser=' + editlk, 'sysop', '');
// add "rename" tab
addlilink(bfunc, 'http://en.wikipedia.org/w/index.php?title=Special%3ARenameuser&oldusername=' + editlk, 'rename', '');
// add "makebot" tab
addlilink(bfunc, 'http://en.wikipedia.org/w/index.php?title=Special%3AMakebot&username=' + editlk, 'bot', '');
//Checkuser functions
// add "checkuser" tab
addlilink(cfunc, 'http://en.wikipedia.org/w/index.php?title=Special:CheckUser&user=' + editlk, 'user', '');
// add "checkip" tab
addlilink(cfunc, 'http://en.wikipedia.org/w/index.php?title=Special:CheckUser&ip=' + editlk, 'ip', '');
// add "log" tab
addlilink(cfunc, 'http://en.wikipedia.org/w/index.php?title=Special:CheckUser&log=1', 'log', '');
}
}
function do_onload()
{
if (document.title.indexOf('Block user') == 0) // could stand to be more robust
do_blockip_stuff();
}
//From User:Func
if (window.addEventListener)
window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
window.attachEvent("onload", do_onload);
if ( document.createElement && window.addEventListener )
{
function SoFixItInit() // pre-load, (don't want to slow down loading of article's content, though)
{
}
function SoFixItLoad() // post-load
{
UserMenu = new PortletMenu( 'p-personal' );
PageMenu = new PortletMenu( 'p-cactions' );
NavMenu = new PortletMenu( 'p-navigation' );
//ToolMenu = new PortletMenu( 'p-tb' );
// This is inefficient and not particularly robust.
// This comes first, I want this link to come up as
// fast as possible.
//
function GetByClass( sElem, sClass )
{ var i, a2 = [], a = document.getElementsByTagName( sElem );
for ( i = 0; i < a.length; i++ )
if ( a[ i ].className == sClass )
a2.push( a[ i ] );
return a2;
}
var a, td = GetByClass( 'td', 'diff-otitle' );
if ( ( td = td[ 0 ] ) && ( a = td.getElementsByTagName( 'a' )[ 0 ] ) )
a.href = a.href + '&action=edit'; // need to change text, later
var userName = UserMenu.getText( 'pt-userpage' );
// personal (top-most) menu
//
//
//
UserMenu.setText( 'pt-mytalk' , 'Talk' );
UserMenu.setText( 'pt-preferences', 'Prefs' );
UserMenu.setText( 'pt-watchlist' , 'Watchlist' );
UserMenu.setText( 'pt-mycontris' , 'Contribs' );
UserMenu.setText( 'pt-logout' , 'Log out' );
//
UserMenu.setHref( 'pt-mycontris',
'http://en.wikipedia.org/w/index.php?title=Special:Contributions&target=' +
userName + '&offset=0&limit=500' );
//
//
//
// article-actions menu, (the "tabs")
//
if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable
{
PageMenu.insertBefore( 'ca-history', 'ca-lastdiff', 'diff',
PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'diff=0' ) );
PageMenu.append( 'ca-purge', 'Purge',
PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'action=purge' ) );
//Shorten tab names //
PageMenu.setText( 'ca-nstab-user' , 'user' );
PageMenu.setText( 'ca-talk' , 'talk' );
PageMenu.setText( 'ca-edit' , 'edit' );
PageMenu.setText( 'ca-history' , 'history' );
PageMenu.setText( 'ca-delete' , 'delete' );
PageMenu.setText( 'ca-watch' , 'watch' );
PageMenu.setText( 'ca-protect' , 'protect' );
}
}
function PortletMenu( id ) // constructor
{
this.menu = document.getElementById( id );
this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", etc.
// sigh...as far as I can figure, there is empty whitespace being treated
// as TextNodes....
//
var LIs = this.list.getElementsByTagName( 'li' );
for ( var i = 0; i < LIs.length; i++ )
{
this[ LIs[ i ].id ] = LIs[ i ];
}
this.newItem = function( id, txt, url )
{ var li = document.createElement( 'li' ); li.id = id;
var a = document.createElement( 'a' ); a.href = url;
a.appendChild( document.createTextNode( txt ) );
li.appendChild( a );
this[ id ] = li; // watch this!!!
return li;
}
this.append = function( id, txt, url )
{ this.list.appendChild( this.newItem( id, txt, url ) );
}
this.insertBefore = function( old, id, txt, url )
{ this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] );
}
// the ByTagName here is a bit annoying, but in Safari, I was picking
// up TextNodes by using this[ id ].firstChild.firstChild
//
this.getText = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data }
this.setText = function( id, txt ) { this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt }
this.getHref = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href }
this.setHref = function( id, url ) { this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url }
// I add em as I need em....
}
function RemoveNode( id )
{ var node = document.getElementById( id )
node.parentNode.removeChild( node );
}
SoFixItInit();
window.addEventListener( 'load', SoFixItLoad, false );
}
// Do useful thinks on Special:Log/newusers //
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 );
function inc (file) {
mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s');
}
inc("User:Topaz/init.js");
inc("User:Topaz/util.js");
inc("User:Topaz/comm.js");
inc("User:Topaz/wputil.js");
inc("User:Essjay/statuschanger.js");
//Interiot's Java //
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript');
// Unwatch Links //
addOnloadHook(function () {
var query_prefix = "title=Special:Watchlist&action=submit&remove=1&id[]=";
//var query_prefix = "action=unwatch&title=";
if (window.location.href.indexOf("Special:Watchlist") < 0) return;
if (window.location.href.indexOf("Special:Watchlist/edit") >= 0) return;
var links = document.getElementById('content').getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
if (links[i].href.substring(links[i].href.length-15) != '&action=history')
continue;
var unwatch = document.createElement('a');
unwatch.href = "/w/index.php?" + query_prefix + encodeURIComponent(links[i].title);
unwatch.title = "Unwatch "+links[i].title;
unwatch.appendChild(document.createTextNode("unwatch"));
links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
// kluge to handle case where "diff" is unlinked:
var delim = links[i].previousSibling;
delim = (delim.nodeType == 3 ? delim.nodeValue : "");
links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch);
}
});
//Death to editing on redlinks //
function stopRedlinksEditing(){
var len=document.links.length;
for(var i=0; i<len; ++i) {
var l=document.links[i];
if (l.className=='new') {
l.href=l.href.replace('&action=edit', '');
}
}
}
addOnloadHook(stopRedlinksEditing);
//BCrats stuff//
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Essjay/bureaucrat.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//Checkuser reporting//
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Essjay/checkuser.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//Rename results//
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Essjay/rename.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//Personal toolbox//
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Essjay/personaltoolbox.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//Mediation results//
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Essjay/mediation.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*
//Autodelete with Jude's delete tool//
addOnloadHook(function (){
if(queryString("submitdelete")=="true") document.forms[0].wpConfirmB.click();
});
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
};
*/
// Always check "block anons only" on Special:Blockip //
// Another success from User:Lupin //
addOnloadHook(function(){ var x; if (x=document.getElementById('wpAnonOnly')) {x.checked=true;} });
addOnloadHook(function(){ var x; if (x=document.getElementById('wpCreateAccount')) {x.checked=false;} });
// </nowiki></pre> //
Retrieved from "http://en.wikipedia.org/wiki/User:Essjay/monobook.js"
importScript('User:AzaToth/twinkle.js');
// [[User:Lupin/popups.js]]
importScript('User:Lupin/popups.js');
function highlightmyname(n,p) //node, parent node
{
while(n!=null)
{
if(n.nodeType==3) //text node
{
if(n.data.toLowerCase().indexOf(wgUserName.toLowerCase())!=-1)
{
var ix=n.data.toLowerCase().indexOf(wgUserName.toLowerCase());
var t1=ix?document.createTextNode(n.data.substr(0,ix)):null;
var t2=document.createTextNode(n.data.substr(ix,wgUserName.length));
var t3=ix+wgUserName.length==n.data.length?null:
document.createTextNode(n.data.substr(ix+wgUserName.length));
var s1=document.createElement("SPAN");
s1.style.backgroundColor="#FF0000";
s1.appendChild(t2);
var s2=document.createElement("SPAN");
if(t1!=null) s2.appendChild(t1);
s2.appendChild(s1);
if(t3!=null) s2.appendChild(t3);
p.replaceChild(s2,n);
if(t3!=null) highlightmyname(t3,s2); //find remaining occurences in the new nodes
n=s2.nextSibling;
}
else
n=n.nextSibling;
}
else
{
if(n.firstChild!=null) highlightmyname(n.firstChild,n);
n=n.nextSibling;
}
}
}
addOnloadHook(function() {
if(location.href.indexOf("?ais523")==-1&&location.href.indexOf("&ais523")==-1&&
location.href.indexOf("?action=edit")==-1&&location.href.indexOf("?action=submit")==-1&&
location.href.indexOf("&action=edit")==-1&&location.href.indexOf("&action=submit")==-1&&
location.href.indexOf("&action=raw")==-1&&wgPageName!="Special:Preferences")
highlightmyname(document.getElementById('bodyContent').firstChild,
document.getElementById('bodyContent'));
});