User:Brossow/monobook.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
//---------------------------------------------------------------------------------------------------------------
//----- HELPER FUNCTIONS ----------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/addLink

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", or "p-navigation".
    //* 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;
}
    

//---------------------------------------------------------------------------------------------------------------

// Adds addlilink(), addTab(), and addToolboxLink() library functions

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


//---------------------------------------------------------------------------------------------------------------
//----- INDEPENDENT MODULES -------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------

// Script from [[Wikipedia:WikiProject User scripts/Scripts/CleanupTab.js]]

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


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/Quick wikify

function doQwikify() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Wikify-date|' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for wikification.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addQwikify() {
  addTab("javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addQwikify);
  }
});


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/Autocopyvio.js

// AutoCopyvio - Adds copyright violation notice to article and adds entry to Copyright Problems page
// Created by Bmicomp from modified AutoVFD(by Korath)
  
  function add_link2(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 copyvio()
  {
    document.editform.wpTextbox1.value = '{' + '{' + 'copyvio|url=}}';
    document.editform.wpSummary.value = 'copyvio';
  
    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();
    var datestring = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();
    var pagename = strip_namespace(target);
  
    window.open('/w/index.php?title=Wikipedia:Copyright_problems/' + datestring + '&action=edit&fakeaction=copyviolist&faketarget=' + pagename, 'status,toolbar,location,menubar,directories,resizeable,scrollbars');
  }
  
  function autocopyvio()
  {
    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 == 'copyviolist')
          {
              document.editform.wpTextbox1.value += '*[[' + target + ']] <span class="plainlinks">([http://en.wikipedia.org/{{localurl:' + target + '|action=history}} history] ยท [http://en.wikipedia.org/{{localurl:' + target + '|diff=0}} last edit])</span>' + ' from [' + '] ~' + '~~' + '~';
              document.editform.wpSummary.value = 'Copyvio ' + '[[' + target + ']]';
          }
        else
          add_link2('javascript:copyvio()', 'copyvio');
      }
  }
  
  addOnloadHook(autocopyvio);


//---------------------------------------------------------------------------------------------------------------

// User:Jnothman/afd helper

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

/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/AutoAFD.js

//Modified version of AutoVFD script to work with AFD
//Script Modified by User:Jtkiefer

// 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' +
              'Reason for nomination. ~~' + '~~\n*\n*\n*\n';
        }
      else
        add_link('javascript:afd()', 'Afd');
    }
}

addOnloadHook(autoafd);


//---------------------------------------------------------------------------------------------------------------

// DOUBLE REDIRECT FIXER

addOnloadHook(function () {
    var contentSub = document.getElementById('contentSub');
    var contentDiv = document.getElementById('content');
    if (!contentSub || !contentDiv) return;

    var contentSubLinks = contentSub.getElementsByTagName('a');
    var redirSource = null;
    for (var i = 0; i < contentSubLinks.length && !redirSource; i++) {
        if (contentSubLinks[i].search.indexOf('redirect=no') >= 0)
            redirSource = contentSubLinks[i];
    }
    if (!redirSource) return;

    var contentDivSpans = contentDiv.getElementsByTagName('span');
    var redirTarget = null;
    for (var i = 0; i < contentDivSpans.length && !redirTarget; i++) {
        if (contentDivSpans[i].className == 'redirectText')
            redirTarget = contentDivSpans[i].getElementsByTagName('a')[0];
    }
    if (!redirTarget) return;

    if (!confirm('Double redirect detected!\nChange "'+redirSource.title+'" to point to "'+redirTarget.title+'"?')) return;

    var createHTTPRequest = function () {
        try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
        try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
        try { return new XMLHttpRequest(); } catch(e) {}
        alert("XMLHttpRequest not supported");
        return null;
    };

    var req;
    var step1 = function () {
        window.status = 'Opening "'+redirSource.title+'" for editing...';
        req = createHTTPRequest(); 
        if (!req) return;

        req.open('GET', 'http://en.wikipedia.org/w/index.php?title='+encodeURIComponent(redirSource.title)+'&action=edit');
        req.onreadystatechange = step2;
        req.send(null);
    };
    var step2 = function () {
        if (req.readyState != 4) return;
        alert('Got response '+req.status+' ('+req.statusText+')');
    };

    step1();
});


//---------------------------------------------------------------------------------------------------------------

// Script from [[User:Lupin/popupsdev.js]]

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

popupFixRedirs=true;
popupFixDabs=true;
popupMaxWidth=450;
popupRevertSummaryPrompt=true;
popupDelay=0.25;
popupLiveOptions=true


//---------------------------------------------------------------------------------------------------------------

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


//---------------------------------------------------------------------------------------------------------------

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


//---------------------------------------------------------------------------------------------------------------

 // Edit tools for the vandal whack-a-mole game
 // [[User:Kbh3rd/whackamole.js]] - please include this line

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


//---------------------------------------------------------------------------------------------------------------

// Kate replacement

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


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/User tabs
// Please leave the following line
// user:Where/usertabs

addOnloadHook(function() {
  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history
     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/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", "");
     addTab("http://en.wikipedia.org/w/index.php?title=Special:Log&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", "");
     addTab("http://en.wikipedia.org/w/index.php?title=Special:Log&type=block&user=" + username, "block log", "ca-blog", "blog", "");
     addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", "");
  }
});


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/test-n.js

function tnaddlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);

  var txt = document.createTextNode(name);
  na.appendChild(txt);

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

function testn(number)
{
  var page = prompt("Vandalism to which article?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "test" + number + "-n|" + page + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Vandalism to [[" + page + "]] - warning " + number;
}

function add_testn_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

  // Only add for pages with "Editing User talk:" somewhere in the title
  if (document.title.indexOf("Editing User talk:") != -1)
    {
      tabs.appendChild(tnaddlilink('javascript:testn(1)',"t1"));
      tabs.appendChild(tnaddlilink('javascript:testn(2)',"t2"));
      tabs.appendChild(tnaddlilink('javascript:testn(3)',"t3"));
      tabs.appendChild(tnaddlilink('javascript:testn(4)',"t4"));
    }
}

addOnloadHook(add_testn_tabs);


//---------------------------------------------------------------------------------------------------------------

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


//---------------------------------------------------------------------------------------------------------------

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


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/Watchlist since
// Adds a "Changes since last load" link to your watchlist.

addOnloadHook(function () {
    if (unescape(window.location.href).indexOf("Special:Watchlist") < 0) return;

    // just one little ID attribute would be _so_ nice...
    var wlNotePara = document.getElementsByTagName('hr')[0];
    while (wlNotePara && !(wlNotePara.tagName && wlNotePara.tagName.toLowerCase() == 'p'))
        wlNotePara = wlNotePara.nextSibling;
    if (!wlNotePara) return;

    var link = document.createElement('a');
    link.id = 'listSince';
    link.href = '#listSince';  // must have a href to show as link!

    var then = +(new Date());
    var fixLinkHref = function () {
        var url = window.location.href.split('#')[0];
        var days = ( +(new Date()) - then )/(1000 * 3600 * 24);
        if (url.match(/[?&]days=/))
            this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days);
        else
            this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;
        return true;
    };
    link.onclick = fixLinkHref;
    link.onmousedown = fixLinkHref;  // react to middle clicks too

    wlNotePara.appendChild(document.createElement('br'));
    wlNotePara.appendChild(link);
    link.appendChild(document.createTextNode('Changes'));
    wlNotePara.appendChild(document.createTextNode(' since last load.'));
});


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/Edit Top
// This will add an [edit top] link at the top of all pages except preview pages
// by User:Pile0nades

// Add an [edit top] link to pages
addOnloadHook(function () {
  // if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -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:15px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';

  // insert divContainer into the DOM before the h1
  if(window.location.href.indexOf("&action=edit") == -1)
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

  if(window.location.href.indexOf("&action=edit&section=0") != -1)
    document.getElementById("wpSummary").value = "/* Intro */ ";
});


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/Watchfilter

addOnloadHook(function () {
    if (unescape(window.location.href).indexOf("Special:Watchlist") < 0) return;

    // just one little ID attribute would be _so_ nice...
    var wlNotePara = document.getElementsByTagName('hr')[0];
    while (wlNotePara && !(wlNotePara.nodeType == 1 && wlNotePara.tagName.toLowerCase() == 'p'))
        wlNotePara = wlNotePara.nextSibling;
    if (!wlNotePara) return;

    var nameSpaces = new Array ('Talk', 'User', 'User talk', 'Wikipedia', 'Wikipedia talk',
                                'Image', 'Image talk', 'MediaWiki', 'MediaWiki talk',
                                'Template', 'Template talk', 'Help', 'Help talk',
                                'Category', 'Category talk', 'Portal', 'Portal talk');
    var list = new Array ();

    var prepareFilter = function () {
        var nsRegexp = new RegExp ("^(" + nameSpaces.join("|") + "):");

        var dates = document.getElementById('content').getElementsByTagName('h4');
        for (var i = 0; i < dates.length; i++) {

            var node = dates[i].nextSibling;
            while (node && node.nodeType != 1) node = node.nextSibling;
            if (!node) continue;

            var sublist = new Array ();
            switch (node.tagName.toLowerCase()) {
              case 'ul':  // normal mode
                sublist = node.getElementsByTagName('li');
                break;

              case 'div': // enhanced mode
                var row = sublist[0] = document.createElement('span');
                node.insertBefore(row, node.firstChild);
                var subnode;
                while (subnode = row.nextSibling) {
                    row.appendChild(subnode);
                    if (subnode.nodeType == 1 && subnode.tagName.toLowerCase() == 'br') {
                        var nextRow = document.createElement('span');
                        node.insertBefore(nextRow, row.nextSibling);
                        row = sublist[sublist.length] = nextRow;
                    }
                }
                break;
            }
            for (var j = 0; j < sublist.length; j++) {
                var link = sublist[j].getElementsByTagName('a')[0];
                if (!link) continue;
                var nsPrefix = nsRegexp.exec(link.title);
                nsPrefix = (nsPrefix ? nsPrefix[1] : "(Main)");
                sublist[j].setAttribute('watchFilterNsPrefix', nsPrefix);
                list[list.length] = sublist[j];
            }
        }
    };

    var activateFilter = function () {
        var nsPrefix = nsSelect.options[nsSelect.selectedIndex].value;

        nsCheckbox.disabled = (nsPrefix == "");
        var invert = (nsPrefix != "" && nsCheckbox.checked);

        for (var i = 0; i < list.length; i++) {
            var show = (nsPrefix == "" || nsPrefix == list[i].getAttribute('watchFilterNsPrefix'));
            if (invert ? !show : show)
                list[i].className = list[i].className.replace(/(^|\s)hiddenStructure(\s|$)/, "$2");
            else
                list[i].className = list[i].className.replace(/(?:(^|\s)hiddenStructure(\s|$)|$)/, " hiddenStructure$2");
        }
    };

    var nsForm = document.createElement('form');
    nsForm.style.display = 'inline';
    nsForm.onsubmit = 'return false';
    nsForm.appendChild(document.createTextNode('Namespace: '));

    var nsSelect = document.createElement('select');
    nsSelect.name = 'ns';
    nsSelect.innerHTML += '<option value="" selected="selected">All</option>\n';
    nsSelect.innerHTML += '<option value="(Main)">(Main)</option>\n';
    for (var i = 0; i < nameSpaces.length; i++) {
        nsSelect.innerHTML += '<option value="' + nameSpaces[i] + '">' + nameSpaces[i] + '</option>\n';
    }
    nsSelect.onchange = activateFilter;
    nsForm.appendChild(nsSelect);

    var nsCheckboxLabel = document.createElement('label');
    var nsCheckbox = document.createElement('input');
    nsCheckbox.type = 'checkbox';
    nsCheckbox.name = 'invert';
    nsCheckbox.value = '1';
    nsCheckbox.onclick = activateFilter;
    nsCheckboxLabel.appendChild(nsCheckbox);
    nsCheckboxLabel.appendChild(document.createTextNode(' Invert selection'));
    nsForm.appendChild(document.createTextNode(' ('));
    nsForm.appendChild(nsCheckboxLabel);
    nsForm.appendChild(document.createTextNode(') '));

    wlNotePara.appendChild(document.createElement('br'));
    wlNotePara.appendChild(nsForm);

    prepareFilter();
    activateFilter();
});


//---------------------------------------------------------------------------------------------------------------

// Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited
// From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510

function addSinceTab() {
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) {
       do_since_I_last_edited()
    }
    else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) {
       var thetitle=document.title.slice(0, String(document.title).indexOf(" - "));
       var l=addlilink(tabs, "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'since', '');
       l.lastChild.title="Changes since I last edited";
    }
}
function do_since_I_last_edited() {
        var csub=document.getElementById("contentSub");
        var msg=document.createElement("p");
        msg.appendChild(document.createTextNode
                        ("Parsing history... please wait..."));
        msg.className="error";
        csub.insertBefore(msg, csub.firstChild)

        var username=document.getElementById("pt-userpage").textContent;
        var hists=document.getElementById("pagehistory").childNodes;
        for (n=0;n<hists.length;n++) {
            if (hists[n].getElementsByTagName("span")[0].textContent==username) {
                document.location=hists[n].childNodes[1].href; 
                return;
            }
        }

        msg.replaceChild(document.createTextNode
                         ("You have not edited this page! (recently)"),
                         msg.firstChild);
}

addOnloadHook(addSinceTab);


//---------------------------------------------------------------------------------------------------------------

// /**** Auto start new topics when hitting empty talk pages from the content page ****/

function talkpageplus()
{
    var talkpagelink = document.getElementById('ca-talk');
    if (talkpagelink.className == 'new')
    {
        talkpagelink.firstChild.href += '&section=new';
    }
}
if (window.addEventListener) window.addEventListener("load",addForceSummary,false);
else if (window.attachEvent) window.attachEvent("onload",addForceSummary);
else{
    window._old_ABCD_onload = window.onload;
    window.onload = function(){
        window._old_ABCD_onload();
        addForceSummary();
    }
}