User:Theda/monobook.js

importScript('User:Henrik/js/automod.js');

//

// User:Lupin/popups.js

// Helper tools

mw.loader.load(

'https://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js'

+ '&action=raw&ctype=text/javascript&dontcountme=s');

//

//popups!

mw.loader.load(

'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'

+ '&action=raw&ctype=text/javascript&dontcountme=s');

popupAdminLinks=true;

//

//{{PAGENAME}}

// Useful stuff from Wikipedia:WikiProject_User_scripts

function addToolboxLink(url, name, id){

var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];

addlilink(tb, url, name, id);

}

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;

}

function addTab(url, name, id, title, key){

var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

addlilink(tabs, url, name, id, title, key);

}

// culled from User:Lupin/popups.js

function nichalp_articleFromURL(h) {

if (typeof h != 'String') h=String(h);

h=decodeURI(h);

var m=RegExp('[^:]*://en\\.wikipedia\\.org/(wiki/|w/index\\.php\\?title=)([^&?]*)').exec(h);

if(m===null) return null;

return m[2];

}

function nichalp_isIpUser(user) {

return RegExp('(User:)?' +

'((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}' +

'(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])')

.test(user);

}

function nichalp_removeAnchor(article) {

// is there a #? if not, we're done

var i=article.indexOf('#');

if (i == -1) return article;

return article.substring(0,i);

}

function nichalp_userName(article) {

var i=article.indexOf('User');

var j=article.indexOf(':');

if (i != 0 || j == -1) return null;

var k=article.indexOf('/');

if (k==-1) return article.substring(j+1);

else return article.substring(j+1,k);

}

// do it

function nichalp_customLinks() {

var article=nichalp_articleFromURL(document.location.href);

if (!article) return;

var user=nichalp_userName(article);

if(!user) return;

user=nichalp_removeAnchor(user);

if (!nichalp_isIpUser(user)) {

addToolboxLink('http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki&user='+user, user+"'s edit count", 'toolbox_katestool');

}

var special='http://en.wikipedia.org/w/index.php?title=Special:';

addToolboxLink(special + 'Log&user='+user, user+"'s log", 'toolbox_userlog');

addToolboxLink(special + 'Blockip&ip='+user, 'Block '+user, 'toolbox_blockuser');

addToolboxLink(special + 'Ipblocklist&action=unblock&ip='+user, 'Unblock '+user, 'toolbox_unblockuser');

}

// make it all happen on page load

if (window.addEventListener) window.addEventListener("load",nichalp_customLinks,false);

else if (window.attachEvent) window.attachEvent("onload",nichalp_customLinks);

else {

window._old_nichalp_onload = window.onload;

window.onload = function() { window._old_nichalp_onload(); nichalp_customLinks(); }

}

//this helps automate AfD closing by adding a 'close' tab to AfD debates

//written by User:Johnleemk based on Wikipedia:WikiProject User scripts/Scripts/test-n.js by User:Celestianpower

function afdaddlilink(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 result()

{

var close = prompt("Result of debate?")

var f = document.editform, t = f.wpTextbox1;

t.value = "{{subst:" + "at" + "}} " + close + ". " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;

if (t.value.length > 0)

t.value += '\n';

t.value += "{{subst:" + "ab" + "}}";

f.wpSummary.value = "Close as " + close;

}

function relist()

{

var f = document.editform, t = f.wpTextbox1;

if (t.value.length > 0)

t.value += '\n';

t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}";

f.wpSummary.value = "Relisting debate";

}

function keep()

{

var date = prompt("Nomination was made when?")

var votepage = prompt("Vote page is? (Enter 'd' for default.)")

var f = document.editform, t = f.wpTextbox1;

// If default votepage...

if (votepage=="d")

{

var temp = document.editform.action.split("/w/index.php?title=");

var temp = temp[1].split("&action=submit");

var temp = temp[0].substring(5);

var votepage = temp;

}

t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;

f.wpSummary.value = "Article survived AfD";

}

function no_consensus()

{

var date = prompt("Nomination was made when?")

var votepage = prompt("Vote page is? (Enter 'd' for default.)")

var f = document.editform, t = f.wpTextbox1;

// If default votepage...

if (votepage=="d")

{

var temp = document.editform.action.split("/w/index.php?title=");

var temp = temp[1].split("&action=submit");

var temp = temp[0].substring(5);

var votepage = temp;

}

t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=no consensus|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;

f.wpSummary.value = "Article survived AfD with no consensus";

}

function redirect()

{

var date = prompt("Nomination was made when?")

var redirect = prompt("Redirect to?")

var votepage = prompt("Vote page is? (Enter 'd' for default.)")

var f = document.editform, t = f.wpTextbox1;

// If default votepage...

if (votepage=="d")

{

var temp = document.editform.action.split("/w/index.php?title=");

var temp = temp[1].split("&action=submit");

var temp = temp[0].substring(5);

var votepage = temp;

}

t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=redirect to " + redirect + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;

f.wpSummary.value = "Article redirected to " + redirect + " as per AfD";

}

function merge()

{

var date = prompt("Nomination was made when?")

var redirect = prompt("Merge and redirect to?")

var votepage = prompt("Vote page is? (Enter 'd' for default.)")

var f = document.editform, t = f.wpTextbox1;

// If default votepage...

if (votepage=="d")

{

var temp = document.editform.action.split("/w/index.php?title=");

var temp = temp[1].split("&action=submit");

var temp = temp[0].substring(5);

var votepage = temp;

}

t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=merge and redirect to " + redirect + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;

f.wpSummary.value = "Article merged and redirected to " + redirect + " as per AfD";

}

function other()

{

var date = prompt("Nomination was made when?")

var result = prompt("Result was?")

var votepage = prompt("Vote page is? (Enter 'd' for default.)")

var f = document.editform, t = f.wpTextbox1;

// If default votepage...

if (votepage=="d")

{

var temp = document.editform.action.split("/w/index.php?title=");

var temp = temp[1].split("&action=submit");

var temp = temp[0].substring(5);

var votepage = temp;

}

t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=" + result + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;

f.wpSummary.value = "AfDed; result was " + result;

}

function add_afd_tabs()

{

var c1 = document.getElementById('column-one');

var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

// Only add for pages with the right string somewhere in the title

if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)

{

tabs.appendChild(afdaddlilink('javascript:result()',"close"));

tabs.appendChild(afdaddlilink('javascript:relist()',"relist"));

}

if (document.title.indexOf("Editing Talk:") != -1)

{

tabs.appendChild(afdaddlilink('javascript:keep()',"keep"));

tabs.appendChild(afdaddlilink('javascript:no_consensus()',"no consensus"));

tabs.appendChild(afdaddlilink('javascript:redirect()',"redirect"));

tabs.appendChild(afdaddlilink('javascript:merge()',"merge"));

tabs.appendChild(afdaddlilink('javascript:other()',"other"));

}

}

$(add_afd_tabs);

//end AfD closing script

//Admin tools

mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js'

+ '&action=raw&ctype=text/javascript');

//

// Script from User:MarkS/extraeditbuttons.js

mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js'

+ '&action=raw&ctype=text/javascript');

//END

// ***** Window Load ******

window.onload = Main;

function Main()

{

//shortTabs();

add_tabs();

if (document.title.indexOf("Editing User talk:") == -1)

addEditSection0();

}

//

//from Func, hacked into warn tabs only

//***********************

//

// Released into the public domain, btw.

// Func's monobook.js, now with ADMIN powers.... :)

//

if ( window.addEventListener ) // modern browsers, screw IE :)

{

function WikiInit()

{

Wiki = {}; // global

Wiki.href = window.location.href;

Wiki.path = window.location.pathname;

Wiki.quer = window.location.search;

if ( Wiki.quer.length < 2 ) Wiki.quer = '';

Wiki.wiki = ! Wiki.path.indexOf( '/wiki/' );

Wiki.diff = Wiki.quer.indexOf( 'diff=' ) != -1;

Wiki.edit = ( Wiki.quer.indexOf( 'action=edit' ) != -1 ) || ( Wiki.quer.indexOf( 'action=submit' ) != -1 );

Wiki.user = Wiki.href.indexOf( 'User:' ) != -1; // make more robust

Wiki.talk = Wiki.href.indexOf( 'User_talk:' ) != -1; // make more robust

Wiki.spec = Wiki.href.indexOf( 'Special:' ) != -1;

Wiki.recentchanges =

Wiki.href.indexOf( 'Special:Recentchanges' ) != -1 ||

Wiki.href.indexOf( 'Special%3ARecentchanges' ) != -1 ;

}

// Pass actions from one page to the next via

// window.name; which is faster and easier than

// using a cookie.

//

function PassItOn( _action_ )

{ if ( _action_ ) window.name = 'wpFuncAction=' + _action_;

else

{ var hack = window.name; window.name = '';

if ( ! hack.indexOf( 'wpFuncAction=' ) )

{ hack = hack.substr( 13 );

if ( hack == 'lastdiff' )

{ if ( Wiki.quer )

window.location.href += '&diff=0';

else

window.location.href += '?diff=0';

}

// more to come....

}

}

}

function wpFuncPreLoad()

{

WikiInit(); // Global Wiki object.

PassItOn(); // Do we need to be somewhere else?

}

wpFuncPreLoad();

// Remind me to ask the developers to throw

// unique IDs onto important elements!!!

//

function GetByClass( className, tagName, elemObj )

{ var i, filter, found = [];

elemObj = elemObj || document;

if ( tagName )

{ filter = elemObj.getElementsByTagName( tagName );

for ( i = 0; i < filter.length; i++ )

if ( filter[ i ].className == className )

found.push( filter[ i ] );

}

else // blah, do it when I need it

{

}

return found;

}

function SP(x)

{ var i, s = ''; x = x || 1; while ( x-- ) s += ' ';

return document.createTextNode( s );

}

function NB(x)

{ var i, s = ''; x = x || 1; while ( x-- ) s += '\xA0';

return document.createTextNode( s );

}

function BR(){ return document.createElement( 'br' ) }

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;

}

function RCPatrol() // for admins

{

var table, TDs, otitle, ntitle, prevLink, currLink, link, rollback, contribs, block;

var tr, td;

if ( Wiki.edit )

{

gEditForm = document.getElementById( 'editform' );

gTextBox = gEditForm[ 'wpTextbox1' ];

gSummary = gEditForm[ 'wpSummary' ];

gMinorBox = gEditForm[ 'wpMinoredit' ];

gWatchBox = gEditForm[ 'wpWatchthis' ];

var addtexts = document.createElement( 'div' );

function Inserter( seeText, addText, editSum, addLoc, color, submit ) // local function

{

var a = NewLink( seeText, '', true, color );

a.addText = addText;

a.addLoc = addLoc || 8; // 2 == top; 5 == insertion-loc; 8 == bottom

a.editSum = editSum || '';

a.submit = submit || false;

a.onclick = function()

{

if ( this.addLoc == 8 ) gTextBox.value += this.addText;

else if ( this.addLoc == 2 ) gTextBox.value = this.addText + gTextBox.value;

else /* this.addLoc == 5; Safari problems */ ;

gMinorBox.checked = true;

// gWatchBox.checked = false;

if ( this.editSum ) gSummary.value += this.editSum;

if ( this.submit ) gEditForm.submit();

return false;

}

return a;

}

if ( Wiki.talk ) // here is where we tell the vandals to bugger off

{

var kTest = '#0000AA', // blue

kWarn = '#00AA00', // green

kFinal = '#AAAA00', // yellow

kBlock = '#AA0000'; // red

var tableTags =

[ [ [ 'uw-create', 'uw-create1' ],

[ 'test2', 'uw-test2', 'uw-uhblock', 'uw-uhblock' ], // special case

[ 'uw-vandalism3', 'uw-vandalism3' ],

[ 'test4', 'uw-vand4' ],

[ 'test5', 'uw-vblock' ]

],

[ null,

[ 'blanking', 'uw-delete1' ],

[ 'blanking2', 'uw-delete2' ],

[ 'blanking3', 'uw-delete3' ],

[ 'blanking4', 'blocked' ]

],

[ [ 'drmafd', 'removing AFDs' ],

[ 'drmafd2', 'removing AFDs, 2nd' ],

[ 'drmafd3', 'removing AFDs, 3rd' ],

[ 'drmafd4', 'final warning' ],

[ 'drmafd5', 'blocked' ]

],

[ [ 'spam', 'uw-spam1' ],

[ 'spam2', 'uw-spam2' ],

[ 'spam2a', 'uw-spam3' ],

[ 'uw-speedy1', 'uw-speedy1' ],

[ 'spam4', 'blocked' ]

],

[ [ 'username', 'uw-username' ],

[ 'Whois', 'Whois' ],

[ 'repeatvandal', 'repeatvandal' ],

[ 'uw-defam3', 'final warning' ],

[ 'indefblockeduser', 'blocked' ]

],

[ null,

null,

[ '3RR', '3RR warning' ],

[ '3RR2', 'final 3RR warning' ],

[ '3RR3', 'blocked for 3RR' ]

],

[ null,

null,

[ 'attack', 'personal attacks' ],

null,

null

]

];

table = document.createElement( 'table' );

// Formatting

//

table.style.fontSize = 'x-small';

var i, j, a, color;

for ( i = 0; i < tableTags.length; i++ )

{ tr = document.createElement( 'tr' );

a = tableTags[ i ];

for ( j = 0; j < 5; j++ )

{ td = document.createElement( 'td' );

color = ( j == 0 ) ? kTest :

( j < 3 ) ? kWarn :

( j == 3 ) ? kFinal :

kBlock ;

if ( a[ j ] )

{ td.appendChild(

Inserter(

a[ j ][ 0 ], // click on text

'{{subst:' + a[ j ][ 0 ] + '}} ~~~~\n\n', // insert this text

a[ j ][ 1 ], // edit summary text

8, // insert at end

color

)

);

td.appendChild( NB() );

td.appendChild(

Inserter(

'!', // click on text

'{{subst:' + a[ j ][ 0 ] + '}} ~~~~\n\n', // insert this text

a[ j ][ 1 ], // edit summary text

8, // insert at end

color,

true // auto-sumbit

)

);

if ( a[ j ][ 2 ] ) // 2 links in one cell, ie: test2a

{ td.appendChild( BR() );

td.appendChild(Inserter(a[j][2],'{{subst:'+a[j][2]+'}} ~~~~\n\n',a[j][3],8,color));

td.appendChild( NB() );

td.appendChild(Inserter('!','{{subst:'+a[j][2]+'}} ~~~~\n\n',a[j][3],8,color,true));

}

}

else td.appendChild( NB() );

tr.appendChild( td );

}

table.appendChild( tr );

}

addtexts.appendChild( table );

var span = document.createElement( 'span' );

span.style.fontSize = 'x-small';

span.appendChild(Inserter('W-graphical','{{subst:W-all}} \n\n','W-link',8,'#0000FF'));

span.appendChild(NB());

span.appendChild( NB(4) );

span.appendChild(Inserter('nothanks|PAGE','{{subst:nothanks|PAGE}} ~~~~\n\n','copyvio',8,'#0000AA'));

span.appendChild( NB(4) );

span.appendChild(Inserter('vanity|PAGE','{{subst:vanity|PAGE}} ~~~~\n\n','WP:NOT',8,'#0000AA'));

span.appendChild( NB(4) );

addtexts.appendChild( span );

}

gEditForm.parentNode.insertBefore( addtexts, gEditForm );

}

}

// Due to problems with Safari, this CURRENTLY will only insert at the END for now.

//

function FieldInsert( field, text, _where_ )

{

field.value += text;

}

function PortletMenu( id ) // constructor

{

this.port = document.getElementById( id );

this.menu = this.port.getElementsByTagName( 'ul' )[ 0 ];

this.menu.style.textTransform = 'none'; // override the CSS

this.items = {};

this.links = {};

var i, o, items = this.menu.getElementsByTagName( 'li' );

for ( i = 0; i < items.length; i++ )

{

// now with sanity checks

//

if ( ( o = items[ i ] ) )

{ this.items[ o.id ] = o;

if ( o.firstChild && o.firstChild.href )

{

this.links[ o.id ] = o.firstChild;

this.links[ o.id ].style.textTransform = 'none'; // I could do this in the .css...

}

}

}

this.register = function( id, txt, url ) // internal, basically

{ var li = document.createElement( 'li' );

li.id = id;

var a = NewLink( txt, url );

li.appendChild( a );

this.items[ id ] = li;

this.links[ id ] = a;

a.style.textTransform = 'none'; // I hate css so much....

return li;

}

this.append = function( id, txt, url )

{ this.menu.appendChild( this.register( id, txt, url ) );

};

this.insert = function( before, id, txt, url )

{ this.menu.insertBefore( this.register( id, txt, url ), this.items[ before ] );

};

this.follow = function( after, id, txt, url )

{ this.menu.insertBefore( this.register( id, txt, url ), this.items[ after ].nextSibling );

}

this.getText = function( id ){ return this.links[ id ].firstChild.nodeValue };

this.setText = function( id, txt ){ this.links[ id ].firstChild.nodeValue = txt };

this.getHref = function( id ){ return this.links[ id ].href };

this.setHref = function( id, url ){ this.links[ id ].href = url };

}

function PageActions()

{ // ca-nstab-main Article /wiki/PAGE | /w/...action=edit

// ca-nstab-user User page /wiki/User:USER | /w/...action=edit

// ca-article Special Page (I find 'ca-article' slightly ironic, since it isn't.)

//

// ca-talk Discussion /wiki/Talk:... User_talk... /w/...action=edit

//

// ca-edit Edit this page /w/...action=edit

// ca-addsection + /w/...action=edit§ion=new

// ca-viewsource View source /w/...action=edit

//

// ca-history History /w/...action=history

//

// ca-protect Protect /w/...action=protect

// ca-delete Delete /w/...action=delete

//

// ca-move Move Special:Movepage/PAGE

//

// ca-watch Watch /w/...action=watch

// ca-unwatch Unwatch /w/...action=unwatch

//

// User Talk Edits Logs Edit 0 + History Diff Protect Delete Move Watch Logs Purge

// Page Talk Edit 0 History Diff Protect Delete Move Watch Logs Purge

// As an admin, I'm not sure when this would be nessesary....

//

var edit = PageMenu.items[ 'ca-viewsource' ] ? 'ca-viewsource' : 'ca-edit';

// I need the space.

//

if ( PageMenu.items[ 'ca-talk' ] ) PageMenu.setText( 'ca-talk', 'Talk' );

if ( PageMenu.items[ 'ca-edit' ] ) PageMenu.setText( 'ca-edit', 'Edit' );

if ( PageMenu.items[ 'ca-viewsource' ] ) PageMenu.setText( 'ca-viewsource', 'View' );

// Move the offset from off of the right of ca-talk to the left of ca-edit

//

// from /skins-1.5/monobook/main.css :

//

// /* offsets to distinguish the tab groups */

// li#ca-talk { margin-right: 1.6em; }

// li#ca-watch, li#ca-unwatch, li#ca-varlang-0, li#ca-print { margin-left: 1.6em; }

//

if ( PageMenu.items[ 'ca-talk' ] )

{

PageMenu.items[ 'ca-talk' ].style.marginRight = '0.3em'; // ??? how to just go back to the browser's default ???

PageMenu.items[ edit ].style.marginLeft = '1.6em';

}

if ( PageMenu.items[ 'ca-nstab-user' ] )

{

PageMenu.setText( 'ca-nstab-user', 'User' );

// User: or User talk:

//

var user = document.getElementsByTagName( 'h1' )[ 0 ].firstChild.nodeValue;

user = user.substr( user.indexOf( ':' ) + 1 );

if ( user.indexOf( '/' ) != -1 ) // subpage

user = user.split( '/' )[ 0 ];

PageMenu.insert( edit, 'ca-edits', 'Edits', '/wiki/Special:Contributions/' + user );

PageMenu.insert( edit, 'ca-logs', 'Logs', '/w/index.php?title=Special%3ALog&user=' + user );

}

}

function wpFuncOnLoad()

{

PageMenu = new PortletMenu( 'p-cactions' );

UserMenu = new PortletMenu( 'p-personal' );

NavMenu = new PortletMenu( 'p-navigation' );

ToolMenu = new PortletMenu( 'p-tb' );

RCPatrol();

PageActions();

UserActions();

}

window.addEventListener( 'load', wpFuncOnLoad, false );

}

//

//END

//*****************************

function hidevfd(){

var divs = document.getElementsByTagName("div");

for(var x = 0; x < divs.length; ++x)

if(divs[x].className.indexOf("vfd") != -1)

divs[x].style.display = "none";

document.getElementById('footer').style.display = 'none';

}

function showvfd(){

var divs = document.getElementsByTagName("div");

for(var x = 0; x < divs.length; ++x)

if(divs[x].className.indexOf("vfd") != -1)

divs[x].style.display = "";

document.getElementById('footer').style.display = '';

}

function addlilink(tabs, url, name){

var na = document.createElement('a');

na.href = url;

na.appendChild(document.createTextNode(name));

var li = document.createElement('li');

li.appendChild(na);

tabs.appendChild(li);

return li;

}

function vfdlinks(){

var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];

if(document.title.indexOf("Wikipedia:Articles for deletion") == 0){

addlilink(tabs, 'javascript:hidevfd()', 'Hide');

addlilink(tabs, 'javascript:showvfd()', 'Show');

}

}

if (window.addEventListener) window.addEventListener("load",vfdlinks,false);

else if (window.attachEvent) window.attachEvent("onload",vfdlinks);

/*

 */

if (wgAction == 'delete') {

var csdDeleteForm = {

FillSelect:function(sel, arr){

if(arr && arr.length>0){

if(arr.length>1){

var FirstOpt = new Option("CSD Reasons", "");

// catches stupid IE error

if(FirstOpt.innerHTML != "CSD Reasons"){

FirstOpt.innerHTML = "CSD Reasons";

}

sel.appendChild(FirstOpt);

sel.options[0].style.color = "gray"

}

sel.disabled = false;

for(var i=0;i

var opt = new Option(arr[i].display, arr[i].value);

// catches stupid IE error

if(opt.innerHTML != arr[i].display){

opt.innerHTML = arr[i].display;

}

sel.appendChild(opt);

}

}else{

sel.options[0] = new Option("No Options Available", "");

// catches stupid IE error

if(sel.options[0].innerHTML != "No Options Available"){

sel.options[0].innerHTML = "No Options Available";

}

sel.disabled = true;

return false;

}

return true;

},

ValueArray:[

{"value":"CSD G1: Patent Nonsense","display":"G1 - Nonsense"},

{"value":"CSD G2: Test Pages","display":"G2 - Test Pages"},

{"value":"CSD G3: Pure Vandalism","display":"G3 - Pure Vandalism"},

{"value":"CSD G4: Recreation of deleted material","display":"G4 - Recreated Deleted"},

{"value":"CSD G5: Contributions by Banned User","display":"G5 - Banned User"},

{"value":"CSD G6: Housekeeping","display":"G6 - Housekeeping"},

{"value":"CSD G7: Only one editor has made substantial edits to this page and he or she has requested its deletion or blanked the page","display":"G7 - Author Request"},

{"value":"CSD G8: Talkpage of non-Existent Article","display":"G8 - Talk Page"},

{"value":"CSD G10: Attack Page","display":"G10 - Attack Pages"},

{"value":"CSD G11: Blatant Advertising","display":"G11 - Advertising"},

{"value":"CSD G12: Blatant Copyright infringement","display":"G12 - Copyright"},

{"value":"CSD A1: Very short article providing little or no context","display":"A1 - No Context"},

{"value":"CSD A2: Foreign language article that exists on another Wikipedia","display":"A2 - Foreign Language"},

{"value":"CSD A3: No meaningful content","display":"A3 - No Content"},

{"value":"CSD A5: Has been transwikied","display":"A5 - Transwikied"},

{"value":"CSD A7 (Bio): Biographical article that does not assert significance","display":"A7 - Unremarkable Bio"},

{"value":"CSD A7 (Group): Article about a club or group that does not assert significance","display":"A7 - Unremarkable Group"},

{"value":"CSD A7 (Band): Article about a band that does not assert significance","display":"A7 - Unremarkable Band"},

{"value":"CSD A7 (Corp): Article about a company that doesn't assert significance","display":"A7 - Unremarkable Firm"},

{"value":"CSD A7 (Web): Article about a web site that does not assert significance","display":"A7 - Unremarkable Web"},

{"value":"CSD A7: Article about subject that does not assert significance.","display":"A7 - Other"},

{"value":"CSD R1: Redirect to non-existent page","display":"R1 - Bad Target"},

{"value":"CSD R2: Redirect to User/User talk namespaces from mainspace","display":"R2 - Crossnamespace"},

{"value":"CSD R3: Implausible typo","display":"R3 - Bad Typo"},

{"value":"CSD I1: Redundant to another image","display":"I1 - Redundant"},

{"value":"CSD I2: Image is corrupted","display":"I2 - Corrupt/Empty"},

{"value":"CSD I3: Improper license","display":"I3 - Improper License"},

{"value":"CSD I4: No license or No Source Information","display":"I4 - Lack of License"},

{"value":"CSD I5: Image is unused and not free","display":"I5 - Unused Unfree"},

{"value":"CSD I6: No justification given for fair use","display":"I6 - No Fair Use"},

{"value":"CSD I7: Bad justification given for fair use","display":"I7 - Invalid Fair Use"},

{"value":"CSD I8: Image exists on the Commons","display":"I8 - On Commons"},

{"value":"CSD C1: Category is Empty (and has been for 4 days or more)","display":"C1 - Empty"},

{"value":"CSD C2: Speedy Renaming","display":"C2 - Speedy Rename"},

{"value":"CSD C3: Corresponding template was deleted","display":"C3 - Template"},

{"value":"CSD U1: User requested deletion","display":"U1 - User Request"},

{"value":"CSD U2: Userpage of non-existent user","display":"U2 - No User"},

{"value":"CSD U3: Userpage that is primarily a gallery of fair use images","display":"U3 - Fair Use Gallery"},

{"value":"CSD T1: Template that is divisive and inflammatory.","display":"T1 - Divisive"},

{"value":"CSD P2: Underpopulated","display":"P2 - Underpopulated"},

{"value":"Wikipedia is not a place for cool ideas or neologisms","display":"WP:NOT#OR"},

{"value":"Wikipedia is not a bureaucracy","display":"WP:NOT#BUREAUCRACY"},

{"value":"Wikipedia is not MySpace or any other social networking site","display":"WP:NOT#SOCIAL"},

{"value":"Talk page of an indefinitely blocked user","display":"Blocked user"},

{"value":"AFD: Deleted after discussion at Articles for Deletion","display":"AFD close"},

{"value":"Prod left uncontested for five days.","display":"Prod close"}

],

//**************************** attaching function *****************************************

// got thIS super handi function from http://www.scottandrew.com he is pretty dang smart **

//*****************************************************************************************

addEvent:function(obj, evType, fn, useCapture){

//alert(obj);

if (obj.addEventListener){

obj.addEventListener(evType, fn, useCapture);

return true;

} else if (obj.attachEvent){

var r = obj.attachEvent("on"+evType, fn);

return r;

} else {

alert("Handler could not be attached");

}

}

}

function addSelectAfter(){

var obj = document.getElementById('wpReason') || document.getElementById('wpComment');

// create select using included array

var sel = document.createElement("SELECT");

csdDeleteForm .FillSelect(sel, csdDeleteForm .ValueArray);

// name it

sel.name = "csdOptions";

sel.id = "csdOptions";

sel.style.marginLeft = "10px";

csdDeleteForm .addEvent(sel, "change", csdChangeBox, false);

// check for next sibling and insert before it or at the end

if(obj.nextSibling){

obj.parentNode.insertBefore(sel,obj.nextSibling);

}else{

obj.parentNode.appendChild(sel);

}

}

try{

// add one on load

csdDeleteForm.addEvent(window, "load", addSelectAfter, false);

}catch(err){}

}

function csdChangeBox() {

var obj = document.getElementById('wpReason') || document.getElementById('wpComment');

obj.value = document.getElementById('csdOptions').value;

}

//

// This script changes the "Your signature with timestamp" edit button to use a real em dash instead of two hyphens.

(function () {

var oldAddButton = addButton;

if (typeof(oldAddButton) != 'function') return;

addButton = function () {

if (arguments.length > 2)

arguments[2] = arguments[2].replace(/^--(~+)$/, '—$1');

oldAddButton.apply(this, arguments);

};

})();

//

/*

 */

//

{{PAGENAME}}