User:JohnManuel/monobook.js

Source: 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.
//<nowiki>
//if(document.URL.indexOf("/w/index.php?title=Special:Watchlist&") == -1)
//{
//Allow loading of other js scripts
function loadJS(s) {
    s = s.replace(/^\[\[/, '').replace(/\]\]$/, '').replace(" ", "_");
    document.write('<script type="text/javascript" src="'
             + 'http://en.wikipedia.org/w/index.php?title=' + s
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

var myname=wgUserName.replace(' ', '_'); //use underscores instead of spaces
var mypage="User:"+myname;
var mytalk="User_talk:"+myname;
var mycontribs="Special:Contributions/"+myname;
var serverurl="http://en.wikipedia.org";
var wikiurl=serverurl+"/wiki/";
var pathurl=serverurl+"/w/";
var phpurl=pathurl+"index.php?title=";
var editcounturl="http://tools.wikimedia.de/~essjay/edit_count/Count.php";
var editcount=editcounturl+"?username=";

function winc(s) {
    s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
    document.write('<script type="text/javascript" src="'
             + 'http://en.wikipedia.org/w/index.php?title=' + s
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
 
winc('[[User:JohnManuel/metadatatest.js]]');
assessmentDefaultProject = "WPBiography";
assessmentDefaultWorkGroup = "s&a-work-group";
assessmentMyTemplateCode = ["{{WPBiography|class=|priority=}}", "{{WikiProject Yorkshire|class=|importance=}}","{{WikiProject Poland|class=|importance=}}", "{{Songs|class=}}"];
 
//winc('[[User:Dr_pda/prosesize.js]]');
winc('[[User:Gimmetrow/fixRefs.js]]');
winc('[[User:Omegatron/monobook.js/addlink.js]]');
winc('[[User:Lupin/popups.js]]');
 popupFixDabs=true;
 popupRedlinkRemoval=true;

//A helper function to add a button to one of the toolbars in the interface.
//An improved(I hope) version of [[Wikipedia:WikiProject User scripts/Scripts/Add LI link|addlilink]].
//[[User:JesseW/sig|JesseW, the juggling janitor]] 05:33, 8 November *2005 (UTC)

function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
    //
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //
    //* name is what will appear as the name of the button.
    //
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //
    //* key is the char you want for the accesskey. Optional.
    //
    //* after is the id of the button you want to follow this one. Optional.
    //
    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);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        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;
}

//COOKIE FUNCTIONS
function readCookie(name) {
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++) {
 var c = ca[i];
 while (c.charAt(0)==' ') c = c.substring(1,c.length);
 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
 }
 return null;
}

function createCookie(name,value,days) {
 if (days) {
 var date = new Date();
 date.setTime(date.getTime()+(days*24*60*60*1000));
 var expires = "; expires="+date.toGMTString();
 }
 else var expires = "";
 document.cookie = name+"="+value+expires+"; path=/";
}

function eraseCookie(name) {
 createCookie(name,"",-1);
}

//END
//==Metadatatest.js==
// [[User:JohnManuel/metadatatest.js]]      
 importScript('User:JohnManuel/metadatatest.js'); 
//==Links==
//Note: This is not like the AdLiLinks from WP:US. This is much different.

//    --- ADD VARIOUS LINKS ----
function addToolboxLink(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, url, name, id);
}
// 
function addTopLink(url, name, id){
    var personal = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    addlilink(personal, url, name, id);
}
// 
function addNavLink(url, name, id){
    var navigation = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
    addlilink(navigation, url, name, id);
}
// 

function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key);
}

//

//      ------ MORE MAJOR LINKAGE -----
function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
    //
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //
    //* name is what will appear as the name of the button.
    //
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //
    //* key is the char you want for the accesskey. Optional.
    //
    //* after is the id of the button you want to follow this one. Optional.
    //
    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);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        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;
}

// 

// ------------- LINKAGE ----------------

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

//==Include==

function loadJSext(s) {
    document.write('<script type="text/javascript" src="'+ s + '"></script>');
}

function loadCSS(page){
  page=page.replace(" ", "_");
  document.write('<style type="text/css">@import "'+phpurl+page+'&action=raw&ctype=text/css";</style>');
}
function loadCSSext(page){
  document.write('<style type="text/css">@import "'+page+'";</style>');
}

//Random stuff that GeorgeMoney makes for me.
loadJS('User:GeorgeMoney/aDel.js'); //test stuff.... hope it don't crash

loadJS('User:GeorgeMoney/csd.js'); //CSD deletion assistant stuff
//loadJS('User:GeorgeMoney/opencontribs.js'); //Open user contribs on rollback (currently has problems)
//loadJS('User:Betacommand/Spam.js'); //Anti-spam
loadJS('User:GeorgeMoney/UserScripts/RemExternalLinks'); //External link killer
loadJS('User:GeorgeMoney/UserScripts/hacks/FilterLinksearchMainspace'); //filter

<!--BEGIN GEORGEMONEY'S INTERFACE TO Wiz's IP LOOKUP SCRIPT --> 
document.write('<script type="text/javascript" src="'  
     + 'http://en.wikipedia.org/w/index.php?title=User:GeorgeMoney/UserScripts/LoadIpInfo'  
     + '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>'); 
<!--END GEORGEMONEY'S INTERFACE TO Wiz's IP LOOKUP SCRIPT -->

// Admin rollback tools [[Category:Wikipedia administrators who use VoA script|{{PAGENAME}}]]
//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>');
//

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

//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 autoafd_result()
{
  var close = prompt("Result of debate?")
  var f = document.editform, t = f.wpTextbox1;
  t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{ns:0');
  t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "ab" + "}}";
  f.wpSummary.value = "Closing debate; result was " + close;
}

function autoafd_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 autoafd_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 autoafd_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 autoafd_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 autoafd_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 autoafd_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 autoafd_add_afd_tabs()
{
  // Only add for pages with the right string somewhere in the title
  if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
    {
      addLink('p-cactions', 'javascript:autoafd_result()', "close");
      addLink('p-cactions', 'javascript:autoafd_relist()', "relist");
    }
  if (document.title.indexOf("Editing Talk:") != -1)
    {
      addLink('p-cactions', 'javascript:autoafd_keep()', "keep");
      addLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus");
      addLink('p-cactions', 'javascript:autoafd_redirect()', "redirect");
      addLink('p-cactions', 'javascript:autoafd_merge()', "merge");
      addLink('p-cactions', 'javascript:autoafd_other()', "other");
    }
}

addOnloadHook(autoafd_add_afd_tabs);

//end AfD closing script

function replace() {
    var s = prompt("Search regexp?");
    if(s) {
        var r = prompt("Replace regexp?");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

addOnloadHook(function () {
    if(document.forms.editform) {
        addLink('p-cactions', 'javascript:replace()', 'replace', 'ca-replace', 'Regexp replace for the edit window', '', 'ca-history');
    }
});

//}

//Auto AFD script

//Please include the two following lines
//Modified version of AutoVFD script to work with AFD
//Script Modified by User:Jtkiefer
//Further modified to work with [[WP:AFDC]] by [[User:ais523]]

// This needs to change depending on skin used.
function add_link(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
  na.appendChild(document.createTextNode(name));

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

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

function strip_namespace(target)
{
  var colon = target.indexOf(':');
  if (colon != -1)
    {
      var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');
      var ns = target.substring(0, colon);
      if (ns == '' || ns == 'Talk')
        return target.substring(colon + 1);
      else
        for (var i = 0; i < spaces.length; ++i)
          {
            if (ns == spaces[i]
                || ns == spaces[i] + '_talk')
              return target.substring(colon + 1);
          }
    }

  return target;
}

function afd()
{
  document.editform.wpTextbox1.value = '{{' + 'subst:afd}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'afd';

  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6,
                            target.lastIndexOf('&action=submit'));

  var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
  var date = new Date();
  date = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();

  var pagename = strip_namespace(target);

  window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/' + pagename + '&action=edit&fakeaction=afdsub&faketarget=' + target,
              'Afd ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizeable,scrollbars');
  window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/Log/' + date + '&action=edit&fakeaction=afdlist&faketarget=' + pagename,
              'AfdLog ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}

function autoafd()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }

      if (action == 'afdlist')
        {
          document.editform.wpTextbox1.value += '{{' + 'Wikipedia:Articles for deletion/' + target + '}}\n';
          document.editform.wpSummary.value = '[[Wikipedia:Articles for deletion/' + target + ']]';
        }
      else if (action == 'afdsub')
        {
          if (document.editform.wpTextbox1.value.length > 0)
            {
              target = document.editform.action;
              target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'))).replace(/_/g, ' ');
              window.alert("There's an old afd at the default location already.\n\n" +
                           'Please either move it out of the way (and update existing links to it), or file the Afd by hand in another location (such as [[' + target + ' (2)]]).');
            }
          else
            document.editform.wpTextbox1.value += '===[[' + target + ']]===\n' +
              '{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|>>add cat here<<}}\n'+
              'Reason for nomination. ~~' + '~~\n*\n*\n*\n';
        }
      else
        add_link('javascript:afd()', 'Afd');
    }
}

addOnloadHook(autoafd);

//
//

<!-- BEGIN VOA'S MONOBOOK OF COOLNESS -->
//<pre><nowiki>
//--------------------------------------------------------------
//First loads
//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');
//////////////////////

//Admin rollback tools
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>');
//END
//BCrat tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Bureaucrat/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
RfAshowlinks = 'true';
//END
//CU tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/CheckUser/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//UTC clock
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>');
//END
//Admin protection tools
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>');
//END
//Approvals
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Approvals.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Replace txt
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>');
//END</nowiki></pre>

//<nowiki><pre>
//---------------------------------------------------------------
//Toolbox links
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 = 'my Talk page';
    document.getElementById('pt-preferences').firstChild.innerHTML = 'Change Preferences';
    document.getElementById('pt-watchlist').firstChild.innerHTML = 'Check my Watchlist';
    document.getElementById('pt-mycontris').firstChild.innerHTML = 'My Contributions';
    document.getElementById('pt-logout').firstChild.innerHTML = 'Log out';
    if(document.getElementById('ca-delete'))
      {document.getElementById('ca-delete').firstChild.innerHTML = '<strong><span style="color:darkred;">delete</span></strong>';} 
}

function navigationlinks()
{
    addnavbox_link('/wiki/Wikipedia:Administrator_intervention_against_vandalism','Vandalism','aiv-ln');
    addnavbox_link('/wiki/Category:Candidates_for_speedy_deletion','Speedy deletions','speedy-ln');
    addnavbox_link('/wiki/Wikipedia:Requests for page protection','Protection requests','rfpp-ln');
    addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard','Noticeboard','AN-ln');
}

function addtoolboxlinks()
 {
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, '/wiki/Special:Newpages', 'New pages', '');
    addlilink(tb, '/wiki/Special:Log/newusers', 'New users', '');
    addlilink(tb, '/wiki/WP:PP', 'Protected pages', '');
}
//END
//---------------------------------------------------------------

// ======== 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 = wgTitle.replace(/User:|User talk:/,'');
      addTab("/w/index.php?title=Special%3ALog&user=" + username, "log", "ca-log", "actions", "");
      addTab("/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username, "bl", "ca-blog", "block log", "");
      addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edits", "ca-kate", "user info", "");
   }
}
//************

//************
//LAST DIFF TAB
function lastdiff() 
    {
    if (document.title.indexOf("Editing ") != -1 || document.getElementById('ca-history') == undefined || location.href.search(/&action=history/) !=-1){return;}
addTab("/w/index.php?title=" + wgPageName.replace(/&/g,'%26') + "&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(location.href.search(/title=Special:|\/Special:/) != -1) return;
  if(document.title.indexOf("Main Page") != -1) return;

  // 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=' + wgPageName + '&action=edit&section=0" title="' + wgTitle + '">' + 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?');}
}

//
addOnloadHook(Dfn_js_con)
function Dfn_js_con()
{
Mvaluejs_class = 'DMalak1';
Rvaluejs_class = 'ERollen2';
Uvaluejs_class = 'DRaven2';
}
//

//************
//New user log tools
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>');
//END
//Admin warning tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Adminwarnings/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//Delete tabs
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>');
//END
//************
//Google tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Google/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END

//Interiot's javascript edit counter
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'); }
//

//************
//Lupin's tools
//************
//Filter changes live [[Category:VoA scripted admins]]
//[[User:Lupin/recent2.js]] - please include this line
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>');
//
//popupShortcutKeys=true; // optional: enable keyboard shortcuts
//popupAdminLinks=true;   // optional: enable admin links [[Category:VoA scripted admins]]
//popupSubpopups=false;
//popupOnEditSelection=false;
//popupStructure='shortmenus';
//END
//************

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

//</nowiki>

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

<!-- END VOA'S MONOBOOK OF COOLNESS -->

//Peer review stuff
// Script from [[User:AndyZ/peerreviewer.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:AndyZ/peerreviewer.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
showInstaview_PR = true;
instaview_PR = true;
cat_PR = true;
initMsg_PR = "";
//</nowiki>

importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklearv.js');
importScript('User:AzaToth/twinklespeedy.js');
importScript('User:AzaToth/twinklediff.js');
importScript('User:AzaToth/twinkleprotect.js');

importScript('User:AzaToth/salt.js');

TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'window',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       "",
        deletionSummaryAd               :       "",
        watchSpeedyPages                :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ 'agf', 'vand' ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       false,
        markWarningsAsMinor             :       true,
        markAIVReportAsMinor            :       true
};

addOnloadHook(function (){
		if(queryString("submitdelete")=="true") document.forms[0].wpConfirmB.click();
	});
	function queryString(p) {
		var re = RegExp('[&?]' + p + '=([^&]*)');
		var matches;
		if (matches = re.exec(document.location)) {
			try { 
				return decodeURI(matches[1]);
			} catch (e) {
			}
		}
		return null;
	};

// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');

importScript('User:MarkS/extraeditbuttons.js'); //[[User:MarkS/extraeditbuttons.js]]
importScript('User:Ioeth/friendly.js'); //[[user:Ioteth/friendly.js]]