User:Misza13/monobook.js

From Wikipedia, the free encyclopedia

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.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
//<pre><nowiki>
 
// [[User:Lupin/popups.js]]
 
//importScript('User:Lupin/popups.js'); //replaced with Gadgets
popusStructure = 'fancy2';
popupDelay = 2;
popupFixDabs = true;
popupAdminLinks = true;
popupOnEditSelection = false;
 
//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  importScript('User:Interiot/Tool2/code.js'); }
 
// Helper tools
importScript('User:Voice_of_All/Addtabs/monobook.js');
 
// Admin tools
// importScript('User:Voice_of_All/admin/monobook.js');
 
addOnloadHook(function (){
//moves
Mvaluejs_class = 'yes';
//edits
Rvaluejs_class = 'yes';
//uploads
Uvaluejs_class = 'yes';
});
 
importScript('User:AzaToth/morebits.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
 
if (document.title.indexOf('Editing User talk:') != -1) {
  importScript('User:AzaToth/twinklewarn.js');
} else {
  importScript('User:AzaToth/twinklespeedy.js');
  importScript('User:AzaToth/twinkleprotect.js');
}
 
TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'tab',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       "",
        deletionSummaryAd               :       "",
        protectionSummaryAd             :       "",
        watchSpeedyPages                :       [  ],
        openUserTalkPageOnSpeedyDelete  :       [  ],
        watchRevertedPages              :       [  ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       false,
        markWarningsAsMinor             :       true,
        markAIVReportAsMinor            :       true,
        markSpeedyPagesAsMinor          :       true,
        confirmUsernameToAIV            :       true,
        orphanBacklinksOnSpeedyDelete   :       true
};
 
 
if (location.href.indexOf('Special:Watchlist') != -1) {
  importScript('User:Misza13/watchlistSorter.js');
}
 
//importScript('User:Misza13/statusChanger.js');
 
if (wgAction == 'edit' || wgAction == 'submit') {
  importScript('User:Misza13/votingToolbar.js');
}
 
////////OTHER STUFF
 
function addlilinkwithedit(tabs, page, name){
   page = page.replace(/ /,'_');
   logLI = document.createElement('li');
   logLI.appendChild(make_link('http://en.wikipedia.org/wiki/'+page,name));
   logLI.appendChild(document.createTextNode(' ('));
   logLI.appendChild(make_link('http://en.wikipedia.org/w/index.php?action=edit&title='+page,'edit'));
   logLI.appendChild(document.createTextNode(')'));
   tabs.appendChild(logLI);
}
 
function make_link(url,text) {
  newA = document.createElement('a');
  newA.href = url;
  newA.appendChild(document.createTextNode(text));
  return newA;
}
 
 
//////////GOOGLE AND YAHOO SEARCHES
addOnloadHook(function (){
  var title;
  if (!(title = document.getElementById('t-whatlinkshere') )) return;
  if (!(title = title.getElementsByTagName('a')[0] )) return;
  if (!(title = title.href )) return;
  if (!(title = title.replace(/^.*Special:Whatlinkshere\//, '') )) return;
  if (!(title = title.replace(/^(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/, '') )) return;
  if (!(title = title.replace(/("|%22)/g, '') )) return;
  if (!(title = title.replace(/_/g, '%20') )) return;
 
  addLink('p-tb', 'http://www.google.com/search?q=%22'+title+'%22%20-Wikipedia&ie=utf-8&oe=utf-8',
    'Google search', 't-googlesearch', 'Search Google for "'+decodeURIComponent(title)+'"', 'G', null);
  addLink('p-tb', 'http://search.yahoo.com/search?p=%22'+title+'%22%20-Wikipedia&ei=UTF-8',
    'Yahoo! search', 't-yahoosearch', 'Search Yahoo! for "'+decodeURIComponent(title)+'"', 'Y', null);
});
 
 
//////////TOOLBOX LINKS
addOnloadHook(function(){
 // get page title
 var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php(?:\?.*&|\?)title=)([^&?#]*)/;
 ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' ');
 user_logs_url1 = "";
 misza_counter = "";
 
 tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0];
 
 addlilink(tabs, '/wiki/Special:Log', 'All logs', 'pt-alllogs');
 addlilink(tabs, '/wiki/Special:Ipblocklist', 'Block list', 'pt-ipblocklist');
 
 // if this is a user, show the logs for the user rather than the page
 if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) {
   regDropSubpages = /[User|User_talk][:|%3A]([^&?\/]*)[\/]?.*/;
   user = regDropSubpages.exec(ptitle)[1];
   user_logs_url1 = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user;
   user_logs_url2 = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=User:" + user;
   misza_counter = ("http://tools.wikimedia.de/~misza13/cgi-bin/count.py?user="+user+"&project=enwiki_p").replace(" ","_");
 }
 
 if (misza_counter != "") {
   addlilink(tabs, misza_counter, "Misza counter", "pt-misza-counter");
 }
 
 if (user_logs_url1 != "") {
   logLI = document.createElement('li');
   logLI.id = 'pt-logs';
   logLI.appendChild(make_link('http://en.wikipedia.org/wiki/User:'+user,'User'));
   logLI.appendChild(document.createTextNode(' ('));
   logLI.appendChild(make_link(user_logs_url1,'logs'));
   logLI.appendChild(document.createTextNode(' • '));
   logLI.appendChild(make_link(user_logs_url2,'logs'));
   logLI.appendChild(document.createTextNode(')'));
   tabs.appendChild(logLI);
 }
 addlilink(tabs, '/w/index.php?title=Special:Log&page=' + ptitle, 'Page logs', 'pt-pagelogs');
 addlilink(tabs, '/wiki/User:Misza13/Desk', 'Desk', '');
 addlilink(tabs, '/wiki/User:Misza13/Sandbox', 'Sandbox', '');
 addlilink(tabs, '/wiki/User:Misza13/Scripts', 'Scripts', '');
 addlilink(tabs, '/wiki/User:MiszaBot', 'MiszaBot', '');
 addlilink(tabs, '/wiki/User:MiszaBot_I', 'MiszaBot I', '');
 addlilink(tabs, '/wiki/User:MiszaBot_II', 'MiszaBot II', '');
 addlilink(tabs, '/wiki/User:MiszaBot_III', 'MiszaBot III', '');
 addlilink(tabs, '/wiki/User:WdefconBot', 'WdefconBot', '');
 addlilinkwithedit(tabs, 'Template:Wdefcon', 'WikiDefcon');
 addlilinkwithedit(tabs, 'User:Misza13/monobook.js', 'Monobook.js');
 addlilinkwithedit(tabs, 'User:Misza13/monobook.css', 'Monobook.css');
 addlilink(tabs, 'http://pl.wikipedia.org/wiki/Wikipedysta:Misza13', 'pl:Misza13', '');
});
 
 
////////////WIKIBREAK ENFORCER
/*addOnloadHook(function(){
    var currentdate = new Date();
                                   // YYYY, MM, DD, HH, MM, SS
    var enforced_break_end = new Date(2006, 03, 15, 9, 00, 00);
                     // *** IMPORTANT: Subtract 1 from month, i.e. january = 0 ***
 
    if (currentdate > enforced_break_end) {
      // alert ("Welcome back from your enforced wikibreak!");
    } else {
      alert ("Enforced wikibreak until " + enforced_break_end.toLocaleString() + " (currently " + currentdate.toLocaleString() + "). Bye!");
      window.location = "http://en.wikipedia.org/w/index.php?title=Special:Userlogout&returnto=Main_page";
    }
});*/
 
 
//////////FLOATING UTC CLOCK
function getTime()
{
    var time    = new Date();
    var date    = time.getUTCDate();
    var months  = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
        month   = months[time.getUTCMonth()];
    var year    = time.getUTCFullYear();
    var hours   = '0' + time.getUTCHours();
        hours   = hours.substr(hours.length-2, hours.length);
    var minutes = '0' + time.getUTCMinutes();
        minutes = minutes.substr(minutes.length-2, minutes.length);
    var seconds = '0' + time.getUTCSeconds();
        seconds = seconds.substr(seconds.length-2, seconds.length);
    var curTime = hours + ":" + minutes + ":" + seconds + ", " + date + " " + month + " " + year + " (UTC)";
    datePlace   = document.getElementById('pt-time').childNodes[0].childNodes[0];
                  datePlace.replaceData(0, datePlace.length, curTime);
    doTime      = window.setTimeout(getTime, 1000);
}
 
 
addOnloadHook(function(){
  var li = document.createElement( 'li' );
  li.id = 'pt-time';
 
  var mySpan = document.createElement( 'span' );
  mySpan.style.position = "fixed";
  mySpan.style.bottom = "5px";
  mySpan.style.left = "5px";
  mySpan.style.border = "1px solid deepskyblue";
  mySpan.style.background = "white";
  mySpan.style.color = "darkslategray";
  mySpan.style.padding = "2px";
  mySpan.appendChild( document.createTextNode( 'date and time' ) );
 
  li.appendChild( mySpan );
  document.getElementById( 'pt-logout' ).parentNode.appendChild( li );
 
  getTime();
});
 
 
// ======== QuickBlocks =======
function QuickBlock (expiry,reason,ao,ab,autob) {
  blockForm = document.getElementById('blockip');
  inputs = blockForm.getElementsByTagName('input');
  for (i=0; i<inputs.length; i++) {
    if (inputs[i].name == 'wpBlockOther') {
      inputs[i].value = expiry;
      continue;
    }
    if (inputs[i].name == 'wpBlockReason') {
      inputs[i].value = reason;
      continue;
    }
    if (inputs[i].name == 'wpAnonOnly') {
      if (ao==1) {
        inputs[i].checked = 'checked';
      }
      continue;
    }
    if (inputs[i].name == 'wpEnableAutoblock') {
      if (autob==0) {
        inputs[i].checked=false;
      }
      continue;
    }
    if (inputs[i].name == 'wpCreateAccount') {
      if (ab==0) {
        inputs[i].checked=false;
      }
      continue;
    }
  }
  blockForm.submit();
}
 
addOnloadHook(function(){
  if (document.title.indexOf("Block user") == -1) return;
  user = document.getElementById('mw-bi-target').value;
  var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
  var isAOL = AOLNetworks.some( function( net ) { return isInNetwork( user, net ) } );
  addPortletLink('p-cactions','javascript:('+QuickBlock+')("indefinite","{{UsernameBlocked}}",0,0,0)','user...','p-block-user')
  addPortletLink('p-cactions','javascript:('+QuickBlock+')("indefinite","{{UsernameHardBlocked}}",1,1,1)','(AB) user...','p-block-b-user')
  addPortletLink('p-cactions','javascript:('+QuickBlock+')("indefinite","Vandalism account",0,0,1)','vandalism','p-block-vandalism')
  addlimenu(tabs, 'indef', 'p-m-indefs');
  addPortletLink('p-m-indefs','javascript:('+QuickBlock+')("indefinite","Please see [[WP:USERNAME]] - no accounts promoting companies/websites.",0,0,0)','promo','p-block-promo')
  addPortletLink('p-m-indefs','javascript:('+QuickBlock+')("indefinite","Oompapa sock",1,1,1)','oompapa','p-block-oompapa')
  addPortletLink('p-m-indefs','javascript:('+QuickBlock+')("indefinite","{{blocked proxy}}",0,0,0)','open proxy','p-block-proxy')
  if (isAOL) {
    addPortletLink('p-cactions','javascript:('+QuickBlock+')("1 hour","{{AOLblock}}",1,0,0)','AOL (1h)','p-block-AOL-1h')
  } else {
    addPortletLink('p-cactions','javascript:('+QuickBlock+')("31 hours","{{anonblock}}",1,0,1)','vandalism (31h)','p-block-31h')
    addlimenu(tabs, 'anon', 'p-m-anonblocks');
    addPortletLink('p-m-anonblocks','javascript:('+QuickBlock+')("3 hours","{{schoolblock}}",1,1,0)','school (3h)','p-block-school')
    addPortletLink('p-m-anonblocks','javascript:('+QuickBlock+')("3 hours","{{anonblock}}",1,0,1)','vandalism (3h)','p-block-3h')
    addPortletLink('p-m-anonblocks','javascript:('+QuickBlock+')("1 week","Repeated vandalism",1,0,1)','One week','p-block-week');
    addPortletLink('p-m-anonblocks','javascript:('+QuickBlock+')("1 month","Chronic vandalism",1,0,1)','One month','p-block-month');
  }
});
 
 
//////// BIG BLOCK BUTTON
addOnloadHook(function () {
  pagetitleH1 = document.getElementById('content').getElementsByTagName('h1')[0]
  pagetitle = pagetitleH1.firstChild.data;
  blockip = document.getElementById('t-blockip');
  if (blockip) {
    blockButton = document.createElement('a');
    blockButton.href = blockip.firstChild.href;
    blockButton.style.color = "red";
    blockButton.appendChild(document.createTextNode('BLOCK'));
    pagetitleH1.appendChild(document.createTextNode(' ('));
    pagetitleH1.appendChild(blockButton);
    pagetitleH1.appendChild(document.createTextNode(')'));
  }
});
 
 
//</nowiki></pre>