User:WeniWidiWiki/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.
 // User:Lupin/popups.js
 
 document.write('<script type="text/javascript" src="' 
              + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
              + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
 popupRedirAutoClick='wpPreview';
 popupFixDabs=true;
 popupOnEditSelection=false;  // turn off annoying edit preview "feature"
 
 // ISBN external references at Amazon
 
 function externISBN() {
   for (var i = 0; i < document.links.length; i++) {       
     var ln = document.links[i].href.match(/isbn=(.*)/);
     if (ln) {
       document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1;
     }
   }
 }
 
 addOnloadHook(externISBN);
 
 //<nowiki> History tools
 document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
 //</nowiki>[[Category:Wikipedians who use VoA script ]]
 
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Add edit count, user space and block log tabs to user and user_talk pages 
 // Add a diff tab to other project pages
 // Adapted from http://en.wikipedia.org/wiki/User:Haza-w/Interiot2.js
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 var title = document.title;
 
 function userAddCactions()
 {
   var split1 = title.split(":");
   var splitvar = split1[1] 
 
   var split2 = splitvar.split(" - Wikipedia, the free encyclopedia");
   var userpath = split2[0];
 
   if (RegExp('/').test(userpath)) {
     var usersplit = userpath.split("/");
     var user = usersplit[0];
   }
   else if (RegExp('- History').test(userpath)) {
     var usersplit = userpath.split(" - History");
     var user = usersplit[0];
   }
   else if (RegExp('- Preview').test(userpath)) {
     var usersplit = userpath.split(" - Preview");
     var user = usersplit[0];
   }
   else {
     var user = userpath;
   }
 
 //      calink2.href = 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=' + user;
 
   var ca1 = document.createElement( 'li' );
     ca1.id = 'ca-essjay';
     var calink1 = document.createElement( 'a' );
       calink1.appendChild( document.createTextNode( 'E-Count' ) );
 //    calink1.href = 'http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=' + user + '&submit=Count';
       calink1.href = 'http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=' + user + '&site=en.wikipedia.org'
     ca1.appendChild( calink1 );
 
 //  var ca2 = document.createElement( 'li' );
 //    ca2.id = 'ca-interiot';
 //    var calink2 = document.createElement( 'a' );
 //      calink2.appendChild( document.createTextNode( 'Count2' ) );
 //      calink2.href = 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + user;
 //    ca2.appendChild( calink2 );
 
   var ca3 = document.createElement( 'li' );
     ca3.id = 'ca-uspace';
     var calink3 = document.createElement( 'a' );
       calink3.appendChild( document.createTextNode( 'U-space' ) );
       calink3.href = 'http://en.wikipedia.org/w/index.php?title=Special:Prefixindex&namespace=2&from=' + user;
     ca3.appendChild( calink3 );
 
   var ca4 = document.createElement( 'li' );
     ca4.id = 'ca-block';
     var calink4 = document.createElement( 'a' );
       calink4.appendChild( document.createTextNode( 'Blk log' ) );
       calink4.href = 'http://en.wikipedia.org/w/index.php?title=Special:Log&type=block&page=User:' + user;
     ca4.appendChild( calink4 );
 
   document.getElementById( 'ca-nstab-user' ).parentNode.appendChild( ca1 );
 //  document.getElementById( 'ca-nstab-user' ).parentNode.appendChild( ca2 );
   document.getElementById( 'ca-nstab-user' ).parentNode.appendChild( ca3 );
   document.getElementById( 'ca-nstab-user' ).parentNode.appendChild( ca4 );
 }
 
 function WPAddCactions()
 {
   var split1 = title.split(" - Wikipedia, the free encyclopedia");
   var path = split1[0];
 
    if (RegExp('- History').test(path)) {
     var histsplit = path.split(" - History");
    var truepath = histsplit[0];
   }
   else if (RegExp('- Preview').test(path)) {
     var prevsplit = path.split(" - Preview");
     var truepath = prevsplit[0];
   }
   else {
     var truepath = path;
   }
 
   var ca = document.createElement( 'li' );
     ca.id = 'ca-diff';
 
     var calink = document.createElement( 'a' );
       calink.appendChild( document.createTextNode( 'Diff' ) );
       calink.href = 'http://en.wikipedia.org/w/index.php?title=' + truepath + '&diff=cur';
 
     ca.appendChild( calink );
 
   document.getElementById( 'ca-history' ).parentNode.appendChild( ca );
 }
 
 if (RegExp('User:','i').test(title)) var appendInteriotLink = 'true';
 if (RegExp('User talk:','i').test(title)) var appendInteriotLink = 'true';
 if (appendInteriotLink) {
   if ( window.addEventListener ) window.addEventListener( 'load', userAddCactions, false );
   else if ( window.attachEvent ) window.attachEvent( 'onload', userAddCactions );
 }
 else if (!(RegExp('/wiki/Special:','i').test(window.location)) || !(RegExp('title=Special:','i').test(window.location))) {
   if ( window.addEventListener ) window.addEventListener( 'load', WPAddCactions, false );
   else if ( window.attachEvent ) window.attachEvent( 'onload', WPAddCactions );
 }
 
 // Retrieved from "http://en.wikipedia.org/wiki/User:Cactus.man/Scripts/MoreTabs.js"