User:Mushii/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>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//    |—————————————————————————————————————————————————————————————————————————————————————————————————————————|    //
//    |-| I feel I am *relatively* good at JavaScript programming, so feel free to ask me questions about any |-|    //
//    |-| scripts on this page. I've gotten the majority of my scripts from [[WP:US/S]]; if you want code,    |-|    //
//    |-| then go there.  Please note that all of these scripts are tested in and developed for Mozilla       |-|    //
//    |-| Firefox ONLY!                                                                                       |-|    //
//    |—————————————————————————————————————————————————————————————————————————————————————————————————————————|    //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
importScript('User:Gracenotes/amelvand.js');
importScript('User:Animum/editsection.js');
importScript('User:Animum/reset.js');
importScript('User:Animum/ais523editcount.js');
importScript('User:Tra/sidebartranslate.js');
importScript('User:Thedjatclubrock/avt.js');
importScript('User:Animum/liveclock.js');
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklexfd.js');
if(wgNamespaceNumber == 14) importScript('User:AzaToth/twinklebatchdelete.js');
importScript('User:Animum/twinkledelimages.js');
importScript('User:Animum/twinklespeedy.js');
TwinkleConfig = {
        deletionSummaryAd               :       "",
        protectionSummaryAd             :       "",
        summaryAd                       :       "",
        showSharedIPNotice              :       false,
        orphanBacklinksOnSpeedyDelete   :       false,
};
 
importScript('User:Lupin/popups.js');
//[[User:Lupin/popups.js]]
popupHideDelay=0.1;
popupDelay=1;
popupAdminLinks=true;
popupsFixDabs=true;
 
importScript('Wikipedia:WikiProject User scripts/Scripts/MotD closure script');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); 
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:Animum/count.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Fix lowercase first letter problem');
 
addOnloadHook(function() {
if(wgAction=="edit") document.forms["editform"].wpWatchthis.checked = false;
});
 
//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_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)
    {
      mw.util.addPortletLink('p-cactions', 'javascript:autoafd_result()', "close");
      mw.util.addPortletLink('p-cactions', 'javascript:autoafd_relist()', "relist");
    }
}
 
addOnloadHook(autoafd_add_afd_tabs);
 
//end AfD closing script
 
function addLink(where, url, name, id, title, key, after) {
    // addLink() accepts either an id or a DOM node, mw.util.addPortletLink() only takes a node
    if (after && !after.cloneNode)
        after = document.getElementById(after);
 
    return mw.util.addPortletLink(where, url, name, id, title, key, after);
}
 
//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'); }
 
if(wgUserName == "Animum") importScript('User:Animum/headers.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add toolbox link');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add tab');
 
 
//
 
// STATUS CHANGER
addOnloadHook(function (){
  var subpage = "/Status";
  var scheme = "/StatusTemplate";
  var subpagelink = wgServer + "/wiki/User:" + wgUserName + subpage;
  var logout = document.getElementById( 'pt-logout' );
  //Add the links
  mw.util.addPortletLink("p-personal", subpagelink + "?action=edit&newstatus=in", "in", "pt-status-in", "I'm in!", "", logout);
  mw.util.addPortletLink("p-personal", subpagelink + "?action=edit&newstatus=busy", "busy", "pt-status-busy", "I'm busy!", "", logout);
  mw.util.addPortletLink("p-personal", subpagelink + "?action=edit&newstatus=out", "out", "pt-status-out", "I'm out!", "", logout);
  if (location.href.indexOf("?action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  var statusRegExp = /\?action=edit&newstatus=(.*)/;
  var status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = "{{User:"+wgUserName+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "Status: "+status;
  document.getElementById('wpMinoredit').checked = 'checked';
  //Submit it!
  document.getElementById('editform').submit();
});
 
//
 
function makeDocLink() {
  if( wgCanonicalNamespace == "Template" && document.getElementById("doc_editlinks") ) {
    var editsection = document.getElementById("doc_editlinks");
    editsection.innerHTML = '[<a href="' + wgServer + '/wiki/' + wgPageName + '/doc">view</a>]' + "&nbsp;" + '[<a href="'+ mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + wgPageName + '/doc&action=edit" title="Edit the template documentation for this page">edit</a>]';
  }
}
 
addOnloadHook(makeDocLink);
 
function addPurgeLinkToToolbox() {
    addToolboxLink('http://en.wikipedia.org/w/index.php?title=' + wgPageName + '&action=purge', "Purge this page", '', '', '', "Purge the cache for this page.");
}
 
addOnloadHook(addPurgeLinkToToolbox);
 
function tagArticle() {
    var template = prompt("What tag to place?");
    document.editform.wpTextbox1.value = "\{\{" + template + "\}\}\n" + document.editform.wpTextbox1.value;
    document.editform.wpSummary.value = "\+\{\{" + template.toLowerCase() + "\}\}"; 
    document.editform.wpMinoredit.checked = true;
    document.editform.wpSave.click();
}
 
function addTagLink() {
  if( (wgNamespaceNumber != -1) && wgAction == "edit") {
    addToolboxLink('javascript:tagArticle()', "Tag page", '', '', '', "Tag this page with a template"); }
}
 
addOnloadHook(addTagLink);
 
function addSubpageLink() {
  var subpagename = wgPageName.split( '/' )[1];
    if( wgNamespaceNumber != 0 && !subpagename ) {
      addToolboxLink(mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=Special:Prefixindex/" + wgPageName + "/", "Subpages", '', '', '', 'View the <a href="http://en.wikipedia.org/wiki/Wikipedia:Subpages">subpages</a> of this page'); }
}
 
addOnloadHook(addSubpageLink);
 
addOnloadHook(function() {
    var subpagename = wgPageName.split( '/' )[1];
    if( ( wgNamespaceNumber == "3" || wgNamespaceNumber == "2" ) && !subpagename ) {
    addToolboxLink("http://en.wikipedia.org/w/index.php?title=Special:DeletedContributions&target=" + wgTitle, 'Deleted Contributions', '', '', ''); }
});
 
 
importScript('User:Voice_of_All/replacetxt.js');
//wierd stuff
importScript('User:Voice_of_All/Specialadmin/monobook.js');
//crat stuff
importScript('User:Voice_of_All/Bureaucrat/monobook.js');
importScript('User:Voice_of_All/History/monobook.js');
//Protection stuff
importScript('User:Voice_of_All/Protection/monobook.js');
importScript('User:Steel359/protection.js');
//rollback
importScript('User:Voice_of_All/Revert.js');
//New pages tools
importScript('User:Voice_of_All/Sleeper/monobook.js');
importScript('User:Voice_of_All/Adminwarnings/monobook.js');
importScript('User:Voice_of_All/Deletion/monobook.js');
importScript('User:Voice_of_All/Google/monobook.js');
importScript('User:Voice of All/Addtabs/monobook.js');
Mvaluejs_class = '';
Rvaluejs_class = '';
Uvaluejs_class = '';
 
importScript('User:Ais523/votesymbols.js');
 
addOnloadHook(function()
 {
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, '/wiki/Special:Newpages', 'New pages', 'newpages-ln');
    addlilink(tb, '/wiki/Wikipedia:Usernames_for_administrator_attention', 'Usernames', 'uaa-ln');
    addlilink(tb, '/wiki/Wikipedia:List_of_protected pages', 'Protected pages', 'pp-ln');
    addlilink(tb, '/wiki/Wikipedia:Administrator_intervention_against_vandalism','Vandalism','aiv-ln');
    addlilink(tb, '/wiki/Category:Candidates_for_speedy_deletion','Speedy deletions','speedy-ln');
    addlilink(tb, '/wiki/Wikipedia:Requests for page protection','Protection requests','rfpp-ln');
    addlilink(tb, '/wiki/Wikipedia:Administrators%27_noticeboard','Noticeboard','AN-ln'); 
 });
 
function PortletMenu( id ) // Taken from [[User:KnowledgeOfSelf/monobook-normal.js]]
 {
 this.menu = document.getElementById( id );
 this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", etc.
 
 var LIs = this.list.getElementsByTagName( 'li' );
 
 for ( var i = 0; i < LIs.length; i++ )
 {
 this[ LIs[ i ].id ] = LIs[ i ];
 }
 
 this.newItem = function( id, txt, url )
 { var li = document.createElement( 'li' ); li.id   = id;
 var  a = document.createElement( 'a'  );  a.href = url;
 
  a.appendChild( document.createTextNode( txt ) );
 li.appendChild( a );
 
 this[ id ] = li; // watch this!!!
 
 return li;
 }
 
 this.append = function( id, txt, url )
 { this.list.appendChild( this.newItem( id, txt, url ) );
 }
 
 this.insertBefore = function( old, id, txt, url )
 { this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] );
 }
 
 this.getText = function( id      ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data }
 this.setText = function( id, txt ) {        this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt }
 
 this.getHref = function( id      ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href       }
 this.setHref = function( id, url ) {        this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url }
 
 }
 
addOnloadHook(function() {
  usermenu = new PortletMenu('p-personal');
    document.getElementById('p-personal').getElementsByTagName('ul')[0].style.textTransform = 'none';
    usermenu.setText('pt-mytalk', 'talk');
    usermenu.setText('pt-preferences', 'preferences');
    usermenu.setText('pt-watchlist', 'watchlist');
    usermenu.setText('pt-mycontris', 'contribs');
    usermenu.setText('pt-logout', 'logout');
 if(document.getElementById('ca-addsection')) document.getElementById('ca-addsection').firstChild.innerHTML = '<b>+</b>';
});
 
importScript('User:Animum/easyblock.js');
importScript('User:Animum/rfavote.js'); //Joke script for laughs.
//</nowiki></pre>