User:Randomtime/monobook.js

// I have too many javascripts // ***** ADDITIONAL LINKS ***** // User:Lupin/popups.js importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript'); function addBar {

document.getElementById('p-navigation').innerHTML += ' '+ ' '+ ' Admin links '+ ' '+ // Begin links to other pages 'Deletion Candidates'+ 'Banning Candidates'+ 'Logs'+ 'Watchlist</li>'+ '<a href=\"/wiki/Special:Prefixindex">Prefix Index</a></li>'+ '<a href=\"/wiki/Special:SpecialPages">Special pages</a></li>'+ '<a href=\"/wiki/Special:Allmessages">UI messages</a></li>'+ // Links end '</ul> '; } //Close addBar

addOnloadHook(addBar); //Call addBar on load

function importScript(page, lang) { var url = wgScriptPath + '/index.php?title=' + encodeURIComponent(page.replace(' ','_')) + '&action=raw&ctype=text/javascript&dontcountme=s'; if (lang) url = 'http://' + lang + '.wikipedia.org' + url; var s = document.createElement('script'); s.src = url; s.type='text/javascript'; document.getElementsByTagName('head')[0].appendChild(s); } /* End of additional links //AjaxRC importScriptURI('http://dev.wikia.com/index.php?title=AjaxRC/code.js&action=raw&ctype=text/javascript')

/* extra rollback links, by Monchoman45 at wikia (http://community.wikia.com/wiki/User:Monchoman45/) */ function CustomRollbacks { var Buttons = [{ text: 'spam', title: 'Revert spam', summary: 'Reverted spam' }, {       text: 'vandalism', title: 'Revert vandalism', summary: 'Reverted vandalism' }, {       text: 'null', title: 'Revert with no summary', summary: ' &bot=1' //This one has no summary, and flags it as a bot edit }];

var list = document.getElementsByTagName('span'); for(i in list) { if(list[i].className == 'mw-rollback-link') { var link = list[i]; var rollback = link.innerHTML; for(j in Buttons) { var customlink = document.createElement('span'); customlink.innerHTML = rollback; customlink.className = 'customrollback'; //we do this to avoid an infinite loop, because when we insert a into the DOM, the list variable includes it               customlink.getElementsByTagName('a')[0].title = Buttons[j].title; customlink.getElementsByTagName('a')[0].href += '&summary=' + Buttons[j].summary; customlink.getElementsByTagName('a')[0].innerHTML = Buttons[j].text; if(urlQuery('action') == 'history') { link.parentElement.insertBefore(customlink, link.nextSibling); customlink.outerHTML = ' | ' + customlink.outerHTML; }               else { link.parentElement.appendChild(customlink); customlink.outerHTML = ' ' + customlink.outerHTML; }           }        }    }    for(i in list) { //why another one of these? we're fixing the class that we set to avoid an infinite loop if(list[i].className == 'customrollback') { list[i].className = 'mw-rollback-link'; }   } }

addOnloadHook(CustomRollbacks);

/* URL parser */ function urlQuery(quer) { for(i in location.href.split('?')) { for(j in location.href.split('?')[i].split('&')) { if(location.href.split('?')[i].split('&')[j].split('=')[0] == quer) { return location.href.split('?')[i].split('&')[j].split('=')[1]; }       }    }    return ''; }

/* Grunny's function for opening up a user's talkpage when rollbacking (http://community.wikia.com/wiki/User:Grunny) */ addOnloadHook( function {    $( '.mw-rollback-link a' ).click( function (e) { e.preventDefault; var $rblink = $( this ); $.ajax( {           url: $rblink.attr( 'href' ),            success: function  {                var    user = $rblink.attr( 'href' ).replace( /.*[&?]from=([^&]*).*/, '$1' ).replace( /\+/g, '_' ),                    newurl = wgServer + wgArticlePath.replace( '$1', 'User_talk:' + user + '?action=edit&section=new' );                location.href = newurl;            },            error: function  {                $rblink.text( function ( i, val ) { return val + ' [failed]'; } );                  }        } );    } ); } );