Jump to content

User:Az1568/common.js

From Wikisource

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
//Notice:                                                                                                      //
//See http://en.wikibooks.org/w/index.php?title=User:Az1568/monobook.js&oldid=648922 for the non-admin version.//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Helper tools
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js&action=raw&ctype=text/javascript');
//

// UTC clock
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Voice_of_All/UTCclock.js&action=raw&ctype=text/javascript');
//
////////////////////////popups stuff////////////////////////////////////////////////
//************
//Lupin's tools
//************
//[[User:Lupin/popupsdev.js]] - please include this line 
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js&action=raw&ctype=text/javascript');

popupShortcutKeys=true; // optional: enable keyboard shortcuts
popupAdminLinks=true;   // optional: enable admin links [[Category:VoA scripted admins]]
popupSubpopups=false;
popupOnEditSelection=false;
popupStructure='shortmenus';

mw.loader.load('http://en.wikibooks.org/w/index.php?title=User:Az1568/recent2.js&action=raw&ctype=text/javascript');
//END
//************
//
popupFixDabs=true;
popupAllDabsStubs=false;

//Experimental
ExtendedRevertSummary=true;
popupExtraUserMenu=true;
////////////////////////END////////////////////////////////////////////////
//Admin protection tools
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js&action=raw&ctype=text/javascript');
//END
//Delete tabs
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Voice_of_All/Deletion/monobook.js&action=raw&ctype=text/javascript');
//END
/////////////////////////////////////////////////////////////////////////////////////
function winc(s) {
mw.loader.load('//en.wikipedia.org/w/index.php?title=' + s + '&action=raw&ctype=text/javascript');
}

winc('User:MarkS/extraeditbuttons.js'); // Script from [[User:MarkS/extraeditbuttons.js]] extra edit buttons

winc('User:Voice_of_All/Sleeper/monobook.js'); // User log tools -Checking for sleeper accounts

winc('User:Voice_of_All/replacetxt.js'); // Replace txt

winc('User:Voice_of_All/Google/monobook.js'); // Google tool

winc('User:Voice_of_All/Addtabs/monobook.js'); // Helper tools <!-- Do Not Use [LAST] tab -->

winc('User:Invitatious/unsigned2.js'); // unsigned comments script

//////////////////////////////////////////////////////////////////////////////////////
//Admin rollback tools
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Lupin/autoedit.js&action=raw&ctype=text/javascript');
//END

// Admin rollback tools [[Category:Wikibooks administrators who use VoA script|{{PAGENAME}}
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js&action=raw&ctype=text/javascript');
//
//////////////////////////////////////////////////////////////////////////////////////////////
//security override HTTP request
//ALSO, reduce IE security settings
//For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ"
//Basically, enable "signed.applets.codebase_principal_support" in about:config 
function makeRequestXML(url, parameters,type,parse) 
{ 
  if(window.XMLHttpRequest)
  {
try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } 
catch (e) {alert("Permission UniversalBrowserRead denied."); } 
http_request = false;
http_request = new XMLHttpRequest(); 
if (http_request.overrideMimeType) 
{http_request.overrideMimeType('text/xml'); }
if (!http_request) 
{alert('Cannot create XMLHTTP instance'); return false; } 
http_request.onreadystatechange = alertContents;
http_request.open(type, url + parameters, true); 
http_request.send(null); 
  }
  else if (window.ActiveXObject)
  {
    try
    {http_request = new ActiveXObject("Msxml2.XMLHTTP");} 
    catch (e)
     {
      try
      {http_request = new ActiveXObject("Microsoft.XMLHTTP");} 
       catch (e){}
     }
  if (!http_request) {showError(ERROR_XML);}
  http_request.onreadystatechange = alertContents;
  http_request.open(type, url + parameters, true); 
  http_request.send(null); 
  }
}
//////////////////////////////////////////////////////////////////////////////////////////////////
//Note: copy the following code (with customized values) to your monobook.js file to set customized confirm text:

//
$(Dfn_js_con)
function Dfn_js_con()
{
//moves
Mvaluejs_class = 'yes';
//edits
Rvaluejs_class = 'yes';
//uploads
Uvaluejs_class = 'yes';
}
//

//</nowiki></pre>[[Category:VoA scripted admins]]

// Always check "block anons only" on Special:Blockip /////////////////////////////////////////////

$(function(){ var x; if (x=document.getElementById('wpAnonOnly')) {x.checked=true;} });
$(function(){ var x; if (x=document.getElementById('wpCreateAccount')) {x.checked=true;} });
$(function(){ var x; if (x=document.getElementById('wpEnableAutoblock')) {x.checked=false;} });

// </nowiki></pre> //

// addPurge tab
$( 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);
});

// ======== QuickBlocks =======//////////////////////////////////////////////////////////////////
function QuickBlock (expiry,reason,ao,autob) {
  blockForm = document.getElementById('blockip');
  inputs = blockForm.getElementsByTagName('input');
  for (i=0; i<inputs.length; i++) {
    if (inputs[i].name == 'wpBlockOther') {
      inputs[i].value = expiry;
      continue;
    }
    if (inputs[i].name == 'wpBlockReason') {
      inputs[i].value = reason;
      continue;
    }
    if (inputs[i].name == 'wpAnonOnly') {
      if (ao==1) {
        inputs[i].checked = 'checked';
      }
      continue;
    }
    if (inputs[i].name == 'wpEnableAutoblock') {
      if (autob==0) {
        inputs[i].checked=false;
      }
      continue;
    }
  }
  blockForm.submit();
}

$(function(){
  if (document.title.indexOf("Block user") == -1) return;
addTab('javascript:('+QuickBlock+')("indefinite","Please read [[Wikibooks:Profanity#Usernames|Wikibooks:Profanity]] and choose another name",0,0)','p-block-user');
  addTab('javascript:('+QuickBlock+')("indefinite","Vandalism Only Account",0,1)','p-block-vand only');
  addTab('javascript:('+QuickBlock+')("indefinite","Username too similar to that of an existing user: please [[Special:Emailuser/Az1568|Email me]] if you are a legitimate editor.",0,1)','sockpuppet','p-block-sock');
  addTab('javascript:('+QuickBlock+')("24 hours","Vandalism.",0,1)','24','p-block-24h');
  addTab('javascript:('+QuickBlock+')("24 hours","Blocked for 24 hours due to recent vandalism. If this is a shared address, please register an account to avoid collateral damage.",1,1)','24ao','p-block-24h');
  addTab('javascript:('+QuickBlock+')("31 hours","Vandalism.",0,1)','31','p-block-31h');
  addTab('javascript:('+QuickBlock+')("31 hours","Blocked for 31 hours due to recent vandalism. If this is a shared address, please register an account to avoid collateral damage.",1,1)','31ao','p-block-31h');
  addTab('javascript:('+QuickBlock+')("1 week","Vandalism.",0,1)','1week','p-block-school');
  addTab('javascript:('+QuickBlock+')("1 week","Blocked for one week due to repeat vandalism. If this is a shared address, please register an account to avoid collateral damage.",1,1)','1weekAO','p-block-school');
  addTab('javascript:('+QuickBlock+')("1 month","Blocked for one month due to chronic vandalism. If this is a shared address, please register an account to avoid collateral damage.",1,1)','1Month','31-days');
  addTab('javascript:('+QuickBlock+')("September 2007","Due to repeated vandalism, this school has been blocked until September 2007. Legitimate users are encouraged to register an account offsite to avoid collateral damage.",1,1)','Sept07','September 2007');
  addTab('javascript:('+QuickBlock+')("31 hours","Blocked for 31 hours due to recent trolling. If this is a shared address, please register an account to avoid collateral damage.",1,1)','Troll-31','p-block-troll-31');
  addTab('javascript:('+QuickBlock+')("indefinite","Trolling",0,1)','Troll-indef','p-block-troll-indef');
});
//[[Category:RC scripted users]]////////////////////////////////////////////////////////////

function block_check()
{
if (document.title.indexOf('Block user') !=0){return;}
  //monobook
  if (document.getElementById('pt-userpage'))
     {var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;}
  //cologneblue
  else if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
      {
      var toplinks = document.getElementById('quickbar');
      var user_name = toplinks.innerHTML.split('<h6>My pages</h6>')[1].split('title="User:')[1].split('"')[0];
      }
if (document.getElementsByTagName('input')[0].value == user_name)
  {alert('Are you sure you want to block yourself?');}
else if (document.getElementsByTagName('input')[0].value == user_name.replace(/ /g,'_'))
  {alert('Are you sure you want to block yourself?');}
}

// </pre>

/* <pre><nowiki> Top of Javascript */

/* Copied from http://commons.wikimedia.org/wiki/MediaWiki:Extra-tabs.js
 * Changed by Kernigh:
 * 2006-04-16: Point to en.wikibooks.org, uncomment tab strings.
 */

/* tooltips and access keys */ 
// ==========================================================================
// BEGIN: MediaWiki interface button definition for Duesentrieb's image tools:
// "Check usage", "User image gallery", "Orphaned images of user" and 
// "Untagged images of user".
// If you are located at an "Image:" you get the "check usage" tab, if you
// are at a "User:" page you get the "gallery", "orphans" and "untagged" tab.
// If you are on other pages these tabs do not get shown.
// These functions are _ONLY_ enabled for Wikimedia Commons sysops by default
// in order to test the whole thing and not to harm the tool server.
// Other users and IP's will see nothing new by default.
// This script has been tested with Konqueror 3.5 and Firefox 1.5. If you enhance
// or change this template please test it previous to editing here in your local
// monobook.js with as many as possible browsers (in order not to clash with the
// function names here change in your local monobook.js all "global_" to "local_").
// Be aware that the global monobook.js script does not get updated by the
// Wikimedia servers that fast after saving it here.

// written by Dbenbenn, Avatar, Duesentrieb and Arnomane

// Translations (variables for internationalisation and localisation):

// project
var tab_project = 'en.wikibooks.org';

// namespace names
var tab_ns_image = 'Image:';
var tab_ns_imagetalk = 'Image_talk:';
var tab_ns_user = 'User:';
var tab_ns_usertalk = 'User_talk:';
var tab_ns_category = 'Category:';
var tab_ns_special = 'Special:';

// Interface strings, get defined in the localised Mediawiki:Monobook.js/<ISO-Code>
// Uncommented because Wikibooks does not have the localistations of Commons
var tab_check_usage = 'check usage';
var tab_categorize = 'categorize';
var tab_log = 'log';
var tab_gallery = 'gallery';
var tab_orphans = 'orphans';
var tab_untagged = 'untagged';
var tab_tree = 'Tree';
var tab_catscan = 'CatScan';
var tab_blocklog = 'Blocklog';

// Appends a new tab.
function global_append_tab(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);

  // Grab the element we want to append the tab and append the tab to it.
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
  tabs.appendChild(li);
}

// Gets the article lemma, with the namespace and with sub pages.
function global_get_tidy_title()
{
  // get the article link from the label 'ca-edit' out of the document text.
  var editlk = document.getElementById('ca-edit');

  // If a page is write protected (for that user, a sysop will always have 'ca-edit')
  // we need 'ca-viewsource' as 'ca-edit' does not exist there.
  if (editlk == null)
  {
    editlk = document.getElementById('ca-viewsource');
  }

  // editlk will still be null on a Special page.  Now we try the ca-article tab.
  if (editlk == null)
  {
    editlk = document.getElementById('ca-article');
  }

  editlk = editlk.getElementsByTagName('a')[0].href;

  // If we found the ca-edit or ca-viewsource tab, the link will have title=.
  // If we found the ca-article tab (on a Special page) it won't.
  if (editlk.indexOf('title=') >= 0)
  {
    // Cut everything up to "title=" from the start and everything past "&action=edit"
    // from the end.
    editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.indexOf('&'));
  }
  else
  {
    // Cut everything up to "/wiki/" from the start.
    editlk = editlk.substring(editlk.indexOf('/wiki/') + 6);
  }

  return editlk;
}
 
// Is user a sysop? This function is needed in order to have these features
// enabled by default for sysops only during test period.
function global_get_sysop_status()
{
  // only sysops have the delete or the block button
  // The delete tab won't exist on user pages that don't exist, but the block link will.
  var delete_tab = document.getElementById('ca-delete');
  var block_link = document.getElementById('t-blockip');

  // this is needed for the Special:Blockip page in order to determine admin status
  if (block_link == null || block_link == false)
  {
    block_link = document.getElementById('blockip');
  }

  // in case of Special:Contributions we need again another way... 
  var testlink = global_get_tidy_title()
  if (testlink.indexOf(tab_ns_special +'Contributions') == 0)
  {
    var flag = document.getElementById('contentSub');
    flag = flag.getElementsByTagName('a')[2].href;
    if (flag.indexOf(tab_ns_special + 'Blockip') >= 0)
    {
      block_link = 'ok';
    }
    else
    {
      block_link = 0;
    }
  }

  // If user is no sysop the variable is null, don't know if it also can be
  // somehow false, but just in case...
  if (delete_tab == null || delete_tab == false)
  {
    if (block_link == null || block_link == false)
    {
      var sysop_status = false;
    }
    else
    {
      var sysop_status = true;
    }
  }
  else
  {
    var sysop_status = true;
  }
 
  return sysop_status;
}

function global_add_image_tabs(imagetitle)
{
  imagetitle = imagetitle.substring(imagetitle.indexOf(':') + 1); // strip off "Image:" namespace

  global_append_tab('http://tools.wikimedia.de/~daniel/WikiSense/CheckUsage.php?i=' + imagetitle + '&w=_100000', tab_check_usage);

  global_append_tab('http://tools.wikimedia.de/~daniel/WikiSense/CommonSense.php?i=' + imagetitle + '&go-clean=yes' , tab_categorize);

  global_append_tab('/w/index.php?title=' + tab_ns_special + 'Log&page=' + tab_ns_image + imagetitle, tab_log);
}
 
function global_add_user_tabs(username)
{
  username = username.substring(username.indexOf(':') + 1); // strip off namespaces like "User:"

  username = username.replace(/\/.*$/, ''); //removing subpages from the link

  global_append_tab('http://tools.wikimedia.de/~daniel/WikiSense/Gallery.php?&wiki=' + tab_project + '&img_user_text=' + username , tab_gallery);
  global_append_tab('http://tools.wikimedia.de/~daniel/WikiSense/OrphanImages.php?wiki=' + tab_project + '&img_user_text=' + username , tab_orphans);
  global_append_tab('http://tools.wikimedia.de/~daniel/WikiSense/UntaggedImages.php?wiki=' + tab_project + '&img_user_text=' + username , tab_untagged);
}

function global_add_category_tabs(category)
{
  category = category.substring(category.indexOf(':') + 1); // strip off "Category:" namespace

  global_append_tab('http://tools.wikimedia.de/~daniel/WikiSense/CategoryTree.php?wiki=' + tab_project + '&cat=' + category , tab_tree);
  global_append_tab('http://tools.wikimedia.de/~daniel/WikiSense/CategoryIntersect.php?wiki=' + tab_project + '&basecat=' + category , tab_catscan);
}

// On Special:Contributions, we add the user tabs just like for a user page.
// On Special:Blockip, we add a blocklog tab.
function global_add_special_tabs(title)
{
  if (title.indexOf(tab_ns_special + 'Blockip') == 0)
  {
    var username = document.getElementsByName('wpBlockAddress')[0].defaultValue;

    if (username != '')
    {
      global_append_tab('/w/index.php?title=' + tab_ns_special + 'Log&type=block&page=' + tab_ns_user + username, tab_blocklog);
    }
  }
  else if (title.indexOf(tab_ns_special + 'Contributions') == 0)
  {
    var username = document.getElementById('contentSub').getElementsByTagName('a')[0].firstChild.nodeValue;
    global_add_user_tabs(tab_ns_user + username);
  }
}
 
function global_do_onload()
{
//  if ((global_get_sysop_status()) == true)
//  {
    // extract the namespace
    var title = global_get_tidy_title();

    if (title.indexOf(tab_ns_image) == 0 || title.indexOf(tab_ns_imagetalk) == 0)
    {
      global_add_image_tabs(title);
    }
    else if (title.indexOf(tab_ns_user) == 0 || title.indexOf(tab_ns_usertalk) == 0)
    {
      global_add_user_tabs(title);
    }
    else if (title.indexOf(tab_ns_category) == 0)
    {
      global_add_category_tabs(title);
    }
    else if (title.indexOf(tab_ns_special) == 0)
    {
      global_add_special_tabs(title);
    }
//  }
}

if (window.addEventListener) 
  window.addEventListener("load", global_do_onload, false);
else if (window.attachEvent) 
  window.attachEvent("onload", global_do_onload);

// END: MediaWiki interface button definition for Duesentrieb's image tools.
// ========================================================================
/* Bottom of Javascript </nowiki></pre> */

//<pre><nowiki>
if (window.location.href.indexOf('action=edit') != -1 && window.location.href.indexOf('remexamplejpg=1') != -1) {
  function RemoveExampleJpg() {
    document.getElementById('wpSummary').value = "Removing [[Image:Example.jpg]], '''bold text''', etc...";
	var contents = document.getElementById('wpTextbox1').value;
	var newcontents = contents.replace(/(\[http:\/\/www\.example\.com link title\]|== Headline text ==|<math>Insert formula here<\/math>|<nowiki>Insert non-formatted text here<\/nowiki>|#REDIRECT \[\[Insert text\]\]|'''Bold text'''|''Italic text''|\[\[(Media:Example\.ogg|Image:Example\.jpg|Link title)\]\]|#REDIRECT \[\[Insert text\]\]|<s>Strike-through text<\/s>|<sup>Superscript text<\/sup>|<sub>Subscript text<\/sub>|<small>Small Text<\/small>|<!-- Comment -->|<gallery>\s+Image:Example.jpg\|Caption1\s+Image:Example.jpg\|Caption2\s+<\/gallery>|<blockquote>\s+Block quote\s+<\/blockquote>|\{\| class="wikitable"\s+\|-\s+! header 1\s+! header 2\s+! header 3\s+\|-\s+\| row 1, cell 1\s+\| row 1, cell 2\s+\| row 1, cell 3\s+\|-\s+\| row 2, cell 1\s+\| row 2, cell 2\s+\| row 2, cell 3\s+\|\})/g, "");
  	document.getElementById('wpTextbox1').value = newcontents;
	document.getElementById('wpWatchthis').checked = "";
    document.getElementById('wpDiff').click();
}
    addOnloadHook(function(){ RemoveExampleJpg(); });
}

if(wgCanonicalNamespace != "Special") {
  addOnloadHook(function(){ 
   var taburl = "http://en.wikibooks.org/w/index.php?title="+wgPageName+"&action=edit&remexamplejpg=1";
   addTab(taburl, "example.jpg", "ca-examplejpgfix", "This is to remove Image:Example.jpg from stuff"); 
  });
}
//</nowiki></pre>
//<pre><nowiki>

function welcometn(num)
{
  var varticle = '';
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
  {t.value += '\n';}
  if (num==1)
  {
  t.value += "{{subst:Welcome}}. ~~~~";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
  else if (num==2)
  {
  t.value += "{{subst:Anon}}. ~~~~";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
  else if (num==3)
  {
  t.value += "{{subst:User:Centrx/Welcome}}";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
}

function testn(number)
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[w:IP address|IP address]], and it is shared by multiple users, ignore this warning if you did not make any unconstructive edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "==" + "Regarding edits made during {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}} {{subst:CURRENTYEAR}}" + varticle + "==" + "\n" + "{{subst:" + "test" + number + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " test" + number;
}

function povn()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[w:IP address|IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "==" + "Regarding edits made during {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}} {{subst:CURRENTYEAR}}" + varticle + "==" + "\n" + "{{subst:" + "NPOV note" + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " NPOV note";
}

function warningn()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[w:IP address|IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Regarding edits made during {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}} {{subst:CURRENTYEAR}}" + varticle + "==" + "\n" + "{{subst:" + "bv" + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " bv";
}

function blockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += ":{{subst:" + "Blocked" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " blocked";
}

//more tabs
$(add_testn_tabs)
function add_testn_tabs()
{ 
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
  if (document.title.indexOf("Talk:") == -1 && document.title.indexOf("talk:") == -1 && document.title.indexOf("User:") == -1 && document.title.indexOf("MediaWiki:") == -1 && document.title.indexOf("Image:") == -1 && document.title.indexOf("Wikipedia:") == -1 && document.title.indexOf("Template:") == -1 && document.title.indexOf("Portal:") == -1 && document.title.indexOf("Help:") == -1 && document.title.indexOf("Main Page") == -1 && document.title.indexOf("Category:") == -1)
      {
      if(document.getElementById('ca-edit'))
      {document.getElementById('ca-edit').firstChild.innerHTML = 'Modify';}
      }
  else 
      {
      if(document.getElementById('ca-edit'))
      {document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';}
      if(document.getElementById('ca-talk'))
      {document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';}
      }
if (document.title.indexOf("Editing ") != -1)
{
  if (document.title.indexOf("Editing User talk:") != -1)
    {
        var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
        addlimenu(tabs, '{{message}}', 'warnfunc');
        var warnfunc = document.getElementById('warnfunc').getElementsByTagName('ul')[0];
        addlilink(warnfunc, 'javascript:welcometn(1)', 'welcome', '');
        addlilink(warnfunc, 'javascript:welcometn(2)', 'anon', '');
        addlilink(warnfunc, 'javascript:testn(1)', 'test', '');
        addlilink(warnfunc, 'javascript:povn()', 'NPOV', '');
        addlilink(warnfunc, 'javascript:testn(2)', 'vandal', '');
        addlilink(warnfunc, 'javascript:testbl()', 'blanking', '');
        addlilink(warnfunc, 'javascript:spam(1)', 'spam', '');
        addlilink(warnfunc, 'javascript:blockn()', 'blocked', '');
      if(document.getElementById('ca-delete'))
      {
        document.getElementById('ca-delete').firstChild.innerHTML = '<span style="color:red;">[d]</span>';
      }  
      if(document.getElementById('ca-move'))
      {
      document.getElementById('ca-move').firstChild.innerHTML = '[m]';
      }  
      if(document.getElementById('ca-watch'))
      {
      document.getElementById('ca-watch').firstChild.innerHTML = '[w]';
       }  
      if(document.getElementById('ca-unwatch'))
      {
      document.getElementById('ca-unwatch').firstChild.innerHTML = '[uw]';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      }
    }
  else if (document.title.indexOf("Editing User:") != -1)
    {  
    var nothing = 'yes';
    }
  else if (document.title.indexOf("Editing Wikipedia:Requests for page protection (section)") != -1)
    {
      if(document.getElementById('ca-delete'))
      {
        document.getElementById('ca-delete').firstChild.innerHTML = '<span style="color:red;">[d]</span>';
      }  
      if(document.getElementById('ca-move'))
      {
      document.getElementById('ca-move').firstChild.innerHTML = '[m]';
      } 
      if(document.getElementById('ca-watch'))
      {
      document.getElementById('ca-watch').firstChild.innerHTML = '[w]';
       }  
      if(document.getElementById('ca-unwatch'))
      {
      document.getElementById('ca-unwatch').firstChild.innerHTML = '[uw]';
      }
    }
  else if (document.title.indexOf("Editing Wikipedia:Administrators' noticeboard/3RR (section)") != -1)
    {
    addTab('javascript:rrwarn()',"a|wn","ca-wn","Warned","");
    addTab('javascript:rrblock()',"a|bl","ca-bl","Blocked","");
    addTab('javascript:rrnoblock()',"r|cl","ca-cl","Close to 3RR","");
    }
 else if(document.title.indexOf("Wikipedia:") != -1 || document.title.indexOf("Help:Contents/Editing Wikipedia") != -1 || document.title.indexOf("Editing Talk") != -1 || document.title.indexOf("Editing Wikipedia talk") != -1)
    {
  {nothing=1;}
    }
}
 else if (document.title.indexOf("User:") != -1)
 {
 if(document.getElementById('ca-talk'))
      {
     document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
      }
 }
 else if (document.title.indexOf("User talk:") != -1)
 {
 if(document.getElementById('ca-talk'))
      {
     document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
      }
  }
}

/*************
*** Dynamically loads information on specific pages
*** by [[m:user:Pathoschild]]
*************/

mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Pathoschild/Script:Getmoredata.js&action=raw&ctype=text/javascript');

/* 
#########
### formDefaults[dev]
###  by Pathoschild
###    * automatically inserts default form values.
#########
*/

function formDefaults() {
	/* variables */
	var strFullUrl = location.href;
	var regFormEdit = /&action=(?:edit|submit)/;
	var regFormMove = /Special:Movepage/;
	var regFormDelete = /&action=delete/;
	var regFormUndelete = /Special:Undelete/;
	var regFormProtect = /&action=protect/;
	var regFormBlock = /Special:Blockip/;
	var regFormUnblock = /&action=unblock/;

        /* get current and fill */
	if(strFullUrl.match(regFormDelete)) {
		var objReason = fPageData('currentforminput');
		objReason.value = '[[WP:DENY|Unneeded userpage for an indefinitely blocked user]]';
		var watchbox = document.getElementById('wpWatch');
		watchbox.checked = true;
		objReason.focus();
	}
	else if(strFullUrl.match(regFormUnblock)) {
		var objReason = fPageData('currentforminput');
		objReason.value = 'Override [[Wikipedia:Autoblock|autoblock]]';
		objReason.focus();
	}
}

$(function() {formDefaults()});

/////////////////////////////////////////////////////////////////////////////////////////////
// Started with code blatently stolen from [[User:Bmicomp/monobook.js]].
// Modified to use test-n, test2-n and test3-n. Remember to put the article title in the tag.
// See [[User:Drini]] for information on the -n templates.
// Menu tabs and some other functions stolen from [[User:alphax]]
//   Requires additions to monobook.css for menu tabs to work

// Helper tools
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js&action=raw&ctype=text/javascript');
//

// Call function to load when needed.
if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else
{
    window.previousLoadFunction = window.onload;
    window.onload = function()
    {
        window.previousLoadFunction();
        myLoadFuncs();
    }
}

// Load custom functions.
function myLoadFuncs()
{
// Add more toolbox links
 addToolBoxLinks();
// Add navbar links
 addNavBarLinks()
// Edit to top of page scetion
 addEditSection0();
// Load custom tabs
 add_tabs();
// Add a tad to purge page cache
 addPurge()
// Button to auto copyvio pages
 autocopyvio();
// Automate add to AfD
 autovfd();
// re-render the title and accesskeys for stuff
 akeytt();
}



/**** 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 = name;
    li.appendChild(na);
    tabs.appendChild(li);
    return 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;
}

/**** Add purge tab ****/

function addPurge()
{
    ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
    if(!document.getElementById) return;
    var x = document.getElementById('ca-history');
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    if(!x) return;
    if(x.children) x = x.children[0];
    else x = x.childNodes[0];
    addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge');
}
// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function edit_summary_watch(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += msg;
  f.wpSummary.value = summ;
  f.wpWatchthis.checked = watch;
}


// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function add_del_tag(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
    msg += '\n';
    msg += t.value;
    t.value = msg;
  f.wpSummary.value = summ;
  f.wpWatchthis.checked = watch;
}

//************************************ 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&section=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&section=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 + '&section=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 + '&section=0';
        z.appendChild(document.createTextNode('0'));
        y.appendChild(z);
        document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
    }
}

function blockuser(msg, other)
{
  var f = document.getElementsByName('wpBlockReason')[0];
  f.value = msg;
  var j = document.getElementsByName('wpBlockOther')[0];
  j.value = other;
}

// Change the names of links at the top of pages.  
function changeLinks()
{
    if(!document.getElementById) return;
    // remove the "my" bits
    document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
    document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist';
    document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions';
    // Change tab names
    document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
    document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
}

// Add more personal links to the tollbox section.
function addToolBoxLinks()
{
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, '/wiki/Wikipedia:Template messages/User_talk_namespace', 'Talk templates', '');
    addlilink(tb, '/wiki/Wikipedia:Template_messages', 'Templates', '');
    addlilink(tb, '/wiki/WP:CSD', 'SD criteria', '');
    addlilink(tb, '/wiki/Special:Log', 'Log', '');
    addlilink(tb, '/wiki/Special:Log/delete', 'Delete log', '');
    addlilink(tb, '/wiki/Special:Log/block', 'Block log', '');
    addlilink(tb, '/wiki/Special:Ipblocklist', 'IPBlocklist', '');
    addlilink(tb, '/wiki/Category:Request for Unblock', 'Unblock requests', '');
    addlilink(tb, '/wiki/Category:Wikipedia spam cleanup', 'Spam cleanup', '');
}

function addNavBarLinks()
{   
    var navbar = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
    var afdtime = new Date();
    var months = ['January', 'February', 'March', 'April', 'May', 'June',
        'July', 'August', 'September', 'October', 'November', 'December'];
    addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
        + '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), 'Todays AfD', '');
    afdtime.setUTCDate(afdtime.getUTCDate() - 5);
    addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
        + '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), '5-day old AfD', '');
    var username=document.getElementById("pt-userpage").textContent;
    addlilink(navbar, '/w/index.php?title=User:' + username + '/Status&action=edit', 'Edit my status', '');
}

/**** Make old AfD's appear or disappear ****/

function hideafd()
{
    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";
    // needed to shrink the page - rendering bug
    document.getElementById('footer').style.display = 'none';
}

function showafd()
{
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs[x].className.indexOf("vfd") != -1)
            divs[x].style.display = "";
    // might as well put it back...
    document.getElementById('footer').style.display = '';
}

// Add test-n templates to user talk pages
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 = "Your edits to [[" + page + "]]" 
  document.editform.wpWatchthis.checked = false;
}

// adds various tabs and menu tabs
function add_tabs()
{
  var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
  var username=document.getElementById("pt-userpage").textContent;

  // Only add for pages with "Editing User talk:" somewhere in the title
  if (document.title.indexOf("Editing User talk:") != -1)
    {
      addlimenu(tabs, 'Talk messages', 'talkm');
      var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:Welcome}} -- ~~~~", "Welcome to Wikipedia!", true, 1)','Welcome', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:Anon}} -- ~~~~", "Welcome to Wikipedia!", true, 1)','Anon', '');
      addlilink(talkm, 'javascript:testn(1)', 'Test1', '');
      addlilink(talkm,'javascript:testn("1a")','Test1a', '');
      addlilink(talkm,'javascript:testn(2)','Test2', '');
      addlilink(talkm,'javascript:testn("2a")','Test2a', '');
      addlilink(talkm,'javascript:testn(3)','Test3', '');
      addlilink(talkm,'javascript:testn("3a")','Test3a', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:Test4}} -- ~~~~", "Last warning", false, 1)','Test4', '');
      addlilink(talkm,'javascript:testn("4a")','Test4a', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:Test5-n|24 hours|~~~~}}", "You have been blocked", false, 1)','Test5', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:Test6}} -- ~~~~", "You have been blocked", false, 1)','Test6', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:Test7}} -- ~~~~", "You have been blocked", false, 1)','Test7', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:bv}} -- ~~~~", "Vandalism", false, 1)','BV', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam1}} -- ~~~~", "Adding links to Wikipedia", false, 1)','Spam1', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{subst:blanking}} -- ~~~~", "Blanking pages", false, 1)','blanking', '');
      addlilink(talkm,'javascript:edit_summary_watch("{{nothanks-sd|pg=page name|url=url of source}} -- ~~~~", "{{nothanks-sd}}", false, 1)','nothanks-sd', '');
    }

   if(document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1){                  // AfD tabs
        addlimenu(tabs, 'AfD close actions', 'afda');
        var afda = document.getElementById('afda').getElementsByTagName('ul')[0];
        addlilink(afda, 'javascript:closevfd("Delete", "")', 'Delete', '');
        addlilink(afda, 'javascript:closevfd("Speedy Delete", "")', 'SD', '');
        addlilink(afda, 'javascript:closevfd("Keep", "")', 'Keep', '');
        addlilink(afda, 'javascript:closevfd("Keep (No consensus)", "")', 'Keep, NC', '');
        addlilink(afda, 'javascript:closevfd("Merge and Redirect", " to [[" + prompt("Merge and redirect to?") + "]]")', 'M&R', '');
        addlilink(afda, 'javascript:closevfd("Redirect", " to [[" + prompt("Redirect to?") + "]]")', 'Redirect', '');
        addlilink(afda, 'javascript:closevfd("Ttranswiki", " to " + prompt("Transwiki to?"))', 'Transwiki', '');
        addlilink(afda, 'javascript:closevfd("Transwiki", " to Wiktionary")', 'WIKT', '');
        addlilink(afda, 'javascript:closevfd(prompt("Result?"), "")', 'Other', '');

    }
   if(document.title.indexOf("Wikipedia:Articles for deletion") == 0){     //Add show/hide closed AfDs
        addlilink(tabs, 'javascript:hideafd()', 'hide closed', 'ca-hide');
        ta['ca-hide'] = ['', 'Hide closed AFDs'];
        addlilink(tabs, 'javascript:showafd()', 'show closed', 'ca-show');
        ta['ca-show'] = ['', 'Show closed AFDs'];
    }

   if (document.title.indexOf("Editing User:" + username + "/Status") == 0){
        addlimenu(tabs, 'Change my status', 'mystatus');
        var mystatus = document.getElementById('mystatus').getElementsByTagName('ul')[0];
        addlilink(mystatus, 'javascript:edit_status("in")', 'In', '');
        addlilink(mystatus, 'javascript:edit_status("out")', 'Out', '');
        addlilink(mystatus, 'javascript:edit_status("around")', 'Around', '');
   }

  if (document.title.indexOf("Block user") == 0)
    {
        addlilink(tabs, 'javascript:blockuser("{{username}}", "indefinite")', "username");
        addlilink(tabs, 'javascript:blockuser("imposter", "indefinite")', "imposter");
        addlilink(tabs, 'javascript:blockuser("please contact an administrator for verification purposes, as described on this page", "indefinite")', "verification");
        addlilink(tabs, 'javascript:blockuser("vandalism only account", "indefinite")', "vandalism only");
        addlilink(tabs, 'javascript:blockuser("{{wow}}", "indefinite")', "willy");
        addlilink(tabs, 'javascript:blockuser("{{wic}}", "indefinite")', "communism");
        addlilink(tabs, 'javascript:blockuser("{{3RR3}}", "24 hours")', "revert");
        addlilink(tabs, 'javascript:blockuser("vandalism - AOL", "15 minutes")', "AOL")
        addlilink(tabs, 'javascript:blockuser("vandalism - shared IP", "3 hours")', "shared")
        addlilink(tabs, 'javascript:blockuser("vandalism - returning", "1 week")', "returning");
        addlilink(tabs, 'javascript:blockuser("vandalism", "24 hours")', "vandalism");
    }

   if (document.title.indexOf("Editing") != 0)
   {
   }
}

function closevfd(bold, notbold){
    var form = document.editform;
    var txt = form.wpTextbox1;
    txt.value = "{{subst:at}} '''" + bold + "'''" + notbold + ". --~~~~\n" + txt.value + "\n{{subst:ab}}\n";
    form.wpSummary.value = "Close discussion: " + bold + notbold;
    form.wpWatchthis.checked = false;
}

//</nowiki></pre>