User:Tygrrr/monobook.js

From Simple English Wikipedia, the free encyclopedia

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

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
WarnVandalSig = " {" + "{subst:user:tygrrr/sig}} " + "~~" + "~~" + "~\n";

WarnVandalCustomItems.push( Array('welcome', 1, 'welcome!', 'welcome') );
WarnVandalCustomItems.push( Array('anon', 1, 'welcome anon', 'anon') );
WarnVandalCustomItems.push( Array('test', 1, 'test', 'test') );
WarnVandalCustomItems.push( Array('test2', 1, 'test2', 'test2') );
WarnVandalCustomItems.push( Array('test3', 1, 'test3', 'test3') );
WarnVandalCustomItems.push( Array('test4', 1, 'test4', 'test4') );
WarnVandalCustomItems.push( Array('test4im', 1, 'test4im', 'test4im') );
WarnVandalCustomItems.push( Array('test5', 1, 'blocked', 'test5') );
WarnVandalCustomItems.push( Array('block2', 0, 'blocked', 'blocked 2') );
WarnVandalCustomItems.push( Array('blocked', 0, 'indef blocked', 'indef') );
WarnVandalCustomItems.push( Array('test2a', 1, 'test2a', 'test2a') );
WarnVandalCustomItems.push( Array('test3a', 1, 'test3a', 'test3a') );
WarnVandalCustomItems.push( Array('testarticle', 1, 'testarticle', 'testarticle') );
WarnVandalCustomItems.push( Array('test2article', 1, 'test2article', 'test2article') );
WarnVandalCustomItems.push( Array('test3article', 1, 'test3article', 'test3article') );

/***********************************************************************
                         EXTRA TOOLBAR LINKS
***********************************************************************/

function Tygrr_addToolboxLink (url, name){
  var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
  var na = document.createElement('a');
  na.href = url;
  na.appendChild(document.createTextNode(name));
  var li = document.createElement('li');
  li.appendChild(na);
  tb.appendChild(li);
}

$( function() {
  Tygrr_addToolboxLink
(wgServer + wgScriptPath  +'/index.php?title=Special%3ANewpages&namespace=14' + '&username=&offset=0&limit=200', 'New categories');
  Tygrr_addToolboxLink(wgServer + '/wiki/Special:Newpages', 'New pages');
  Tygrr_addToolboxLink
(wgServer + '/wiki/Special:Withoutinterwiki', 'Pages w/o interwiki');
  Tygrr_addToolboxLink(wgServer + '/wiki/Special:Uncategorizedpages', 'Uncategorized pages');
  Tygrr_addToolboxLink(wgServer + '/wiki/Special:Wantedcategories', 'Wanted categories');
});

/***********************************************************************
                         EXTRA EDIT BUTTONS
***********************************************************************/
// Extra edit page buttons [[Wikipedia:Tools/Editing_tools#Misc._Editing_tools]]
 
// This is based on the original code on Wikipedia:Tools/Editing tools
//
// The original code was on the project page and needed to be cut and paste to the user's
// monobook.js page. However, this caused problems with the quote marks. So I have moved 
// it to its own page. 
//
// I have taken this from simple:user:Huji/monobook.js and modified it. I do not know how to do this from scratch so if you want it for yourself, you're better off using another source.
//
// See the [[User:MarkS/Extra edit buttons]] for changes log
 
 
function InsertButtonsToToolBar()
{
d = new Date();
todayISO = d.getFullYear()+"-";
if (d.getMonth > 8) {
  todayISO += (d.getMonth()+1)+"-";
} else {
  todayISO += "0"+(d.getMonth()+1)+"-";
}
if (d.getDay > 9) {
  todayISO += d.getDate();
} else {
  todayISO += "0"+d.getDate();
}

//Template button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png",
    "speedTip": "Template",
    "tagOpen": "{{",
    "tagClose": "}}",
    "sampleText": "Template:"}
//Category button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/b6/Button_category_link.png",
    "speedTip": "Category",
    "tagOpen": "[[Category:",
    "tagClose": "]]",
    "sampleText": "Category title"}
//Redirect button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
    "speedTip": "Redirect",
    "tagOpen": "#redirect[[",
    "tagClose": "]]",
    "sampleText": "Redirect page"}
//English interwiki button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png",
    "speedTip": "EN interwiki",
    "tagOpen": "[[en:",
    "tagClose": "]]",
    "sampleText": "English article"}
//My signature button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/d/d1/Button_mysignature.png",
    "speedTip": "My sig",
    "tagOpen": "{{subst:",
    "tagClose": "user:tygrrr/sig}}",
    "sampleText": ""}
}
$( InsertButtonsToToolBar );

/* Script to warn you if your userpage is changed by another user. By [[en:User:ais53]]. Note that the message will display until you edit your userpage yourself. */
 
function upm_checkthisisme(xmlreq)
{
  var junk;
  try
  {
    var ed=xmlreq.responseText.split('<rev user="')[1].split('"')[0];
    if(ed!=wgUserName) document.getElementById('siteSub').innerHTML+="<div class='usermessage'>Your userpage was changed by "+
      "<a href='/wiki/User:"+encodeURI(ed)+"'>"+ed.split('<').join('&lt;').split('>').join('&gt;').split('&').join('&amp;')+"</a>"+
      " (<a href='/wiki/Special:Mypage'>your userpage</a>, <a href='/w/index.php?title=User:"+encodeURI(wgUserName)+"&diff=last'>"+ 
      "last change</a>)";
  } catch(junk) {};
}
 
$(function(){
  var a = sajax_init_object();
  a.open('GET', mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php?action=query&prop=revisions&titles=User:'+
    encodeURI(wgUserName)+'&rvlimit=1&rvprop=user&format=xml');
  a.send('');
  a.onreadystatechange = function(){if(a.readystate==4) upm_checkthisisme(a)};
});