User:SoLando/monobook.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>
//--------------------------------------------------------------
//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');
//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
//Google 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
//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
//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

//live-preview stuff
wpUserName = 'Voice of All';
wpShowImages = true;
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js&action=raw&ctype=text/javascript');
//END
//---------------------------------------------------------------
function URLEncoding(input)
      {
        var encodedInputString=escape(input);
        encodedInputString=encodedInputString.replace("+", "%2B").replace("+", "%2B").replace("+", "%2B");
        encodedInputString=encodedInputString.replace("/", "%2F").replace("/", "%2F").replace("/", "%2F");   
        encodedInputString=encodedInputString.replace("&","%26").replace("&","%26").replace("&","%26");     
        var outputurl=encodedInputString;
        return outputurl;
      }
//END

//---------------------------------------------------------------
//Toolbox links
function changelinks() {
    if(!document.getElementById) return;
    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';
}
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/Category:Candidates_for_speedy_deletion', 'Speedy deletions', '');
    addlilink(tb, '/wiki/Wikipedia:Administrator_intervention_against_vandalism', 'Vandalism', '');
    addlilink(tb, '/wiki/WP:RfPP', 'Protection requests', '');
    addlilink(tb, '/wiki/WP:PP', 'Protected pages', '');
    addlilink(tb, '/wiki/Wikipedia:Administrators%27_noticeboard', 'Noticeboard', '');
    addlilink(tb, '/wiki/Wikipedia:Administrators%27_noticeboard/3RR', '3RR violations', '');
}
//END

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

//************

//************
//LAST DIFF TAB
function lastdiff() 
    {
    if (document.title.indexOf("Editing ") != -1 || document.getElementById('ca-history') == undefined)
    {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:35px;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() 
{
    lastdiff();
    changemovetab();
    changelinks();
    addtoolboxlinks();
}

window.onload = Main;
function Main() 
{
    addtoplink();
    LivePreviewInstall();
    if(addSinceTab)
    {addSinceTab();}
}
//END
//************

//
Mvaluejsadmin = 'DMalak1';
Rvaluejsadmin = 'ERollenH1';
//
//************
//Slow load tools
//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
// Script from [[User:MarkS/extraeditbuttons.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END
//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'); }
//

//Change move tab name
function changemovetab()
{
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';}
  if(document.getElementById('ca-move'))
  {document.getElementById('ca-move').firstChild.innerHTML = 'Rename';}
  if(document.getElementById('ca-history'))
  {document.getElementById('ca-history').firstChild.innerHTML = 'Revisions';}
  }
if (document.title.split(' - ')[0].split(".js")[1] != undefined)
  {
  if (document.title.split(' - ')[0].split(".js")[1] != undefined)
     {
      if(document.getElementById('ca-nstab-main'))
      {
      document.getElementById('ca-nstab-main').firstChild.innerHTML = 'Javascript';
      }  
      else if(document.getElementById('ca-nstab-user'))
      {
      document.getElementById('ca-nstab-user').firstChild.innerHTML = 'User JS';
      } 
      else if(document.getElementById('ca-nstab-mediawiki'))
      {
      document.getElementById('ca-nstab-mediawiki').firstChild.innerHTML = 'MediaWiki JS';
      }  
    }
  }
}
//END

//************
//Lupin's tools
//************
//Filter changes live [[Category:Wikipedia administrators who use VoA script]]
//[[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:Wikipedia administrators who use VoA script]]
popupSubpopups=false;
popupOnEditSelection=false;
popupStructure='shortmenus';
//END
//************
//</nowiki></pre>[[Category:Wikipedia administrators who use VoA script]]