User:Nae'blis/monobook.js

var myname=wgUserName.replace(' ', '_'); //use underscores instead of spaces var mypage="User:"+myname; var mytalk="User_talk:"+myname; var mycontribs="Special:Contributions/"+myname; var serverurl="http://en.wikipedia.org"; var wikiurl=serverurl+"/wiki/"; var pathurl=serverurl+"/w/"; var phpurl=pathurl+"index.php?title="; var editcounturl="http://tools.wikimedia.de/~essjay/edit_count/Count.php"; var editcount=editcounturl+"?username=";

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 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; }

// This will add an [edit top] link at the top of all pages except preview pages // by User:Pile0nades

setTimeout("editTopLink", 0) // this is equivalent of onload function editTopLink { // if this is preview page or generated page, stop if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=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 = ' [edit top] ';

// insert divContainer into the DOM before the h1 document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

}

//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'); }

// adds a 'logs for this page' link to the navigation bar // if the page is a user's page, talk page or subpage, the link will go to logs for the user instead // if the page is a special page, then no link is displayed

addOnloadHook(function {

// get page title var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/; ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' '); // 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]:([^&?\/]*)[\/]?.*/; user = regDropSubpages.exec(ptitle)[1]; url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user; } else if(window.location.href.indexOf("Special:") != -1) { // don't display link for special pages return; } else { url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=" + ptitle; } tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0]; l = addlilink(tabs, url, "Logs", "pt-logs");

});

addOnloadHook(function {    var tabs = document.getElementById('p-cactions').cloneNode(true);    tabs.id = 'mytabs';    var listitems = tabs.getElementsByTagName('LI');    for (i=0;i<listitems.length;i++) {        if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;    }

content = document.getElementById("content");   // Find the content div content.parentNode.insertBefore(tabs, content.nextSibling);   // Place tab list right after content div });

addOnloadHook(function {       var ds = document.getElementsByTagName('td');        for(var i=0; i<ds.length; i++) {                var a = ds[i];                if(a.className == 'diff-ntitle') {                        var fs = a.getElementsByTagName('a');                        for(var j=0; j<fs.length; j++) {                                var b = fs[j];                                if(b.firstChild.data == 'rollback') {                                        var oldhref = ''+b.href;                                        var usr = unescape(b.href.split('from=')[1].split('&')[0]);                                        var cont = 'http://en.wikipedia.org/wiki/'+                                                       'Special:Contributions/'+usr;                                        b.href = 'javascript:void(0)';                                        b.onclick = function {                                                var http = new XMLHttpRequest; http.open('GET', oldhref, true); http.setRequestHeader("Connection", "close"); http.send(null); http.onreadystatechange= function { window.location.href = (cont); }                                       }                                }                        }                }        } });

// User:Lupin/popups.js

importScript('User:Lupin/popups.js');