User:Lelouch Di Britannia/wikia.js

importScriptPage('User:Quarenon/quickpreview.js', 'runescape'); importScriptPage('AdvancedOasisUI/code.js', 'dev'); importScriptPage('User:Joeyaa/wham.js','vstf'); importScriptPage('FastDelete/code.js', 'dev'); importScriptPage( 'AjaxUndo/code.js', 'dev' ); //changes the contribute button to a recent changes button $(function { $('.WikiHeader div.buttons nav').replaceWith('  Recent Changes '); }); /*gets rid of the autodelete summary function removeDeleteSummary { if(wgAction == 'delete') {document.getElementById('wpReason').value = '';} } addOnloadHook(removeDeleteSummary); */ //suppress undo summary function removeUndoSummary { if(window.location.href.indexOf('&undo=') != -1) {document.getElementById('wpSummary').value = '';} }	addOnloadHook(removeUndoSummary); //gets rid of the admin dash drawer and makes things look better if(document.getElementById('AdminDashboardDrawer')) { $('.AdminDashboardNavigation').prepend($('#WikiaSearch').css('float', 'right').detach);}

//adds recent Changes and Random page into the new editor $(function addEditorButtons {if ($('.checkboxes').length) { $('   Random PageRecent Changes  ').insertBefore('.checkboxes'); } }); //fast delete var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'spam', 'label': 'SP'}; fdButtons[fdButtons.length] = { 'summary': 'vandalism', 'label': 'VA'}; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'HK'}; fdButtons[fdButtons.length] = { 'summary': 'Spam/Self-Answered Question', 'label': 'Self'}; fdButtons[fdButtons.length] = { 'summary': 'Not a Question/Nonsensical Question', 'label': 'NotAQ'}; fdButtons[fdButtons.length] = { 'summary': 'Not About One Piece', 'label': 'NotB'}; fdButtons[fdButtons.length] = { 'summary': 'Please see the main page. Te anime has ended. It is not coming back', 'label': 'Anime'}; // remove admin link on toolbar $.ready( function { $('li > a[data-tracking="admindashboard/toolbar/admin"]').remove; } ); //UrlQuery 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 ''; } //adds a recent changes button next to the WikiActivity button on wikis without the new nav function AddRecentChanges { $('div.buttons').css({'width': '310px'}); $('a[data-id="wikiactivity"]').after('Recent Changes'); } addOnloadHook(AddRecentChanges);

//Custom Rollback buttons function CustomRollbacks { var Buttons = [{ text: 'spam', title: 'Revert spam', summary: 'Reverted spam', loadtalk: false }, {               text: 'vandalism', title: 'Revert vandalism', summary: 'Reverted vandalism', loadtalk: false }, {               text: 'null', title: 'Revert with no summary', summary: ' &bot=1', //This one has no summary, and flags it as a bot edit loadtalk: false }];       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(Buttons[j].loadtalk == true) {customlink.getElementsByTagName('a')[0].className = 'loadtalk';} if(urlQuery('action') == 'history') { link.parentNode.insertBefore(customlink, link.nextSibling); customlink.outerHTML = ' | ' + customlink.outerHTML; }                               else { link.parentNode.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'; }       }        /* Grunny's function for opening up a user's talkpage when rollbacking (http://community.wikia.com/wiki/User:Grunny) */ $( '.mw-rollback-link .loadtalk' ).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]';                                } ); }               } );        } ); } addOnloadHook(CustomRollbacks); /* shrink the side rail to add content space when rail is present - 2/1/11 */ //changes links on image from image popup to the actual page $(function changeimagelinks {   if (window.skin == 'oasis') {        var article = $('#WikiaArticle, .LatestPhotosModule, #article-comments');    }    else {        var article = $('#bodyContent');    }    article.unbind('click.lightbox');    var a = document.getElementsByTagName("a");    for ( var t = 0; t < a.length; ++t ) {        var a2 = a[t];        var img = a2.getElementsByTagName("img");        if ( img[0] != null ) {            if ( a2.href.indexOf("images.wikia.com") != -1 ) {                var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1);                a2.setAttribute('href',link);            }        }    } }); //Ajax RC AjaxRCRefreshText = 'Auto-refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxCallAgain = [CustomRollbacks]; importScriptPage('AjaxRC/code.js', 'dev'); var ajaxRefresh = 20000; //Timer, needs to be adjusted for new nav // ============================================================ // displayTimer - 2/1/11 // ============================================================ //Add a clock to the WikiHeader //Modified from work by Patrick Westerhoff [poke]: //http://bulbapedia.bulbagarden.net/wiki/MediaWiki:Monobook.js hookEvent( 'load', displayTimer ); function displayTimer {   if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) return; var date; if (skin == 'oasis') {   var timerParent = document.getElementById( 'WikiHeader' ).getElementsByTagName( 'div' )[0]; }   if (skin == 'monobook') {   var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0]; }   var timerLink   = document.createElement( 'a' ); var timerObj   = document.createElement( 'li' ); timerLink.href              = '/wiki/' + wgPageName + '?action=purge'; timerLink.title             = 'Purge the server cache and update the contents of this page.' timerObj.id                 = 'displayTimer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight   = 'bold'; timerObj.style.fontSize     = '100%'; timerObj.appendChild( timerLink ); timerParent.insertBefore( timerObj, timerParent.firstChild ); if (skin == 'oasis') {       $('#displayTimer').css({'position': "inherit", 'right': "0px", 'top': "-28px"}); }   var month = new Array(12); month[0] = "Jan"; month[1] = "Feb"; month[2] = "Mar"; month[3] = "Apr"; month[4] = "May"; month[5] = "Jun"; month[6] = "Jul"; month[7] = "Aug"; month[8] = "Sep"; month[9] = "Oct"; month[10] = "Nov"; month[11] = "Dec"; function actualizeUTC {       timerDate           = new Date; timerLink.innerHTML = ( timerDate.getUTCDate    < 10 ? '0' : '' ) + timerDate.getUTCDate     + ' ' + ( timerDate.getUTCMonth   < 10 ?  :   ) + month[timerDate.getUTCMonth] + ' ' + ( timerDate.getUTCFullYear < 10 ? '0' : '' ) + timerDate.getUTCFullYear + ' ' + ( timerDate.getUTCHours   < 10 ? '0' : '' ) + timerDate.getUTCHours    + ':' + ( timerDate.getUTCMinutes < 10 ? '0' : '' ) + timerDate.getUTCMinutes  + ':' + ( timerDate.getUTCSeconds < 10 ? '0' : '' ) + timerDate.getUTCSeconds  + ' (UTC)'; }   function actualizeCustom {       timerDate           = new Date; timerDate.setMinutes ( timerDate.getMinutes + timerDate.getTimezoneOffset + timerTimezone * 60 ); timerLink.innerHTML = ( timerDate.getDate    < 10 ? '0' : '' ) + timerDate.getDate     + ' ' + ( timerDate.getMonth   < 10 ?  :   ) + month[timerDate.getMonth] + ' ' + ( timerDate.getFullYear < 10 ? '0' : '' ) + timerDate.getFullYear + ' ' + ( timerDate.getHours   < 10 ? '0' : '' ) + timerDate.getHours    + ':' + ( timerDate.getMinutes < 10 ? '0' : '' ) + timerDate.getMinutes  + ':' + ( timerDate.getSeconds < 10 ? '0' : '' ) + timerDate.getSeconds + ' (UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')'; }   // start if ( typeof( timerTimezone ) !== 'number' ) {       actualizeUTC; setInterval( actualizeUTC, 1000 ); }   else {       actualizeCustom; setInterval( actualizeCustom, 1000 ); } }

importScriptPage("PageRenameAuto-update/code.js", "dev");