User:Heptite/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.
//function addlilink(tabs, url, name, id, title, key){
//    var na = document.createElement('a');
//    na.href = url;
//    na.appendChild(document.createTextNode(name));
//    var li = document.createElement('li');
//    if(id) li.id = id;
//    li.appendChild(na);
//    tabs.appendChild(li);
//    if(id)
//    {
//        if(key && title)
//        {
//            ta[id] = [key, title];
//        }
//        else if(key)
//        {
//            ta[id] = [key, ''];
//        }
//        else if(title)
//        {
//            ta[id] = ['', title];
//        }
//    }
//    // re-render the title and accesskeys from existing code in wikibits.js
//    akeytt();
//    return li;
//}
//
//function addTab(url, name, id, title, key){
//    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
//    return addlilink(tabs, url, name, id, title, key);
//}
 
//function addLink(where, url, name, id, title, key, after){
//    //* where is the id of the toolbar where the button should be added;
//    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
//    //
//    //* url is the URL which will be called when the button is clicked.
//    //   javascript: urls can be used to do more complex things.
//    //
//    //* name is what will appear as the name of the button.
//    //
//    //* id is the id of the button; it's best to define one.  
//    //   Use a prefix to make sure its unique. Optional.
//    //
//    //* title is the tooltip title that gives a longer description 
//    //   of the button; if you define a accesskey, mention it here. Optional.
//    //
//    //* key is the char you want for the accesskey. Optional.
//    //
//    //* after is the id of the button you want to follow this one. Optional.
//    //
//    var na = document.createElement('a');
//    na.href = url;
//    na.appendChild(document.createTextNode(name));
//    var li = document.createElement('li');
//    if(id) li.id = id;
//    li.appendChild(na);
//    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
//    if(after) {
//        tabs.insertBefore(li,document.getElementById(after));
//    } else {
//        tabs.appendChild(li);
//    }
//    if(id) {
//        if(key && title) { ta[id] = [key, title]; }
//        else if(key) { ta[id] = [key, '']; }
//        else if(title) { ta[id] = ['', title];} 
//    }
//    // re-render the title and accesskeys from existing code in wikibits.js
//    akeytt();
//    return li;
//}
 
// external editor
//addOnloadHook(function(){
// if (document.URL.search("=") == -1 && !document.getElementById("ca-viewsource") && document.URL.search("/Special:") == -1) { //viewing a page that isn't protected or special
//   addTab("javascript:location = document.URL + '?action=edit&externaledit=true';", "ee", "ca-exted", "external editor", "");
// }
// else if (document.title.indexOf("Editing ") == 0) { //this line from techniques subpage of WP:US
//   addTab("javascript:location = document.URL + '&externaledit=true';", "ee", "ca-exted", "external editor", "");
// }
//});
 
//// addPurge
//addOnloadHook(function (){
//    var x = document.getElementById('ca-history');
//    if(!x) return;
//    if(x.children) x = x.children[0].href;
//    else x = x.childNodes[0].href;
//    addLink("p-cactions", x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 0);
//});
 
//// Add an [edit top] link to pages
//addOnloadHook(function(){
//  // if this is preview page or generated page, stop
//  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -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:15px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';
//
//  // insert divContainer into the DOM before the h1
//  if(window.location.href.indexOf("&action=edit") == -1)
//    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
//
//  if(window.location.href.indexOf("&action=edit&section=0") != -1)
//    document.getElementById("wpSummary").value = "/* Intro */ ";
//});
//
//// red link on talk page to new section
//addOnloadHook(function(){
//    var talkpagelink = document.getElementById('ca-talk');
//    if (talkpagelink.className == 'new')
//    {
//        talkpagelink.firstChild.href += '&section=new';
//    }
//});
 
//This code will change ISBN links to point to the url of your choice,
//instead of Special:Book_sources. 
//
//You can change the destination url by simply modifying the quoted url that
//follows document.links[i].href=
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);
 
 
 
 
// [[User:Lupin/editcount.js]]
popupEditCounterTool='custom';
popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1';
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/editcount.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
 
// [[User:Lupin/popups.js]]
 
popupFixRedirs = true;
popupRedlinkRemoval = true;
popupFixDabs = true;
popupRevertSummaryPrompt = true;
popupMaxWidth = 500;
popupDragHandle = 'popupTopLinks';
popupStructure = 'menus';
popupDelay = 1.5;
popupHideDelay = 1.0;
 
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>');
 
// [[User:Lupin/recent2.js]]
//document.write('<script type="text/javascript" src="' 
//             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' 
//             + '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
 
 
// [[User:Zocky/PicturePopups.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/PicturePopups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
importScript('User:Supadawg/secedit.js');
 
importScript('User:AzaToth/twinkle.js');