User:BryghtShadow/global.js

console.log('Loaded script from "http://community.wikia.com/wiki/User:BryghtShadow/global.js".'); /* importArticles({ type: 'script', articles: [ 'w:c:dev:RevealAnonIP/code.js',  'w:c:dev:DupImageList/code.js',  'w:c:dev:SkinSwitchButton/code.js',  'w:c:dev:PurgeButton/code.js' ] });

importScriptPage('User:Monchoman45/ChatHacks.js', 'community'); mw.loader.load('//dev.wikia.com/wiki/BotoneraPopups/Code/en.js?action=raw&ctype=text/javascript&templates=expand'); importStylesheetPage('BotoneraPopups/code.css', 'dev'); // Create if not exists if (!window.BotoneraPopups) { window.BotoneraPopups = {}; } // Change key binding for opening popup window.BotoneraPopups.displayOnKey = $.extend(true, window.BotoneraPopups.displayOnKey, {ctrlKey: false, altKey: false, shiftKey: true});

/* FakeTalk */ $(function {    var conf = mw.config.get([ 'wgPageName', 'wgUserName' ]);   var sub = ['Talk', 'talk']; //pages to check

var on = false; for(var i = 0; i < sub.length; i++) { sub[i] = 'User:' + conf.wgUserName + '/' + sub[i]; if(conf.wgPageName === sub[i]) {on = true; break;} }   if (!on) { $.getJSON( mw.util.wikiScript( 'api' ), {           format: 'json',            action: 'query',            titles: sub.join('|'),            prop: 'info'        } ) .done( function ( data ) {           var pages = data.query.pages;

for (var i in pages) { var title = pages[i].title; var yhnm = 'You have new messages'; if (i > 0 && pages[i].lastrevid > localStorage.getItem('msgwl_' + pages[i].title.slice(pages[i].title.indexOf('/') + 1))) { if (skin === 'oasis') { $('#WikiaFooter ul').first.after(' ' + yhnm + '. '); $('#WikiaNotifications .close-notification').click( function (ev) {                           var notification = $(this).parent;                            notification.parent.remove;                        } ); }                   else { $('#contentSub').after($(' ' + yhnm + ' (show most recent). '));                   }                }            }        } );    }    else {localStorage.setItem('msgwl_' + conf.wgPageName.slice(conf.wgPageName.lastIndexOf('/') + 1), mw.config.get('wgCurRevisionId'));} });

/* AnonIP */ $(function {    var list = document.getElementsByTagName('a');    for (var i in list) {        if (list[i].href && list[i].href.indexOf('Special:Contributions/') && list[i].innerHTML === 'A Wikia contributor') {            list[i].innerHTML = list[i].href.substring(list[i].href.lastIndexOf('/') + 1, list[i].href.length);        }    } });

/************* Oasis stuff *************/ if(skin === 'oasis') { /* change publish to save and rename to move */ $(function {        $('#wpSave').val('Save changes');        $('a[data-id="move"]').html('Move');    }); }

/************* Monobook stuff *************/ if (skin === 'monobook') { /* User links */ $(function {        $('#pt-mytalk a').text('Talk');        $('#pt-preferences a').text('Preferences');        $('#pt-mycontris a').text('Contribs');        $('#pt-watchlist a').text('Watchlist');        //Wall-notification link after userpage link         var $wall = $('#pt-wall-notifications').detach;        $wall.children('a').contents.filter(function{return this.nodeType === 3}).wrap(' ');        $('#pt-userpage').after($wall);        //This really should never have changed to rename        $('#ca-move a').text('Move');        //And this really shouldn't have changed to publish        $('#wpSave').val('Save page');        $('#wpPreview').val('Show preview');    });

/* Skin change buttons and JS tab */ $(function {        $('#p-cactions .pBody ul li:nth-last-child(1)').after('Oasis');    });

/**** function displayTimer.js * by Patrick Westerhoff [poke] */ function displayTimer { if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) return; var date; 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                 = 'pt-timer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight   = 'bold'; timerObj.appendChild( timerLink ); timerParent.insertBefore( timerObj, timerParent.firstChild ); function actualizeUTC {   timerDate           = new Date; timerLink.innerHTML = ( 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.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 ); } } $( displayTimer );

}