User:Glen/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//<pre><nowiki>
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');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/UTCclock.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/replacetxt.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Deletion/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Cactus.man/Scripts/FixDiffWidth.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }

function changelinks()
{
    if(!document.getElementById) return;
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;
 if (document.title.indexOf('User:' + user_name + '/xml') != -1 || document.title.indexOf('User:' + user_name + '/XML') != -1)
    {addlilink(toplinks, 'javascript:XMLrequestprompt()', 'Request XML', 'Request XML');}
    document.getElementById('pt-mytalk').firstChild.innerHTML = 'Talk';
    document.getElementById('pt-preferences').firstChild.innerHTML = 'Prefs';
    document.getElementById('pt-watchlist').firstChild.innerHTML = 'Watchlist';
    document.getElementById('pt-mycontris').firstChild.innerHTML = 'Contribs';
    document.getElementById('pt-logout').firstChild.innerHTML = 'Logout';
    if(document.getElementById('ca-delete'))
      {document.getElementById('ca-delete').firstChild.innerHTML = '<strong><span style="color:darkred;">delete</span></strong>';} 
}

function navigationlinks()
{
    addnavbox_link('/wiki/Category:Candidates_for_speedy_deletion','Speedy deletes','speedy-ln');
    addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard/Incidents','AN/I','AN/I');
    addnavbox_link('/wiki/User:Glen/AIV','WP:AIV','aiv-ln');
    addnavbox_link('/w/index.php?title=Special:Ipblocklist&limit=100', 'Block log', '');
    addnavbox_link('/w/index.php?title=Special:Ipblocklist&action=unblock', 'Unblock', '');
    addnavbox_link('/w/index.php?title=User:Glen/monobook.js&action=edit', 'monobook.js', '');
    addnavbox_link('/w/index.php?title=User:Glen/monobook.css&action=edit', 'monobook.css', '');
    addnavbox_link('/w/index.php?title=Special%3ALog&type=newusers&user=&page=&limit=100&offset=0', 'New users', '');
    addnavbox_link('/w/index.php?title=Special:Newpages&namespace=0&limit=100&offset=0', 'New pages', '');
    addnavbox_link('/wiki/User:Glen/Links', 'Useful links', '');
    addnavbox_link('/w/index.php?title=Special:Prefixindex&namespace=2&from=Glen', 'My userspace', '');
    var afdtime = new Date();
    var months = ['January', 'February', 'March', 'April', 'May', 'June',
        'July', 'August', 'September', 'October', 'November', 'December'];
    addnavbox_link('/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
        + '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), 'Todays AfD', '');
    afdtime.setUTCDate(afdtime.getUTCDate() - 5);
    addnavbox_link('/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
        + '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), '5-day old AfD', '');
    var username=document.getElementById("pt-userpage").textContent;
}

function addtoolboxlinks()
 {
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, '/wiki/Special:Log', 'Logs', '');
}

// ======== USER TABS =======
function userlogs()
{
//no subpages or history
   if (document.title.search("/") != -1 || location.href.search(/Special:|&action=[^p]|&diff=/) !=-1)
   {return;}
   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) 
   {
      username_a = document.URL.match(/:.*:(.*)/);
      username=username_a[1];
      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username, "blk-log", "ca-blog", "block log", "");
      addTab("http://en.wikipedia.org/w/index.php?title=Special:Prefixindex&namespace=2&from=" + username, "u-space", "ca-uspace", "U space", "");
      addTab("http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=" + username + "&submit", "e-count", "ca-kate", "Count", "");
   }
}
//************

// ======== QuickBlocks =======
function QuickBlock (expiry,reason,ao) {
  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;
    }
  }
  blockForm.submit();
}

addOnloadHook(function(){
  if (document.title.indexOf("Block user") == -1) return;
addTab('javascript:('+QuickBlock+')("indefinite","{{UsernameBlocked}}",0)','Username','p-block-user')
  addTab('javascript:('+QuickBlock+')("indefinite","vandal only account",0)','Vandal acc','p-block-vandalism')
  addTab('javascript:('+QuickBlock+')("31 hours","persistant vandalism despite many warnings",1)','31 hours','p-block-31h')
  addTab('javascript:('+QuickBlock+')("1 week","persistant vandalism many prior blocks",1)','one week','p-block-school')
  addTab('javascript:('+QuickBlock+')("1 month","continuous persistant vandalism, many prior blocks",1)','one month','31-days')
  addTab('javascript:('+QuickBlock+')("3 months","long term persistant vandalism, extensive block record",1)','3 months','90-days')
});
//************

//************
//LAST DIFF TAB
function lastdiff() 
    {
    if (document.title.indexOf("Editing ") != -1 || document.getElementById('ca-history') == undefined || location.href.search(/&action=history/) !=-1)
    {return;}
    z=document.getElementById("content").childNodes;
    for (var n=0;n<z.length;n++) { 
      if (z[n].className=="firstHeading") 
      {
  var pname=document.title.split(' - ')[0].replace(/&/g,'%26').replace(/\\+/g, '%2B');
      }
    }
addTab("http://en.wikipedia.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", "Last", "ca-diff", "Show most recent diff", "");
}

// This will add an [edit top] link at the top of all pages except preview pages
function addtoplink()
{
var edittop = '<span style="color:black;">[</span>edit top<span style="color:black;">]</span>';
  // if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return;
  if(document.title.indexOf("Main Page") != -1) return;

  // get the page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); 

  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:130px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">' + edittop + '</a></div>';

  // insert divContainer into the DOM before the h1
if (document.getElementById("content") !=undefined) {
  document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);}
}
//END

//************
//MAIN
//************

addOnloadHook(Mainfast)
function Mainfast() 
{
    userlogs();
    changelinks();
    navigationlinks();
    addtoolboxlinks();
}

window.onload = Main;
function Main() 
{
    watchlist_tab();
    block_check();
    lastdiff();
    addtoplink();
}
//END
//************

function watchlist_tab()
{
if (location.href.indexOf('Special:Watchlist/edit') !=-1)
  {addTab("javascript:watchlist_clean()", "check deleted pages", "ca-clean", "check all deleted pages", "");}
}

function watchlist_clean()
{
//monobook
if (document.getElementById('bodyContent'))
  {
  var body = document.getElementById('bodyContent');
  }
//cologneblue
else if (document.getElementById('quickbar'))
  {
  if (!document.getElementById('content')){return;}
  var body = document.getElementById('content');
  }
  var l = body.getElementsByTagName('li');
  for (var i=0; i<l.length; i++)
    {
    if (l[i].getElementsByTagName('a')[0].href.indexOf('&action=') !=-1)
      {l[i].getElementsByTagName('input')[0].checked=true;}
    }
}

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?');}
}


//Lupin's tools
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

//[[User:Lupin/popupsdev.js]] - please include this line 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

popupAdminLinks=true;   


function XMLrequestprompt()
{
var parameters = '';
var type = 'GET';
var url = location.href;
url = prompt('Enter a URL:');
parse_js_value_cache = 0;
parse_js_value_cache = prompt('Parse the data?' + '\n' + '0 - false (default)' + '\n' + '1 - true (no script/SRCs/images)' + '\n' + '2 - true (no script/SRCs)' + '\n' + '3 - true (script/images allowed)');
if (parse_js_value_cache != 0 && parse_js_value_cache != 1 && parse_js_value_cache != 2 && parse_js_value_cache != 3){return;}
if (!url || url == ''){return;}
makeRequestXML(url, parameters,type);
}

function alertContents()
{
  if (http_request.readyState != 4)
    return;
  body = document.getElementById('bodyContent');
  if (body && parse_js_value_cache == 3)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:"; 
  body.innerHTML = '<strong>XML source return:</strong><br>' + http_request.responseText;
  }
  else if (body && parse_js_value_cache == 2)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:"; 
  var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
  body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">');
  }
  else if (body && parse_js_value_cache == 1)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:"; 
  var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
  body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(<img [^<]+>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">');
  }
  else if (body && parse_js_value_cache == 0)
  {
  document.getElementsByTagName('title')[0].innerHTML = "XML request:";
  var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
  xml = xml.replace(/(<a href=["'][^<]+<.a>)/gi,'%parenST|span style="background-color: yellow"|%parenEN$1%parenST|/span|%parenEN').replace(/(<img [^<]+>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<iframe [^<]+<.iframe>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<script [^`]+)`<.script>/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1</script>%parenST|/span|%parenEN').replace(/(<\w* onload=["'][^<]+["']>)/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1%parenST|/span|%parenEN').replace(/\s(src=["'][^<]+["'])>/gi,'%parenST|span style="background-color: #FF3300"|%parenEN $1>%parenST|/span|%parenEN');
  body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/%parenST\|/g,'<').replace(/\|%parenEN/g,'>');
  }
}

//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); 
  }
}
//

//
addOnloadHook(Dfn_js_con)
function Dfn_js_con()
{
Mvaluejs_class = 'go';
Rvaluejs_class = 'go';
Uvaluejs_class = 'go';
}
//

function glen(num)
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  if (num==1)
  {
  t.value += "==" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:User:Glen/Templates/Warning}}";
  f.wpSummary.value = "Regarding your edits (test1)";
  }
  else if (num==2)
  {
  t.value += "==" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:User:Glen/Templates/Vandalism}}";
  f.wpSummary.value = "Warning, please stop now (test2)";
  }
  else if (num==3)
  {
  t.value += "==" + "Final warning before block for vandalism" + varticle + "==" + "\n" + "{{subst:User:Glen/Templates/Final}}";
  f.wpSummary.value = "Final warning (test4)";
  }
  else if (num==4)
  {
  t.value += "{{subst:User:Glen/Templates/Blocked}}";
  f.wpSummary.value = "You have been blocked";
  }
  else if (num==5)
  {
  t.value += "{{subst:User:Glen/Templates/Indefblocked}}";
  f.wpSummary.value = "You have been indefinitely blocked";
  }
}

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:Done!}}";
  f.wpSummary.value = "Done!";
  }
  else if (num==2)
  {
  t.value += "{{subst:User:Glen/Templates/Welcome}}";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
  else if (num==3)
  {
  t.value += "{{subst:UsernameBlocked}}- ~~~~";
  f.wpSummary.value = "Please choose a new username";
  }
  else if (num==4)
  {
  t.value += "{{subst:User:Glen/Templates/:)}}";
  f.wpSummary.value = "Small token of thanks and appreciation :)";
  }
}

function misc(num)
{
  var varticle = '';
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
  {t.value += '\n';}
  if (num==1)
  {
  t.value += "{{subst:User:Glen/Templates/Notability}}";
  f.wpSummary.value = "Your article";
  }
  else if (num==2)
  {
  t.value += "{{subst:Vanity|}}- ~~~~";
  f.wpSummary.value = "About the page you created";
  }
  else if (num==3)
  {
  t.value += "{{subst:nothanks-sd|pg=article|url=url}}- ~~~~";
  f.wpSummary.value = "About your edits";
  }
  else if (num==4)
  {
  t.value += "{{subst:User:Glen/Templates/Spam-notice|}}";
  f.wpSummary.value = "About your edits";
  }
  else if (num==5)
  {
  t.value += "{{subst:recreated|}}- ~~~~";
  f.wpSummary.value = "Please stop";
  }
}

function testn(number)
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[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].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 [[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].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:" + "NPOV0a" + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " NPOV0a";
}

function warningn()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[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].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:" + "final warning" + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " bv";
}

function revertsn()
{
  var IPnoteR = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnoteR = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning, but aviod making any [[Wikipedia:revert|reverts]] within 24 hours of this warning in order to avoid any confusion.'' ";}
  var article = prompt("Enter the page name where the 3RR violation occured:")
  articleh = article.replace(/ /g, '_');
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Regarding reversions" + "[http://en.wikipedia.org/w/index.php?title=" + articleh + "&action=history] " + "made on [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] to " + "[[" + article + "]]" + "==" + "\n" + "{{subst:" + "3rr" + "}} " + IPnoteR + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " 3rr";
}

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

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

function rrblockn()
{
  username_a = document.URL.match(/:.*:(.*)/);
  username=username_a[1];
  var article = prompt("Enter the page name where the 3RR violation occured:");
  articleh = article.replace(/ /g, '_');
  var well = prompt("Warning is already in context (*y* or *n*)?")
  var time = prompt("Enter the duration of the block (in hours)")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    {t.value += '\r';}
  t.value += '<div style="background-color: #f9f9f9; border: 1px solid red; padding: 3px;">' + '\n';
  if (well == 'y' || well == 'yes')
  {
  t.value += ":{{subst:" + "3rr3" + "}} The duration of the [http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username + " block] is " + time + " hours. [http://en.wikipedia.org/w/index.php?title=" + articleh + "&action=history Here] are the reverts in question. ~" + "~" + "~" + "~" + "</div>";
  }
  else if (well == 'n' || well == 'no') 
  {
  t.value += "==" + "Regarding reversions" + "[http://en.wikipedia.org/w/index.php?title=" + articleh + "&action=history] " + "made on [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] to " + "[[" + article + "]]" + "==" + "\n" + "{{subst:" + "3rr3" + "}} The duration of the [http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username + " block] is " + time + " hours. ~" + "~" + "~" + "~" + "</div>";
  }
  else 
  {
  prompt("Error, enter *y* or *n*.");
  return;
  }
  f.wpSummary.value = "User notice:" + " temporary 3RR block";
}

function testbl()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[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].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:" + "test2a}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " test2a";
}

function spam(type)
{
  if (type == 1){var temp = 'spam'}
  else if (type == 2){var temp = 'spam4im'}
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[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].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:" + temp + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice: " + temp;
}

function rrwarn()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*The user has now been warned per [[WP:3RR|3RR]] not to let this happen again. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Result: user warned)');
  f.wpSummary.value = "Response: user warned";
}

function rrblock()
{
  var number = prompt("User blocked for how many hours?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*I have blocked the user for " + number + " hours per [[WP:3RR]]. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Result: ' + number + ' hours)');
  f.wpSummary.value = "Response: user blocked";
}

function rrnoblock()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*The user has not yet violated [[WP:3RR]] because there are not yet four reverts within 24 hours nor is there any severely disruptive behavoir. However, I have warned the user for nearly breaching [[WP:3RR]]. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Result: no violation)');
  f.wpSummary.value = "Response: no violation";
}

//more tabs
addOnloadHook(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:glen(1)', 'Warning', '');
        addlilink(warnfunc, 'javascript:glen(2)', 'Vandalism', '');
        addlilink(warnfunc, 'javascript:glen(3)', 'Final', '');
        addlilink(warnfunc, 'javascript:glen(4)', 'Blocked', '');
        addlilink(warnfunc, 'javascript:glen(5)', 'Indefblocked', '');
        addlilink(warnfunc, 'javascript:welcometn(1)', 'Done', '');
        addlilink(warnfunc, 'javascript:welcometn(2)', 'welcome', '');
        addlilink(warnfunc, 'javascript:welcometn(3)', 'username', '');
        addlilink(warnfunc, 'javascript:welcometn(4)', 'barnstar', '');
        addlilink(warnfunc, 'javascript:misc(1)', 'notability', '');
        addlilink(warnfunc, 'javascript:misc(2)', 'vanity', '');
        addlilink(warnfunc, 'javascript:misc(3)', 'nothanks-sd', '');
        addlilink(warnfunc, 'javascript:misc(4)', 'spam-article', '');
        addlilink(warnfunc, 'javascript:misc(5)', 'recreated', '');
        addlilink(warnfunc, 'javascript:testn(1)', 'test', '');
        addlilink(warnfunc, 'javascript:testn(2)', 'test2', '');
        addlilink(warnfunc, 'javascript:testn(3)', 'test3', '');
        addlilink(warnfunc, 'javascript:finalwn()', 'test4', '');
        addlilink(warnfunc, 'javascript:povn()', 'NPOV', '');
        addlilink(warnfunc, 'javascript:warningn()', 'final warning', '');
        addlilink(warnfunc, 'javascript:testbl()', 'blanking', '');
        addlilink(warnfunc, 'javascript:spam(1)', 'spam', '');
        addlilink(warnfunc, 'javascript:spam(2)', 'spam last', '');
        addlilink(warnfunc, 'javascript:blockn()', 'vblock', '');
        addlilink(warnfunc, 'javascript:revertsn()', '3rr', '');
        addlilink(warnfunc, 'javascript:rrblockn()', 'rr block', '');
      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';
      }
  }
}

//</nowiki></pre>[[Category:Wikipedia administrators who use VoA script]]